Skip to content

feat(app submit): a resubmit replaces your own version in review - #1005

Merged
ZacxDev merged 3 commits into
mainfrom
feat/resubmit-replaces-pending
Dec 3, 2026
Merged

ZacxDev merged 3 commits into
mainfrom
feat/resubmit-replaces-pending

Conversation

@ZacxDev

@ZacxDev ZacxDev commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

What

The Civitai server now replaces an author's own App Block version that is still waiting for review with a new submit (civitai/civitai#11502). The old version is marked replaced, its store listing and media are kept, and moderators see only the new version. Before, a second submit was refused ("withdraw it first"), and withdrawing a first version deleted its draft listing.

civitai app submit now handles that case:

  • Same version as the one in review: refused with the exact bump, e.g. pixel-garden@0.2.4 is already waiting for review (pubreq_…); set "version" to 0.2.5 in block.manifest.json, then submit again. It exits 1 like the version-regression guard: the project is wrong, not the invocation.
  • Different version: announced, naming the version and publish request it replaces. On a terminal without --yes it asks first (Replace the version in review? [y/N]). --yes and unattended runs print the line and go ahead.
  • Success output names the replaced submission, from the submit answer's new replaced field.

The guard reads GET /api/v1/blocks/submissions, which is scoped to the caller's own submissions, so a pending row there is the caller's own and is the one the server replaces. It shares one read with the version guard (onceLister). A failed read warns and the submit goes ahead, since the server enforces the replace rule itself. Like the other network guards, it runs after the submit confirmation and is skipped by --package-only and by a run with no token.

README: the submit section and the exit-code list both describe it.

Testing

  • go build ./...
  • go test ./internal/cmd/... passes.
  • go test ./internal/appapi/...: TestSubmitVersionDoesNotTagWhenTheWriteWasCutShort fails its own CONTROL check on this machine, and it fails the same way on an unmodified origin/main checkout. It is environmental and not caused by this change. CI is the verdict.
  • New tests in internal/cmd/app_submit_pending_guard_test.go:
    • same-version refusal text and exit kind;
    • --yes announces without asking;
    • a TTY asks, and only y/yes proceed;
    • another app's pending row is ignored;
    • a failed read warns;
    • one read serves both guards;
    • nextPatchVersion cases.

🤖 Generated with Claude Code

ZacxDev and others added 3 commits December 3, 2026 11:46
The server now replaces the author's own version still waiting for review with a
new submit (civitai/civitai#11502), keeping its store listing and media. On top:

- a submit whose manifest declares the same version as the one in review is
  refused with the exact bump (set "version" to 0.1.1 in block.manifest.json),
  exit 1 like the version guard;
- otherwise the submit says which version (and publish request) it replaces and,
  on a terminal without --yes, asks first;
- the success output names the replaced submission (the submit answer's
  `replaced`).

The guard reads the same GET /api/v1/blocks/submissions as the version guard,
through one read; a failed read warns and the submit goes ahead.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ng withdraw

Audit round 1 follow-ups (no deploy-blocker):
- end-to-end app submit tests: the same version is refused before uploading
  (ErrSameVersionInReview, the exact bump), a new version is announced, one
  submissions read serves both guards, and the success line names the replaced
  submission;
- app submit --help lists the guard; app withdraw --help and the page-money
  scaffold README say to submit again rather than withdraw to update a version
  in review;
- the pending status is compared case-insensitively, and the prompt reads one
  line (readPromptLine) rather than through a buffered reader.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@ZacxDev

ZacxDev commented Dec 3, 2026

Copy link
Copy Markdown
Contributor Author

Audit round 0 (requirements and deletion): proceed to the checklist. Every behaviour traces to the operator's two asks. No open premises.

D1 — onceLister (internal/cmd/app_submit_pending_guard.go) and its test: a caching wrapper that saves one GET /api/v1/blocks/submissions per submit; two direct client.ListSubmissions calls would do

Audit round 1 (the nine correctness axes), read at 9060c5fc24. It found no 🔴 issues, so the ladder ends here. The 🟡 and two 🟢 findings are fixed in ff1f088bad, which has not been re-audited.

1. end-to-end app submit tests cover the guard wiring: same version refused before upload, new version announced, one submissions read, the replaced line on success
2. app submit --help lists the guard; app withdraw --help and the page-money scaffold README no longer advise withdrawing to update a version in review
3. the pending status compare is case-insensitive and the prompt reads one line via readPromptLine

Two 🟢 findings are left open:

  • 409 pending_version_being_approved: the server's message is printed verbatim, followed by the generic bundle diagnosis, which is the existing behaviour for every 409.
  • Same-version compare is exact: it compares the version strings exactly, so v0.2.4 and 0.2.4 count as different versions.

@ZacxDev
ZacxDev merged commit b36a201 into main Dec 3, 2026
9 checks 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