Skip to content

test(cli): skip the serve-scope symlink test when the platform refuses the link - #1042

Open
Vasanthdev2004 wants to merge 1 commit into
mainfrom
fix/serve-scope-symlink-skip
Open

test(cli): skip the serve-scope symlink test when the platform refuses the link#1042
Vasanthdev2004 wants to merge 1 commit into
mainfrom
fix/serve-scope-symlink-skip

Conversation

@Vasanthdev2004

@Vasanthdev2004 Vasanthdev2004 commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Closes #1021.

os.Symlink on Windows needs SeCreateSymbolicLinkPrivilege, which an ordinary developer account does not hold. TestBuildServeScopeKeepsLexicalPaths called it and treated the refusal as a test failure, so on a stock Windows machine the package reported:

serve_test.go:172: symlink ...\real-workspace ...\link-workspace: A required privilege is not held by the client.
--- FAIL: TestBuildServeScopeKeepsLexicalPaths

with nothing wrong in the code. CI runners are elevated, so it never showed there. It cost a round of triage on #1003 before being ruled environmental, and it has been the only failure in internal/cli on my machine all week; the package is green with this.

The fix is the answer the rest of the repo already gives: skip when the platform will not make the link. Both other symlink tests in this package do exactly that, as do the ones in internal/agent, internal/pathjail, internal/plugins, internal/repomap, internal/sandbox and others.

I swept the remaining os.Symlink-then-t.Fatal sites rather than assuming this was the only one, and ran them:

  • internal/release passes here.
  • The one in internal/agent/freeform_tool_test.go is never reached on this box.
  • internal/peermsg/private_dir_unix_test.go and transport_unix_test.go are unix-only files, where the call cannot fail this way.
  • internal/installtest and internal/npmwrapper build node package layouts rather than exercising link semantics.

So this was the outlier, and the change stays to the one test.

A skip is the honest answer here specifically because the missing privilege is an environmental prerequisite the fixture does not control and cannot arrange. It is not a fixture-controlled condition being skipped past, which would hide a real failure. Restoring the t.Fatal reproduces the failure above on an unelevated account.

Summary by CodeRabbit

  • Tests
    • Updated symlink-related test setup to skip gracefully when the required symlinks cannot be created, avoiding failures in unsupported environments.

…s the link

Creating a symlink on Windows needs SeCreateSymbolicLinkPrivilege, which an
ordinary developer account does not hold, so this reported a failure with
nothing wrong in the code: "A required privilege is not held by the client".
CI runners are elevated, so it only ever appeared locally, where it cost a
round of triage on #1003 before being ruled environmental and would do the
same to any contributor on a stock Windows machine.

The two other symlink tests in this package, and most of the rest of the
repo, already answer this way. Swept the remaining os.Symlink-then-Fatal
sites rather than assuming: internal/release passes, the one in
internal/agent is never reached, and the unix-only files cannot hit it. This
was the outlier.

Closes #1021
@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Essentials

Run ID: c351c343-39a5-428d-b5aa-2de9cedcbb57

📥 Commits

Reviewing files that changed from the base of the PR and between f30f550 and 44e96c8.

📒 Files selected for processing (1)
  • internal/cli/serve_test.go

Limit details: You’ve used all 5 included reviews currently available. Your 19 included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.


Walkthrough

The symlink setup in TestBuildServeScopeKeepsLexicalPaths now skips when either symlink cannot be created. This prevents environment-specific privilege limitations from failing the test.

Changes

Test environment handling

Layer / File(s) Summary
Symlink setup handling
internal/cli/serve_test.go
The test skips when either os.Symlink call fails because the platform does not permit symlink creation.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to 44e96

The lexical-path test now skips on systems that cannot create symlinks, avoiding false failures on unelevated Windows accounts without changing product behavior.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: the symlink-based serve-scope test now skips when the platform refuses symlink creation.
Linked Issues check ✅ Passed The change satisfies issue #1021. It skips the test when either os.Symlink call fails, uses the required symlink-unavailable behavior, and prevents privilege-related failures on unelevated Windows sys…
Out of Scope Changes check ✅ Passed The change is limited to the targeted test and directly supports issue #1021. No unrelated code or behavior changes are identified.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/serve-scope-symlink-skip

Usage-based review receipt

Note

This review was completed with usage-based billing: files reviewed beyond your plan's included limits are billed at $0.25/file. View usage-based billing.


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

@greptile-apps

greptile-apps Bot commented Sep 9, 2026

Copy link
Copy Markdown

Greptile Summary

This PR makes the lexical-path serve-scope test portable to environments where creating symbolic links is unavailable.

  • Changes symlink-creation failures from test failures to skips.
  • Documents the Windows privilege limitation motivating the behavior.

Confidence Score: 5/5

The PR appears safe to merge.

The change is confined to test behavior and consistently treats unavailable symlink creation as an unmet environmental prerequisite without modifying production code.

Important Files Changed

Filename Overview
internal/cli/serve_test.go Updates one symlink-dependent test to skip when its environmental prerequisite is unavailable; no actionable defect was identified.

Reviews (1): Last reviewed commit: "test(cli): skip the serve-scope symlink ..." | Re-trigger Greptile

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Zero automated PR review

Verdict: No blockers found

Blockers

  • None found.

Validation

  • [pass] Diff hygiene: git diff --check
  • [pass] Tests: go test ./...
  • [pass] Build: go run ./cmd/zero-release build
  • [pass] Smoke build: go run ./cmd/zero-release smoke

Scope

Head: 44e96c8c725f
Changed files (1): internal/cli/serve_test.go

This deterministic review checks validation status and basic diff hygiene. A human reviewer still owns product judgment and design quality.

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.

cli: TestBuildServeScopeKeepsLexicalPaths fails instead of skipping when symlinks need a privilege

1 participant