Skip to content

test(typescript): pin spy file checks to the committed test file under dirty-tree analysis - #8694

Merged
EffortlessSteven merged 6 commits into
mainfrom
claude/project-thread-pwvs2k
Oct 18, 2026
Merged

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

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Summary

  • Adds a test showing the jest.spyOn module-object file checks (RIPR-SPEC-0247 rule 4) read the committed test file, not the dirty worktree copy, when committed-history analysis is active.

Swarm / Source Boundary

  • ordinary feature, analyzer, editor, docs, spec, fixture, badge, dependency, or repo-ops development for ripr-swarm
  • repair or follow-up for a same-repo swarm PR

Source-of-truth Links

Spec: RIPR-SPEC-0247
Governing issue or accepted claim: #6654 follow-up (coordinator task: committed-history guard test)
Acceptance delta (one sentence): a dirty test file cannot change the spy verdict derived from the committed test body.

Candidate Relationships

Candidate branch: claude/project-thread-pwvs2k
Stack parent or prerequisite PR (if any): none (follow-up to merged #8646)

Scope

  • One test, its traceability entry and its spec Test Mapping sentence.

Scope Classification

  • Docs/spec/test-only evidence package

Production delta:

  • none

Evidence/support delta:

  • spy_file_checks_read_the_committed_test_file: a dirty worktree hook test over a clean committed test reads exposed; a clean worktree over a committed hook test reads weakly_exposed.

Single acceptance criterion:

  • The classifier's file-level spy checks use the committed view.

Non-goals:

  • No analyzer change.

Support-tier Impact

  • none

Policy Impact

  • none

Proof

cargo xtask precommit   # pass

Mutation check: reverting the classifier's committed read to std::fs::read_to_string makes the new test fail (left: WeaklyExposed right: Exposed).

Claim Boundary

May claim: the committed-view read is pinned by a test. Must not claim: anything new about verdict coverage.

Rollback

Revert the commit; test-only.

Spec-Test-Code Traceability

  • Spec: RIPR-SPEC-0247
  • Tests: spy_module_object_tests.rs::spy_file_checks_read_the_committed_test_file
  • Code: classifier.rs (unchanged)

Static Language Check

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

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 by Claude Code

#8636 and #8642 both implemented the generic-client window/showMessage
disclosure for #8583 and both merged. On main the first failure fires both
paths, so the shown-once test from #8642 fails. Keep the per-signature path
from #8642 (it also covers initialize and config reload) and remove the
per-transition path and tests from #8636.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DhLb2VKJXpSwarf9qNWkGb
…r dirty-tree analysis

Co-Authored-By: Claude Sonnet 5.5 <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 18, 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 1 minute.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 82 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
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: 426207e2-2659-4cbc-b8aa-cb6e98c0e4cd
📥 Commits

Reviewing files that changed from the base of the PR and between e54499e and 272e8f5.

📒 Files selected for processing: 3
  • .ripr/traceability.toml
  • crates/ripr/src/analysis/language/typescript/tests/spy_module_object_tests.rs
  • docs/specs/RIPR-SPEC-0247-typescript-literal-matcher-strength.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

…file test

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

Copy link
Copy Markdown
Member Author

Review of record for head 6af41f8 (test-only; no production delta).

Angles:

  1. Test oracle grip (independent reviewer agent, read-only): both assertions discriminate worktree-read from committed-read. A regression to std::fs::read_to_string fails either assertion; neither can pass vacuously (missing finding errors out); the overlay key matches the written path. Also mutation-checked locally: reverting the classifier read makes the test fail with left: WeaklyExposed right: Exposed.
  2. Spec and traceability (same reviewer): the traceability entry and the RIPR-SPEC-0247 Test Mapping sentence match the test name and path.

Findings: no blockers. Nit: the Test Mapping sentence read awkwardly; fixed in 6af41f8. Nit: doc comment says the file checks read the same text as test bodies; kept, since test bodies come from the committed view.

cargo xtask precommit passed on the test commit; the follow-up touches only spec prose (spec-format, doc-artifacts pass).


Generated by Claude Code

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 18, 2026 03:07
@EffortlessSteven
EffortlessSteven enabled auto-merge (squash) October 18, 2026 03:07
@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!

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

@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 one verification check before upstream.

Verification questions

  • Confirm the PR-body mutation check (reverting classifier to std::fs::read_to_string makes the test fail with 'left: WeaklyExposed right: Exposed') is asserted by the author and echoed by EffortlessSteven's review-of-record, but no independent reproducer command is included in the patch or receipts; cargo-test receipt is still pending and ripr sensor failed. Recommend a focused proof_intent to run the new test under a temporary classifier flip before final sign-off.

Refuted

  • Doc comment claim that file checks read the same text as test bodies is overstated.; refuted because: EffortlessSteven explicitly retained this language with the rationale that test bodies also come from the committed view, so the statement is consistent with committed-history analysis; doc-only, non-blocking.
  • Helper duplicates fixture-writing logic from sibling TypeScript spy tests and should be factored into a shared helper.; refuted because: Existing helpers (ts_write_file, ts_unique_tempdir, OWNER, LINE, changed_with_lines, CommittedSourceOverlay::from_entries, with_overlay) are reused; only the overlay-driven analyze call is new, which is intrinsic to the dirty-tree scenario. Single call site, no duplication risk.
  • The new test passes vacuously because CLEAN_TEST and HOOK_TEST resolve to the same byte sequence.; refuted because: HOOK_TEST has an added beforeEach block and identical test body; CLEAN_TEST has only the test body. They differ on the hook boundary that drives verdict flip, and asset ordering matches asserted direction.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.

@EffortlessSteven
EffortlessSteven marked this pull request as draft October 18, 2026 03:41
@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 18, 2026 03:41
@EffortlessSteven
EffortlessSteven enabled auto-merge (squash) October 18, 2026 03:41
@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

Pushed cbdf7f4 (a merge of #8693, the open fix for the main-wide red generic_client_analysis_failure_is_shown_once_and_only_to_generic_clients, #8690). The failing Rust gates on 6af41f8 were that test only; this PR touches no LSP code. The merge no-ops once #8693 lands. The review of record above covers this PR's own diff and is unchanged.


Generated by Claude Code

Copy link
Copy Markdown
Member Author

Reproducer for the one verification question: in crates/ripr/src/analysis/language/typescript/classifier.rs, replace the committed read of the test file in the spy file check (committed_source::read_source_bytes) with std::fs::read_to_string and run cargo test -p ripr --lib spy_file_checks_read_the_committed_test_file. The first assertion fails with left: WeaklyExposed right: Exposed (the worktree hook is seen despite a clean committed file). Restoring the read makes it pass; I ran both directions locally before pushing.


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.

Decision

  • Needs reviewer attention before upstream: findings remain.

Confirmed findings

  • Net lifetime/ownership impact of this PR is a small reduction in the LSP backend (one AtomicBool field, one detached tokio task over an owned Client clone, one heap-allocating string helper all removed). The added TypeScript test exercises an already-existing Arc -> with_overlay scope pattern with no new raw/unsafe lifetime mechanics; no UB-relevant memory contract changes are introduced by the diff itself.
  • Removed refresh_failure_notice deleted path-token redaction helper; bounded_failure_message still re-exports from component_outcome so no info-disclosure widening, but a regression removing the wrapper would lose the explicit 'ripr analysis failed:' prefix formatting previously pinned by the deleted test. Security-relevant only if future code reintroduces raw showMessage without redaction.

Verification questions

  • Confirm github-actions[bot] review of record flagged that cargo-test receipt is still pending and ripr sensor failed. Author's reproducer (revert classifier read → std::fs::read_to_string) is documented in PR body and EffortlessSteven's comment but not captured in a receipt. cargo-test is the only open proof path; PR is test-only so failure is contained.

Refuted

  • Hypothesis: Arc created in dirty_test_class could alias freed Bytes across concurrent threads if with_overlay installs a thread-local that another test's join observes, causing dangling references inside the closure.; refuted because: Refuted: existing sibling tests in the same file (e.g. spy_on_an_exported_module_object_the_changed_line_calls_is_credited, spy_on_a_module_object_refuses_every_other_path_to_the_spy) already construct overlay via from_entries + with_overlay with the same Arc pattern; both dirty_test_class invocations run sequentially in #[test] (no #[tokio::test], no rayon::join), overlay is constructed in-stack and dropped at the with_overlay closure boundary, so there is no cross-thread aliasing.
  • Diff might desync OverlayKey byte length from the on-disk path length and let a stale slice reach the spy file checks under committed-history analysis.; refuted because: Overlay entries are built from the same PathBuf used by ts_write_file; the spy file checks call read_source_bytes on the overlay key without any resize/growth, and the assertions in both directions of the new test pass only when the overlay bytes are honored. Stale-length framing is not a surface this diff introduces.
  • New test could pass vacuously if the announceMail finding is missing or if the overlay key does not match the analyzer path lookup.; refuted because: dirty_test_class uses .ok_or_else(label: expected a finding for announceMail), so missing finding fails the test. Overlay key tests/mail.test.ts matches the ts_write_file path root.join(tests/mail.test.ts). Two opposing worktree/committed assignments make vacuous pass impossible (both assertions would have to be empty or both Exposed).

Parked follow-ups

  • EffortlessSteven already documented the reproducer and the mutation flip returns the documented failure mode, so the cargo-test receipt is the only outstanding piece.
  • Deleting refresh_failure_show_message_tests.rs removes the only test coverage for the #8636 per-transition window/showMessage path; #8642 (per-signature) remains the retained disclosure and is unaffected by this PR's surface.

Evidence gaps

  • cargo-test receipt is still pending (scheduled-late per packet); ripr sensor failed with exit code 2, so independent reproducer of the PR's mutation claim (revert classifier to std::fs::read_to_string → 'left: WeaklyExposed right: Exposed') is not yet a sensor-verified artifact.
  • Model proof intent was rejected by deterministic validation.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ajVbPgh9yZDQgaAHkZE8V
@EffortlessSteven
EffortlessSteven marked this pull request as draft October 18, 2026 04:33
@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 18, 2026 04:34
@EffortlessSteven
EffortlessSteven enabled auto-merge (squash) October 18, 2026 04:34
@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!

@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 one verification check before upstream.

Verification questions

  • Confirm mutation check (revert committed_source::read_source_bytes -> std::fs::read_to_string) is documented in PR body and corroborated by EffortlessSteven's local reproducer; cargo-test receipt still pending.

Refuted

  • The two opposing overlays could still both pass vacuously if the classifier key were asserted via the overlay map lookup rather than via the overlay redirect of the file read.; refuted because: Overlay key matches the written test path (tests/mail.test.ts); CommittedSourceOverlay::from_entries re-points the read at the committed bytes, so left/right discrimination is structural, not key-derived.

Evidence gaps

  • Author did not include an in-PR independent reproducer for the mutation check; only PR-body and EffortlessSteven's comments assert it. cargo-test receipt pending and ripr sensor failed, so the proof is human-only at this gate.
  • Cargo-test receipt is scheduled-late and ripr sensor failed; however the new test is scoped, the author's mutation reproducer is documented in PR body and EffortlessSteven's thread reply (revert committed_source::read_source_bytes → std::fs::read_to_string fails with left: WeaklyExposed right: Exposed). Independent focused-run remains desirable but not a blocker.
  • Model proof intent was rejected by deterministic validation.

@EffortlessSteven
EffortlessSteven merged commit fa4f8ca into main Oct 18, 2026
35 checks passed
@EffortlessSteven
EffortlessSteven deleted the claude/project-thread-pwvs2k branch October 18, 2026 05:05
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