Skip to content

feat(typescript): scope the partial-extraction disclosure to test files that can reach the diff - #10474

Merged
EffortlessSteven merged 4 commits into
mainfrom
claude/project-thread-stp16t
Oct 25, 2026
Merged

EffortlessSteven merged 4 commits into
mainfrom
claude/project-thread-stp16t

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Summary

typescript_test_extraction_partial was workspace-wide: one registration the extractor drops (a loop over non-literal data, a wrapper-passed it) anywhere in a repo made every analysis of it partial, however unrelated the diff. Real repos always contain some, so zod, ky, h3 and execa never completed (#10436).

A dropped registration now counts only when a test in that file could be related to code the diff changed. New gap_reach.rs answers that from the file's local import closure and fails closed:

  • reaches a changed file (barrels, helpers and ./x.js → x.ts followed), or names an owner of a changed file → kept
  • unresolved relative import, computed import() / require(), import.meta.glob, require.context, createRequire → kept
  • bare specifier the alias map or a workspace package could resolve, root package self-import, ~/#/$///@/ prefixes → kept
  • any bundler/test-runner config mentioning alias / moduleNameMapper, or a Rust change related through the Bun bridge → scoping off
  • closure over 400 files → kept

Only the disclosure's scope changes. Findings and classification are untouched. The conditional-credit and owner-extraction disclosures are unchanged.

Measured on real repos (draft mode, one commit each)

repo, commit before after
h3 f90f4c8 30 gap files 2 (one opaque import(), one names headers)
ky 242c327 1 (with-performance.ts) 0 extraction gaps (owner-extraction #private gap remains, #10440)
ky 58233f1, 33462fc, 6e27594, 16b5936, 8a3a9cf partial complete_with_findings, no limitations
execa 224dd20 17 17: 12 of them reach lib/io/contents.js, which holds the changed handleMaxBuffer (correct)
ufo 5cd9e67 1 1: query.test.ts imports the whole library and its loop has a computed title (correct)

So a mid-size TypeScript repo (ky, 98 files) now completes for diffs that do not touch an unextractable owner shape, and a diff that really reaches a dropped registration is still disclosed.

Swarm / Source Boundary

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

Source-of-truth Links

Governing issue or accepted claim: #10436 (part of #10338 / #9278)
Acceptance delta (one sentence): The TypeScript partial-extraction disclosure is limited to test files whose import closure can reach the diff, failing closed on anything the scan cannot follow.

Candidate Relationships

Candidate branch (GitHub PR head is authoritative after publication): claude/project-thread-stp16t

Validation

  • gap_reach unit tests (8) and analyze_diff_scopes_extraction_partial_to_test_files_that_reach_the_diff (unrelated file, barrel+helper reach, computed import)
  • all analysis::language::typescript lib tests pass (1734 before the e2e test; 23/23 analyze_diff*)
  • cargo xtask precommit passes

Generated by Claude Code

…es that can reach the diff (#10436)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ERrUtJSfh2ieZiae8ZVwTB
@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 25, 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 7 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 182 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: a44e1b0f-01bd-4be7-8aa3-427a83cb91d0
Commits

Reviewing files that changed from the base of the PR and between d2ae1fe and 79cf872.

Files selected for processing: 6
  • .ripr/traceability.toml
  • changelog.d/10436-scope-ts-partial-extraction-to-the-diff.md
  • crates/ripr/src/analysis/language/typescript/gap_reach.rs
  • crates/ripr/src/analysis/language/typescript/mod.rs
  • crates/ripr/src/analysis/language/typescript/tests.rs
  • docs/specs/RIPR-SPEC-0027-typescript-preview-static-facts.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

… imports (#10436)

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

Copy link
Copy Markdown
Member Author

Review of record for head dda23552 (self-review, disposition COMMENT; Gemini and CodeRabbit are quota-limited, so those providers are missing, not clean).

Angles inspected and what I found:

  • Soundness of "cannot reach". The scoping can only hide a gap when the gap file's whole local import closure is resolved and contains neither a changed file nor a changed owner's name. I enumerated the ways a test file can reach code without a followable relative import and made each keep the gap: unresolved relative import (including directories with their own package.json, query suffixes, .vue/.svelte), computed import() / require(), import.meta.glob, require.context, createRequire, bare specifiers the alias map or a workspace package could resolve, root package self-import, ~ # $ / @/ prefixes, bundler or runner alias config, Jest moduleDirectories / modulePaths / moduleNameMapper, tsconfig rootDirs, and any package-level tsconfig with paths / baseUrl or a relative extends (the alias map loads only the root config). An npm-package extends (e.g. @sindresorhus/tsconfig) deliberately does not disable scoping, since it is shared compiler settings, not a path map for this workspace; that is the one judgement call, and it errs only if such a base config defines paths.
  • Cross-language. A Rust change related to TypeScript tests through the Bun bridge turns scoping off.
  • Over-collection is the safe direction. Specifier scanning is text-based, so a specifier in a comment only widens the closure. Static from / import specifiers must be quoted with ' or " (prose like "the from/to options" produced a bogus / specifier on execa until I fixed that); resolve( was removed from the call list for the same reason.
  • Unchanged contracts. Findings, classification, the owner-extraction and conditional-credit disclosures and the JSON shape are untouched; only which gap files feed the existing summary changes.
  • Real-repo evidence is in the PR description: h3 30→2 gap files, ky completes on 5 of 30 sampled commits, and execa and ufo stay disclosed where the diff really reaches a dropped registration. After the config-scan hardening I re-ran ky and h3 and the results were unchanged.
  • Proof: 9 gap_reach unit tests (including config cases), the e2e analyze_diff_scopes_extraction_partial_to_test_files_that_reach_the_diff (unrelated, barrel+helper reach, computed import), all analysis::language::typescript tests, and cargo xtask precommit.

Findings blocking: none. Applying merge-ready for this head.


Generated by Claude Code

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 25, 2026 21:44
@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 6 potential issues.

Devin Review

… spec and traceability

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

Copy link
Copy Markdown
Member Author

Review of record, head 5af247c

Angles: correctness (fail-closed reachability), tests, spec/traceability, perf/security.

  • Correctness: the scoping only removes a partial-extraction disclosure when every lookup is positive-negative: the closure was fully followed and nothing reached a changed file or owner. The budget (400 files), a missing source, opaque loaders, bundler/Babel/vitest aliases, baseUrl, a cross-language consumer and workspace/alias specifiers all keep the workspace-wide disclosure.
  • Findings from Devin (spaced calls, baseUrl, Babel aliases, missing spec) were valid and are fixed in this head, each with a table or e2e row. Two info threads acknowledged.
  • Tests: cargo test -p ripr --lib analysis::language::typescript 1739 passed; e2e analyze_diff_scopes_extraction_partial_to_test_files_that_reach_the_diff covers both the unrelated-gap and the reaching-gap case.
  • Spec: RIPR-SPEC-0027 documents the rule; check-traceability and cargo xtask precommit pass.
  • Perf: one pass over gap files only; no change when no gaps exist.

No blockers.

Governing issue: #10436. Acceptance delta: a real mid-size TS repo no longer reports partial extraction for gaps its diff cannot reach.


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.

Verification questions

  • Confirm package export maps may hide a related gap: a bare package subpath is followed as external unless the root package name is recognized, even if package.json exports maps it to changed workspace code.
  • Confirm the e2e oracle does not verify that only the relevant gap file is disclosed when multiple unrelated and related gaps coexist.
  • Confirm the sibling-path scan is not broad enough to prove absence across JavaScript package resolution variants: only package.json name and selected config markers are checked in the available diff.
  • Confirm the e2e test is discriminating for unrelated, reachable, and computed-import cases, but it does not assert the changed-owner-name fallback.
  • Confirm the scanner treats non-string primary expressions in import() and require() as opaque, but only computes calls named import and require; other common loader forms are not conservatively classified.
  • Confirm the end-to-end test's helper imports the barrel, while the barrel imports the changed pricing module; it does not exercise a helper that imports the changed file directly.

Refuted

  • A bare package import can hide a changed-code gap through package.json exports/imports or a workspace package subpath export.; refuted because: The current diff does not show package export-map resolution, but the available evidence is insufficient to prove this path is reachable in the affected workspace; retain as a verification request rather than a confirmed defect.
  • The tested positive case does not match its claimed helper-and-barrel shape.; refuted because: The helper imports the barrel and the barrel reaches pricing, so the test still follows a valid two-edge helper-to-barrel-to-changed-file closure; this is a coverage precision issue rather than a false oracle.

Evidence gaps

  • Central validation evidence remains incomplete despite the claim that focused TypeScript tests and precommit pass.
  • The central ripr sensor failed with exit code 2 while cargo-test evidence is only scheduled late, so this lane cannot treat the new Rust logic as independently test-proven.
  • Model proof intent was rejected by deterministic validation.
  • The late cargo-test witness is still pending in the supplied packet.

Copy link
Copy Markdown
Member Author

Review of record, head 79cf872 (supersedes the 5af247c record; only gap_reach.rs loader parsing and one traceability row changed since)

Angles: correctness, tests, spec/traceability, perf/security.

  • Correctness: Graphite found that require('../src/' + name) was read as the leading literal and resolved to the src directory, which could hide a real reach. Verified against the code and fixed: a call argument counts as a fixed specifier only if the closing quote is followed by ) or ,; otherwise require/import is computed and keeps the gap. All other fail-closed paths are unchanged from the 5af247c record.
  • github-actions "verification questions": package exports maps are covered because workspace packages resolve through the alias map and anything it cannot resolve stays MayReach; the remaining items are coverage-precision notes, not defects. The ripr sensor note is that bot's own lane evidence, not a repository check.
  • Tests: cargo test -p ripr --lib gap_reach 10 passed (new: concatenated specifier); full analysis::language::typescript run passed at 5af247c (1739).
  • cargo xtask precommit passes on this head; check-traceability includes the new test.

No blockers. All 7 review threads replied to and resolved.


Generated by Claude Code

Copy link
Copy Markdown
Member Author

Independent native follow-through confirmed the package-base extends disclosure residual and filed it as #10522 for this existing owner. TypeScript5.9.3 resolves the inherited package paths to the changed owner, but the exact landed-head CLI incorrectly says complete and omits that reaching extraction gap. Five paired controls establish literal/relative-extends disclosure, unrelated-index omission and successful concatenation refusal; all six findings arrays remain exactly identical. Please carry the conservative inherited-config disclosure repair in the existing lane, preserving classification/alias-credit boundaries. No rollback or competing writer is requested. An immutable six-case proof handoff follows.

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