Skip to content

feat(typescript): RIPR-SPEC-0254 read a changed lookup-table entry as a return-value change - #7612

Merged
EffortlessSteven merged 9 commits into
mainfrom
claude/project-thread-pwvs2k
Oct 13, 2026
Merged

EffortlessSteven merged 9 commits into
mainfrom
claude/project-thread-pwvs2k

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Summary

Before: the TypeScript verdict corpus reads ts-vitest-unit-price-table as a false gap.

  • The diff moves pear: 95 to pear: 99 in const table = { apple: 120, pear: 95 }.
  • The owner returns table[sku] ?? 0, and the test asserts fetchUnitPrice("pear") resolves to 95.
  • The changed const line had no specific probe shape. The ambiguous fallback is never exposed, so the finding was weakly_exposed with "no statically comparable predicate boundary".

After: a proven one-line lookup table reads as a return_value change (RIPR-SPEC-0254 rule 1).

  • When it applies: the old and new lines declare the same table with the same keys in the same order, holding plain literal values. At least one value must move.
  • Owner shape: the owner returns table[param] or table[param] ?? <literal>.
  • Credit: it reads exposed only when a strong exact assertion observes a whole owner call whose key argument is a quoted literal naming a changed key (rule 2).
  • Otherwise: it stays weakly_exposed and names the changed keys. An exact pin on an unchanged key such as "apple" passes on both versions, so it does not credit the change.

How:

  • lookup_table_guard.rs parses the old and new table lines and checks the owner shape. It reports the moved keys and the key parameter.
  • In classifier.rs, the probe falls back to this guard only when no specific shape matched, and it applies the changed-key witness to the exposure decision.
  • Float values are compared with total_cmp, so 95 against 95.0 does not move.

Swarm / Source Boundary

  • ordinary feature, analyzer, editor, docs, spec, fixture, badge, dependency, or repo-ops development for ripr-swarm

Source-of-truth Links

Candidate Relationships

Scope Classification

Non-goals:

  • no classifier change for lines outside rule 1;
  • no snapshot or weak-matcher credit;
  • no other languages.

Decisions: recorded in the spec's Decisions section, under the owner's "make reasonable documented decisions" direction.

  • Only a proven table is promoted, so other object-literal declarations keep the fallback.
  • A changed-key witness is required, not any exact pin.

Support-tier Impact

  • none (TypeScript stays Preview)

Policy Impact

  • doc artifacts: RIPR-SPEC-0254 is registered in doc-artifacts, traceability and the Rust and Python spec ledgers.
  • generated artifact: one corpus row is re-blessed.

Proof

cargo xtask precommit                         # exit 0 on this head
cargo test -p ripr --lib typescript           # 1004 passed
cargo xtask verdict-corpus check-all          # 4 corpora pass; TypeScript 4/106 (main 5/106)

Negative experiments: removing any of the following guard conditions fails a named test in lookup_table_tests.rs:

  • same keys in the same order;
  • the key grammar;
  • the value grammar;
  • the moved-value check;
  • the ?? null rule;
  • one return and no nested function;
  • the table named exactly twice;
  • parameter stability;
  • the changed-key witness.

Claim Boundary

May claim: a value change in a one-line const lookup table returned as table[param] reads as a return-value change, and it is exposed only when a strong assertion looks up a changed key by a literal.

Must not claim:

  • multi-line, nested, module-level, Map or switch tables;
  • computed keys in tests (these stay weakly_exposed).

Rollback

Revert the squash commit.

Spec-Test-Code Traceability

  • Spec: docs/specs/RIPR-SPEC-0254-typescript-lookup-table-entry.md
  • Tests: crates/ripr/src/analysis/language/typescript/tests/lookup_table_tests.rs
  • Code: lookup_table_guard.rs, classifier.rs
  • Golden outputs: fixtures/typescript-verdict-corpus/expected/rows/ts-vitest-unit-price-table.json

Static Language Check

  • Static output avoids killed, survived, untested, proven, and adequate.

Engineering Check

  • No new panic, unwrap, expect, todo, or unimplemented in production code or tests.

🤖 Generated with Claude Code

https://claude.ai/code/session_013ajVbPgh9yZDQgaAHkZE8V


Generated by Claude Code

… change

