fix(publish): commit a draft's edits without the repository hooks (AGT-4677) - #818
Merged
Merged
Conversation
…T-4677) A parked or unfinished run's uncommitted edits were committed for publication with the repository's hooks on, so work that did not pass lint never became a draft: AX-1797's was refused by ruff (SIM114 in tests/test_a1_cost_rules.py:236) and stayed in the worktree. Every other preservation commit in worktreeManager already uses --no-verify. Commit with --no-verify when the publication is a draft; a reviewed, non-draft publication keeps the hooks, because there the repository's own gate is the intent. The commit moves to publicationCommit.ts, which keeps worktreeManager.ts under its line cap and lets the rule be tested against a real repository with a failing hook.
The code under test runs a plain git commit, and the test only put the author identity in the environment of its own setup helper. A machine with a global identity passed; the CI runner has none and failed with 'Author identity unknown' (PR 818, first run). Set user.name and user.email in the repository.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR
commitAndCreatePRWithHeadcommitted the worker's uncommitted edits with the repository's hooks on. A draft exists only so parked or unfinished work is visible, so work that does not pass lint never became one and stayed in the worktree.Evidence (2026-10-03)
[Runner] Could not publish parked work for AX-1797: Command failed: git -C .../worktree/a69c25b8-... commit -m feat(AX-1797): ..., hook outputSIM114 [*] Combine if branches using logical or operator --> tests/test_a1_cost_rules.py:236:9(ruff, cgf-portal pre-commit). The run had spent 72 of 90 minutes.worktreeManager.ts:613,:736,:1328andworktreeEphemeralOps.ts:241already commit with--no-verify; only the publication commit did not.publishOnPark.tspassdraft: true.Change
publicationCommit.ts:commitStagedForPublication(worktreePath, message, { draft })adds--no-verifyonly whendraftis set. A reviewed, non-draft publication keeps the hooks: there the repository's own gate is the point.worktreeManager.tscalls it (1483 → 1484 lines; the file is near its 1500-line cap, so the logic lives in the new module).Tests
Against real temporary repositories whose pre-commit hook rejects every commit:
Mutations: keeping the hook for drafts fails the first; skipping it for everything fails the other two.
vitestworktree manager, publication commit and publish suites: 10 files, 198 tests pass.Risk
A draft PR can now contain lint-failing code. It is a draft, unreviewed, and CI lints it on the PR; the alternative was losing the work from view.
After deploy
A parked run whose edits fail the repository hook is published as a draft instead of logging
Could not publish parked work.