Skip to content

fix(typescript): reach owners passed as values and built by combinators (#13592) - #14993

Merged
effortlessg41[bot] merged 15 commits into
mainfrom
claude/project-thread-dm57gr
Nov 22, 2026
Merged

effortlessg41[bot] merged 15 commits into
mainfrom
claude/project-thread-dm57gr

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Requested by Steven Zimmerman · project thread

Summary

  • TypeScript code reached only through a closure read no_static_path even when tests run it. Three shapes were missed: a function passed as a value (JSON.parse(text, reviver), keys.sort(compare)), a constant built by a call whose callbacks run when the value is invoked (const Rule = match(re, (s) => upper(s)), then parse(input, Grammar)), and the combinator that built it. The same-module entry graph only followed bare calls.
  • The graph now records closure edges: AST identifier references from one top-level declaration's code to another. They exclude names that code binds anywhere, names the module reassigns, type positions, and a factory's directly returned functions. An owner reached from an export only along a path with a closure edge gets a closure entry. The path may take at most 3 bare calls before its first closure edge and at most 8 edges in total, and an owner keeps at most 32 closure entries. Closure entries continue across importers.
  • Reach whose every entry is closure or cross-module reads static_unknown whatever the oracle. It is never exposed or weakly_exposed, and it starts no repair, because when the value runs is not modeled.

Swarm / Source Boundary

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

Source-of-truth Links

Proposal: n/a
Spec: RIPR-SPEC-0243 rule 2 (new "Closure continuation" paragraph)
ADR: n/a
Plan item: n/a
Governing issue or accepted claim: #13592
Acceptance delta (one sentence): TypeScript owners reached only through a closure (a function passed as a value, a combinator-built constant, its callbacks or its combinator) read static_unknown instead of no_static_path when a test calls the export that leads to them, cutting Stryker-caught false gaps on the eight-package corpus from 619 to 323 against current main with no other verdict change.

Candidate Relationships

Candidate branch: claude/project-thread-dm57gr
Stack parent or prerequisite PR: none (builds on merged #13886 / #14958 / #13719 B2)
Proposed replacement of PR: none

Scope

Scope Classification

  • One production behavior

Production delta:

  • TypeScript relation reach through closure edges, read as static_unknown.

Evidence/support delta:

  • tests/closure_entry_tests.rs (18 tests), spec paragraph, changelog fragment.
  • One fixture flip, no_static_path → static_unknown, blessed with a RIPR-SPEC-0243 reason: typescript_adversarial_hoc_wrapped_owner (the test calls total = withLogging(computeTotal); no oracle borrowed, no repair packet, exposed still forbidden; honesty corpus and RIPR-SPEC-0108 rows updated).
  • feat(ts): reach a module-level const through a same-module reader (#13592 B2) #13719's factory_const_keeps_its_previous_no_entry_reading becomes factory_const_is_reached_only_as_a_closure: a bare-called factory product gets closure entries only.

Single acceptance criterion:

  • Closure-only reach no longer reads no_static_path, and it never reads better than static_unknown.

Non-goals:

Support-tier Impact

  • none

Policy Impact

  • none

Proof

cargo test -p ripr --lib -- analysis::language::typescript   # 2570 passed, 0 failed
cargo xtask goldens check && cargo xtask fixtures && cargo xtask verdict-corpus check-all   # pass
cargo xtask check-evidence-promotion-honesty && cargo xtask check-generation-pins && cargo xtask precommit   # pass
# replay: each Stryker 9.6.1 mutant (local run, corpus-typescript.json pinned SHAs) as a one-hunk diff
# through `ripr check --diff --format json`, class on the mutated lines, current main (with #13719 B2) vs this merged head
package false gaps (caught, read no_static_path) missed, read no_static_path exposed (overclaims)
pathe 317 → 64 55 → 13 2 (0) → 2 (0)
ohash 246 → 230 297 → 293 6 (1) → 6 (1)
destr 22 → 0 1 → 0 2 (1) → 2 (1)
cookie-es 5 → 0 2 → 0 46 (5) → 46 (5)
ufo, knitwork, hookable, defu unchanged unchanged unchanged
total 619 → 323 461 → 412 unchanged

no_static_path agreement rises from 42.7% to 56.1% (461/1080 → 412/735). Every moved mutant (345) moved no_static_path → static_unknown, and no other class changed on any of the 8 packages. The 49 missed mutants that moved are the cost of not modeling when a callback runs. (Before #13719 landed, against cedfe04, the same slice measured 723 → 428.)

The replay reads the class whatever the analysis completeness. The xtask harness excludes most pathe mutants as analysis_incomplete, because pathe's test/utils.spec.ts registers tests in an Object.entries loop. So the table counts are not the hosted receipt's figures.

Result, failures, or skipped proof:

  • Local gates above passed on the merged head (4a58b3d adds only rustfmt and the changelog figure). The replay used the 211d070 release binary and an origin/main release binary.
  • An independent fresh-context review found no soundness blocker. It raised 3 medium findings (mixed-reach wording, two quadratic scans), which are repaired in 6ceaa2d with tests. A second fresh review of 47b5b8c..5f33f0a found nothing blocking; its low wording notes are pre-existing across the reach-only family.

Claim Boundary

May claim: closure-only reach is related and reads static_unknown, and the false-gap reduction on this corpus at these revisions.

Must not claim: that a callback runs, discrimination, or a change to the hosted spot-check receipt before a rerun. #13592's agreement goal is not met; this is one slice.

Rollback

Revert the squash commit. The file-fact schema bump makes old cache entries read as misses in both directions.

Spec-Test-Code Traceability

  • Spec: docs/specs/RIPR-SPEC-0243-typescript-oracle-and-reach-rules.md (rule 2, closure continuation; traceability list entry)
  • Tests: crates/ripr/src/analysis/language/typescript/tests/closure_entry_tests.rs
  • Code: module_entries.rs, owners.rs, related_tests.rs, classifier.rs
  • Golden outputs: fixtures/typescript_adversarial_hoc_wrapped_owner (blessed, CHANGELOG reason); typescript_module_value_use and typescript_module_value_unused unchanged
  • Metrics: replay table above

Static Language Check

  • Static output avoids killed, survived, untested, proven, and adequate.
  • Unknowns include stop reasons where applicable (propagation_evidence_unknown).

CI Economics

n/a

Engineering Check

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

🤖 Generated with Claude Code

https://claude.ai/code/session_01UNUoLWNFkvBxA39ETvfk7J

…rs (#13592)

The same-module entry graph only followed bare calls, so code reached through
a closure read no_static_path: a function passed as a value
(`JSON.parse(text, reviver)`, `keys.sort(compare)`), a constant built by a
call whose callbacks run when the value is invoked
(`const Rule = match(re, (s) => upper(s))`), and the combinator that built
it. The graph now records closure edges (AST references to other top-level
declarations, minus anything the code binds, anything the module reassigns,
type positions and a factory's directly returned functions) and gives an
owner reached only along a path with a closure edge a closure entry, bounded
at 8 edges. Closure entries continue across importers and read
static_unknown whatever the oracle: when the value runs is not modeled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UNUoLWNFkvBxA39ETvfk7J
Mixed call and closure reach says "same-module or callback callers" and
keeps the same-module class; reference collection skips the own/returned
split when nothing is returned and dedups through sets; an owner keeps at
most 32 closure entries; a bare-called combinator constant reads its entry
as closure reach. Four more tests pin these and the cross-module closure
bound.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UNUoLWNFkvBxA39ETvfk7J
@EffortlessSteven EffortlessSteven self-assigned this Nov 17, 2026
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

  • Ask an admin to enable usage-based reviews

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Next included review available in 14 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 146 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: 4b1b552c-fe2c-4b98-96ce-ec422bfccb30
Commits

Reviewing files that changed from the base of the PR and between 195b362 and 1638b8a.

Files selected for processing: 22

  • changelog.d/13592-ts-closure-reach.md
  • crates/ripr/src/analysis/language/typescript/class_entries.rs
  • crates/ripr/src/analysis/language/typescript/classifier.rs
  • crates/ripr/src/analysis/language/typescript/decorated_entries.rs
  • crates/ripr/src/analysis/language/typescript/fact_store.rs
  • crates/ripr/src/analysis/language/typescript/instance_factories.rs
  • crates/ripr/src/analysis/language/typescript/module_entries.rs
  • crates/ripr/src/analysis/language/typescript/owners.rs
  • crates/ripr/src/analysis/language/typescript/related_tests.rs
  • crates/ripr/src/analysis/language/typescript/tests.rs
  • crates/ripr/src/analysis/language/typescript/tests/closure_entry_tests.rs
  • crates/ripr/src/analysis/language/typescript/tests/mock_object_argument_tests.rs
  • crates/ripr/src/analysis/language/typescript/tests/module_entry_tests.rs
  • crates/ripr/src/analysis/language/typescript/tests/module_value_read_tests.rs
  • docs/specs/RIPR-SPEC-0108-evidence-promotion-honesty-meta-gate.md
  • docs/specs/RIPR-SPEC-0243-typescript-oracle-and-reach-rules.md
  • fixtures/evidence-promotion-honesty-corpus/corpus.json
  • fixtures/typescript_adversarial_hoc_wrapped_owner/SPEC.md
  • fixtures/typescript_adversarial_hoc_wrapped_owner/expected/CHANGELOG.md
  • fixtures/typescript_adversarial_hoc_wrapped_owner/expected/check.json
  • fixtures/typescript_adversarial_hoc_wrapped_owner/expected/human-full.txt
  • fixtures/typescript_adversarial_hoc_wrapped_owner/expected/human.txt
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

gemini-code-assist[bot]

This comment was marked as resolved.

…#13592)

A member write (obj.x = 1, obj[key]++) no longer marks obj or key as
reassigned; a bare or destructuring-shorthand identifier target still does.
The closure-entry cap is now pinned by a test, and its comment and spec text
say an owner past it reads as before closure reach.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UNUoLWNFkvBxA39ETvfk7J
…ue_use (#13592)

A call-built constant that a function reads gained closure entries, and
the module-entry search ran before the module_value_use heuristic, so a
test that names the constant itself dropped from weakly_exposed to
static_unknown (fixture typescript_module_value_use). Direct value use now
wins; closure entries apply only when no test names the constant.

typescript_module_value_unused moves no_static_path -> static_unknown:
its test calls collect, which reads stop, the reach this PR adds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UNUoLWNFkvBxA39ETvfk7J
…e reach (#13592)

total = withLogging(computeTotal) is a call-built constant that passes
computeTotal as a value; the test calling total now relates with reach
only. No oracle is borrowed and no repair packet is emitted; exposed
stays forbidden. Honesty corpus and RIPR-SPEC-0108 rows updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UNUoLWNFkvBxA39ETvfk7J
@EffortlessSteven
EffortlessSteven marked this pull request as ready for review November 17, 2026 16:32
@github-actions

Copy link
Copy Markdown
Contributor

merge-ready was requested, but this PR conflicts with main (head 5f33f0af), so GitHub creates no test-merge ref and no qualification run can start.

  1. Merge main into the branch and resolve the conflicts.
  2. Remove and re-apply merge-ready to request admission and qualification only.
  3. After qualification is green, enqueue the PR through the native queue route; re-applying the label does not enqueue it.

Main landed #13592 B2 (module-level const read through a same-module
reader). Combined: a B2 value keeps its reader entries; any other
call-built constant (a factory product graph node) reads every entry as a
closure entry. Both PRs bumped the TS file-fact schema to 9, so this one
moves to 10. B2's factory_const test now asserts closure-only entries.
Symbol(...) constants are B2 values and exported values are never
followed, so typescript_module_value_unused keeps main's no_static_path;
the precedence test uses a factory-built sentinel instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UNUoLUXKv4U44DhiT1ST6G

@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 2 potential issues.

Devin Review

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

VERDICT: BLOCK 4a58b3d

Source review of #14993 at this head. One confirmed defect in the new closure-edge owner, against the mask set this PR itself writes into SPEC-0243.

Blocking: a named function expression's own name is never masked

Trigger. A module with a top-level helper plus
export const label = function helper() { return helper.name; };.
In JS the inner helper binds to the function expression's own name, not the top-level declaration.

Mechanism (source, not inference).

  • collect_function_as (module_entries.rs:511) calls add_function_references(name, &func.params, body, &returned, nodes). The declaration's name is the declarator's (label); func.id is passed nowhere.
  • References (line 673) binds only the BindingIdentifiers it visits, and add_function_references visits FormalParameters and the FunctionBody (lines 700-701) — never the Function node that carries func.id.
  • So all.bound misses helper, push_unbound (line 731) keeps it in node.references, and closure_callees (line 285-296) admits it because nodes.contains_key("helper") and nothing filters it.

Effect. Every test that names label gives top-level helper a closure entry, so a changed helper reads static_unknown instead of no_static_path. Reach is invented for an owner no test runs — the direction this graph exists to prevent.

Predicate it violates. SPEC-0243 as amended in this PR: "A name the referencing code binds anywhere (parameter, local, inner function, nested callback parameter, catch binding), a name the module ever assigns or updates, and a reference in a type position add no edge." A named function expression is exactly an "inner function", so the spec states a guarantee the code does not implement, in the same commit.

Repair at the seam. Bind the function expression's own name before the references are recorded (insert func.id into all.bound, or visit the Function node instead of params+body), and add two cases to tests/closure_entry_tests.rs: the named expression referencing itself with a top-level same-name declaration, and the same source with no top-level helper (both must stay no_static_path).

Non-blocking: the factory edge ignores its own reassignment, more narrowly than reported

closure_callees inherits nodes.get(factory).returned_references (lines 280-284) and applies reassigned only to the targets (line 293), so a rebound factory still supplies the original returned function's references. Devin's phrasing ("after a factory is reassigned") is too broad: const Rule = makeRule(...) evaluated before the rebinding correctly inherits, because the initializer ran against the original binding. It is wrong only when the factory is rebound before the product's initializer runs, and reassigned_names is order-insensitive, so the code cannot tell those apart. Applying "may hold another value" to the factory is the consistent choice, but the consequence is the same bounded class movement (no_static_path → static_unknown) with no test credit, so I am not blocking on it.

What I checked and what I did not

Checked by source reading: the closure-edge construction, References/push_unbound, the reassignment and hop filters, the SPEC-0243 amendment this PR adds, the new closure_entry_tests.rs case list, and the fixture/expected deltas for verdict movement.

Not established: I did not execute the TypeScript analyzer locally, so this is a static determination of the bound set rather than an observed finding on a fixture; hosted CI would not decide it either, since no case exercises the shape. The cheapest discriminator is the pair of unit tests named above. If the author believes helper is masked somewhere I missed, that test settles it in one run.

This head carried no earlier attestation to supersede: the two reviews at 13:20Z were body-less and therefore were never a disposition.

Next action: repair the binding mask and push; I will re-review the new head at the source stage.

…assigned factories, module values (#13592)

- A named function expression's own name binds inside its body, so it is
  never a closure edge to a same-named top-level declaration (Devin).
- A reassigned factory lends its product no returned references (Devin).
- A B2 module value continues across importers only on closure entries,
  matching a value with call entries only (merge-resolution review).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UNUoLWNFkvBxA39ETvfk7J

Copy link
Copy Markdown
Member Author

Re the VERDICT: BLOCK 4a58b3da review: the blocking defect is confirmed and repaired in 48f206e.

  • Named function expression self-name. collect_function_as removes func.id's name (when it differs from the declarator) from the node's references and returned_references. Test a_named_function_expression_self_reference_is_not_the_outer_declaration asserts that a top-level helper gets no entry from const label = function helper() { return helper.name; }. Its anonymous twin (function () { return helper.name; }) must give helper the closure entry label, so the test fails if the mask is removed. With no top-level helper there is no owner to relate, so that variant cannot read anything but its prior state. The SPEC-0243 closure paragraph names the rule.
  • Reassigned factory (non-blocking). I applied it as the consistent fail-closed choice: a factory in reassigned_names lends its product no returned references. Because the scan is order-insensitive, this also drops an edge from a product built before the rebinding. That loses reach and never adds it. Test a_reassigned_factory_lends_no_returned_references.
  • Also from the merge-resolution review: a feat(ts): reach a module-level const through a same-module reader (#13592 B2) #13719 module value now continues across importers only on its closure entries (related_tests.rs seed filter), so a value with mixed entries no longer gets cross-module reach through its call entries.

Proof on 48f206e: cargo test -p ripr --lib -- analysis::language::typescript 2572 passed; goldens check, fixtures, verdict-corpus check-all, check-evidence-promotion-honesty and precommit all exit 0.


Generated by Claude Code

…; widen precedence comment (#13592)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UNUoLWNFkvBxA39ETvfk7J

Copy link
Copy Markdown
Member Author

REVIEW_READY

Head: 2ddb823

This records a fresh-context independent reviewer subagent's result on this exact head. It is not the author's own read.

  • 48f206e (full PR vs origin/main): VERDICT: REVIEW_READY. The reviewer independently checked:
    • soundness: no closure path reaches exposed/weakly_exposed, a repair packet or a verify command; a factory product cannot get a call entry; mixed reach is conservative;
    • precision: bound names, named function expression self-name, reassigned names and factories, type positions;
    • the interaction with feat(ts): reach a module-level const through a same-module reader (#13592 B2) #13719 B2 values;
    • the 3/8/32 bounds and cross-module continuation;
    • positive twins in every refusal test;
    • spec/code parity.
      It ran closure_entry 19, module_value_read 19 and module_entry 53, all passing. It raised 3 low doc/comment items and no correctness defect.
  • 2ddb823 (delta from 48f206e): VERDICT: REVIEW_READY. The delta is only doc and comment text, and it repairs all 3 low items: spec schema 10, the re-measured 296, and the widened precedence comment.
  • Earlier VERDICT: BLOCK 4a58b3da. The named-function-expression self-reference is repaired in 48f206e with a discriminating test. Details are in the comment above.
  • Devin threads. Both are repaired and resolved.

Local proof on 48f206e (2ddb823 changes no code):

  • TS lib tests: 2572 passed.
  • goldens check, fixtures, verdict-corpus check-all, check-evidence-promotion-honesty and precommit all exit 0.

Generated by Claude Code

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

REVIEW_READY

This records a fresh-context independent reviewer subagent's result on this exact head (2ddb823). The PR comment above has the full scope. The named-function-expression finding from the earlier review is repaired in 48f206e, with a test.


Generated by Claude Code

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

SOURCE_REVIEW_READY

Source review of #14993 at 2ddb8234aa54e4ce0048e6d79ce7ba774d096120. This supersedes my VERDICT: BLOCK at 4a58b3da.

Blocking finding: repaired

Named function expression self-name. collect_function_as now drops func.id's name (when it differs from the declarator) from the node's references and returned_references.

I checked the mechanism rather than the claim. add_function_references visits params and body only, never func.id, so the expression's own name was never in bound and push_unbound could not filter it — that is exactly the leak I reported. The retain closes that gap for both vectors. The call-built path (Expression::CallExpression) was never affected: it visits the whole initializer with References, whose visit_binding_identifier records the function expression's own name as bound, so push_unbound already dropped it there.

Discriminating test. a_named_function_expression_self_reference_is_not_the_outer_declaration PASSes in hosted shard 1 (run 44167871137, 20:35:31Z). Its anonymous twin asserts helper gets the closure entry ["label"], so removing the mask fails the test; the self-named twin asserts no entry. The test is not vacuous.

a_reassigned_factory_lends_no_returned_references also PASSes (20:35:32Z), with the same positive-twin shape.

Evidence at this head

  • Rust tests shard 1 of 2: success. Shard 2 of 2: success. Shard verify: success.
  • Rust gates: Strict all-features Clippy, Strict workspace Clippy, Required Rust doctests, Golden and fixture contracts, Verdict corpora, Base still merges cleanly — all success.
  • Admit PR Candidate: pass at this head (run 44167871137).
  • The earlier Ripr Rust Small Result failure (run 44167546404, 20:16:25Z) was the admission refusal before the 20:18 attestation, not a test failure: the log reads "source review attestation refused".

Non-blocking observations

  1. The bare-call text scan still credits a self-named recursive function expression. function helper(n: number): number { return n; } export const label = function helper(n: number): number { return n <= 0 ? 0 : helper(n - 1); }; — label's call_texts contain the token helper, so a test calling label is credited with reaching the top-level helper it never calls. This is the pre-existing text-token callees scan in add_function_node, not the closure surface this PR adds, and the same false edge exists for nested declarations, parameters and locals. The closure path is fixed; the call path is a separate, older limitation. Worth a follow-up issue, not a block here.
  2. The third change has no dedicated test. (!module_value || entry.closure) in CrossModuleEntries::of narrows a call-built constant's cross-module continuation to closure entries. a_cross_module_closure_chain_takes_the_closure_bound covers a function owner, not a call-built constant, so this narrowing is unguarded by a regression test.
  3. SPEC-0243's "296 caught mutants" is a local corpus measurement I did not reproduce. The schema claim is correct: TYPESCRIPT_FILE_FACT_SCHEMA_VERSION is "10".

Not established

Ripr Rust Small Result is not yet green at this head: the gates job's PR evidence step is still running. Source readiness is posted on the source evidence above; final readiness needs that check green on this exact head.

Next action

Root's enqueue call once Ripr Rust Small Result is green on 2ddb8234aa.

@github-actions

Copy link
Copy Markdown
Contributor

merge-ready is set, but this PR conflicts with main (head 2ddb8234), so GitHub creates no test-merge ref and no qualification run can start. 1. Merge main into the branch and resolve the conflicts. 2. Remove and re-apply merge-ready to request admission and qualification only. 3. After qualification is green, enqueue the PR through the native queue route; re-applying the label does not enqueue it.

Copy link
Copy Markdown
Member Author

FYI: #15286 is a real-world case of the "combinator that built it" shape. A change inside the function returned by factory, behind export const upperKeys = factory(...), reads no_static_path on main. It comes from blakeembrey/change-case keys.ts.

A regression test for it would be useful on this PR, with these negative controls:

  • the factory returns a different function from the one changed;
  • the const is reassigned;
  • an unrelated export;
  • a mocked factory.

We are not writing a separate fix in module_entries.rs, to avoid conflicting with this PR.


Generated by Claude Code

Copy link
Copy Markdown
Member Author

For #15286, I ran a generated TypeScript control that distinguishes the function a factory returns from a different closure inside the same factory. All cases use the same test body, expect(upperKeys("abc")).toEqual("ABC"). I executed it with Node 24.22.3, node:test, and deepStrictEqual backing toEqual.

Changed guard, one mutation per run Runtime assertion
Baseline Passed
In the directly returned mapKeys Failed: actual "abc", expected "ABC"
In the sibling neverCalled arrow Passed
In a top-level function passed as an ignored second argument to factory Passed
In the same top-level function with no reference from the export Passed

The source for the first three rows was:

function unrelated(depth: number) {
  if (depth === 0) return "unused";
  return "other";
}
function factory(fn: (key: string) => string) {
  const neverCalled = (depth: number) => {
    if (depth === 0) return "nested";
    return "other";
  };
  return function mapKeys(key: string, depth = 1): string {
    if (depth === 0) return key;
    return fn(key);
  };
}
export const upperKeys = factory((key) => key.toUpperCase());

Each mutation changes one depth === 0 to depth === 1. For the passed-callback control, add an unused second parameter ignored: (depth: number) => string and pass unrelated after the mapping callback.

The sibling case matters for the exact-entry follow-up: promoting a test relation based only on the enclosing factory would also promote the unused arrow. The changed probe must belong to the function value actually invoked through upperKeys.

I checked out main c2759a77eeb43e90797d63a8cbfd35b0477ea2a4 and this PR at 2ddb8234aa54e4ce0048e6d79ce7ba774d096120. Both two-worker, ten-minute CLI builds timed out compiling dependencies, so the table is runtime evidence only. Main subsequently advanced to f08eb52922bf00c27552bba2c8cb3d5612fcd987 without touching the TypeScript analyzer.

When resolving this PR's main conflict, please run these one-hunk diffs through ripr check --diff diff.patch --format json. For this PR's conservative scope, check that the returned-body case loses its firm no_static_path, both unused callback cases receive no exact invocation credit, and the unreferenced function has no related test. That would verify the issue minimum on the integrated head; the exact returned-body relation can then be judged against the sibling control.

Main moved the TS file-fact schema to 11 (#15939), so closure moves to 12.
Keeps main's build-entry relation tier ahead of the heuristic fallback.
Takes main's typescript_adversarial_hoc_wrapped_owner expected files for
re-blessing on the merged head.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UNUoLWNFkvBxA39ETvfk7J

Copy link
Copy Markdown
Member Author

I merged main again (conflicted since 2026-11-18). The new head is 52a8a77.

Factory controls from the #15286 comment, run on the merged head (debug binary at 52a8a77's source). Each case is a one-hunk diff through ripr check --diff diff.patch --format json, using the same test expect(upperKeys("abc")).toEqual("ABC"):

Changed guard (depth === 0 → depth === 1) Owner Class Related Repair
In the directly returned mapKeys factory static_unknown (propagation_evidence_unknown) 1, helper_owner_call none
In the sibling neverCalled arrow factory static_unknown (propagation_evidence_unknown) 1, helper_owner_call none
In top-level unrelated, passed as an ignored second argument unrelated static_unknown (propagation_evidence_unknown) 1, helper_owner_call none
In the same unrelated, with no reference from the export unrelated no_static_path 0 none

This matches the PR's conservative scope:

  • The returned-body case loses its firm no_static_path.
  • Both unused-callback cases get reach only, with no exact invocation credit and no repair.
  • The unreferenced function has no related test.

The returned body and the sibling arrow share the owner factory, because nested arrows are not owners. So they read the same here. Telling them apart is the exact-entry follow-up, which is out of scope for this PR.

Local proof on 52a8a77. goldens check, fixtures, verdict-corpus check-all, check-evidence-promotion-honesty, check-generation-pins and precommit all exit 0.

Not established locally. The cargo test -p ripr --lib compile is OOM-killed in this container on merged main: it peaks at about 13 GB of 15 GB, and rustc receives SIGKILL. That is an infrastructure limit, not a test failure, so the TS unit suite runs only in the hosted test shards for this head. A fresh independent review of the merge is running.


Generated by Claude Code

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

REVIEW_READY

This records a fresh-context independent reviewer subagent's result on this exact head (52a8a77). That review covered the second main merge on top of 2ddb823, which was itself reviewed as ready.

  • related_tests.rs: the merged order is owner call, then the ModuleFunction heuristic, then module entries, then main's build_entry_call tier, then the heuristic fallback. Main's new tier finds nothing for ModuleFunction owners, on main too, so skipping the second heuristic pass hides nothing.
  • Schema: 12 after #15939's 11, and the pin is updated.
  • Main's changes since 2ddb823: none of them can raise closure reach above static_unknown. #15939's replacement refusal is still applied to the entry's stand-in owner.
  • Fixture: typescript_adversarial_hoc_wrapped_owner still reads static_unknown with no repair packet, consistent with its SPEC.md and the honesty corpus.
  • Low note, non-regressive: a test that stubs an inner function but calls its wrapper still relates through a closure entry, as plain module entries already do on main. It reads static_unknown only.

Generated by Claude Code

@github-actions

Copy link
Copy Markdown
Contributor

merge-ready was requested, but this PR conflicts with main (head 52a8a777), so GitHub creates no test-merge ref and no qualification run can start.

  1. Merge main into the branch and resolve the conflicts.
  2. Remove and re-apply merge-ready to request admission and qualification only.
  3. After qualification is green, enqueue the PR through the native queue route; re-applying the label does not enqueue it.

Main's #15962 took TS file-fact schema 12; closure entries move to 13.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UNUoLWNFkvBxA39ETvfk7J
…ss entries (#13592)

Main's #15962 and instance-factory statics build module entries without
the closure field; both are call/inheritance reach, so closure is false.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UNUoLWNFkvBxA39ETvfk7J

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

REVIEW_READY

This records a fresh-context independent reviewer subagent's result on this exact head (1638b8a). It covers the delta 52a8a77..1638b8a. That is the third main merge, which brought #15962's barrels, heritage and instance-factory statics and #16023's setup mocks, plus the two closure: false additions. 52a8a77 itself was reviewed as ready.

  • Construction and forwarding: every TypeScriptModuleEntry literal sets closure explicitly.
    • Closure-derived paths only copy the flag: module_entries.rs:390 sets it, and related_tests.rs:555/632/646 copy it.
    • Main's import-then-export forwarding and namespace-barrel matching only affect name resolution. A closure entry carried through a barrel keeps frame.closure, so it still reads opaque.
  • New entry kinds: closure: false is correct for static factories (instance_factories.rs:178) and subclass entries (related_tests.rs:789). Both are class-member owners and never closure-derived.
  • Schema: 13 after main's 12. The constant, the pin test and the spec line 1104 are consistent, with no stale claim.
  • Classifier: main's changes don't touch module_entry_reach_is_opaque_only or module_entry_reach_includes_closure.
  • Local evidence on this head: cargo test -p ripr --lib -- analysis::language::typescript gives 2785 passed. goldens check, fixtures, verdict-corpus check-all and check-evidence-promotion-honesty also pass.
  • Low, informational: no test pins a closure entry through an import-then-export barrel. The flag holds by construction, since it is carried on the walk frame.

Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants