Unify the mapped/excluded route existence checks in scopes.test.ts #191
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/scopes-existence-guard"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #189.
TOKEN_ROUTES.has(id) === falseis trivially true for a route that's been deleted entirely, so the "excludes routes that would leak logs, config, secrets, or file/artifact contents" test kept passing vacuously the moment/api/settings/agent-instructionswas removed from the codebase while still sitting in that list — the test looked like it was guarding something but wasn't checking anything for that entry anymore.Rather than add a second, separate existence check next to the existing one (for
TOKEN_ROUTES's mapped keys), this hoists theexcludedarray up next to the existingisDeadMappingpredicate and folds both lists into the single test that already asks "does this id map to a real route" — one check, one meaning, covering mapped and excluded ids alike. Net effect: fewer independent assertions expressing the same property, not more.Verified by mutation: swapped a real excluded entry for a nonexistent path — passed before this change, fails after it (both confirmed directly, not assumed).
Test plan
pnpm typecheck— 0 errorspnpm lint— cleanpnpm vitest run src/lib/server/tokens/scopes.test.ts— 17/17excluded— SURVIVED before this change, KILLED after