Skip to content

CLI: reject an already-published version before uploading anything - #18

Merged
madhavkhoslaa merged 2 commits into
mainfrom
cli-check-duplicate-version
Oct 16, 2026
Merged

madhavkhoslaa merged 2 commits into
mainfrom
cli-check-duplicate-version

Conversation

@madhavkhoslaa

Copy link
Copy Markdown
Contributor

What

vapour publish now checks the project's published releases (GET /projects/:id) before uploading anything. If the version is already published — e.g. 0.3.1 was pushed and vapour.toml still says version = '0.3.1' — it fails immediately with:

error: version 0.3.1 is already published. Bump "version" in vapour.toml (or pass --version) and run publish again

Why

The only enforcement was the server's 409 version_exists, which the CLI discovers after the whole build zip has been uploaded. For a large build that is minutes of wasted upload before the developer is told to change the config.

Changes

  • internal/api: Client.GetProject (owner view of a project) and Game.Releases / Release.
  • cmd/publish.go: checkVersionFree runs right after ensureProject, before the store page push and the build upload. The 409 handling stays as the fallback (two publishes racing, or an older server).
  • cmd/cmd_test.go: fake API serves GET /projects/g1 with the published releases; the flow test asserts the blocked repeat never reaches /projects/:id/publish (server sees only 0.2.0 and 0.3.0).

Testing

go build ./... and go test ./... pass (run in a clean copy of the tree; note the untracked WIP files cmd/controller.go, cmd/template.go, internal/devserver etc. in the working dir do not compile against internal/project yet — unrelated to this change).

publish now fetches the project's releases first and stops if the version
is already published, so a repeat (e.g. pushing 0.3.1 twice) fails in
seconds instead of after a full build upload, with the existing message
telling the developer to bump "version" in vapour.toml or pass --version.
The server-side 409 version_exists handling stays as the fallback.
@madhavkhoslaa
madhavkhoslaa merged commit 4143146 into main Oct 16, 2026
1 check passed
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.

1 participant