Repository navigation
fix(analysis): tighten TypeScript runner and alias-gap evidence - #4096
Conversation
- typescript_path_alias_unresolved: a default import (imported: "default")
now only counts as a plausible owner import when the LOCAL binding name
matches the owner. Previously any default import from any non-relative
package (e.g. import React from 'react') false-fired the limitation,
contradicting the documented contract. Named-import matching unchanged.
Negative control: import React from 'react' emits no limitation; positive
control: import applyDiscount from '@/applyDiscount' still does.
- detect_framework: collect all distinct framework signals. When two or more
match (e.g. jest + vitest devDeps), emit the additive, classification-
neutral package limitation typescript_test_runner_ambiguous and cap
confidence at medium instead of silently resolving by fixed priority.
jest+vitest discovery test pins the disclosure.
- mocha fail-closed: typescript_test_runner_unresolved is now emitted
whenever the inferred verify command is None (mocha has no file-target
mapping and no lockfile previously produced neither command nor
limitation), matching the documented OUTPUT_SCHEMA contract.
- package.json detection reads parsed fields via serde_json
(ManifestFacts) instead of substring scans: a "test" key outside
scripts is not the test script, the word "workspaces" inside a string
value does not mark a monorepo root, and a framework name inside a
free-text value ("description": "jest") is not dependency evidence.
Unparseable manifests fail closed.
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Warning Review limit reachedNext included review available in 52 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Summary
Four honest-evidence fixes in the TypeScript preview adapter, all inside
crates/ripr/src/analysis/language/typescript/:typescript_path_alias_unresolveddefault-import false-fire (static_limit.rs): a default import recordsimported: "default", andname_matchestreated that as a match for ANY owner — soimport React from 'react'in any uncredited test fired the alias-gap limitation, contradicting the documented contract ("Do NOT emit it for ordinary third-party imports"). A default import now only counts when the local binding name matches the owner name; named-import matching is unchanged. Added negative control (import React from 'react'→ no limitation) and positive control (import applyDiscount from '@/applyDiscount'→ limitation fires).Multi-runner silent priority resolution (
package.rs):detect_frameworkresolved first-match-wins (jest > vitest > ...) with no disclosure. Newdetect_framework_signalscollects all distinct matched frameworks; when ≥ 2 match, discovery emits the additive, classification-neutral package limitationtypescript_test_runner_ambiguousand caps confidence atmedium(the priority pick is arbitrary from evidence).typescript_test_runner: <name>is still emitted. Test pins jest+vitest → ambiguity disclosed,@types/jest+jeststill count as ONE signal.Mocha without lockfile: no command AND no limitation (
mod.rs): mocha has no file-target command mapping, so a detected mocha framework with no runner evidence produced neithertypescript_verify_commandnor any limitation.typescript_test_runner_unresolvedis now emitted whenever the inferred command isNone— which is exactly what OUTPUT_SCHEMA.md already documents ("emitted whenverify_command_for_discoveryreturnsNone"). Adapter-level test added.Fragile package.json substring scanning (
package.rs):extract_test_script_valuefound the first"test":anywhere in the file andjson_has_workspaces_fieldsubstring-matched"workspaces". Detection now reads fields from a singleserde_jsonparse (ManifestFacts): a"test"key outsidescriptsis not the test script,"workspaces"inside a string value does not mark a monorepo root, and a framework name inside a free-text value ("description": "jest") is not dependency evidence. Unparseable manifests fail closed. All existing pinned detection tests pass unchanged.Evidence
Non-goals
docs/OUTPUT_SCHEMA.mdalready documents the Fix-3 contract; a follow-up may add the newtypescript_test_runner_ambiguouskind to the kinds list (left out to keep this diff inside the analysis lane).Rollback
Revert this PR; behavior is additive-limitation-only plus false-positive removal.