syntaxai/tdd.md · commit 9c0db74

Fix silent deploy failure: snapshot+sama-cli now run via podman, errors surface

Closes #13. /reports/live had been stuck on the 2026-05-03 → 2026-05-10
window for 12 days because the deploy script's snapshot step always
failed silently: it tried to invoke bun directly over ssh, but p620's
host has no bun on PATH (Bun lives only inside the tdd-md container).
The `2>/dev/null || echo ⚠ skipped (non-fatal)` line swallowed the
"bun: command not found" exit and pretended success on every deploy.

Same hidden failure on the sama CLI bundle step.

Fix:

- Run both scripts inside the existing localhost/tdd-md:latest image
  via `podman run --rm -v $HOME/src/tdd.md:/work:Z --workdir /work`.
  The :Z relabel is needed for the SELinux-enabled Fedora host.
- The bundle step uses `--entrypoint sh -c ...` because the alpine-
  based image doesn't ship bash.
- Drop the silent error suppression. Failures now print and exit 1.
- One-line presence check for IMAGE_TAG so first-ever deploys on a
  fresh p620 don't fault before the initial build runs.

Verification:
- /reports/live header now reads `2026-05-03 → 2026-05-22` (today)
- Snapshot file mtime moved from May 11 → today on p620
- /sama/verify?repo=syntaxai/tdd.md still 4/4 ✓ (no regression)

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
author
syntaxai <[email protected]>
date
2026-05-22 13:22:55 +01:00
parent
7b55b52
commit
9c0db746060f9397e91b7e8dfe602ab5030c0fe2

1 file changed · +20 −8

modified scripts/p620/deploy-tdd-md.sh +20 −8
@@ -138,17 +138,29 @@ else
138138 fi
139139
140140 # ---------------------------------------------------------------------
141-# Snapshot git-history + tests — only meaningful in git mode (rsync
142-# mode already did this above against the local tree).
141+# Snapshot git-history + bundle sama-cli — only meaningful in git mode
142+# (rsync mode already did this above against the local tree).
143+#
144+# p620 itself has no bun on the host PATH; the canonical Bun runtime
145+# lives in the tdd-md image. Run the scripts via `podman run` on the
146+# existing image, mounting the working tree so the writes land where
147+# the build context expects them. Surfaces non-zero exits — these
148+# steps used to be `2>/dev/null || echo ⚠ skipped` which silently hid
149+# 12 days of stale `/reports/live` data.
143150 # ---------------------------------------------------------------------
144151 if [[ "$MODE" == "git" ]]; then
145- echo "→ snapshot git history (on $SSH_HOST) → content/git-history/"
146- ssh "$SSH_HOST" "cd ~/$REMOTE_SRC_DIR && bun scripts/p620/snapshot-git-history.ts" 2>/dev/null \
147- || echo " ⚠ snapshot-git-history skipped (script may live outside the rsync exclude — non-fatal)"
152+ image_present=$(ssh "$SSH_HOST" "podman image inspect $IMAGE_TAG >/dev/null 2>&1 && echo yes || echo no")
153+ if [[ "$image_present" == "no" ]]; then
154+ echo " ⚠ image $IMAGE_TAG not present yet — skipping snapshot+bundle (will run on the next deploy after first build)"
155+ else
156+ echo "→ snapshot git history via podman run → content/git-history/"
157+ ssh "$SSH_HOST" "podman run --rm -v \$HOME/$REMOTE_SRC_DIR:/work:Z --workdir /work $IMAGE_TAG bun scripts/p620/snapshot-git-history.ts" \
158+ || { echo "✗ snapshot-git-history failed"; exit 1; }
148159
149- echo "→ bundle sama CLI on $SSH_HOST"
150- ssh "$SSH_HOST" "cd ~/$REMOTE_SRC_DIR && bun build scripts/sama-cli.ts --target=bun --outfile=public/sama-cli >/dev/null && chmod +x public/sama-cli" 2>/dev/null \
151- || echo " ⚠ sama-cli bundle skipped (non-fatal)"
160+ echo "→ bundle sama CLI via podman run → public/sama-cli"
161+ ssh "$SSH_HOST" "podman run --rm -v \$HOME/$REMOTE_SRC_DIR:/work:Z --workdir /work --entrypoint sh $IMAGE_TAG -c 'bun build scripts/sama-cli.ts --target=bun --outfile=public/sama-cli >/dev/null && chmod +x public/sama-cli'" \
162+ || { echo "✗ sama-cli bundle failed"; exit 1; }
163+ fi
152164 fi
153165
154166 echo "→ podman build $IMAGE_TAG op $SSH_HOST"