Repository navigation
TypeScript committed-snapshot: refuse root config spread of an unread base and computed keys - #11934
Conversation
…ad base or uses a computed key (#9940) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AoapkiftDmzBaXiATmb2KP
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Next included review available in 57 minutes. View limit details
|
There was a problem hiding this comment.
Confirmed findings
- crates/ripr/src/analysis/language/typescript/committed_snapshot.rs:738 —
at_roottreats the first brace in the file as the config root, even when it belongs to a function body or callback. A later unrelated{...base}can therefore downgrade an otherwise valid config to Medium. Identify the exported/config object structurally, or otherwise exclude non-root scopes. - Root-level detection requires exactly one opening brace on the stack, so a root config object inside defineConfig({...}) is not classified as root.
- The lexical scanner treats a quote inside a regex literal as an unterminated string and therefore refuses credit, even when the regex is unrelated to root inheritance.
- The scanner can mistake a function-body object for the runner-config root and refuse an otherwise readable config containing an unrelated spread.
Verification questions
- Confirm the lexical scanner treats any unterminated quote as unreadable, including quotes inside regex literals; this intentionally fails closed but may reject valid configs unrelated to snapshot inheritance.
- Confirm the new tests cover root-level syntax but not a config whose earlier brace belongs to a function, callback, or other non-root construct.
- Confirm crates/ripr/src/analysis/language/typescript/tests/committed_snapshot_tests.rs:2123 — Add negative controls where an unread identifier spread appears inside an array element and inside a nested object. The current controls only use array access and a nested spread, so they do not directly prove that
root_inherits_unread_keysignores non-root spreads as claimed. - Confirm the new test proves the intended root spread/computed-key distinctions but does not isolate whether a quote-containing regex causes refusal independently of unread inheritance.
Evidence gaps
- The available proof is incomplete: cargo-test was scheduled but has no receipt, and the ripr sensor failed with exit code 2.
- The PR's proof statement is not independently confirmed by the available sensor receipts.
- The claimed 51-test pass and precommit success lack an available completed cargo-test receipt; ripr itself failed with exit code 2.
- Model proof intent was rejected by deterministic validation.
There was a problem hiding this comment.
Independent review (fresh-context reviewer, head e107913): REVIEW_INCOMPLETE
Inspected:
- PR #11934 (open, draft, no labels), head
e107913f020ffc2baa542fbb30fce8637f0ec42d, basefa621a32eaf4c3dc6c17119021ea943641696aef. 5 files, +154/-9. - Governing issue #9940 (open). Its acceptance: "refuse (fail closed) when a config contains a
presetkey or a spread/import of a non-literal base, with a negative control for a plain config. Needs a decision on over-refusal cost against the verdict corpus." This PR delivers the spread and computed-key half; thepreset:half was already refused bypreset_may_name_a_file(crates/ripr/src/analysis/language/typescript/committed_snapshot.rs:481-511, used at :695), which I verified at this head, so the spec sentence the PR adds aboutpresetis accurate and that bullet of the issue is already closed. - Semantic owner and consumers: the new detector
root_inherits_unread_keys(committed_snapshot.rs:712-775) is composed intodelegates_beyond_plain_projects(:780-788), whose single consumer is the workspace config walk at :952 (file_name != "package.json" && delegates_beyond_plain_projects(file_name, &text)); atruereturnsNonefor the whole reading and the committed-snapshot credit drops to Medium. The pre-existing detectors it sits beside aredelegates_to_other_config(:401-406, keysprojects/workspace/root),blank_value_strings(:414-476),blank_comments(:534-583),without_plain_inline_projects(:593-710) andpreset_may_name_a_file(:481-511). The new function reusesblank_commentsandskip_triviaand does not fork any existing decision. - Oracle strength of the new test (
crates/ripr/src/analysis/language/typescript/tests/committed_snapshot_tests.rs:2116-2177): ten inputs, five expecting Medium and five expecting Strong. I checked that the five refusal cases actually discriminate rather than merely restating an existing refusal:delegates_to_other_configlooks only forprojects/workspace/root(:401-406), so none of the five refusal inputs matched it before this change — e.g.module.exports = { ...require("./jest.base"), testEnvironment: "node" };names none of those keys, so it kept the strong credit before and is Medium now. The five Strong inputs are the negative control the issue asked for, and I hand-traced each against the new scanner: the array spread sits behindmoduleFileExtensions:so its[follows:rather than{/,(:757-761), the nested-object spread is at brace depth 2 whereat_rootis false (:748-749), and the literal computed key["testEnvironment"]starts with a quote (:759). A wrong implementation that refused array or nested spreads, or that let a variable-computed key through, would fail this test. - Over-refusal claim in the PR body: I read all 15 committed TypeScript verdict-corpus runner configs (
fixtures/typescript-verdict-corpus/subjects/*/jest.config.js); none contains a root-object spread or a computed key, so "corpus verdicts are unchanged" holds as stated (I did not run the corpus). - Repo conventions:
.ripr/traceability.d/9940-ts-snapshot-root-inheritance.tomlfollows the established per-slice extension form (51 of the 84 files in that directory omitcode, and a leading comment line is the norm),changelog.d/9940-snapshot-root-config-inheritance.mduses the<!-- section: Fixed -->header, and RIPR-SPEC-0258 is updated in the same change to name the limits that remain (config[name] = ...,mergeConfig(base, {...})), which is the right treatment. - Hosted evidence for head
e107913f: every Rust lane isskipped(CI 41247202475, Coverage 41247202413, Security 41247202428, Future Clippy 41247202445, macOS 41247202560, Windows 41247202462, printed-command paste 41247202421) because the PR is a draft with nomerge-readylabel; "Source of Truth" (41247202404) and "Qualify ripr-rs Python Wheel" (41247202394) are green but neither compiles nor runs the changed Rust code.
Blocking:
None proven. The gap to REVIEW_READY is hosted proof: with no merge-ready label, no Rust lane ran on head e107913f, so the new scanner and its test have no hosted execution receipt at all. skipped here is unobserved, not green.
Non-blocking:
- The refusal is keyed on syntactic depth, but the property that matters is whether the root's effective key set is statically known. A root spread whose operand is an object literal is treated as safe (:751-756), yet that literal's contents become root keys, so
module.exports = { ...{ ...base } };andmodule.exports = { ...{ [name]: "x" } };keep the strong credit: the inner spread and the inner computed key sit at brace depth 2, whereat_rootis false (:748-749), and the literal operand suppresses the outer refusal. In both cases the effective root keys are unknown in exactly the way #9940 is about, so an unread base can still carrysnapshotResolver/snapshotFormat/updateunseen by the text search at :943-950. One level of descent into an object-literal operand would close it; RIPR-SPEC-0258:248-252 does not currently name it as a limit either, so the issue's remaining scope should be stated explicitly rather than implied closed. - Over-refusal on a config that declares another object literal before exporting.
at_rootmeans "the outermost{in the file" (:748-749), not "the object the config exports", soconst shared = { ...defaults };\nmodule.exports = { testEnvironment: "node" };is refused even though the exported config reads cleanly, downgrading the credit to Medium. All five negative controls in the new test start withmodule.exports =, so this shape is unpinned. - The blast radius grows.
delegates_beyond_plain_projectsis evaluated per config file found in the tree (:930-957) and a refusal from any one of them returnsNonefor the whole reading, so one unrelated config file anywhere in the workspace — now also one that merely spreads at root — downgrades the committed-snapshot credit for every snapshot in that workspace. That is the pre-existing shape of the rule, but this detector adds a new class of trigger to it. - Two scanners now disagree about which configs are readable.
blank_value_stringsrefuses outright on/and a backtick because a regex or template may hold quotes that desynchronise a scan (:458-461);root_inherits_unread_keysinstead scans a regex as code and reads a quote inside one as an unterminated string, refusing (:730-744). Both directions are fail-closed and the divergence is documented in the PR's own doc comment, but the two detectors reach different answers about the same file, and the new one is the stricter. - Scope note for reconciliation, no action required: the
preset:refusal the issue lists was already implemented by #10139, so #9940's remaining scope after this PR is the spread/computed-key rule plus the two boundaries in items 1 and 2 above.
Not run:
- The Rust toolchain on this host is not on
PATH, so I could not runcargo test,cargo fmt --check,cargo xtask precommit, clippy, or any other repo-native gate. The PR body's "51 committed_snapshot tests pass" and "cargo xtask precommitexit 0" are the author's; I did not reproduce them. My conclusions about the scanner come from reading the implementation and the detector it composes at heade107913fand hand-tracing the ten test inputs — the over-refusal and under-refusal cases in items 1 and 2 are derived from that reading, not observed. - The TypeScript verdict corpus was not executed; the PR's over-refusal claim was checked by reading the 15 committed corpus runner configs, not by running them.
- No hosted Rust lane ran on this head (draft, no
merge-readylabel), so the new test has no hosted receipt.
Reviewed by an independent Mavis review agent on behalf of the maintainer; bound to head e107913f020ffc2baa542fbb30fce8637f0ec42d. Not an approval.
…ot spread (#9940) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AoapkiftDmzBaXiATmb2KP
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Review of record, head 121d001. Angles: scanner correctness and fail-open paths, over-refusal on common configs, spec/test accuracy, clippy/no-panic policy. Reviews: one read-only subagent pass on e107913, one fresh-context review (no blockers, hosted proof missing), and a github-actions bot pass (hypotheses, checked below). Findings and resolutions:
Over-refusal: none of the 15 committed corpus runner configs has a root spread, computed key, regex or function, so corpus verdicts are unchanged. Remaining known limits ( Generated by Claude Code |
There was a problem hiding this comment.
Verification questions
- Confirm the root-only distinction has controls for array and nested spreads, but no case places an earlier non-root block before the actual root object.
- Confirm the specification documents several syntactic refusal conditions, but the added test does not directly exercise a root object following an unrelated earlier brace.
- Confirm the test asserts only final strength rather than the specific medium-strength cause, leaving a theoretical route where an unrelated downgrade could make a refusal case pass.
- Confirm a root object can be constructed indirectly through a variable or factory without the literal spread syntax appearing in the scanned root object, so the new detector does not cover every possible unread base inheritance route.
Evidence gaps
- Focused cargo-test evidence is still absent, so the PR body's claim that 51 committed_snapshot tests pass is not confirmed by an available receipt in this packet.
- The lane lacks completed executable proof: cargo-test was only scheduled with an absent receipt, while ripr failed with exit code 2.
- The strongest remaining verification gap is execution of the focused Rust tests, since the scheduled cargo-test receipt is absent.
- Model proof intent was rejected by deterministic validation.
- Executable cargo-test completion evidence remains unavailable in the shared packet.
- The PR claim that verdict-corpus verdicts are unchanged is not proved by the added focused test.
Parked follow-ups
- Call-based base merging is intentionally not refused; the specification retains mergeConfig(base, {...}) as a known limit rather than broadening this change.
- Known dynamic inheritance forms remain non-refused, so they are residual analysis blind spots rather than memory-safety or exploit primitives.
…nfig-inheritance-9940
|
CI shard 2 of 4 failed on 121d001 at Generated by Claude Code |
…11924) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AoapkiftDmzBaXiATmb2KP
|
Generated by Claude Code |
There was a problem hiding this comment.
Independent review (fresh-context reviewer, head f495f22): REVIEW_INCOMPLETE
Inspected:
- PR #11934 at head f495f22 (base 7ddbd2f, merge-ready, not a draft). Its six changed paths are .ripr/traceability.d/9940-ts-snapshot-root-inheritance.toml +6/-0, changelog.d/9940-snapshot-root-config-inheritance.md +6/-0, crates/ripr/src/analysis/language/typescript/committed_snapshot.rs +103/-2, crates/ripr/src/analysis/language/typescript/tests/committed_snapshot_tests.rs +83/-0, docs/specs/RIPR-SPEC-0258-typescript-committed-snapshot.md +12/-7, policy/process_allowlist.d/11720-first-pr-run-chain.txt +0/-1.
- The head moved twice under me while I was reviewing. The previously reviewed head was 121d001. The first move, d498e2f, is "Merge remote-tracking branch 'origin/main' into claude/ts-snapshot-config-inheritance-9940", 70 commits of main with no change to the PR's own content: all five of its own blobs are byte-identical between 121d001 and d498e2f (committed_snapshot.rs f0e930c, committed_snapshot_tests.rs 24b90b0, RIPR-SPEC-0258 e1063b3, the traceability entry a70994f, the changelog fragment 410734c). The second move, f495f22, is "Port the run_chain process allowlist fix from #11975 (main red after #11924)", one commit, +0/-1 in the policy allowlist fragment. At f495f22 the five original blobs are still byte-identical to d498e2f, so every finding below carries over unchanged.
- crates/ripr/src/analysis/language/typescript/committed_snapshot.rs at f495f22: holds_unscannable_construct ~712-760, root_inherits_unread_keys ~760-810, is_identifier_char :38, delegates_beyond_plain_projects :715; the test table in crates/ripr/src/analysis/language/typescript/tests/committed_snapshot_tests.rs ~2135; docs/specs/RIPR-SPEC-0258-typescript-committed-snapshot.md:244-259.
- Hosted evidence at f495f22: "Merge-ready request f495f22..." run 41256165912 is in_progress, CI run 41256165859 is in_progress and Windows Advisory run 41256165791 is in_progress, so the required check "Ripr Rust Small Result" has not been produced at this head. The lanes that ran at 121d001 and at d498e2f are superseded and are not attributed to f495f22.
Blocking:
- The required check "Ripr Rust Small Result" does not exist for this head yet: the Merge-ready request run 41256165912 and CI run 41256165859 are both in_progress at f495f22. The source review of the PR's own content is complete and the change itself is sound, but hosted proof is not established, so this cannot be REVIEW_READY. This is a hosted-proof gap, not a defect in the candidate.
- No candidate defect is blocking; the earlier blocking-free state holds.
Non-blocking:
- The ported policy fix in the new commit is correct and minimal, and I checked it rather than accepting the commit message. policy/process_allowlist.d/11720-first-pr-run-chain.txt at d498e2f carried four entries, and f495f22 removes exactly one: "crates/ripr/src/output/first_pr/run_chain.rs|use std::process::Command|1|first-pr-run-chain|#11720: import for the spawn above." That entry is stale because crates/ripr/src/output/first_pr/run_chain.rs at f495f22 no longer contains a
use std::process::Command;statement; the file still calls Command::new(exe) at line 368, and that call remains covered by the surviving "Command::new|1" entry on the same file. This is base-move maintenance forced by #11924 landing in main, not a change to this PR's claim, and it is worth noting only because the branch now carries one file outside its own five. - Earlier non-blocking #1 REPAIRED. The root-spread rule now refuses any root-level spread: root_inherits_unread_keys returns true unconditionally for a spread on the root config object instead of exempting an operand that starts with "{", the test table now expects Medium for module.exports = { ...{ ...base } }, and the spec was updated to "A spread on the root config object" (RIPR-SPEC-0258:249-252). A spread on the root object can hide a snapshot override behind it, so refusing is the conservative direction.
- Earlier non-blocking #2 STILL HOLDS, the over-refusal when another object literal precedes the export. The root is located as the outermost "{" in the file, so in a config file that declares an unrelated object literal before module.exports = {...}, the analysis refuses to read the export. The braces and at_root logic is unchanged in meaning by this delta and no test pins that shape, so the over-refusal is unmeasured in either direction.
- Earlier non-blocking #3 STILL HOLDS and widens, the blast radius. One unrelated config file that trips any of these trigger classes downgrades every committed snapshot in the workspace to Medium, and this delta adds trigger classes (regex literal, function keyword, block arrow body), so the set of workspace-wide downgrades grows. The PR's own changelog fragment records the advisory downgrade, but the workspace-wide reach of one file's contents is not bounded by the PR.
- Earlier non-blocking #4 STILL HOLDS, the two scanners disagree about readability. The blank_value_strings and root_inherits_unread_keys paths can reach different conclusions about the same config, so a snapshot's credit depends on which scanner ran. The delta does not reconcile them.
- New observation on the breadth of holds_unscannable_construct (committed_snapshot.rs ~712-760): any "/" preceded by a space or by one of
":,(=[{!&|?;"is treated as the start of a regex literal, so a plain division such as maxWorkers: cpus / 2 is classified as an unscannable construct and refuses. The test table expects Strong for module.exports = { maxWorkers: cpus / 2, testEnvironment: "node" };, which is consistent with the fixture, but it means the detector is a punctuation heuristic rather than a parser: it refuses on division and on a regex-looking division alike. Thefunctionkeyword test reads rest.get(7..) against text.get(at..), which lands on the eighth character of "function", so the offset is right, but the keyword is matched lexically and is not required to be a declaration. - One earlier suspicion of mine that I withdraw: I had flagged a possible stray duplicated "A member" fragment at RIPR-SPEC-0258:256. Re-reading the clause in full ("...since the root could hide behind it. A member assignment through a variable key (
config[name] = ...) and a base merged through a call (mergeConfig(base, {...})) are not read and keep the credit"), the sentence is well formed; the line is only longer than the surrounding wrap. No finding. - Duplicate claim: none found for this PR in the current open set.
- Efficiency: the delta adds one linear scan of the config text per file. holds_unscannable_construct walks the text once with a per-character filter and the braces counter is a small stack walk, so the cost is O(text length) per config file, the same order as the reads that already happen, with no change in growth rate, no new I/O, no process spawn, no cache and no retained collection. The added scan is real but linear and small relative to parsing the file; I did not profile it and therefore do not claim a measured figure. The widening set of trigger classes increases how often the refusal path is taken, which is a constant-factor effect, not a growth-rate change. The new policy commit removes one allowlist line and has no runtime effect at all.
Not run:
- The Rust toolchain on this host is not on
PATH: rustc, cargo and rustup are absent from PATH, so cargo xtask precommit, cargo test, cargo fmt --check, clippy and cargo xtask goldens check could not be run, and the shared checkout was not built while other agents hold it. Every Rust-level statement above comes from source read at SHA f495f22 plus hosted run metadata. - The Rust lanes for f495f22 were still running when this review was posted, so I did not read their logs and the verdicts for this head are not established by this review. One point for whoever reads the next lane result: the merged base contains main's fix for the previously inherited main-red, commit a5c3ba4 "fix(python): None never equals a number in shared literal equality (main red) (#11918)", so the shard-2 python failure that was inherited at 121d001 should be gone, while the rust verdict-corpus drift (rows eq-divert-match-later-arm-old-constant and shop-tier-gold-arm-unreached, expected "limited", observed "gap") arrived with the same merge through crates/ripr/src/analysis/language/rust/probes.rs and remains inherited.
- I did not obtain a green main lane for comparison, so inheritance of any red is argued by the direct source-level chain (byte-identical corpus rows and rust analysis files across the base/head boundary; this PR changes no rust analysis and no rust corpus file), not by a lane-to-lane comparison.
Reviewed by an independent Mavis review agent on behalf of the maintainer; bound to head f495f2215f4476438d046c53d94cc82f91bca0a8. Not an approval.
There was a problem hiding this comment.
Confirmed findings
- crates/ripr/src/analysis/language/typescript/committed_snapshot.rs:765 — The computed-key classifier refuses every unquoted computed key, including valid literal expressions such as [1], [null], and [true]. This is broader than the documented variable-computed-key rule and can over-refuse otherwise readable configs. Restrict refusal to computed keys that can depend on runtime variables, or document and test this deliberate limitation.
- The detector rejects a computed key whenever the token after '[' does not begin with a quote, rather than proving the key is variable-computed.
Verification questions
- Confirm root-object detection treats the first top-level brace as the config root, so an earlier unrelated object can become the analyzed root.
- Confirm the focused regression test covers root spreads, variable computed keys, plain configs, array spreads, nested spreads, and unscannable regex/function forms.
- Confirm variable-computed keys are refused only when the computed key begins after a root-object opening brace or comma; literal computed keys remain credit-bearing.
Evidence gaps
- Executable proof for the changed Rust behavior is unavailable in this packet: cargo-test is scheduled without a receipt and ripr exited 2.
- The focused cargo-test sensor was scheduled late, but its receipt is absent; ripr also failed with exit code 2.
- Focused Rust test execution is still unavailable: cargo-test has no receipt and the ripr sensor failed with exit code 2.
- No completed focused cargo-test receipt establishes the new positive and negative controls.
- Focused executable proof of the new scanner behavior remains unavailable because cargo-test has no completed receipt and ripr failed with exit code 2.
- Model proof intent was rejected by deterministic validation.
- Executable focused-test confirmation remains unavailable in the supplied packet.
…nfig-inheritance-9940
There was a problem hiding this comment.
Confirmed findings
- The computed-key rule refuses every unquoted root computed-key expression, although the documented change is specifically variable-computed keys; literal expressions such as [1] are also refused.
Verification questions
- Confirm the new test covers root spreads, variable computed keys, array and nested spreads, literal computed keys, regex/function forms, and plain configs, but does not assert an earlier unrelated brace before the actual root object.
- Confirm the new test asserts only final oracle strength, not the specific Medium-strength cause, so a refusal case could pass because of an unrelated downgrade.
Refuted
- Worker-handoff focus is not applicable to this patch; async and function factory configs are explicitly downgraded to Medium without evaluating their returned objects.
Evidence gaps
- Focused executable evidence for the new scanner and its negative controls is not present in this packet; cargo-test is scheduled-late with no receipt.
- Executable focused cargo-test receipt is absent from the supplied review packet, so passing behavior is not independently confirmed here.
- Executable proof of the claimed 51 passing committed-snapshot tests is unavailable in this packet; cargo-test was scheduled but its receipt is absent.
- Focused executable proof for the changed Rust route is absent: cargo-test is scheduled-late without receipt and ripr failed with exit code 2.
- The new architecture behavior lacks a completed focused executable receipt: cargo-test is scheduled but absent, while ripr failed with exit code 2.
- Model proof intent was rejected by deterministic validation.
- Focused executable proof for the changed Rust behavior is still absent; cargo-test was scheduled rather than completed in the available packet.
- Focused test execution remains unconfirmed because cargo-test is only scheduled and ripr failed with exit code 2.
|
Merged at af8899e (squash 1de30eb) after Generated by Claude Code |
Governing issue or accepted claim: #9940
Acceptance delta (one sentence): A Jest or Vitest config whose root object spreads a non-literal base or uses a variable-computed key no longer keeps the strong committed-snapshot credit.
What changed
root_inherits_unread_keysincommitted_snapshot.rsrefuses (fail closed, reading staysmedium) when the root config object has a spread of anything but an object literal, a key built from a variable, or an unscannable string/comment (e.g. a quote in a regex literal).[...defaults.moduleFileExtensions]), nested-object spreads (transform: { ...preset }) and literal computed keys keep the credit.presetwas already handled by typescript: a jest.config.js withprojectsmakes a snapshot test that does catch the edit read weakly_exposed (false actionable) #10139; RIPR-SPEC-0258 now says so and lists what remains a known limit (config[name] = ...,mergeConfig(base, {...})).Proof
root_spread_of_unread_base_and_computed_key_refuse_but_plain_configs_keep_credithas positive refusals and plain/array/nested negative controls; 51 committed_snapshot tests pass.cargo xtask precommitexit 0.Generated by Claude Code