scopes.test.ts's TOKEN_ROUTES exclusion list has no existence guard #189
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
lz/agent-nexus#189
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Context
nexus/src/lib/server/tokens/scopes.test.tshas a test ("excludes routes that would leak logs, config, secrets, or file/artifact contents") that asserts a hand-maintainedexcludedarray of route ids are never present inTOKEN_ROUTES. Caught during thefix/nexus-pluginbranch's Task 6 review: when a route in that list is later deleted from the codebase entirely (as happened with/api/settings/agent-instructions), the assertionTOKEN_ROUTES.has(id) === falsestays trivially green forever — a deleted route can't be in the map either way — so the guard silently loses its meaning without any test going red.The file already has the fix pattern next door:
isDeadMapping(used elsewhere in the same file to catch a mapped route id that no longer resolves to a real route). The same idea applies here in the other direction — an excluded entry should still resolve to a real route file, or the exclusion is decorative.Suggested fix
Add an assertion alongside the existing exclusion-list test:
(or equivalent — whatever fits
isDeadMapping's actual signature/usage in that file) so a route deleted from the codebase without also being removed from this list fails loudly instead of silently.Verified
All seven entries in the
excludedarray were confirmed to still exist and exportGETas of the review that caught this — so this is prophylactic, not a live defect today.