Repository navigation
Add --tag to release upload for parity with release create - #172
Conversation
andrew
left a comment
There was a problem hiding this comment.
Please address these two points:
- In
internal/cli/release.go, explicitly empty--tagbypasses conflict validation:forge release upload --tag='' v1.0.0 app.zipaccepts the positional tag and proceeds to repository resolution. Checkcmd.Flags().Changed("tag")and reject empty flag values so an unset script variable cannot silently select positional mode. - In
internal/cli/release_test.go, the new tests only call the parser helper and check that the flag exists. Add tests through command execution for both supported forms and invalid combinations, including an empty--tag, and assert the tag and file contents passed toUploadAsset. This will cover flag binding and the upload path together.
andrew (re-review on git-pkgs#172): --tag='' bypassed conflict validation and fell through to positional mode. uploadTagAndFile now takes Changed("tag") and rejects an explicitly empty flag value, so an unset script variable cannot silently select positional mode. Tests run the command end to end for both supported forms and the invalid combinations, asserting the tag and file contents passed to UploadAsset (and zero calls on refusal).
|
Both points addressed: |
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Rene Turcios <95189389+CloudCorpRecords@users.noreply.github.com>
andrew (re-review on git-pkgs#172): --tag='' bypassed conflict validation and fell through to positional mode. uploadTagAndFile now takes Changed("tag") and rejects an explicitly empty flag value, so an unset script variable cannot silently select positional mode. Tests run the command end to end for both supported forms and the invalid combinations, asserting the tag and file contents passed to UploadAsset (and zero calls on refusal). Signed-off-by: Rene Turcios <95189389+CloudCorpRecords@users.noreply.github.com>
20ecf71 to
c87889d
Compare
andrew
left a comment
There was a problem hiding this comment.
Both requested fixes are addressed: explicitly empty --tag values are rejected, and command execution tests verify the tag and file contents for both supported upload forms.
Fixes #168
forge release createtakes--tag, butforge release uploadonly accepted the tag positionally, which is awkward in scripts. This adds--tagtoupload:--tag, the single argument is the file; without it, the existing<tag> <file>form applies, so nothing breaks.--tagand a positional tag, no tag at all, or the wrong number of arguments gives a clear error.uploadTagAndFile, so it is unit-tested directly (7 cases), plus a test that the flag exists.I left
release download <tag> <asset-name>alone since the issue is about upload; happy to give it the same--tagtreatment in a follow-up if you want.Checks:
go test -race ./...andgolangci-lint runpass locally.This change was written with Claude Code (an AI coding agent); I ran the tests and linter above.