Skip to content

fix(lint): resolve staticcheck SA1019 findings - #890

Merged
skevetter merged 6 commits into
mainfrom
lint/staticcheck-deprecations
Aug 7, 2026
Merged

fix(lint): resolve staticcheck SA1019 findings#890
skevetter merged 6 commits into
mainfrom
lint/staticcheck-deprecations

Conversation

@skevetter

@skevetter skevetter commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Resolves all 8 staticcheck SA1019 deprecation findings, handled per-case rather than blanket-suppressed:

Migrated (real fix):

  • pkg/driver/kubernetes/client.go: swapped k8s.io/apimachinery/pkg/util/httpstream for its k8s.io/streaming/pkg/httpstream replacement — identical IsUpgradeFailure(error) bool signature, already an indirect module dependency, now promoted to direct via go mod tidy.
  • pkg/ts/workspace_server.go: migrated all three httputil.ReverseProxy.Director usages (git/docker credentials proxies, HTTP port-forward proxy) to .Rewrite. Added a shared addForwardedFor helper that replicates the X-Forwarded-For header ReverseProxy sets automatically for Director but not for Rewrite, so proxy behavior is unchanged. Verified via a temporary httptest-based smoke test (routing, header stripping, and X-Forwarded-For parity) before removing it.

Suppressed (out of scope for a lint-cleanup PR):

  • cmd/mcp/notify.go: session.Log — MCP SDK v1.7.0 has no replacement API; deprecation is protocol-level (SEP-2577) with a 12-month functional window.
  • pkg/agent/inject.go (3 sites): inject.ExecFunc/inject.Inject — explicitly named legacy shell injection path with a real replacement (AgentDelivery implementations), but migrating callers is a behavior-changing change outside this PR's scope.

golangci-lint run --enable-only=staticcheck --max-same-issues=0 ./... now reports 0 issues.

Summary by CodeRabbit

  • Bug Fixes

    • Improved credential and port-forwarding proxy behavior.
    • Preserved client connection information during forwarding while preventing internal routing headers from being exposed.
  • Maintenance

    • Updated streaming support for improved compatibility.
    • Documented intentional use of legacy compatibility paths.
    • No changes to the public API.

Migrated k8s.io/apimachinery/pkg/util/httpstream to its k8s.io/streaming
replacement (drop-in, already an indirect dependency) and
httputil.ReverseProxy.Director to .Rewrite in pkg/ts/workspace_server.go's
three reverse proxies, preserving exact prior behavior including the
implicit X-Forwarded-For header Director set automatically.

Suppressed the remaining findings where migration is out of scope for a
lint-cleanup PR: the MCP SDK's session.Log (SEP-2577 protocol-level
deprecation, no replacement API in go-sdk v1.7.0) and the three
inject.ExecFunc/inject.Inject call sites in pkg/agent/inject.go, which are
part of the legacy shell injection path retained until callers migrate to
AgentDelivery.
@netlify

netlify Bot commented Aug 6, 2026

Copy link
Copy Markdown

Deploy Preview for images-devsy-sh canceled.

Name Link
🔨 Latest commit 44f6b21
🔍 Latest deploy log https://app.netlify.com/projects/images-devsy-sh/deploys/6a75390ad936ea0008f65c9e

@netlify

netlify Bot commented Aug 6, 2026

Copy link
Copy Markdown

Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit 44f6b21
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6a75390abd703a0008e4c0d3

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b4592ddd-4968-451a-b1d1-4772a8288860

📥 Commits

Reviewing files that changed from the base of the PR and between 91300a2 and 44f6b21.

📒 Files selected for processing (1)
  • pkg/ts/workspace_server.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • pkg/ts/workspace_server.go

📝 Walkthrough

Walkthrough

The change updates credential and port-forward proxy rewriting, moves the Kubernetes streaming package to a direct dependency, updates its import, and documents intentional use of deprecated MCP and shell injection APIs.

Changes

Proxy and compatibility updates

Layer / File(s) Summary
Streaming dependency and Kubernetes import
go.mod, pkg/driver/kubernetes/client.go
k8s.io/streaming v0.36.3 is now direct, and the fallback executor imports httpstream from that package.
Reverse-proxy request rewriting
pkg/ts/workspace_server.go
Credential and port-forward proxies use ProxyRequest.Rewrite. The proxies set forwarding data and remove internal port-forward headers.
Retained legacy API annotations
cmd/mcp/notify.go, pkg/agent/inject.go
staticcheck suppression comments document intentional use of deprecated MCP logging and shell injection APIs.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant WorkspaceServer
  participant ReverseProxy as httputil.ReverseProxy
  participant CredentialEndpoint
  Client->>WorkspaceServer: Send credential or port-forward request
  WorkspaceServer->>ReverseProxy: Rewrite destination and headers
  ReverseProxy->>CredentialEndpoint: Forward request with X-Forwarded-For
  CredentialEndpoint-->>ReverseProxy: Return response
  ReverseProxy-->>Client: Return proxied response
Loading

Possibly related PRs

🚥 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 clearly describes the main change: resolving staticcheck SA1019 deprecation findings.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch

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.

@github-actions github-actions Bot added the size/m label Aug 6, 2026

@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 `@pkg/ts/workspace_server.go`:
- Around line 438-452: Update addForwardedFor to preserve the validated
X-Forwarded-For chain from pr.In.Header before appending the client address,
since pr.Out.Header no longer contains inbound values after
ReverseProxy.Rewrite. Copy the inbound header into the outbound request, then
retain the existing omission and RemoteAddr handling.
🪄 Autofix

✅ Autofix completed


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: df56afb3-05dd-4ada-931b-6ec8899f7afc

📥 Commits

Reviewing files that changed from the base of the PR and between 4279672 and 91300a2.

📒 Files selected for processing (5)
  • cmd/mcp/notify.go
  • go.mod
  • pkg/agent/inject.go
  • pkg/driver/kubernetes/client.go
  • pkg/ts/workspace_server.go

Comment thread pkg/ts/workspace_server.go
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Fixes Applied Successfully

Fixed 1 file(s) based on 1 unresolved review comment.

Files modified:

  • pkg/ts/workspace_server.go

Commit: e0d026c5aa1fbc0f96cbe96c03dadb1aeb1fc774

The changes have been pushed to the lint/staticcheck-deprecations branch.

Time taken: 7m 7s

Fixed 1 file(s) based on 1 unresolved review comment.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
@skevetter
skevetter marked this pull request as draft August 7, 2026 01:18
@skevetter
skevetter marked this pull request as ready for review August 7, 2026 03:31
@skevetter
skevetter merged commit bd85187 into main Aug 7, 2026
114 of 117 checks passed
@skevetter
skevetter deleted the lint/staticcheck-deprecations branch August 7, 2026 03:39
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