RIPR-SPEC-0254. A one-line `const table = { k: literal, ... }` whose only
read is `return table[param] [?? literal]` changes only what the owner
returns for the moved keys. Read it as a return-value probe, and credit it
only when a strong exact assertion observes a whole owner call whose key
argument is a quoted literal naming a moved key. Moves the corpus case
ts-vitest-unit-price-table from gap to credited; no other row moves.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ajVbPgh9yZDQgaAHkZE8V
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Warning

Review limit reached

The included review limit has been reached and this organization has disabled usage-based review continuation. Wait for reviews to reset or ask a billing admin to change After included review limits.

Next included review available in 2 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 878fede7-02b9-4da2-a1b0-1d9499f538a1
📥 Commits

Reviewing files that changed from the base of the PR and between 717d9d1 and 0c54ebb.

📒 Files selected for processing (26)
  • .ripr/traceability.toml
  • changelog.d/6654-typescript-lookup-table-entry.md
  • crates/ripr/src/analysis/language/typescript/classifier.rs
  • crates/ripr/src/analysis/language/typescript/lookup_table_guard.rs
  • crates/ripr/src/analysis/language/typescript/mod.rs
  • crates/ripr/src/analysis/language/typescript/tests.rs
  • crates/ripr/src/analysis/language/typescript/tests/lookup_table_tests.rs
  • docs/specs/README.md
  • docs/specs/RIPR-SPEC-0254-typescript-lookup-table-entry.md
  • fixtures/python-verdict-corpus/spec-coverage.toml
  • fixtures/rust-verdict-corpus/cases/spec0231-oracle-assert-ne-ok-value.json
  • fixtures/rust-verdict-corpus/cases/spec0231-oracle-assert-ne-scalar.json
  • fixtures/rust-verdict-corpus/cases/spec0231-oracle-ensure-not-equal.json
  • fixtures/rust-verdict-corpus/cases/spec0231-oracle-helper-assert-not-equal.json
  • fixtures/rust-verdict-corpus/expected/rows/spec0231-oracle-assert-ne-ok-value.json
  • fixtures/rust-verdict-corpus/expected/rows/spec0231-oracle-assert-ne-scalar.json
  • fixtures/rust-verdict-corpus/expected/rows/spec0231-oracle-assert-ne-struct-literal.json
  • fixtures/rust-verdict-corpus/expected/rows/spec0231-oracle-ensure-not-equal.json
  • fixtures/rust-verdict-corpus/expected/rows/spec0231-oracle-helper-assert-not-equal.json
  • fixtures/rust-verdict-corpus/spec-coverage.toml
  • fixtures/typescript-verdict-corpus/cases/ts-vitest-unit-price-table-other-key.diff
  • fixtures/typescript-verdict-corpus/cases/ts-vitest-unit-price-table-other-key.json
  • fixtures/typescript-verdict-corpus/expected/rows/ts-vitest-unit-price-table-other-key.json
  • fixtures/typescript-verdict-corpus/expected/rows/ts-vitest-unit-price-table.json
  • policy/doc-artifacts.toml
  • xtask/src/reports/dx_scoreboard/population_tests.rs

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: d9fa588d-3a27-4cf2-8921-170eddd0e724
📥 Commits

Reviewing files that changed from the base of the PR and between 16355a0 and 717d9d1.

📒 Files selected for processing (1)
  • crates/ripr/src/analysis/language/typescript/tests/lookup_table_tests.rs
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

Summary by CodeRabbit

  • Bug Fixes
    • TypeScript analysis now recognizes changed values in supported lookup tables as return-value changes. A strong assertion that looks up a changed key marks the change as exposed; otherwise, findings identify changed keys as weakly exposed. This corrects a verdict in the TypeScript corpus and clarifies which keys are not covered by assertions.

Walkthrough

Adds TypeScript analysis for qualifying one-line lookup-table value changes. The classifier treats them as return-value changes and credits exposure only when a strong pinned assertion observes an owner call with a changed key at the key parameter. The PR adds tests, a specification, and corpus and traceability updates.

Changes

TypeScript lookup-table analysis

Layer / File(s) Summary
Detect qualifying lookup-table changes
crates/ripr/src/analysis/language/typescript/lookup_table_guard.rs, crates/ripr/src/analysis/language/typescript/classifier.rs, crates/ripr/src/analysis/language/typescript/mod.rs, crates/ripr/src/analysis/language/typescript/tests.rs, crates/ripr/src/analysis/language/typescript/tests/lookup_table_tests.rs
The guard recognizes supported one-line tables and owner return shapes. The classifier treats qualifying changes as return-value changes. Tests cover accepted and rejected table and return shapes.
Require changed-key assertion evidence
crates/ripr/src/analysis/language/typescript/lookup_table_guard.rs, crates/ripr/src/analysis/language/typescript/classifier.rs, crates/ripr/src/analysis/language/typescript/tests/lookup_table_tests.rs
A strong pinned assertion must observe an owner call with a changed key at the table-key parameter. Otherwise, the classifier reports the changed keys and classifies the result as weakly exposed. Tests cover witnessing and non-witnessing assertions.
Record the rule and verdict coverage
docs/specs/RIPR-SPEC-0254-typescript-lookup-table-entry.md, docs/specs/README.md, policy/doc-artifacts.toml, .ripr/traceability.toml, fixtures/python-verdict-corpus/spec-coverage.toml, fixtures/rust-verdict-corpus/spec-coverage.toml, fixtures/typescript-verdict-corpus/expected/rows/ts-vitest-unit-price-table.json, changelog.d/6654-typescript-lookup-table-entry.md
Adds the proposed specification and traceability entry, marks Python and Rust coverage out of scope, and updates the TypeScript corpus verdict and changelog.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant TypeScriptClassifier
  participant LookupTableGuard
  participant AssertionCandidates
  TypeScriptClassifier->>LookupTableGuard: Check old and new owner lines
  LookupTableGuard-->>TypeScriptClassifier: Return qualifying changed keys and parameter index
  TypeScriptClassifier->>LookupTableGuard: Check for changed-key assertion evidence
  LookupTableGuard->>AssertionCandidates: Inspect strong pinned assertions and owner calls
  AssertionCandidates-->>LookupTableGuard: Provide observed call arguments
  LookupTableGuard-->>TypeScriptClassifier: Return witness result
Loading
Merge Risk: ⚪ Minimal · up to 717d9

The lookup-table verdict change has targeted coverage for the changed-key distinction, and no concrete merge-blocking issue is established.

Pre-merge checks · Passed 4 · Failed 1

Failed Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 76.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 25 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks (4 passed)
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly and concisely identifies the TypeScript lookup-table behavior added by this pull request.
Description check Passed The description is mostly complete and clearly documents the behavior, scope, source links, proof, claim boundary, rollback, and traceability. It omits several template sections, including the explici…
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checked the table keys,
And watched the tests with twitching ears.
A changed key met a pinned assertion,
The verdict shifted with precision.
The spec now names the rules in ink,
Then off I hopped before the spring.

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decision

  • Needs reviewer attention before upstream: findings remain.

Confirmed findings

  • Active-view semantics are not in scope: the diff adds string-only parsing of masked TypeScript source. No ArrayBuffer, TypedArray, SharedArrayBuffer, or ResizableArrayBuffer usages appear in new or changed code paths.
  • The two-param positive case asserts expect(fetchUnitPrice("pear", "apple")) returns WeaklyExposed, but the constant is hardcoded NEW (pear: 99); the test does not assert the changed-key name appears in missing for that specific two-param shape. Minor oracle-coverage gap; existing single-param negative tests already pin the message format.

Verification questions

  • Confirm multi-line, nested, Map, switch and module-level table shapes are documented non-goals but yield weakly_exposed with 'no statically comparable predicate boundary' on real TypeScript corpus cases beyond ts-vitest-unit-price-table.

Refuted

  • The lookup-table guard returns a struct holding borrowed &str keys (changed_keys: Vec<String>) and param_index, which could alias a backing source buffer that resizes or detaches between diff parsing and oracle walk, leaving a stale slice in active view.; refuted because: All String owners in LookupTableChange are owned allocations produced by the guard at call time (entries.push((key.to_string(), value.to_string()))); the only &str lifetime is the input line_text / old_line_text parameters, which the caller owns and does not mutate during ts_lookup_table_witnessed. No ArrayBuffer, TypedArray, or Rc<[T]> slice is taken.
  • ts_lookup_table_change would misfire when the table name equals a parameter name and the return reads return x[x] (self-indexing) — param_index = params.iter().position(\|p\| p == key_param) would then return the index of the (only) parameter and credit a non-key literal-argument match against p == x; refuted because: Rejecting owner's body has identifier_offsets(&body, &name).len() != 2 (declaration + return). A second read of the table name as a parameter declaration would change that count, but in normal ESM the parameter list is not inside the body — masked_owner_body excludes name(...) parameter text, so table appears only twice. Independently: self-indexing x[x] would still produce a valid changed_keys claim and test would have to use f(x) to be an oracle.

