[READ-ONLY] Mirror of https://github.com/Aquaticat/Monochromatic. TypeScript and Rust monorepo: Claude Code and Pi coding-agent plugins, a m
Monochromatic doc handover cli-git-native-auto-push.md

Native auto-push lane (evidence) #

Lane: auto-push. Worktree: .claude/worktrees/cli-git-lane-auto-push. Branch: feat/cli-git-native-auto-push, based on feat/cli-git-native-transactions at 7bd2729505. Image tag: autopush. Brief: /var/home/user/temp/agent/lane-brief.md.

Scope #

Phase 1 (slice 9's independent parts): branch keys, last-pushed records, single flight with joins, auto-push orchestration with failure reporting, and the post-commit policy gate over a landed delta. Phase 2: manual-push listings for the content policies with the push lifecycle.

Commits #

  • 8c7d2f0fba port auto-push branch keys, records, single flight and orchestration.
  • 4f0fbdf87e concurrency tests for single flight and joins across racing and killed processes.
  • e70478ebdd explicit returns in auto-push closures (Clippy).
  • b4694e15e6 post-commit gate over the landed delta before auto-push.
  • c53695377a explicit returns in post-commit test closures (Clippy).
  • caab11ba04 manual-push update probe with a private dry-run recorder.
  • cd76c3c8cb commits a manual push newly publishes.
  • 8c7ab5a150 manual-push candidate listing and the push lifecycle, natively.
  • 954f6a2805 planted guard removals for the new gates, and the control test update.
  • 63625b0802 empty duplicate of 954f6a2805, created by the commit hook; no content.
  • 1ad7cc9617 refuses a remote ref deleted after negotiation; repoints two planted controls at the tests that kill them.
  • 6648ae7512 merge of feat/cli-git-native-transactions (one import conflict, resolved to the transactions side).
  • e2bf4ba277 pins the final-tree scope of a pushed tip with no published base (closes a surviving mutant).

Modules #

Phase 1 (package/git-policy/cli/src/native/):

  • auto_push_branch_key.rs (+ _tests.rs, 7 tests): encodeBranchKey and decodeBranchKey. Fixture pairs were generated by Node 26 running the TypeScript encoder.
  • auto_push_record.rs (+ _tests.rs, 9 tests): parse and validate, tolerant read, JSON.stringify-identical encoding, candidate write with mode 0600 then rename, candidate removal on failure.
  • auto_push_single_flight.rs (+ _tests.rs, 14 tests): early join, join after the owner lock with the owner-token rule, dead-owner takeover, failed push output, uncovered tip, coalescing across threads.
  • auto_push.rs (+ _tests.rs, 11 tests; _concurrency_tests.rs, 7 tests): upstream and origin probes, detached note, push argument selection, output filter, failure reporting that never changes the commit's status.
  • post_commit.rs (+ _tests.rs, 9 tests): the gate over a landed delta, the commit-landed event, exit 2 when blocked, and the backup only for clean or warning-only gates. run_post_commit is the integrator entry point.

Phase 2:

  • manual_push_probe.rs (+ _tests.rs, 11 tests): a private dry-run push (git -c core.hooksPath=<private> push --dry-run --verify) whose generated pre-push shell hook writes each update record, then git ls-remote --refs per destination. A value that changed after negotiation stops the probe.
  • manual_push_range.rs (+ _tests.rs, 8 tests): peeled prior values, remote-tracking refs matched literally per remote, published tips, rev-list --not scopes, final-tree scope when no base is known, fail-closed non-commit targets.
  • manual_push_lifecycle.rs (+ _tests.rs, 3 tests): the scope of one push, from probe to candidate request.
  • wrapped_command.rs (shared): prepare_manual_push runs before the manual-push stage. The probe working directory is the worktree root from the repository location, falling back to the process directory.

Shared modules changed (outside the lane's own files) #

  • candidate_prediction.rs: CandidateRequest::Landed(ObjectId) and CandidateRequest::Pushed(PushedScope). Both return before the staged prediction; no private-index work is needed for them, but the private index is still created for uniform cleanup.
  • candidate_store.rs: committed_records, tree_records and the added_raw_from_ls_tree converter. Tree listing skips submodule entries, whose content is a commit name that no content policy reads.
  • policy_events.rs: PolicyEvent::CommitLanded { oid }, rendered as the incumbent's commit-landed line.
  • policy_trigger.rs: trigger_is_ported is true for every trigger, including PostCommit and ManualPush.
  • policy_trigger_tests.rs, policy_pass_tests.rs, policy_engine_tests.rs: expectations that the post-commit and manual-push refusals exist were replaced; the unported_triggers_are_unavailable_not_clean and an_unported_lifecycle_is_unavailable tests were removed because no trigger is unported now.
  • wrapped_command_tests.rs: scripted-fact push cases now expect exit 2 with a content-unavailable failure; the manual-push refusal helper was removed.
  • binary_frontier_tests.rs: a_real_push_is_scanned_and_forwarded (replaces the refusal test) and a_real_push_of_a_nonconforming_commit_is_refused_and_publishes_nothing.
  • binary_controls_tests.rs: the push case expects the content-unavailable failure.
  • bin/native-planted-controls.mjs: four additive planted guard removals (manual-push confirmation, single-flight join, post-commit blocking, manual-push final-tree scope).
  • lib.rs: additive pub mod lines.

Gates #

Image localhost/git-policy-native-test:autopush (Git 2.56.0 in the container) at head 15cc6dfd70: image id prefix cd09d902b879. Container tests: lib 939 passed, 3 ignored; binary 44 passed; doc 1 passed; Clippy build finished. Earlier runs at the same code failed three binary tests on the 5-second time bound while host load was about 44; the reruns passed.

Host Git 2.55.0 (native:test:host) at head e2bf4ba277: lib 929 passed, 10 failed, 3 ignored. The 10 failures are the Git 2.56-specific tests listed under Git 2.55 differences; the set is unchanged. Commits after e2bf4ba277 change only the mutation script's option parsing (7b621481d7) and a doc comment (15cc6dfd70), and the gate ran after both.

Git 2.55 differences #

Host Git 2.55.0 fails these 2.56-expecting tests (none touches this lane's code paths): command_add::tests::table_and_bulk_spellings_match_git (--no-verbose family and --intent-to-add, --resolved, --auto-advance option tables), command_branch_create::git_tests::tables_match_git, paired_branch_options_match_git, single_branch_options_match_git (branch option tables, e.g. --edit-description, --delete-merged=, --forked=), command_options::git_tests::curated_sequences_match_git_parse_options, default_mode_matches_..., stop_at_non_option_mode_..., keep_dashdash_mode_... (help request parsing: -h is a help request in 2.55 and not in 2.56 mode), git_metadata::tests::queries_capture_output_and_exit_state and global_arguments::tests::native_git_256_controls_confirm_the_option_boundary (the git version text is 2.55.0). The native minimum is being lowered to 2.55.0 (user decision 2026-10-10), so these expectations need the integrator's attention before cutover.

Mutation #

Lane campaign (native-mutation-VBPL00) over manual_push_probe.rs, manual_push_range.rs, manual_push_lifecycle.rs, post_commit.rs and policy_trigger.rs, run at 6648ae7512:

  • Planted controls: 18 of 18 noticed (exit 101 each). The manual-push confirmation and single-flight join controls were repointed in 1ad7cc9617. The coordinated-Git lease control is noticed after the transactions merge.
  • cargo-mutants: 110 mutants; 33 caught, 21 unviable, 1 missed, 55 timeouts, 1 baseline success.
  • The missed mutant (manual_push_lifecycle.rs:152, !trees.contains in the final-tree branch) is killed by the_pushed_scope_lists_each_final_tree_once (commit e2bf4ba277); the mutation fails that test.
  • The 55 timeouts are not verified kills. The test phase limit is 90 seconds (--timeout 90 in bin/mutate-native-container.mjs), and the unmutated baseline test phase took about 73 seconds under host load. Rerun these mutants with a larger limit on an idle host to classify them.

Shared-module campaign (native-mutation-gSluCG) over candidate_prediction.rs, candidate_store.rs, policy_events.rs and wrapped_command.rs at e2bf4ba277:

  • 93 mutants; 56 caught, 26 unviable, 0 missed, 11 timeouts, 1 baseline success.
  • The 11 timeouts have the same cause and the same unverified status as the lane timeouts.
  • The first attempt failed its baseline on the 5-second time bound under host load and was rerun.

Trailing gates #

Per the user decision of 2026-10-11, lane mutation campaigns and the auto-push-only modules trail the cutover.

Results so far (scoped runs with --timeout 300, one file at a time through gate-slot.ts):

  • policy_trigger.rs: 9 mutants; 6 caught, 1 unviable, 1 missed, 1 baseline success. The missed mutant (replace trigger_is_ported -> bool with true) is equivalent: the exhaustive match over the five Trigger variants already answers true for each, so no test can kill it. The doc comment that still said manual push was unported was corrected in 15cc6dfd70.
  • post_commit.rs: 6 mutants; 2 caught, 4 unviable, 0 missed, 0 timeouts. The 90-second timeout is caught at 300 seconds.
  • Not yet rerun at 300 seconds. Their 90-second timeouts are unverified, not kills:
    • manual_push_probe.rs: 26 timeouts (the rerun was stopped by the user decision; nothing recorded).
    • manual_push_range.rs: 26 timeouts.
    • manual_push_lifecycle.rs: 1 timeout.
    • policy_events.rs (shared): 11 timeouts. Of the 66 timeouts recorded before the reruns, 2 are resolved (policy_trigger.rs, post_commit.rs) and 64 are unresolved.

Exact rerun commands, one at a time (run from the worktree root, after the previous unit has stopped):

cd package/git-policy/cli
systemd-run --user --unit=autopush-timeout-<name> --collect --property=MemoryMax=12G --working-directory=$PWD --setenv=GIT_POLICY_NATIVE_IMAGE_TAG=autopush node "$HOME/temp/agent/gate-slot.ts" mise run //package/git-policy/cli:native:mutation:scoped -- --timeout 300 --file src/native/<file>

With <name> and <file> set to manual-push-probe and manual_push_probe.rs, manual-push-range and manual_push_range.rs, manual-push-lifecycle and manual_push_lifecycle.rs, policy-events and policy_events.rs.

Auto-push-only modules (not run): mutation over auto_push.rs, auto_push_branch_key.rs, auto_push_record.rs and auto_push_single_flight.rs; fuzz (none names auto-push or manual-push); the interop matrix beyond one-direction fixtures; Windows checks (the probe and auto-push code is unix-only).

Open facts and choices to veto #

  • The manual-push probe records updates with a runtime-generated shell pre-push hook. The incumbent generates a Node hook, and the ledger lists the native form as undetermined. Choice to veto: a shell hook under the private probe directory.
  • The hook is capped at 16 MiB plus one byte; a larger input fails the probe as the incumbent does.
  • Non-commit pushed objects (annotated tags, trees, blobs) fail closed with a content-unavailable failure. The incumbent materializes them; that scan is not ported.
  • Submodule entries in a pushed tree are not scanned (no content policy reads them).
  • The post-commit gate takes the landed commit as input; the integrator must pass the wrapper's global prefix and child environment so that every query reads the repository the commit landed in.
  • The commit path still refuses (Unported::CommitTransaction), so the TypeScript git commit binary cases (auto-push-concurrency, post-commit end to end) are reproduced at the library level with helper processes and the binary-level auto-push test waits for the integration step.
  • The post-commit exit status for a blocked gate is 2 (the incumbent's PolicyDecisionError(2)), not the native BLOCKED_EXIT_CODE.
  • The TypeScript post-commit and manual-push fixtures use injected plugin policies; the native port uses the built-in final-newline and forbidden-strings policies at fixed severities.

Status #

Gated commit: 15cc6dfd70 (container gate passed there: lib 939, binary 44, doc 1, Clippy). Planted controls: 18 of 18 noticed in the lane run. The one surviving lane mutant from the first run is closed in e2bf4ba277. Mutation: the trailing rerun results are above; 64 of 66 timeouts are unverified. Host Git 2.55 check: 929 passed, 10 documented Git 2.56-specific failures.