fix(api/server): exact-equality routing for GET /v1/genomes/top (PKT-533) - #443
Open
bugsyhewitt wants to merge 1 commit into
Open
fix(api/server): exact-equality routing for GET /v1/genomes/top (PKT-533)#443bugsyhewitt wants to merge 1 commit into
bugsyhewitt wants to merge 1 commit into
Conversation
…533)
Replace path.startsWith('/v1/genomes/top') || path === '/v1/genomes/top'
with path === '/v1/genomes/top' to prevent silent dispatch to handleTopGenomes
for unrelated paths (/topology, /topsecret, /topfoo, /topN, /toppings).
Adds 6-case regression test covering 4 over-match 404s + 2 control 200s,
mirroring the PKT-491 test diff that was never merged to main.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
src/alienclaw/api/server.ts:203routing defect wherepath.startsWith('/v1/genomes/top')silently dispatched unrelated paths (/v1/genomes/topology,/v1/genomes/topsecret,/v1/genomes/topfoo, etc.) tohandleTopGenomesinstead of returning 404 NOT_FOUND.path.startsWith('/v1/genomes/top') || path === '/v1/genomes/top'withpath === '/v1/genomes/top'test/api/routing-prefix-mismatch.test.ts— 4 over-match cases (expect 404) + 2 control cases (expect 200), using the establishedvi.doMockstorage patternfix/pkt-408-top-routing-prefix-shadow, never merged) and PKT-491 (branchfix/491-api-server-router-genomes-top-prefix-overmatch, never merged); this branch adds the test coverage from PKT-491Test plan
pnpm testexits 0 (vitest 2167 passed + 46 skipped, pytest 1206 passed + 125 skipped)TopGenomesdescribe-block intest/api/ts-api-server.test.tsunaffected🤖 Generated with Claude Code