Skip to content

test(gpg): stabilize forwarded socket polling test - #1264

Merged
skevetter merged 2 commits into
mainfrom
fix/gpg-forwarded-socket-test
Sep 23, 2026
Merged

skevetter merged 2 commits into
mainfrom
fix/gpg-forwarded-socket-test

Conversation

@skevetter

@skevetter skevetter commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • extract waitForForwardedSocket from ownership mutation in claimForwardedSocket
  • test socket discovery directly, including asynchronous appearance, missing socket, non-socket, stat errors, and cancellation
  • remove load-sensitive wall-clock correctness assertions while retaining bounded safety contexts
  • preserve production polling/backoff values and sudo chown behavior

Validation

  • gofmt
  • git diff --check
  • go test ./pkg/gpg
  • go test ./pkg/gpg -race -count=20
  • CGO_ENABLED=0 go test ./pkg/gpg -race -count=100
  • CGO_ENABLED=0 go test ./pkg/gpg -race -short -coverprofile=dist/gpg-profile-cgo0.out -covermode=atomic -count=50
  • mise exec -- task cli:lint:ci
  • mise exec -- prek run --files pkg/gpg/gpg_forwarding.go pkg/gpg/gpg_forwarding_test.go

The requested CGO_ENABLED=1 race/count and atomic-coverage invocations are blocked on this host by the macOS SDK linker rejecting malformed .tbd files (arm64e.x1-* architectures). Local CodeRabbit was attempted before PR creation but was blocked by the account organization membership (HTTP 403).

Summary by CodeRabbit

  • Bug Fixes
    • Improved GPG forwarding reliability by waiting for the forwarded socket to become available before changing its ownership. Forwarding now reports errors when the path is invalid, inaccessible, or the wait is interrupted, rather than proceeding before the socket is ready. This helps ensure ownership changes are applied only after the expected socket is present.

@coderabbitai

coderabbitai Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: e65a1535-7696-4772-8a55-ff132705f3d6

📥 Commits

Reviewing files that changed from the base of the PR and between 505c9a2 and 0e76f20.

📒 Files selected for processing (2)
  • pkg/gpg/gpg_forwarding.go
  • pkg/gpg/gpg_forwarding_test.go

Included review availability: Your plan provides up to 2 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The forwarding code now waits for the forwarded path to become a Unix socket before changing its ownership. Tests cover socket appearance, timeouts, non-socket paths, permission errors, and context cancellation.

Changes

Forwarded socket readiness

Layer / File(s) Summary
Socket readiness and ownership
pkg/gpg/gpg_forwarding.go, pkg/gpg/gpg_forwarding_test.go
claimForwardedSocket calls waitForForwardedSocket and changes ownership only after the wait succeeds. The tests cover socket appearance, timeout, non-socket paths, permission errors, and cancellation.
Estimated code review effort: 2 (Simple) ~10 minutes

Merge Risk: ⚪ Minimal · up to 0e76f

No actionable merge-blocking issue is established; the change is mergeable after normal checks.

🚥 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 8 functions across 2 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: stabilizing the GPG forwarded socket polling test. It matches the production and test changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
✨ Simplify code
  • Commit to this branch
  • Create a new PR

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.

@netlify

netlify Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for images-devsy-sh canceled.

Name Link
🔨 Latest commit 0e76f20
🔍 Latest deploy log https://app.netlify.com/projects/images-devsy-sh/deploys/6ab3fdc292afb0000857de62

@netlify

netlify Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit 0e76f20
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6ab3fdc2ed6edc0008e5669a

@skevetter

Copy link
Copy Markdown
Contributor Author

@greptileai review

@greptile-apps

greptile-apps Bot commented Sep 23, 2026

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

The PR appears safe to merge with no actionable correctness, security, or repository-rule issues identified.

Summary

The PR extracts forwarded-socket discovery into a directly testable helper while preserving the production polling and ownership-change sequence.

  • Updates socket polling tests to target the new helper without invoking sudo chown.
  • Covers asynchronous socket creation, timeout, invalid file type, stat failures, and cancellation.
  • Replaces load-sensitive elapsed-time assertions with bounded contexts and behavioral error assertions.

Reviews (1) · Last reviewed commit: "test(gpg): remove load-sensitive socket ..."

@skevetter
skevetter marked this pull request as ready for review September 23, 2026 17:16
@mergify

mergify Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@skevetter
skevetter merged commit 1c87179 into main Sep 23, 2026
87 checks passed
@skevetter
skevetter deleted the fix/gpg-forwarded-socket-test branch September 23, 2026 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant