Shell and git

A pipe hides a failed command, and && carries on anyway#

  • Symptom: gh pr merge ... | tail -1 && git checkout main && git tag v1.1.0 && git push origin v1.1.0 printed nothing. The PR was still open, and a release tag was pushed onto the previous commit.
  • Cause: a pipeline's exit status is that of its last command (tail), which succeeded. && only sees that.
  • Fix:
    • Never pipe a command whose success gates the next step.
    • Run it alone, or use set -o pipefail.
    • Before tagging or deploying, check the state: gh pr view N --json state must be MERGED.
  • Found in: Alt-SAMP/Brand v1.1.0, 2026-11-20. The tag was moved to the merge commit minutes later.

Another session may be working in the same checkout#

  • Symptom: git status -sb shows a branch you never created (e.g. feature/proper-shaders-m0), and files you didn't touch are modified.
  • Cause: a second agent session was started in the same repo folder. Branching or switching there changes its working tree under it, and branching from its branch can pull its commits into your PR.
  • Fix:
    • Before any git operation in a repo, run git status -sb, and check running sessions in that folder (the app's session list).
    • If the folder is shared, work in your own worktree: git worktree add ../<Repo>-<task> <base-branch>.
    • If it already happened, check what your PR contains (gh pr view N --json commits), put the other session's checkout back on its branch without touching its edits, and tell that session.
    • Unity projects in a fresh worktree need a full reimport (no Library/), so plan builds accordingly.
  • Found in: Alt:SA Engine, 2026-11-20. No damage: the other branch had no commits yet.

Files generated on Windows break checksum tools elsewhere#

  • Symptom: sha256sum -c fails for every line with No such file or directory.
  • Cause: Python's str(path) gives backslashes, and write_text writes CRLF on Windows.
  • Fix: use Path.as_posix() for paths that go into manifests or archives, and write_text(..., newline='\n').
  • Found in: Alt:SA brand kit packager, 2026-11-20.

Inline scripts: write them to a file#

  • Symptom: a heredoc with nested quoting or <<EOF ... || ... <<EOF2 starts an interactive Python REPL and hangs the shell call. Escaped \n inside a Python string in a heredoc may not survive either.
  • Fix: for anything beyond a few lines, write the script to a scratch file with the editor tool and run python -I file.py. For exact one-line replacements in existing files, use the editor's replace tool, not sed with tricky regex.

SVG to PNG without Inkscape#

  • Use: @resvg/resvg-js@2.6.2 with Node. new Resvg(svg, { fitTo: { mode: 'width', value: W } }).render().asPng(). It has no native dependencies to compile. Outlined text renders exactly; it doesn't need system fonts.
  • Found in: Alt:SA brand kit rebuild (06-source/render-svg.cjs), 158 renders in under 2 minutes.

Site data synced from the wrong branch#

  • Symptom: the live changelog showed a version that was only on a draft PR and missed the newest release.
  • Cause: site.config.json synced release-notes.json from a worktree that was checked out on a feature branch.
  • Fix: sync data only from a checkout on the release branch (dev/main), never from a feature worktree. Say which branch it must be in the site repo's AGENTS.md.
  • Found in: altmp.app first deploy, 2026-11-20.

Wrangler: a placeholder account_id breaks deploy#

  • Symptom: wrangler deploy fails on "account_id": "<CLOUDFLARE_ACCOUNT_ID>".
  • Fix: leave account_id out of wrangler.jsonc. Wrangler uses the signed-in account when there is only one, or CLOUDFLARE_ACCOUNT_ID from the environment. Pages are served at clean URLs: /page.html redirects (307) to /page.
  • Found in: altmp.app sites, 2026-11-20.