Parked follow-ups

  • Two oracle derivations in classifier.rs now share ts_owner_call_names + ts_observed_owner_call_arguments; future shape guards that relax receivers or rename locals must update both call sites or risk silent drift.
  • string_literal_content in lookup_table_guard.rs is a near-duplicate of string_literal_argument in the same file (single-vs-double quotes with no-escape rule). Co-locating or sharing one helper would shrink the surface for future key/argument parsing.
  • Number move detection uses numeric_literal_value(...).and_then(\|v\| v.parse::<f64>()).total_cmp, which collapses 1e3 to float but the key 1e3 itself is refused in table_key; the value side only sees numeric tokens like 50, 50.0. The exponent-95e0 value case is not pinned by any test in lookup_table_change_refuses_other_shapes.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.

…view

- A fallback must be one whole literal; `?? "x" ? a : b` and
  `?? "x", 0` no longer pass as a string fallback.
- The table declaration must be a top-level statement of the body; a
  table in an inner block leaves the return reading another table.
  Arrow owners with a block body still read.
- Integer keys are capped at 15 digits, since longer ones may round.
- A move between a number, a string and a boolean does not count, since
  loose equality can read them as the same value.
- The changed-key witness needs a pinned expected side.

Adds tests for the rule-2 kind filter, the namespace receiver, a nested
function, and each new refusal; the spec states the new conditions.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ajVbPgh9yZDQgaAHkZE8V

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decision

  • Needs reviewer attention before upstream: findings remain.

Confirmed findings

  • Active-view region: out of scope for this diff. No ArrayBuffer/TypedArray/SharedArrayBuffer/ResizableArrayBuffer surface is touched; the new module is purely syntactic parsing of masked TS source plus a usize param_index and owned Vec.
  • Spec rule 2 wording says 'a quoted string literal naming a changed key' but rule 1 grammar permits numeric/integer keys — examples only cover quoted-string cases so the contradiction is silently consistent with current corpus.
  • identifier_offsets(&body, "return") and identifier_offsets(&body, &name) count tokens in the raw owner body without masking comments or string contents. A comment containing // table or return would miscount and trigger the rule-1 refusal, silently demoting a real lookup-table owner to weakly_exposed. Consider masking literals and comments first, or restrict the search to statement-shaped lines. (crates/ripr/src/analysis/language/typescript/lookup_table_guard.rs:160).

Verification questions

  • Confirm two-param WeaklyExposed case asserts classification but does not assert the changed-key name appears in the named limitation message (prior-seeded minor gap).
  • Confirm rule 2 negative matrix omits an explicit expect.any(String) or expect.stringContaining key argument case — if assertion.has_dynamic_matcher_arg excludes such a key, the test never pins. Spec rule 2 requires a quoted string literal naming a changed key, so dynamic key is correctly rejected, but coverage of that branch rests on assertion_expected_side_is_pinned returning false on dynamic matcher args.
  • Confirm ts_observed_owner_call_arguments inlines the previous observed_expression None-continue, weakening an early-continue invariant for ts_dropped_term_witness callers.
  • Confirm guard's identifier-occurrence check ('table named exactly twice') runs on the literal body, so a comment containing the table name (// table) would inflate the count and reject a real lookup-table owner. No masking is applied to identifier_offsets.
  • Confirm proof receipts in PR body (cargo xtask precommit, cargo test -p ripr --lib typescript, cargo xtask verdict-corpus check-all) were not reproducible in this lane (cargo subroutines require --allow-heavy which the gh-runner profile disables). Late-evidence cargo-test receipt will land at the gate. Acceptable residual.

