Skip to content

test(lsp): preserve changed test-file exclusion - #2137

Merged
EffortlessSteven merged 2 commits into
mainfrom
fix/lsp-production-scope-2130
Jul 22, 2026
Merged

EffortlessSteven merged 2 commits into
mainfrom
fix/lsp-production-scope-2130

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Jul 21, 2026 •

Copy link
Copy Markdown
Member

What this does

Pins the current LSP workspace-diagnostics scope contract: in Instant mode, a changed production Rust file can produce a diagnostic, while a changed tests/ file is indexed as part of the diff but must not produce a finding.

This is a regression test for the existing Rust analysis guard and its LSP batch projection. It does not claim CLI/LSP output-count parity or resolve the original per-file volume comparison in #2130.

Verification

Check Result
LSP scope regression 1 passed, 0 failed
cargo clippy -p ripr --lib -- -D warnings pass
cargo fmt --check, git diff --check clean
full library tests, cargo xtask precommit not run to completion because concurrent Windows worktrees held the shared build/tool surface

Review map

  • crates/ripr/src/analysis/language/rust.rs: changed test paths are excluded from probe generation.
  • crates/ripr/src/lsp/diagnostics.rs: workspace findings are projected into URI batches.
  • crates/ripr/src/lsp/tests.rs: end-to-end fixture covering production and test-file changes.

Related: #2130
Follow-up guidance semantics: #2131

@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@coderabbitai

coderabbitai Bot commented Jul 21, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 6e2fae75-bce7-4c6c-9364-c111b925b2c8

📥 Commits

Reviewing files that changed from the base of the PR and between 56529b7 and 3117fd0.

📒 Files selected for processing (2)
  • crates/ripr/src/lsp/tests.rs
  • policy/process_allowlist.txt

Summary by CodeRabbit

  • Tests
    • Added end-to-end coverage for LSP diagnostic scoping.
    • Verified that diagnostics continue to appear for changed production files while changes limited to test files are excluded.
    • Added workspace and version-control fixture coverage to improve confidence in diagnostic results.

Walkthrough

Changes

The LSP test suite adds a git-backed integration fixture that verifies changed test files are excluded from published diagnostics while changed production files still produce findings. Process allowlist entries permit the fixture’s git subprocess setup.

LSP diagnostic scoping

Layer / File(s) Summary
Fixture and process setup
crates/ripr/src/lsp/tests.rs, policy/process_allowlist.txt
Adds helpers for writing fixture files and running git commands, plus matching process allowlist entries.
Diagnostic exclusion regression test
crates/ripr/src/lsp/tests.rs
Creates baseline and changed commits, runs scoped LSP diagnostics, and asserts test-file exclusion and production-file findings.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Poem

A rabbit hopped through git’s fresh trail,
Testing scopes where findings sail.
Test files hide, production speaks,
Commits mark the paths it seeks.
With carrots green, the checks prevail!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/lsp-production-scope-2130

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

Copy link
Copy Markdown
Member Author

The issue correction changes the interpretation of the original report: this is not evidence that the LSP should be made CLI-parity scoped per open file. I rechecked current main and the existing contract is explicit: Instant-mode changed Rust analysis excludes test paths before probe generation (crates/ripr/src/analysis/language/rust.rs:661-669), while the LSP workspace adapter publishes the resulting diagnostic batches (crates/ripr/src/lsp/diagnostics.rs:627-790).

I am keeping this PR as a narrow regression guard for that current workspace-diagnostics contract, but I am removing the claim that it fixes the original volume comparison. The issue's remaining category/guidance concern stays with #2131.

@EffortlessSteven

Copy link
Copy Markdown
Member Author

Rebased onto current main (d3b8f11 → 8b09017). The earlier required-lane failure ran before #2201 landed (the xtask cwd-guard flake that was failing unrelated PRs); this branch's test passes locally on current main (workspace_diagnostics_exclude_changed_test_files_from_published_findings, 1/1). CI rerunning.

@EffortlessSteven
EffortlessSteven force-pushed the fix/lsp-production-scope-2130 branch from d3b8f11 to 8b09017 Compare July 22, 2026 07:11
)

The changed-test-file exclusion regression test builds its own temp git
repo via the same Command::new helper as the existing scoping fixture;
check-process-policy (CI-only) caps lsp/tests.rs at one spawn and zero
Command imports. Bump the cap with the owner/reason recorded.
@EffortlessSteven

Copy link
Copy Markdown
Member Author

Correction to my earlier hypothesis: the rebase did not fix CI because the failure was not the #2201 cwd flake. The real failure was check-process-policy (CI-only, not in precommit): the new regression test builds its temp git repo through a second Command::new in crates/ripr/src/lsp/tests.rs, over the allowlist cap of 1 spawn / 0 imports. Fixed in 3117fd0 by recording the second spawn + import in policy/process_allowlist.txt with owner/reason. cargo xtask check-process-policy and policy_checker_facade_runs_current_repo_checks pass locally.

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review July 22, 2026 07:35
@EffortlessSteven
EffortlessSteven merged commit 2486445 into main Jul 22, 2026
20 of 21 checks passed
@EffortlessSteven
EffortlessSteven deleted the fix/lsp-production-scope-2130 branch July 22, 2026 07:35

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3117fd0bc3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

&root.path,
&["add", "Cargo.toml", "src/lib.rs", "tests/end_to_end.rs"],
)?;
run_lsp_scope_git(&root.path, &["commit", "-m", "base"])?;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Disable inherited git signing in the fixture commits

This new temp-repo setup skips the local commit.gpgSign false that init_lsp_test_scope_repo uses for the neighboring LSP scope fixtures. On a developer/runner with global commit.gpgSign=true, the first fixture commit fails before the scoping assertions run; reproduced with GIT_CONFIG_GLOBAL=<file containing [commit] gpgSign=true> cargo test -p ripr workspace_diagnostics_exclude_changed_test_files_from_published_findings, while the existing helper-backed scope test passes under the same config. Reuse the existing helper or set the same local git config before committing, then rerun that targeted test.

Useful? React with 👍 / 👎.

@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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.

1 participant