---
name: exit-zero-from-a-flag-order-noop
description: "mirror-public.sh takes --apply ONLY in position 1; `script vX.Y.Z --apply` ran as a dry run, printed DRY-RUN ok and exited 0 — a success code for work never done."
metadata: 
  node_type: memory
  type: feedback
  originSessionId: 1b6eb63e-f879-4c62-831e-a6b6a6f69bde
  modified: 2026-08-22T06:41:26.211Z
---

2026-08-22, publishing claude-spt v0.29.0: `sh ci/publish/mirror-public.sh v0.29.0 --apply`
exited **0** and mirrored **nothing**. The script parses `--apply` only as `$1`
(`if [ "${1:-}" = "--apply" ]; then APPLY=1; shift; fi`), so the trailing flag became part of
nothing and the run fell through to the dry-run branch — which prints `DRY-RUN ok` and exits 0.

**Why:** an exit code answers "did the script finish", never "did it do the thing". A no-op path
that is a legitimate mode of the tool exits 0 by design, so status alone cannot separate
"applied" from "declined to apply". This is the same family as
[[msys-grep-instrument-traps]] and [[two-tmp-namespaces-publish-trap]]: the instrument returned
the reassuring answer.

**How to apply:** for any publish/apply step, (1) read the OUTPUT TEXT for the mode it actually
ran in, not just `$?`, and (2) confirm at the CONSUMER — `git ls-remote --tags <remote> <tag>`
for a mirror, `gh release view --json assets` for a release asset — never from your own log.
Flag position matters in these hand-rolled sh scripts: `--apply` first, then the ref.
Related: [[list-vs-predicate-assertions]] (a gate that passes by skipping the case it tests).

**Hit AGAIN on 2026-08-25 (v0.30.0), with this memory already written.** Same command shape,
same `DRY-RUN ok`, same exit 0 — knowing the trap did not prevent it, because the muscle memory
is `<script> <version> <flag>`. What caught it was the habit half, not the knowledge half: I read
the output text and saw `DRY-RUN ok` where `mirrored:` belonged. Treat the CONSUMER CHECK as
mandatory rather than as a belt-and-braces extra: `git ls-remote --tags` after every mirror,
before reporting anything as published.