Refuted

  • LookupTableChange keys alias a backing source buffer that could detach/resize between diff parsing and oracle walk, leaving stale slices in the active view.; refuted because: Inspect the new struct: pub(crate) changed_keys: Vec<String> is owned (cloned via key.to_string() in table_declaration and key.clone() in ts_lookup_table_change); param_index: usize is recomputed by owner.params.iter().position(...) against the live &TypeScriptOwner. No &str slice from line_text, old_line_text, or owner.source_text outlives the function. The seeded summary's wording ('borrowed &str keys') does not match the diff; it is a false premise on the diff as written.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.

…to read as numbers

`numeric_literal_value` drops `_` separators before its digit check,
so an identifier value such as `_1` read as the number 1 and a move from
`_1` to `2` counted as a change. Also pins the arrow-owner inner-block
refusal.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ajVbPgh9yZDQgaAHkZE8V
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ajVbPgh9yZDQgaAHkZE8V

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed findings

  • The two-param positive case asserts ExposureClass::WeaklyExposed but skips the missing contains lookup-table value for pear`` check that the single-param negative loop asserts; minor oracle-coverage asymmetry worth tightening once, not a blocker.

Verification questions

  • Confirm pR body claims 'cargo test -p ripr --lib typescript # 1004 passed' and the four lookup_table_tests cover rule 1/2 plus rule 2 negatives with named pear-in-missing assertions. Proof receipt for cargo-test is scheduled-late, not yet captured in this packet; treat the run count as author-asserted until the broker lands the receipt.
  • Confirm identifier_offsets counts tokens on raw owner body without masking comments/strings; a // return line or /*return*/ block comment would inflate 'return' count and silently demote a real owner to weakly_exposed (downgrade, not upgrade).
  • Confirm two-param WeaklyExposed positive case does not pin the changed-key name in finding.missing; seeded review summary already flagged this and the diff has not closed it.
  • Confirm three verifications repo-relative: (a) classifier.rs already observed the tables[sku] shape yielding ReturnValue in current corpus; (b) reproduce the original false verdict in main by running corpus check on pre-PR head; (c) confirm no non-ts-vitest-unit-price-table row flips class/outcome from the rule.
  • Confirm rule 1 grammar admits numeric and unquoted identifier keys; rule 2 witness demands a quoted string literal match. A decimal-integer-keyed table like { 10: 1 } → { 10: 2 } therefore cannot satisfy rule 2 in the implementation even when tests look up the numeric key as a string. The spec body is consistent with the code (examples only use string keys), but the wording claims a general 'changed key' witness the code does not deliver.
  • Confirm body masking for identifier_offsets is not applied in ts_lookup_table_change; a comment containing return or function could miscount rules. table_declaration masks literals/comments, but the rest of the guard operates on raw owner.source_text.
  • Confirm rule-2 witness filter narrows oracle_kind to ExactValue|WholeObjectEquality, but spec rule 2 says 'strong exact_value or whole_object_equality'; an inline snapshot on the changed key is Strong but Snapshot kind, so lookup-snapshot-on-changed-key correctly stays WeaklyExposed only via the kind filter, not via the changed-key argument check. The 'lookup-snapshot-on-changed-key' test asserts class=WeaklyExposed and the missing mentions pear; a symmetric test asserting it stays weak when the snapshot key IS a changed key is present, but no test asserts the Snapshot-kind branch against a UNCHANGED key (would also be Weak). Borderline gap.
  • Confirm values_differ() returns true when one side is null and the other is a number/string, because the type guard only excludes non-null type-cross moves. Spec rule 1 says 'Under a ?? fallback, a move to or from null does not count.' The code filters such moves via the 'involves_null && has_fallback' post-filter, so a non-fallback move null<->number still counts as moved (test 'a move to null under a fallback' is rejected because has_fallback=true). For a fallback-less owner (return table[param];), the rule would still credit null<->number — there is no test pinning this distinction either way.

Refuted

  • Spec rule 2 says 'a quoted string literal naming a changed key' but rule 1 grammar admits plain decimal/identifier/unquoted keys, so a string change witness can never satisfy rule 2 for a numeric-key table. Body text acknowledges this implicitly via integer-key examples, but the spec clauses are not tightened; the implementation matches the body.
  • typed array api allocation failure; refuted because: No typed-array surface, Box::from(slice), or allocation-failure path is touched by this diff. Objection is out of scope.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.

… key

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ajVbPgh9yZDQgaAHkZE8V
@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 13, 2026 05:20
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 3 potential issues.

