Skip to content

Add --tag to release upload for parity with release create - #172

Merged
andrew merged 2 commits into
git-pkgs:mainfrom
CloudCorpRecords:feat/168-release-upload-tag-flag
Oct 19, 2026
Merged

andrew merged 2 commits into
git-pkgs:mainfrom
CloudCorpRecords:feat/168-release-upload-tag-flag

Conversation

@CloudCorpRecords

Copy link
Copy Markdown
Contributor

Fixes #168

forge release create takes --tag, but forge release upload only accepted the tag positionally, which is awkward in scripts. This adds --tag to upload:

forge release upload v1.0.0 app.zip          # unchanged
forge release upload --tag v1.0.0 app.zip    # new
  • With --tag, the single argument is the file; without it, the existing <tag> <file> form applies, so nothing breaks.
  • Supplying --tag and a positional tag, no tag at all, or the wrong number of arguments gives a clear error.
  • The argument handling lives in a small pure helper, 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 --tag treatment in a follow-up if you want.

Checks: go test -race ./... and golangci-lint run pass locally.

This change was written with Claude Code (an AI coding agent); I ran the tests and linter above.

@andrew andrew left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address these two points:

  • In internal/cli/release.go, explicitly empty --tag bypasses conflict validation: forge release upload --tag='' v1.0.0 app.zip accepts the positional tag and proceeds to repository resolution. Check cmd.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 to UploadAsset. This will cover flag binding and the upload path together.

CloudCorpRecords added a commit to CloudCorpRecords/forge that referenced this pull request Oct 18, 2026
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).
@CloudCorpRecords

Copy link
Copy Markdown
Contributor Author

Both points addressed: uploadTagAndFile now takes Changed("tag") and rejects an explicitly empty --tag, so --tag='' can no longer fall through to positional mode. Tests run the command end to end for both supported forms and the invalid combinations (including both empty---tag shapes), asserting the tag and file contents passed to UploadAsset and zero calls on refusal — the empty-flag-with-positional case failed before the fix. Full internal/cli suite, go vet, and gofmt all clean.

CloudCorpRecords and others added 2 commits October 18, 2026 11:37
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>
@CloudCorpRecords
CloudCorpRecords force-pushed the feat/168-release-upload-tag-flag branch from 20ecf71 to c87889d Compare October 18, 2026 18:37

@andrew andrew left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@andrew
andrew merged commit 4aac417 into git-pkgs:main Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

forge release and upload parameter inconsistency

2 participants