Skip to content

fix(agent-reference): align toolkit and store tests with current implementation - #41

Merged
Weegy merged 4 commits into
fix/ci-resurrectionfrom
fix/agent-reference-toolkit
May 17, 2026
Merged

fix(agent-reference): align toolkit and store tests with current implementation#41
Weegy merged 4 commits into
fix/ci-resurrectionfrom
fix/agent-reference-toolkit

Conversation

@iret77

@iret77 iret77 commented May 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes 6 failures in the agent-reference cluster (Issue #37).

  • Cluster: agent-reference (Toolkit query_notes_by_person, Store filter, SubAgentAccessor)
  • Failures addressed: 6
  • Triage distribution: 2 TEST-NEVER-VALID (wrong fixtures/assertions), 1 CODE-DRIFT-REGRESSION (real routing bug)

Changes

src/routes/store.ts (CODE-DRIFT-REGRESSION)

router.get('/:id', ...) captures only one path segment. Scoped plugin IDs like
@omadia/agent-reference-maximum contain a literal /, so the route matched
id='@omadia' and left /agent-reference-maximum unmatched — Express returned its
default HTML 404 page instead of { code: 'store.plugin_not_found' }. This is a
production bug: any operator querying /api/v1/store/@<org>/<plugin> would receive
an HTML 404 rather than a JSON response.

Fix: change to router.get('/*', ...) and derive the full id from req.path.slice(1).

test/agent-reference-maximum/queryNotesByPerson.test.ts (TEST-NEVER-VALID)

Multi-match test searched for "John" against 3 records; only n1 mentions "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 the
assertion options.length === 2.

test/agent-reference-maximum/subAgentAccessor.test.ts (TEST-NEVER-VALID)

[...list].sort() sorts lexicographically; @ (ASCII 64) precedes d (100).
Expected array had the items in the opposite order.

Test plan

  • CI: agent-reference / Toolkit query_notes_by_person (OB-29-4) all green
  • CI: agent-reference / Store filter for is_reference_only all green
  • CI: agent-reference / SubAgentAccessor all green

Drives 6 of the ~100 remaining failures to zero. Other clusters tracked in #37.

cwendler and others added 4 commits May 17, 2026 17:12
…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
Weegy force-pushed the fix/agent-reference-toolkit branch from a5d2d91 to bc4beee Compare May 17, 2026 15:16
@Weegy
Weegy merged commit 2e77d3c into fix/ci-resurrection May 17, 2026
5 checks passed
@Weegy
Weegy deleted the fix/agent-reference-toolkit branch May 17, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants