Skip to content

box: a status git cannot read stops the call before the version commit is built - #379

Merged
juliankang4 merged 1 commit into
midagedev:mainfrom
Burntgogi:fix/git-status-checked
Oct 16, 2026
Merged

juliankang4 merged 1 commit into
midagedev:mainfrom
Burntgogi:fix/git-status-checked

Conversation

@Burntgogi

Copy link
Copy Markdown
Contributor

Fixes #365.

A failed git status was discarded by the -z test, so a corrupt index read as clean and REMOTE_CMD exported BLOOMERY_GIT_COMMIT pointing at a commit whose dirt nobody saw.

  • The status is a checked assignment now (st=$(git -C "$HERE" status --porcelain 2>/dev/null)), under the condition the check serves: a tree whose HEAD reads. A tree the status fails on stops rc 70 naming the tree and Git's exit code, before REMOTE_CMD is constructed. A tree with no readable HEAD keeps its previous path (COMMIT=unknown), which is not the defect the issue names.
  • The self-test's scratch tree is a git repo with a committed HEAD (identity and hooks pinned), and a corrupt-index check sits at the boundary: printf 'x' > .git/index, then the call must end rc 70 naming $HERE and git exit 128, say what the mark would have been, and never reach ssh.

Checks on the fixed tree: tools/box.sh --self-test passes whole. The negative control — the same self-test against a copy carrying the old -z line — ends self-test 4 failed (rc 0, want 70, no tree/message in the output, and the command reached ssh).

…t is built

A failed git status was discarded by the -z test, so a corrupt index read as clean and REMOTE_CMD exported BLOOMERY_GIT_COMMIT without its -dirty mark. The status is a checked assignment now, read only where the HEAD reads: a tree whose HEAD succeeds stops rc 70 naming the tree and Git's exit code before REMOTE_CMD, and the self-test's scratch tree carries a committed HEAD with a corrupt-index check at that boundary.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: CLEAN: The status check rejects Git failures before constructing the version export, and the regression assertion rejects the old behavior.

Non-blocking

⚠ Use English for the new comment: tools/box.sh:1144. CONTRIBUTING.md requires English comments. Replace the three lines with # Reject unreadable dirt before exporting a known commit; trees without HEAD keep unknown. This keeps the new contract readable without a later translation edit.

Checked

Duplicates: no new functions, types or constants; no shared owner needed for this short check.
Complexity: no Rust functions changed. Dryer and crapper did not run.
Silent failure: 1 changed status read followed through the version export. Failed reads, including partial stdout, exit 70. Direct, local and queued execution share the check.
Tests: bash syntax and five isolated guard cases passed. The original status line returns 0 on Git exit 128; the added want 70 assertion rejects that result. The PR body reports the full self-test and negative control.
Gates: one corrupt-index regression case added; none removed or relaxed. No pins moved.
Escape catalog: no new C1–C4 pattern matched; Git's status is captured before another command can replace it.

Notes

The full self-test was not rerun; it creates scratch files outside the permitted review outputs.

🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)

Filed outside this PR: #381, #382

@juliankang4
juliankang4 merged commit 1181637 into midagedev:main Oct 16, 2026
6 checks passed
@juliankang4

Copy link
Copy Markdown
Collaborator

@Burntgogi Thanks for the contribution. The review is done, so I'm merging this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

box: failed Git status still publishes a source commit without a dirty marker

2 participants