Skip to content

midcobra: check TraceMiddleware against the Middleware interface - #3148

Open
shu-chen-dot-ca wants to merge 1 commit into
jetify-com:mainfrom
shu-chen-dot-ca:fix-3124-trace-middleware-assertion
Open

shu-chen-dot-ca wants to merge 1 commit into
jetify-com:mainfrom
shu-chen-dot-ca:fix-3124-trace-middleware-assertion

Conversation

@shu-chen-dot-ca

Copy link
Copy Markdown

Summary

Fixes #3124.

The compile-time interface check in internal/boxcli/midcobra/trace.go read var _ Middleware = (*DebugMiddleware)(nil), a copy-paste slip from debug.go, so TraceMiddleware was never checked against Middleware. This changes it to (*TraceMiddleware)(nil).

How was it tested?

  • Renamed TraceMiddleware.postRun to postRunTypo as a simulated mistake and ran go build ./internal/boxcli/midcobra/. On main the build succeeds. With the change it fails with *TraceMiddleware does not implement Middleware (missing method postRun). The rename was reverted afterwards.
  • go tool golangci-lint run --timeout 10m: 0 issues. gofumpt -extra -l is clean.
  • go test -race -cover -timeout 30m ./... with Nix installed: all packages pass, including testscripts.
Before After
before after

Community Contribution License

All community contributions in this pull request are licensed to the project
maintainers under the terms of the
Apache 2 License.

By creating this pull request, I represent that I have the right to license the
contributions to the project maintainers under the Apache 2 License as stated in
the
Community Contribution License.

@greptile-apps

greptile-apps Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5 · The change appears safe to merge.RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The change appears safe to merge.

Summary

Corrects the compile-time check in trace.go to check *TraceMiddleware against Middleware instead of checking *DebugMiddleware again.

  • The compiler checks the tracing middleware against its shared interface.

Reviews (1) · Last reviewed commit: "boxcli: check TraceMiddleware against Mi..." · Reviewed by Greptile

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

midcobra/trace.go interface assertion checks DebugMiddleware instead of TraceMiddleware

1 participant