Skip to content

fix(lsp): make real-gopls integration test opt-in via env var#691

Open
PierrunoYT wants to merge 2 commits into
Gitlawb:mainfrom
PierrunoYT:fix/gopls-test-opt-in
Open

fix(lsp): make real-gopls integration test opt-in via env var#691
PierrunoYT wants to merge 2 commits into
Gitlawb:mainfrom
PierrunoYT:fix/gopls-test-opt-in

Conversation

@PierrunoYT

@PierrunoYT PierrunoYT commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #684TestManagerCheckRealGopls ran as part of the default go test ./... suite whenever any gopls binary was on PATH, so an installed but unusable gopls (e.g. a broken persistent-index cache) failed the whole suite with lsp error -1: EOF.

Changes

The test is now gated behind an explicit ZERO_LSP_REAL_GOPLS_TEST=1 opt-in, following the repo's existing convention for real-dependency smoke tests (ZERO_STT_DOWNLOAD_TEST, ZERO_STT_STREAM_SERVER, …). The gopls-on-PATH skip is kept as a secondary guard for the opt-in path. Default hermetic coverage continues to run against the fake LSP server.

Verification

On Windows (go1.26.5 windows/amd64):

  • Default run: go test ./internal/lsp -run '^TestManagerCheckRealGopls$' -v → SKIP with a clear opt-in message.
  • Opt-in run: ZERO_LSP_REAL_GOPLS_TEST=1 go test ... → PASS against a real gopls (1 compiler diagnostic reported).
  • Full go test ./internal/lsp passes.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • The real-language-server verification test now runs only when explicitly enabled with the ZERO_LSP_REAL_GOPLS_TEST environment variable.
    • The test continues to skip automatically when the required language server is unavailable.

TestManagerCheckRealGopls ran whenever a gopls binary was on PATH, so
an installed but unusable gopls (e.g. a broken persistent-index cache)
failed the default go test ./... suite with 'lsp error -1: EOF'.

Gate the test behind ZERO_LSP_REAL_GOPLS_TEST=1, following the
existing opt-in convention for smoke tests, so the default hermetic
suite never depends on the health of a developer's global language
server. Default coverage continues to use the fake LSP server.

Fixes Gitlawb#684

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 14, 2026 20:51

Copilot AI 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.

Pull request overview

This PR makes the real-gopls integration test in internal/lsp explicitly opt-in via an environment variable so the default go test ./... suite remains hermetic and doesn’t fail due to a developer’s local gopls installation health/cache state.

Changes:

  • Gate TestManagerCheckRealGopls behind ZERO_LSP_REAL_GOPLS_TEST (skip by default with a clear message).
  • Keep the existing secondary guard that skips when gopls is not on PATH.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@PierrunoYT, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 9 minutes

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).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 62ce3fe6-327c-4e81-ac13-53804afb1c34

📥 Commits

Reviewing files that changed from the base of the PR and between 5d18337 and 23390b0.

📒 Files selected for processing (1)
  • internal/lsp/real_gopls_manual_test.go

Walkthrough

The real gopls manual test is now opt-in through ZERO_LSP_REAL_GOPLS_TEST; unset environments skip with instructions, while missing gopls continues to skip.

Changes

Real gopls test gating

Layer / File(s) Summary
Environment-gated manual verification
internal/lsp/real_gopls_manual_test.go
The test skips unless ZERO_LSP_REAL_GOPLS_TEST is set and retains the skip when gopls is unavailable.

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

Suggested reviewers: copilot

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: making the real gopls test opt-in via an environment variable.
Linked Issues check ✅ Passed The change satisfies #684 by gating the real gopls test behind explicit opt-in while preserving the fake LSP default path.
Out of Scope Changes check ✅ Passed The only change is the intended test gating update, with no unrelated code paths or extra behavior introduced.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/lsp/real_gopls_manual_test.go`:
- Around line 18-19: Update the environment guard in the real gopls test to
enable execution only when ZERO_LSP_REAL_GOPLS_TEST equals the exact string "1";
skip for unset, empty, "0", "false", and all other values, while preserving the
existing skip message.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 31c1d621-9c2b-4431-b8fd-bd04ab1aafd7

📥 Commits

Reviewing files that changed from the base of the PR and between 6fc1220 and 5d18337.

📒 Files selected for processing (1)
  • internal/lsp/real_gopls_manual_test.go

Comment thread internal/lsp/real_gopls_manual_test.go Outdated
Any non-empty value (including 0 or false) enabled the real gopls
test, contradicting the documented =1 contract in the skip message.
Compare against "1" exactly, per PR review.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@jatmn jatmn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@anandh8x anandh8x left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. Hermetic-by-default, opt-in via ZERO_LSP_REAL_GOPLS_TEST=1, matches existing ZERO_*_TEST convention. The == "1" strict match fix in 23390b0 is correct. Ship it.

Follow-up (non-blocking): add a short CONTRIBUTING.md note listing the ZERO_LSP_*_TEST env vars so future real-LSP tests for other languages follow the same pattern.

@Vasanthdev2004 Vasanthdev2004 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Read the diff the ZERO_LSP_REAL_GOPLS_TEST=1 guard goes in before the LookPath check, which is the right order, and the skip message is clear. Confirmed gofmt and go vet ./internal/lsp/ are clean on the touched file, and without the env var set the test skips and the full ./internal/lsp/ suite passes. Test-only and low risk, so I'm approving. Good call gating this behind an env var so a globally installed gopls can't flake the hermetic suite.

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.

Real gopls manual test can fail the default suite on an unusable installation

5 participants