fix(agent-reference): align toolkit and store tests with current implementation - #41
Merged
Merged
Conversation
Weegy
force-pushed
the
fix/ci-resurrection
branch
from
May 17, 2026 14:30
da31abd to
8547b45
Compare
…ementation Three fixes across the agent-reference cluster (Issue #37): 1. fix: store detail route does not match scoped plugin IDs (CODE-DRIFT-REGRESSION) Express route `/:id` only captures one path segment. Plugin IDs like `@omadia/agent-reference-maximum` contain a literal `/`, causing the detail endpoint to return an Express HTML 404 instead of JSON. Change `router.get('/:id', ...)` to `router.get('/*', ...)` and derive the id from `req.path.slice(1)`. Affects any operator querying the store detail for an @-scoped plugin in production. 2. fix: queryNotesByPerson multi-match test fixture has only one John record (TEST-NEVER-VALID) Test for _pendingUserChoice emission searches for "John" but only one of the three fixture records mentions "John". Single-match branch fires → no _pendingUserChoice → assertion fails. Add a fourth record "Sprint-Review mit John Mueller" so the search yields 2 hits as the test expects. 3. fix: subAgent list() sort assertion has wrong expected order (TEST-NEVER-VALID) `[...list].sort()` sorts lexicographically. `@` (ASCII 64) precedes `d` (100), so `@omadia/agent-seo-analyst` sorts before `de.byte5.agent.confluence`. The expected array had them reversed.
…ed IDs The wildcard route also matched , breaking the list endpoint. Switch to which requires at least one character after the leading slash, so the list endpoint at is unambiguous.
PR #44 worked around the Express `/:id` slash-blocking by URL-encoding the scoped plugin ID inside the test (`encodeURIComponent('@omadia/...')`). The cherry-pick from PR #41 (a5d2d91) replaces the route with a regex pattern that matches slashes natively, so the test can again send the raw URL path. Cleaner, matches production UI behaviour.
…tching 'John' Christian's commit debb2f3 added a 4th seed note ('Sprint-Review mit John Mueller') that contains 'John' in title + body. The case-insensitive substring match against 'John' now finds 3 matches (n2, n3, n4) instead of 2, but the assertion expecting '2 Notizen erw.hnen' wasn't updated in the same commit. Bump both the regex and options.length to 3.
Weegy
force-pushed
the
fix/agent-reference-toolkit
branch
from
May 17, 2026 15:16
a5d2d91 to
bc4beee
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes 6 failures in the agent-reference cluster (Issue #37).
Changes
src/routes/store.ts(CODE-DRIFT-REGRESSION)router.get('/:id', ...)captures only one path segment. Scoped plugin IDs like@omadia/agent-reference-maximumcontain a literal/, so the route matchedid='@omadia'and left/agent-reference-maximumunmatched — Express returned itsdefault HTML 404 page instead of
{ code: 'store.plugin_not_found' }. This is aproduction bug: any operator querying
/api/v1/store/@<org>/<plugin>would receivean HTML 404 rather than a JSON response.
Fix: change to
router.get('/*', ...)and derive the full id fromreq.path.slice(1).test/agent-reference-maximum/queryNotesByPerson.test.ts(TEST-NEVER-VALID)Multi-match test searched for
"John"against 3 records; onlyn1mentions "John".Single-match branch fired → no
_pendingUserChoice. Added a 4th fixture record"Sprint-Review mit John Mueller"so there are exactly 2 "John" hits, matching theassertion
options.length === 2.test/agent-reference-maximum/subAgentAccessor.test.ts(TEST-NEVER-VALID)[...list].sort()sorts lexicographically;@(ASCII 64) precedesd(100).Expected array had the items in the opposite order.
Test plan
agent-reference / Toolkit query_notes_by_person (OB-29-4)all greenagent-reference / Store filter for is_reference_onlyall greenagent-reference / SubAgentAccessorall greenDrives 6 of the ~100 remaining failures to zero. Other clusters tracked in #37.