Devin Review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed findings

  • identifier_offsets in lookup_table_guard.rs counts tokens on the raw owner body without masking comments/strings; a // return line or /*return*/ would inflate the count and trigger the rule-1 refusal (strict downgrade, not over-credit). Not a tests-red-green blocker, but the spec's rule 1 examples do not pin this case and the test matrix does not cover it.
  • identifier_offsets("return"/"function"/name) counts tokens in the raw owner body without masking comments or string contents; a comment or string containing those words silently fails rule 1 and downgrades a real owner to weakly_exposed.
  • crates/ripr/src/analysis/language/typescript/lookup_table_guard.rs:160 — Add a refusal case where the owner body contains // return or /*return*/ plus one real return; rule 1 should still pass because the comment does not match the structural return line, but the raw-counting identifier_offsets(&body, "return") will see 2 tokens and refuse. This is a silent demote path the spec does not document.

Verification questions

  • Confirm two-param WeaklyExposed case asserts classification but skips the missing contains lookup-table value for pear pin that single-param negatives assert; minor oracle-coverage asymmetry.
  • Confirm lookup_change is computed against the whole line_text even when the diff spans multiple const table = {...} declarations on distinct lines; rule 1 only filters by source.lines().filter(...).count()==1 and would refuse multi-declaration owners, but a single declaration with two changed-shape rows could still match — confirm corpus coverage.
  • Confirm pR-claimed proof: cargo xtask precommit, cargo test -p ripr --lib typescript # 1004 passed, cargo xtask verdict-corpus check-all # TypeScript 4/106 (main 5/106). Author asserts; not yet captured. Identifier-masking concern (comments/strings inflating return/function counts in identifier_offsets) would fail the no-nested-function assertion, a strict-downgrade, not a silent upgrade.
  • Confirm identifier_offsets counts raw body tokens without masking comments/strings, so a // return or /*return*/ would inflate the count and silently demote a real owner to weakly_exposed; this is a rule-1 false negative (downgrade) and is not exercised by any test in the new module.

Refuted

  • Async / GC handoff: ts_lookup_table_witnessed and ts_observed_owner_call_arguments pass assertion/test slices through cross-candidate iteration that could race with a worker finalize or detach step in the JS-backed Bun array-buffer pipeline (active-view sibling lane).; refuted because: The TypeScript adapter here is the static-source adapter (masked textual parse of owner/test source) — it has no JS runtime, no Promise, no microtask queue, no GC, no SAB. The function bodies are pure synchronous iteration over &[TypeScriptRelatedCandidate] and &[TypeScriptAssertion]. No new code path is reachable from the active-view or bun_array_buffer_facts code in this diff. The witnessed() call is gated by lookup_change.is_some() in classifier.rs and runs only after diff parsing completes.
  • Tests are smoke-only because they only assert classification, not message contents.; refuted because: The negative-loop test independently asserts both class and missing contains lookup-table value for pearand the discriminate summary contains `no strong assertion looks up a changed key` + pear ``; positive cases add direct toBe(95) / `toEqual(95)` / `toBe(120)` checks at the assertion level, then class assertions at the finding level. Oracle discrimination is exercised, not bypassed.
  • RIPR-SPEC-0254 wiring could store borrowed &str into LookupTableChange that aliases a buffer resized or detached between diff parsing and the oracle walk, leaving a stale active-view slice.; refuted because: The new struct LookupTableChange holds owned Vec changed_keys and usize param_index, both built from locally owned Strings; no &str outlives the call frame, and no ArrayBuffer/TypedArray/SharedArrayBuffer/ResizableArrayBuffer is touched by this diff. Indexed reads use usize positions into a String, not into a resizable buffer.

Evidence gaps

  • Rule 1 unit tests pin 4 positive shapes and 31 negative shapes; rule 2 tests pin 4 expose-true + 7 stay-weak + 6 stay-weak-with-message cases. Together they would catch any regression in either gate, but cargo test -p ripr --lib typescript proof receipt is scheduled-late, not yet in this packet.
  • Model proof intent was rejected by deterministic validation.

… fallback and refuses BigInt values

