Repository navigation
fix(typescript): skip colon __proto__ in the match-object field pin - #8145
Conversation
{ __proto__: v } sets the prototype rather than an own property, so
toMatchObject({ __proto__: v }) must not credit an owner whose changed
line is __proto__: v. Skip that colon form in flat_object_keys and the
owner-side key reader. Computed and shorthand forms are own properties
and are unchanged.
Co-authored-by: Steven Zimmerman, CPA <EffortlessSteven@users.noreply.github.com>
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
Summary by CodeRabbit
WalkthroughThe TypeScript match-object analysis now excludes colon-form ChangesTypeScript Match-Object Field Handling
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to
|
EffortlessSteven
left a comment
There was a problem hiding this comment.
review-pr (author self-review, COMMENT)
GitHub cannot request changes from the author; this is not an approval.
reviewed_head_sha: 65d466d838189dcf6e668dabdc8cc50da8fbcb0f
integration_basis: origin/main ef12e0258a63e2476fcf9509d867152d6b36df80
claim_boundary: colon `__proto__:` is not a listed match-object field on the matcher argument or the owner returned literal; sibling own fields still pin; computed/shorthand `__proto__` are not treated as proto setters and already fail this reader's colon/`[]` split
changed_surfaces_and_semantic_owners_inspected: crates/ripr/src/analysis/language/typescript/match_object_guard.rs (`flat_object_keys`, `ts_owner_returned_field_key`); consumers `ts_match_object_facts`; tests in match_object_tests.rs; changelog fragment; RIPR-SPEC-0250 unchanged. Fenced files and #8140 surfaces not touched.
blocking_findings: none on source/oracle
non_blocking_suggestions: the combined finding asserts `!= Exposed` rather than `WeaklyExposed`; either skip alone would also satisfy that finding, which is why the owner-key and `flat_object_keys` unit asserts exist.
refuted_or_stale_findings: Gemini quota comment is missing review for that provider, not a clean result. CodeRabbit reported no actionable comments on this head.
proof_and_ci_observed: on origin/main before the skip, owner colon key was Some("__proto__"), assertion colon keys listed `__proto__`, combined finding Exposed/ExactValue/Strong. After skip: `cargo test -p ripr --lib match_object` 11 passed; `cargo xtask precommit` pass (clippy -p ripr/--all-targets and -p xtask); `cargo xtask check-fast` pass, selector stable, 3 files, 10 gates, skipped check-support-tiers (n/a) and check-fixture-contracts. Independent `git diff --name-only origin/main...HEAD` is the same 3 files. GitHub merge ref 27a212456 parents (ef12e0258, 65d466d83), tree f1d256e identical to head.
proof_or_review_missing: hosted required checks and artifacts for this published head (Draft; Ripr Rust Small Result has not run). External Gemini review unavailable (quota).
affected_currentness_dimensions: production implementation, test stimulus, test oracle, public claim (changelog). Generated relationships, conflict resolution unchanged.
residual_assumptions_and_non_claims: does not credit computed/shorthand `__proto__`; does not move corpus/goldens (no `__proto__` TypeScript fixture rows); does not amend SPEC-0250; static skip is not a runtime mutation result.
disposition: REVIEW_INCOMPLETE
Source and oracle inspection on this exact head found no blocker. Hosted qualification is still missing, so this is not merge-ready.
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
There was a problem hiding this comment.
Decision
- Needs reviewer attention before upstream: findings remain.
Confirmed findings
- Changelog entry says 'no longer pins a returned proto: v field' but does not mention that the owner-side key reader also skips; minor readability nit, not a behavior risk.
Verification questions
- Confirm colon-sibling-adult end-to-end expectation asserts Exposed via profile_finding; profile_test only checks the matcher string, so the adapter that resolves owner field keys is not exercised here.
- Confirm both early-exit sites for proto sit inside the colon-only read path. computed ["proto"] and shorthand proto are explicitly noted as already failing the parse; assertion that owner-side setPrototypeOf and method-style proto assignment are not in this PR is consistent with the changeset.
- Confirm hardening: owner line
__proto__: 0,returns None, but a quoted-key form like"__proto__": 0,is not exercised in the owner-side test. - Confirm recall: own keys are skippable on matcher side, prototype-setter line returns None on owner side. Sibling 'adult' test asserts Exposed; ok. But no negative test that a purely proto-only owner does not produce any Exposed row.
Refuted
- Computed ['proto'] or shorthand proto would be treated as proto setters and skipped, causing a real own-property pin to be lost.; refuted because: flat_object_keys splits on the colon and only iterates colon entries; computed keys never enter the key=="proto" branch. ts_owner_returned_field_key requires a leading identifier and a strip_prefix(':') after it; shorthand has no colon, and computed keys are bracketed. Both spells fail upstream and return None before the new check.
- Two skip checks are duplicated and should be hoisted to a shared is_proto_setter_key helper.; refuted because: Readers operate on different shapes (full masked object literal vs single-line identifier+colon read); a shared helper would still be called twice and add indirection without semantic gain for a single string literal.
- Skipping proto removes a true own-property pin and weakens evidence quality.; refuted because: By ECMAScript spec,
{ __proto__: v }performs Object.prototype assignment via the literal proto-setter, not an own data property creation. Treat-list key as 'set prototype' is correct: the resulting object has no own 'proto' key. No real own-field pin is lost.
Evidence gaps
- Model proof intent was rejected by deterministic validation.
|
Reply to the Actions review on Changelog nit. Agreed it is readability-only. The fragment already says the key is skipped "on both the matcher argument and the owner literal." Not behavior-risk; leaving the head stable. Verification questions, from current source:
The three refuted items in that review are correct. |
EffortlessSteven
left a comment
There was a problem hiding this comment.
review-pr (author self-review, COMMENT)
GitHub cannot request changes from the author; this is not an approval.
Published-head pass on the same SHA as the pre-publication REVIEW_INCOMPLETE record. Source and oracle inspection is unchanged; this pass binds hosted exact-head evidence.
reviewed_head_sha: 65d466d838189dcf6e668dabdc8cc50da8fbcb0f
integration_basis: origin/main ef12e0258a63e2476fcf9509d867152d6b36df80 (PR base; GitHub mergeable MERGEABLE)
claim_boundary: colon `__proto__:` is not a listed match-object field on the matcher argument or the owner returned literal; sibling own fields still pin; computed/shorthand `__proto__` are not treated as proto setters and already fail this reader's colon/`[]` split
changed_surfaces_and_semantic_owners_inspected: crates/ripr/src/analysis/language/typescript/match_object_guard.rs (`flat_object_keys` continue at key=="__proto__" after quote strip; `ts_owner_returned_field_key` return None after leading_identifier + colon); consumer `ts_match_object_facts` (owner None early-returns empty PinFacts; matcher lists_key via flat_object_keys.contains); tests in match_object_tests.rs::colon_proto_is_not_a_listed_match_object_field; changelog fragment; RIPR-SPEC-0250 unchanged. Three files only. Fenced files and #8140 surfaces not touched. Rival draft #8148 folds #8133 with #8138; this PR remains the dedicated #8133 candidate.
blocking_findings: none
non_blocking_suggestions: combined finding asserts != Exposed rather than WeaklyExposed; either skip alone would also satisfy that finding, which is why the owner-key and `flat_object_keys` unit asserts exist. Changelog already names both matcher and owner.
refuted_or_stale_findings: Devin corpus-control thread resolved as fenced/out of scope. Devin quoted-key is_none_or thread resolved as weaker quoted-only loop; load-bearing continue-vs-None is `{ __proto__: 0, adult: true }` plus colon-sibling-adult. Actions review changelog nit and verification questions answered in comment 6196911758 without a head change. Gemini quota comments are missing review for that provider, not a clean result. CodeRabbit reported no actionable comments on this head.
proof_and_ci_observed: local precommit + check-fast + match_object 11 passed on this SHA (prior pass). Hosted: Ripr Rust Small Result success (job 116558013348, run 38767564632); Ripr Rust Small on GitHub Hosted / Rust gates success. Combined commit status success (CodeRabbit, Devin). Advisory Rust-only feature lane failure (job 116527917778, run 38765618545): cli_smoke `structural_workspace_markers::scalar_marker_preserves_cargo_uv_git_and_unmarked_root_boundaries` panicked at line 182 because the `uv` sandbox's pyproject.toml is detected as Python while the binary is `--no-default-features --features lang-rust`. docs/CI.md states this lane is not a required check. This PR does not touch cli_smoke, workspace markers, or language-feature wiring; not a candidate defect; head left stable. Threads required-resolution: both Devin threads resolved. Ruleset 18845973: 0 approving reviews, thread resolution required, extra approval for unattributed changes; classic protection unreadable (403).
proof_or_review_missing: Gemini review (quota). Classic branch-protection required-check list unreadable; repository docs and SPEC-0087 name Ripr Rust Small Result as the protected gate, and that check succeeded on this head.
affected_currentness_dimensions: candidate head identity and exact-head CI/receipts refreshed; production/test/oracle/public-claim unchanged since the pre-publication pass.
residual_assumptions_and_non_claims: does not credit computed/shorthand `__proto__`; does not move corpus/goldens; does not amend SPEC-0250; static skip is not a runtime mutation result; does not repair the inherited rust-only uv/lang-python cli_smoke failure.
disposition: REVIEW_READY
Mutation/removal challenge: on origin/main the owner colon key was Some("__proto__"), assertion colon keys listed __proto__, and the combined finding was Exposed / ExactValue / Strong. After the skip those unit asserts are None / not listed / not Exposed. Removing only one skip would still fail that side's unit assert. Sibling adult still Exposed through profile_finding / analyze_diff.
…guard The #8133 reconciliation (issue comment on #8133 after PR #8145, commit 758a7c0) selects skip-the-key-keep-sibling-field semantics that main already carries at this branch's merge base, and instructs #8148 to drop the overlap rather than amend RIPR-SPEC-0250 for it. This restores RIPR-SPEC-0250 to its landed text, removes the duplicated early __proto__ refusal in ts_owner_returned_field_key (the landed post-colon check already refuses it) and the duplicated changed-side assertion. Behavior is unchanged: the changed-side refusal, sibling-field credit and the escaped-key fail-closed skip (the resolved CodeRabbit thread) are kept, and the commented-key control from the review is pinned in colon_proto_is_not_a_listed_match_object_field. Also pins the two additional wrapper forms from the P1 review evidence as refusals: the comma expression jest.fn((() => 0, recordTwo)) and the helper call jest.fn(choose(() => 0)).
…they seem (#8138) * fix(typescript): refuse mock bindings and __proto__ keys that are not what they seem (#8138, #8133) RIPR-SPEC-0247 rule 1 now requires the mock binding to be exactly a fresh mock: no implementation or an arrow one, nothing after the call, and the statement ended where it appears to end. `jest.fn ()` with a space reads as the factory call it is. RIPR-SPEC-0250 rule 1 no longer reads a `__proto__:` entry as a listed field on either the owner's returned literal or the expected object. No verdict-corpus row moves. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013ajVbPgh9yZDQgaAHkZE8V * fix(typescript): reject escaped __proto__ keys in match object expected literals * fix(typescript): skip escaped __proto__ key without failing sibling own fields * fix(typescript): credit only a whole-arrow mock implementation (#8148 review) closed_mock_call accepted any argument containing an arrow token, so jest.fn((() => recordTwo)()) and jest.fn(ready ? (v) => v : recordTwo) read as fresh mocks although the wrapper can evaluate to a named implementation that records the asserted payload through this. The argument must now itself be an arrow expression (optional async, then a parenthesized parameter list or one identifier, then =>). Verified by a known-wrong control: with the guard reverted, the new honesty-corpus fixture reports exposed / oracle strong; with the guard, weakly_exposed / oracle medium (RIPR-SPEC-0108 charter case ts_mock_payload_wrapped_impl_not_a_fresh_mock). Also pins that a commented colon __proto__ matcher key still refuses to list while sibling own fields keep listing (RIPR-SPEC-0250, review thread superseded by the skip semantics landed in b1dc26e). * fix(typescript): drop the landed #8133 overlap, keep the whole-arrow guard The #8133 reconciliation (issue comment on #8133 after PR #8145, commit 758a7c0) selects skip-the-key-keep-sibling-field semantics that main already carries at this branch's merge base, and instructs #8148 to drop the overlap rather than amend RIPR-SPEC-0250 for it. This restores RIPR-SPEC-0250 to its landed text, removes the duplicated early __proto__ refusal in ts_owner_returned_field_key (the landed post-colon check already refuses it) and the duplicated changed-side assertion. Behavior is unchanged: the changed-side refusal, sibling-field credit and the escaped-key fail-closed skip (the resolved CodeRabbit thread) are kept, and the commented-key control from the review is pinned in colon_proto_is_not_a_listed_match_object_field. Also pins the two additional wrapper forms from the P1 review evidence as refusals: the comma expression jest.fn((() => 0, recordTwo)) and the helper call jest.fn(choose(() => 0)). * fix(typescript): accept a space before the mock factory call const send = jest.fn () refused while the factory path (is_bare_mock_factory) accepts the same spelling. closed_mock_call and without_closed_mock_factories now trim after the factory name and after optional type arguments, so a spaced direct binding or inline property credits and the implementation text still reads as the factory's arguments when checking what opens a function before the owner call. Also pins that a ) inside a string in the implementation never ends the call: string contents arrive masked, so jest.fn(() => ")") credits at its real closing parenthesis (#8148 review threads). --------- Co-authored-by: Claude <noreply@anthropic.com>
Summary
flat_object_keysandts_owner_returned_field_keytreated colon{ __proto__: v }as an ordinary listed field.toMatchObject({ __proto__: 1 })could pin an owner whose changed line was__proto__: 1,asexposed/exact_value/ strong — a false credit, because that spelling sets the prototype rather than an own property.__proto__(identifier or quoted) is skipped on both the matcher argument and the owner-side key reader. A sibling own field such asadultstill pins. Computed["__proto__"]and shorthand__proto__are own properties; they already fail this reader's colon/[]split and are not skipped as proto setters.match_object_guard.rscontinues pastkey == "__proto__"inflat_object_keysand refuses that key fromts_owner_returned_field_keyafter the colon read.Closes #8133.
Swarm / Source Boundary
ripr-swarmSource-of-truth Links
Proposal: n/a
Spec: RIPR-SPEC-0250 (no spec text change; this is a false-credit hole in the existing field pin)
ADR: n/a
Plan item: n/a
Governing issue or accepted claim: #8133
Acceptance delta (one sentence): colon
__proto__:is not a listed match-object field on the assertion or owner side; no corpus row or golden moves.Candidate Relationships
Candidate branch:
cursor/ts-match-object-proto-skip-85d5Stack parent or prerequisite PR: none
Proposed replacement of PR: none
#8140 holds
classifier.rs,types.rs,.ripr/traceability.toml, and other TypeScript files; this PR does not touch them.Scope
Scope Classification
Production delta:
__proto__:inflat_object_keysandts_owner_returned_field_key.Evidence/support delta:
match_object_tests.rs.Single acceptance criterion:
toMatchObject({ __proto__: 1 })does notexposed-pin an owner whose changed line is__proto__: 1,; siblingadultstill pins.Non-goals:
["__proto__"]or shorthand__proto__(already not parsed here; they are real own properties and must not be treated as proto setters).{ m: jest.fn(...) }value and trailing text are not checked #8138 and neighbor TypeScript follow-ups.Support-tier Impact
Claim/proof notes:
Policy Impact
Proof
Result, failures, or skipped proof:
Some("__proto__"), assertion colon keysSome(["__proto__"]), combined findingExposed/ExactValue/Strong.None, shorthand keysNone, owner computed/shorthandNone— already correct; dropped as cases.match_object11 passed.precommitnative 0 on65d466d838189dcf6e668dabdc8cc50da8fbcb0f(selected Clippy-p ripr --all-targetsand-p xtask).check-fastselector stable, 3 files vsorigin/main, 10 gates, skippedcheck-support-tiers(not applicable) andcheck-fixture-contracts. Independentgit diff --name-only origin/main...HEADmatches those 3 files.__proto__rows in the TypeScript fixture corpus, so no golden/corpus edit.27a212456parents (ef12e0258,65d466d83), tree identical to head.Claim Boundary
May claim: colon
__proto__:is not a listed match-object field, so that spelling cannot false-credit a returned-field pin.Must not claim: computed or shorthand
__proto__pins; corpus movement; a SPEC-0250 amendment.Rollback
Revert the squash commit. No corpus or golden re-bless.
Spec-Test-Code Traceability
match_object_tests.rs::colon_proto_is_not_a_listed_match_object_fieldmatch_object_guard.rstypescript_match_object_pin_mismatch(unchanged)Static Language Check
killed,survived,untested,proven, andadequate.CI Economics
n/a
Engineering Check
panic,unwrap,expect,todo, orunimplementedin production code.panic,unwrap,expect,todo, orunimplementedin tests.Gates
cargo fmt --check(via precommit)cargo xtask precommitcargo xtask check-fastContinuation