Conversation
…modeled after db/sql drivers
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
tavern/app.go
Outdated
| ArgsUsage: "[upstream_address] [transport=http1] [listen_on=8080]", | ||
| Action: func(c *cli.Context) error { | ||
| var ( | ||
| upstream = c.Args().Get(0) | ||
| listenOn = c.Args().Get(1) | ||
| transport = c.Args().Get(2) |
There was a problem hiding this comment.
Order redirector CLI arguments correctly
The redirector command documents its arguments as [upstream_address] [transport=http1] [listen_on=8080], but the implementation reads the second argument into listenOn and the third into transport. Anyone following the help text and running tavern redirector example.com grpc :9090 will instead try to start a redirector named ":9090" and bind to "grpc", which fails with "redirector ":9090" not found". Either the assignments should be swapped or the help text changed so that transport can actually be set via the second argument.
Useful? React with 👍 / 👎.
|
@claude Take a look? |
|
Claude finished @hulto's task —— View job Code ReviewI've reviewed this PR and overall the refactoring looks solid! The modular redirector design following Go's Positive Highlights
Critical Issue: CLI Argument Mismatch ❗The automated review correctly identified a serious bug in // Line 67: Documentation says:
ArgsUsage: "[upstream_address]",
// Lines 69-78: Flags defined as --listen and --transport
cli.StringFlag{
Name: "listen",
Usage: "Address to listen on for incoming redirector traffic (default: :8080)",
Value: ":8080",
},
cli.StringFlag{
Name: "transport",
Usage: "Transport protocol to use for redirector (default: http1)",
Value: "http1",
},The implementation correctly uses named flags ( Impact: This is confusing for users, but not a runtime bug since the flags work correctly. The Recommendation: Update line 67 to: ArgsUsage: "[upstream_address]",
Usage: "Run a redirector connecting agents using a specific transport to the server (use --listen and --transport flags)",Minor Issues
Code Quality Observations
Testing Recommendations
DocumentationThe docs update in The SummaryThis is a high-quality refactoring that successfully makes the codebase more modular. The main issue is the CLI documentation mismatch which should be fixed before merge. Everything else is minor polish. Recommendation: Approve after fixing the |
| // EnvHTTPListenAddr sets the address (ip:port) for tavern's HTTP server to bind to. | ||
| // EnvHTTPMetricsAddr sets the address (ip:port) for the HTTP metrics server to bind to. | ||
| EnvHTTPListenAddr = EnvString{"HTTP_LISTEN_ADDR", "0.0.0.0:80"} | ||
| EnvHTTPListenAddr = EnvString{"HTTP_LISTEN_ADDR", "0.0.0.0:8000"} |
There was a problem hiding this comment.
Update the docs that reference http://localhost
Update the agent to default to 8080 as well
Refactor our
redirectorpackage to be more modular, allowing multiple redirector transports to be registered. This registration system is modeled after Golang'sdb/sqldriver registration. Also makes the docs a bit more clear.What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Prepares us to implement a gRPC redirector