Skip to content

test(router): rank by literal text length where the texts sort the other way - #450

Merged
dinwwwh merged 2 commits into
mainfrom
claude/project-thread-4zwssp
Nov 29, 2026
Merged

dinwwwh merged 2 commits into
mainfrom
claude/project-thread-4zwssp

Conversation

@dinwwwh

@dinwwwh dinwwwh commented Nov 29, 2026

Copy link
Copy Markdown
Member

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.gz beating {name}.gz. The text .gz sorts 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:

  • templateChild dedupe: perf only, since a duplicate child is never reached first
  • the text.includes('{') gate before split: perf only
  • the catch-all pre-check: perf only

The others are the known baseline.


Generated by Claude Code

…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
@dinwwwh dinwwwh self-assigned this Nov 29, 2026
@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1f33f8e5-db87-4a6d-9a43-6618c6a6b0b0
Commits

Reviewing files that changed from the base of the PR and between ce4ee9d and 7bc404c.

Files selected for processing: 1

  • packages/router/tests/templates.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@pkg-pr-new

pkg-pr-new Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@openapi-spec/downgrader@450
npm i https://pkg.pr.new/@openapi-spec/router@450
npm i https://pkg.pr.new/@openapi-spec/types@450

commit: 7bc404c

@codecov

codecov Bot commented Nov 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@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 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.gz vs {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:637 to Math.min(0, …) makes the new case fail (/f/a.tar.gz resolves to the .gz route with name: 'a.tar'), so the length-prefix character is now pinned rather than incidentally satisfied.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

Comment thread packages/router/tests/templates.test.ts Resolved
@codspeed

codspeed Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 33 untouched benchmarks
⏩ 2 skipped benchmarks1


Comparing claude/project-thread-4zwssp (7bc404c) with main (ce4ee9d)

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. ↩

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VVaw7NfvMWthzxzRb81nfW

@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 — the delta since the prior Pullfrog review (ec6ba6e), 1 file, +1:

  • Shorter tail template now asserted — 7bc404c adds /g/x/a.gz → /g/{+p}/{name}.gz with { 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 and oxfmt --check is 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.

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

@dinwwwh
dinwwwh merged commit 1b89bc3 into main Nov 29, 2026
12 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