A move to or from null under `?? 0` now counts when the returned values
still differ (95 then 0); a string or undefined fallback still refuses.
BigInt values are refused, since `95` to `95n` changes the type and large
BigInts lose precision as numbers. Adds the negative corpus control
ts-vitest-unit-price-table-other-key (apple moves, only pear is looked up;
vitest passes on the edit) and a comment-masking positive.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ajVbPgh9yZDQgaAHkZE8V
Main's Rust corpus rows for five SPEC-0231 inequality cases drifted after
#6670 (relational_check / weak is now observed); #7631 re-blesses them.
Same change, so it no-ops once #7631 lands.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ajVbPgh9yZDQgaAHkZE8V
…n ideal gap

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ajVbPgh9yZDQgaAHkZE8V
@EffortlessSteven
EffortlessSteven marked this pull request as draft October 13, 2026 06:51
@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 13, 2026 06:51
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

Copy link
Copy Markdown
Member Author

The required check failed on 717d9d1 in verdict-corpus check-all, and the cause is not this PR. Five Rust rows for RIPR-SPEC-0231 inequality cases (spec0231-oracle-assert-ne-*, -ensure-not-equal, -helper-assert-not-equal) now observe relational_check / weak on current main after #6670. Main itself drifts here. #7631 re-blesses those rows, and I ported its exact diff in 4915367, so the change becomes a no-op once #7631 lands. With the port in place, check-all passes locally on the merged tree. The new head 0c54ebb also carries fixes for the Devin findings, and I toggled the PR back to Ready for a fresh required check.


Generated by Claude Code

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed findings

  • Rule 1 grammar in spec example 4 also refuses 'a fallback followed by a comma' (?? "x", 0) — a comma expression, which Node/TS technically parses. Guard's split_once("??") taking the LHS discards trailing context but read.split_once("??") only fires on first occurrence; if body has table[sku] ?? "x", 0 the read parses as "x", 0 and the strip_prefix-strip_suffix match falls through. Behavior is correct but the test case documents the intent; no live corpus row depends on it. Not a blocker.
  • two-param WeaklyExposed positive at lookup_table_tests.rs:430 does not pin the missing contains lookup-table value for pear`` phrase that single-param negatives enforce — minor oracle-coverage asymmetry, submaterial and already flagged in seeded thread.
  • Spec is registered in policy/doc-artifacts.toml and .ripr/traceability.toml with code/test/fixture/output pointers; both Rust and Python spec-coverage ledgers record RIPR-SPEC-0254 as scope=out with consistent reasons, and the corpus golden rows are updated with changed_since_labeling: true only on the moving row — no other row moved.

Verification questions

  • Confirm rule 2 only credits quoted string keys; numeric arg unitPrice(3) for { 3: 95 } stays weakly_exposed even though 95 changed. Spec says this is known under-credit; track as residual.
  • Confirm probe-shape override and observation-guard gate are layered on the existing classify_change_with_alias_state fallback branch only, so unrelated shapes keep their existing read; rule 2 gate is an AND with boundary_witnessed, preserving RIPR-SPEC-0027 / 0098 downgrades.
  • Confirm rIPR-SPEC-0254 rule 1 grammar permits numeric/integer keys, but rule 2 witness text requires 'a quoted string literal naming a changed key'; an integer-keyed table where the test passes the key as a number stays weakly_exposed (under-credit by design, documented under Known limits). No silent over-credit, but spec wording is internally asymmetric — verification: confirm spec Rule 2 prose reads 'quoted string literal' or is updated to 'key argument names a changed key' for parity.
  • Confirm body-side identifier_offsets in ts_lookup_table_change scans the raw owner body (not comment/string-masked); a comment like // return would inflate 'return' count and refuse rule 1 (strict downgrade). Test 'lookup_table_change_reads_the_moved_keys_and_the_key_parameter' covers masked source at declaration level but not body-level masking for nested comment cases.

Refuted

  • ts_lookup_table_change could over-credit a real lookup-table owner by being fooled by a // return comment (raw identifier_offsets count would be under-counted, triggering a false promotion).; refuted because: Raw counting only inflates the count, not deflates; an extra return token forces refusal of rule 1 (downgrade to weakly_exposed), never promotion. The body-comment case is a strict demote path, not over-credit.
  • Vec<&str> borrowed keys in LookupTableChange could alias a backing source buffer that resizes or detaches, leaving a stale slice in active view between diff parse and oracle walk; refuted because: changed_keys is owned Vec built via to_string() / String literals inside table_declaration; rule-2 only re-reads candidate.test bodies via string_literal_argument on per-candidate assertion arguments, never dereferences a borrowed key into a backing view. No ArrayBuffer/SharedArrayBuffer/ResizableArrayBuffer or transferable surface is introduced by the new module.
  • Adding a lookup_table_guard module would have demanded a new top-level dispatcher entry under crates/ripr/src/analysis/language and a second TypeScript adapter path.; refuted because: Diff adds lookup_table_guard as a private submodule of typescript/ (mod.rs:71) and re-exports it via pub(crate) use lookup_table_guard::*; the probe shape and observation-guard integration happen inside the existing classify_change_with_alias_state, so no new dispatch surface or adapter path is introduced.

