Skip to content

test(router): pin a catch-all tail segment ending in } as literal - #193

Merged
dinwwwh merged 1 commit into
mainfrom
claude/project-thread-m32ra9
Oct 29, 2026
Merged

dinwwwh merged 1 commit into
mainfrom
claude/project-thread-m32ra9

Conversation

@dinwwwh

@dinwwwh dinwwwh commented Oct 29, 2026

Copy link
Copy Markdown
Member

Requested by dinwwwh · project thread

What

This is a test-only change. The literal-text test in router.test.ts now adds /f/{+p}/id} and checks two requests:

  • /f/1/id} matches it, with { p: '1' }.
  • /f/1/id matches nothing.

Why

Since #186, the tree build calls toSegment only for parts that start with {. A catch-all's tail segments still go through toSegment whatever they start with, and so do parse's callers (createPrefixMatcher and the two-catch-all check in add). Mutation testing found that dropping the leading-{ half of toSegment's param check failed no test, even with the 73 tests now on main. With that mutant, id} becomes a param named d, so /f/1/id matches. The new assertions catch it.

Checks

  • All 73 router tests pass, and pnpm check passes.
  • With that mutant applied, the test fails.

Generated by Claude Code

A tail segment like `id}` reaches `toSegment`, whose param check needs a
leading `{` as well as a trailing `}`; no test failed when the leading
check was dropped, which made `id}` a param named `d`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VVaw7Sutbw6xMTMyDFeNfw
@dinwwwh dinwwwh self-assigned this Oct 29, 2026
@codecov

codecov Bot commented Oct 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@codspeed

codspeed Bot commented Oct 29, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning

⚠️ 1 benchmark is dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 29 untouched benchmarks
⏩ 2 skipped benchmarks1


Comparing claude/project-thread-m32ra9 (11b3817) with main (6b348e1)2

Open in CodSpeed

Footnotes

  1. 2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

  2. No successful run was found on main (1e46b22) during the generation of this report, so 6b348e1 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Pin catch-all tail ending in } as literal — adds /f/{+p}/id} to the literal-segment suite plus assertions that /f/1/id} matches ({ p: '1' }) and /f/1/id does not.

I verified the PR's central claim: with the leading-{ half of toSegment's check removed, id} becomes param d and the new assertion fails (params.d = 'id}'). The full router suite passes as-is. Test-only, no production code touched.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@dinwwwh
dinwwwh merged commit 8bd0e36 into main Oct 29, 2026
11 checks passed
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.

2 participants