Repository navigation
Conversation
scoreQuery declares {score, reason, matched, total}, but the top-tier
branch added in #5289 returned only {score, reason}. That is a type error
under checkJs, which fails the published CLI api type-surface check on
main, and it left callers that gate on coverage (build's pages group)
reading undefined for the strongest kind of match.
Routes the branch through the existing asFull helper: a verbatim match on
the whole query has answered every concept in it by definition.
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Closing this — not mine to land. Leaving the diagnosis here for whoever picks it up.
The fix is to route that branch through the Introduced in f44af81 (#5289). It landed after |
What
mainis red, and this one-line change is what fixes it.scoreQueryinpackages/cli/api/search/search.mjsdeclares its return as{score, reason, matched, total} | null. The top-tier branch added by #5289 — the whole query matching a name or a declared keyword verbatim, promoted above the token-sum path — returns only{score, reason}:Two consequences, one cosmetic in CI and one real.
It fails the build. Under
checkJsthat isTS2739, so the "Verify the published CLI ./api type surface" step exits non-zero:That step sits ahead of
Run pnpm test, so on every PR thetestcheck fails without a single test running. It also failsbuild-storybookandbuild-sandbox, which skips the visual-evidence job, sovisual-acceptancefails too with "Stable visual evidence could not be published" and no frame report. Both of my open PRs are red on this and neither has anything to do with it.It also loses real information.
matched/totalexist so callers can tell "matched one word of three" from "matched all three" —buildgates its pages group on that, and the JSDoc says as much. The strongest possible hit was the one hit that reported nothing, so that caller was readingundefined.The fix
The function already has an
asFullhelper for precisely this case, used by both other whole-phrase branches:The promoted branch is a whole-phrase hit too — more emphatically so, since it requires a verbatim match on a name or an authored keyword. So it routes through the same helper. Scores and ordering are untouched; the object just carries the two fields it always claimed to.
Test plan
main's copy of the file — sameTS2739, same line — then confirmednode .github/scripts/cli-api-types-verify.mjsgoes green with the change: "All published type-surface checks passed."vitest run packages/cli/api/searchagainstmain's test file — 30 passed, including the ranking tests fix(cli): rank exact keyword phrase matches above token-sum scores #5289 added. No expectations needed changing, which is the point: this is additive to the returned object.Provenance
Introduced in f44af81 (#5289). It landed after
main's last CI run, and that run had already failed on an unrelated "package.json exports are stale!", so the break went unnoticed.Changeset included.
Made with Cursor