Add function secrets commands#42
Conversation
897cbad to
a109322
Compare
|
Live integration verification now run with env from Result: passed. |
|
| Filename | Overview |
|---|---|
| internal/cmd/functions.go | Adds four function-secrets subcommands (list/get/set/delete) wired to /secrets with function_env namespace; logic, validation, and flag wiring are correct |
| internal/cmd/functions_test.go | Adds unit tests for all four secrets operations; correctly saves/restores global state, verifies HTTP method, query params, and request body namespace |
| internal/testutil/httpserver.go | Extends RecordedRequest with Query and Body fields; body is correctly buffered and restored so the HTTP handler can still read it after recording |
| tests/integration/functions_test.go | Adds full set/get/list/delete lifecycle integration test with proper deferred cleanup and unique timestamped secret names |
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
internal/cmd/functions.go:937-943
When both a positional argument and the `--value` flag are provided simultaneously (e.g. `set NAME positional --value flag`), the positional argument silently wins because `value = args[1]` overwrites `functionSecretValue` without any warning. A user who sets `--value flag` would be silently ignored, which is surprising. Consider returning an error when both are provided.
```suggestion
value := functionSecretValue
if len(args) == 2 {
if cmd.Flags().Changed("value") {
return fmt.Errorf("secret value is ambiguous: do not provide both a positional argument and --value")
}
value = args[1]
}
if value == "" && !cmd.Flags().Changed("value") {
return fmt.Errorf("secret value required: pass it as an argument or with --value")
}
```
Reviews (2): Last reviewed commit: "Add function secrets commands" | Re-trigger Greptile
Summary
notte function secrets/notte functions secretscommands for list, get, set, and delete/secretswithfunction_envnamespaceTests
go test ./internal/cmd ./internal/testutilgo test ./...NOTTE_API_KEY=dummy go test -tags integration ./tests/integration -run '^$'\n-go run ./cmd/notte function secrets --help\n\nNote: live integration test was not run locally because no realNOTTE_API_KEYwas available in this shell.