Evidence gaps

  • CARGO-TEST receipt is scheduled-late, not yet captured in packet; PR body claim 'cargo test -p ripr --lib typescript # 1004 passed' is author-asserted. Treat unit-test correctness as unverified until broker lands receipt.
  • Model proof intent was rejected by deterministic validation.

Copy link
Copy Markdown
Member Author

Review of record — head 0c54ebb

The required check Ripr Rust Small Result is green on this head, and so is every other non-skipped check.

Angles

  1. Correctness / false credit. Two independent reviewers covered the first candidate, a re-review covered the fixes, and a further adversarial pass covered the null-under-fallback change in 0793deb.
  2. Tests and negative experiments. Each guard condition has a removal experiment that fails a test.
  3. Spec and contract parity. The RIPR-SPEC-0254 text was checked against the code, along with its registrations and corpus rows.

Findings and resolutions

  • Review round 1 (fixed in 672aea8). False-credit routes through a dynamic or self-compared expected side, a non-strong kind, a table in an inner block, number↔string↔bool moves under loose equality, a fallback that only starts with a string, and an integer key over 15 digits.
  • _1 identifier value (fixed in 49ff5a9). It read as the number 1. Numbers must now start with a digit.
  • Integer keys passed as numbers (under-credit, documented in 16355a0). These are never credited. Spec Known limits now says so.
  • Two-parameter miss (fixed in 717d9d1). The test now pins the changed key in the missing evidence.
  • Devin: null under ?? 0 was dropped (fixed in 0793deb). These moves now compare the returned values with the fallback substituted. A string or undefined fallback still refuses. The adversarial pass found no false credit, covering 0/0.0, ?? false, ?? null, ?? 0n, masked comments and cross-type substitution.
  • Devin: BigInt values (fixed in 0793deb). These are now refused as table scalars.
  • Devin: no corpus negative control (fixed in 0793deb and 0c54ebb). ts-vitest-unit-price-table-other-key was added. vitest 5.0.4 passes on the edit, so the truth is not_discriminated, and the row reads as an ideal gap.
  • Bot: comments and strings inflating the return count. Refuted, because the body is masked by masked_owner_body. A comment-masking positive was added in 0793deb.
  • CI red on 717d9d1. Not this PR's failure: main drifted on five SPEC-0231 Rust rows. I ported eval(verdict-corpus): rebless five SPEC-0231 rule-1 oracle rows after #6670 and ratchet the ledger #7631's diff in 4915367; it becomes a no-op once eval(verdict-corpus): rebless five SPEC-0231 rule-1 oracle rows after #6670 and ratchet the ledger #7631 lands.

Non-blocking, left as is

  • A legacy octal 010 reads as decimal 10 in the shared numeric_literal_value. That is pre-existing, and TypeScript and ES modules reject the syntax.
  • The github-actions bot noted two-parameter message coverage (since pinned) and helper duplication.

Evidence on the merged tree

  • 1007 TypeScript lib tests pass.
  • verdict-corpus check-all passes. TypeScript is at 4/107 false verdicts, against 5/106 on main.
  • cargo xtask precommit exits 0.

Verdict: nothing blocking. Merging.


Generated by Claude Code

EffortlessSteven pushed a commit that referenced this pull request Oct 13, 2026
Main added RIPR-SPEC-0254 (TypeScript lookup-table entry, #7612) after this
branch's base, so the combined tree failed the TS ledger's completeness
check in the required Rust gates. It is a TypeScript analyzer spec, so it is
in scope; `ts-vitest-unit-price-table` is example 1's own corpus case and
cites it. Coverage 46/97, floor 46.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UkJX24i4awmd7UoVV5CXkP
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