Repository navigation
test(router): rank by literal text length where the texts sort the other way - #450
Conversation
…her way #449 moved the ranking tests to one-param templates whose texts already sort in the expected order, so a key without the length char went unnoticed (Stryker survivor). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VVaw7NfvMWthzxzRb81nfW
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 48 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
ℹ️ No critical issues — one minor suggestion inline.
Approach: sound — it adds the one ranking pair whose literal texts sort against the intended order, which is exactly the case the surviving Math.max → Math.min mutant needs. I confirmed the test fails under that mutant and passes on head.
Reviewed changes — full diff at ec6ba6e (1 file, +17):
- New ranking case in
templates.test.ts—{name}.tar.gzvs{name}.gz, the README's own example, asserted for a plain segment (/f/…) and for a template in a catch-all tail (/g/{+p}/…), with routes added in both orders. - Mutant kill verified — editing
packages/router/src/index.ts:637toMath.min(0, …)makes the new case fail (/f/a.tar.gzresolves to the.gzroute withname: 'a.tar'), so the length-prefix character is now pinned rather than incidentally satisfied.
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏
Merging this PR will not alter performance
Comparing Footnotes
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VVaw7NfvMWthzxzRb81nfW
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — the delta since the prior Pullfrog review (ec6ba6e), 1 file, +1:
- Shorter tail template now asserted —
7bc404cadds/g/x/a.gz→/g/{+p}/{name}.gzwith{ p: 'x', name: 'a' }, closing the coverage gap raised in the previous review's inline thread (now resolved). The test file passes 17/17 at head andoxfmt --checkis clean.
The addition is not a ranking assertion — /g/x/a.gz can only match that one route — but it does pin the catch-all tail route's existence and param extraction, which is what the thread asked for.
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

Requested by dinwwwh · project thread
Test only.
After #449, Stryker found a surviving mutant at
String.fromCharCode(Math.max(0, ...))→Math.min. That mutant drops the length character from the template key, so templates sort by their text alone. The ranking tests #449 rewrote only use pairs whose text already sorts in the expected order (.json<n), so the tests passed either way.The new test uses the README's own example,
{name}.tar.gzbeating{name}.gz. The text.gzsorts before.tar.gz, so the mutant now fails. The test covers a plain segment and a segment after a catch-all, with routes added in both orders.Stryker on ce4ee9d: 563 killed, 10 timeouts, 76 survived. This test kills one of them. Of the rest in #449's new code, I checked:
templateChilddedupe: perf only, since a duplicate child is never reached firsttext.includes('{')gate beforesplit: perf onlyThe others are the known baseline.
Generated by Claude Code