Skip to content

test(python): pin one workspace parse per run for the foreign-write index (#10125) - #10264

Merged
EffortlessSteven merged 2 commits into
mainfrom
claude/py-foreign-index-parse-count
Oct 25, 2026
Merged

EffortlessSteven merged 2 commits into
mainfrom
claude/py-foreign-index-parse-count

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Governing issue or accepted claim: #10125 (perf claim made in #9861; independent review of 80f279a found the equivalence test shares the code it checks and never counts parses)
Acceptance delta (one sentence): analyze_diff over one versus three changed Python modules must parse the workspace the same number of times, so rebuilding the foreign-write index per changed file fails a test.

Change

  • module_value.rs: a #[cfg(test)] thread-local FOREIGN_PARSES incremented at the one assigned_attributes call in ForeignIndex::build. No release-build state.
  • python_tests.rs: analyze_diff_parses_the_workspace_once_however_many_files_changed runs the adapter over six sources with one and then three changed constants; requires one finding per changed constant, six parses for six sources, and equal counts across both runs.

Verification

  • Passes on this head; cargo xtask precommit exit 0.
  • Negative control: building the index inside the for changed loop makes the test fail (12 parses against the expected 6); reverted.


Generated by Claude Code

…ce per run (#10125)

A thread-local parse counter in the foreign index and an analyze_diff test
over one versus three changed modules require identical parse counts. Moving
the index build into the per-changed-file loop makes the count double.

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

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 25, 2026 06:56
@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 49 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 168 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: bdc9f6de-ef3f-40d3-9dca-952556dd6fa6
Commits

Reviewing files that changed from the base of the PR and between feea378 and 6eb9f1f.

Files selected for processing: 2
  • crates/ripr/src/analysis/language/python/module_value.rs
  • crates/ripr/src/analysis/language/python/python_tests.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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 verification checks before upstream.

Verification questions

  • Confirm the new test-only thread-local counter can be affected by concurrent tests on the same worker thread.
  • Confirm sibling Python analysis routes that may independently construct ForeignIndex were not exhaustively scanned, so the test proves the analyze_diff route rather than a repository-wide parse invariant.
  • Confirm the acceptance claim is supported by the changed test structure, but successful test execution is still required because the ripr sensor failed.

Refuted

  • Adding the regression test could change production behavior through shared state.; refuted because: Both the thread-local and its increment are guarded by #[cfg(test)], so release builds exclude the added state and instructions.
  • The test duplicates or over-couples to unrelated analysis behavior instead of isolating the performance invariant.; refuted because: The helper constructs only minimal Python sources, changes only the number of changed modules, and asserts findings plus stable parse counts; the counter is placed at the single assigned_attributes call used by ForeignIndex::build.
  • The PR title/body overclaim a workspace-level parse guarantee that a six-file synthetic fixture cannot establish for all Python sources or parse failures.; refuted because: The changed behavior being tested is that analyze_diff does not rebuild one shared foreign index per changed module; the fixture directly checks that invariant. It does not claim that every possible workspace parses successfully.

Evidence gaps

  • The only material correctness question is whether the focused test actually executes and distinguishes the intended one-index-build implementation from a per-changed-file rebuild.

Copy link
Copy Markdown
Member Author

Ripr Rust Small Result failed on 286fca34 at one step: cargo xtask goldens check, drift in 14 fixtures (13 Python fixtures from #10235 plus rust_qualified_foreign_receiver), all missing the Next: lines RIPR-SPEC-0319 now renders in human-full.txt. Rust tests, clippy, precommit and doctests passed. This PR changes no fixture or output, and main fails the same check (cargo xtask goldens check on 8d5d0d01). The #10235 fixtures landed alongside the output change and were blessed without it.

The fix of record is #10269 (re-blesses exactly these 14, merge-ready, CI running). I am not opening another. Once it lands I will merge main here and re-apply merge-ready.


Generated by Claude Code

@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: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

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.

Decision

  • Needs verification checks before upstream.

Verification questions

  • Confirm the counter increments once per ForeignIndex::build candidate source, not necessarily once per successful parse; the test's six-parse label may overstate what the counter measures.
  • Confirm the test demonstrates the analyze_diff route but does not establish a repository-wide invariant for sibling Python analysis routes.
  • Confirm the test does not establish that every sibling Python analysis route builds ForeignIndex only once; it pins the claim for analyze_diff with one changed file and three changed files.

Refuted

  • The test proves that every Python analysis route parses the workspace once, rather than only analyze_diff.; refuted because: The test invokes PythonAdapter.analyze_diff and compares runs that differ only in changed-file count; it does not claim or exhaustively test sibling routes.
  • Instrumentation could leak into production or materially change ForeignIndex construction.; refuted because: The counter declaration and increment are both cfg(test)-guarded, and the added test-only state does not alter release code.
  • The test cannot detect rebuilding the workspace index once per changed file.; refuted because: The helper creates six source files, invokes analyze_diff with one and then three changed modules, expects six parses for each run, and requires equal counts. A per-file rebuild would parse 18 times in the three-file run, contradicting the equality assertion.

Parked follow-ups

  • A failed analyze_diff still records and returns the parse count, but cleanup is skipped because result? occurs after remove_dir_all is scheduled; the test may leave temporary directories on error.

Evidence gaps

  • The acceptance claim lacks trustworthy execution evidence in this packet: ripr failed, while cargo-test is only scheduled late.
  • Current-head automated test success is not established by the supplied sensor receipts.
  • Model proof intent was rejected by deterministic validation.
  • The regression test is blocked only on execution.

Copy link
Copy Markdown
Member Author

Review of record, head 6eb9f1f

CI: Ripr Rust Small Result success on this head (run 40178696784); Devin Review found no issues.

Angles:

  • Correctness / production risk: the counter and its increment are both #[cfg(test)], so release code is unchanged. The count is one per ForeignIndex::build call, which is what the claim is about.
  • Test discrimination: the test runs analyze_diff with one and then three changed modules over six sources and requires equal counts (6 and 6). Moving the build into the per-changed-file loop would give 18 in the three-file run and fail the equality.
  • Scope: pins analyze_diff only, not sibling routes; the claim in Python ForeignWrites::scan reparses the whole workspace once per changed Python file #10125 is about this route.
  • Late bot review (github-actions): verification questions on the counter's meaning and scope are answered above; the parked item (temp dir cleanup when analyze_diff errors) affects only a failing test run and is a non-blocking nit.

No blocking finding.


Generated by Claude Code

@EffortlessSteven
EffortlessSteven merged commit 9f059f4 into main Oct 25, 2026
51 checks passed
@EffortlessSteven
EffortlessSteven deleted the claude/py-foreign-index-parse-count branch October 25, 2026 09:39
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