Skip to content

feat: batch --integration --push — publish review refs, never forced, swept by sweep-after - #340

Merged
Jammy2211 merged 5 commits into
mainfrom
feature/batch-review-integration-p3
Sep 2, 2026
Merged

Jammy2211 merged 5 commits into
mainfrom
feature/batch-review-integration-p3

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

Summary

Closes #339. Phase 3 of the batch review integration branches (phases 1-2: #338). batch collect --integration --push publishes each integration/<slot> the local leg built to origin, from the laptop's own git auth, so the merged review state can be checked out on another machine or handed to CI.

Three rules make it safe to leave on:

  • Never forced. A remote ref whose tree is identical to the local one is not re-pushed (the local re-cut mints new merge SHAs every run, so trees are compared, not commits); a fast-forward is pushed plainly; anything else is published under the first free integration/<slot>-N and the earlier ref is left untouched. _integration.py contains no force flag at all, and a test pins that.
  • Expires. The record gains - integration-remote: Repo:branch, … (rewritten on every push) and - sweep-after: YYYY-MM-DD (filled once, default review-at + 7 days, a human value wins). bin/branch_sweep.sh gains --records <batches dir> and an integration/* case: protected while no record names the ref or its sweep-after is today or later, sweepable the day after. Deletion stays on the existing workflow_dispatch path; the three sweep workflows pass --records (the Brain per-repo sweep gains the same PyAutoMind checkout the org-wide one already has).
  • Doctrine. AUTONOMY.md's "no network except one opt-in flag" bullet records the batch exception: fetch + push, opt-in, laptop-only, throwaway integration/* refs only, never main, never a PR, never a base.

--push without --integration is a usage error (rc 2); non-laptop lanes refuse with a pointer at GITHUB_ACCESS.md; a push failure is a note with pushed=false and never changes the merge verdict. A pushed conflicted repo carries only the merged members, and the panel says so.

API Changes

  • pyauto-brain batch collect --integration --push (new flag, collect-only, requires --integration).
  • Evidence/--json integration rows gain remote_branch, pushed, push_note; the block gains pushed, sweep_after.
  • Batch record keys integration-remote: and sweep-after:; collect() exposes review_at / sweep_after.
  • bin/branch_sweep.sh --records <dir>; new integration/* classification (integration-no-sweep-after / integration-until-<d> protected, integration-expired-<d> sweepable).
  • Packet panel and report name the remote branch and the expiry when pushed.
    See full details below.

Test Plan

  • tests/test_batch_integration.py (31 tests): origin carries the branch equal to local; after main moves the first ref is untouched and -2 appears; unchanged refresh mints nothing; conflicted repo publishes its partial branch; failed push is a note and the verdict stands; --push without --integration rc 2; plan --push rc 2; cloud lane refuses; record stamps + default sweep-after = review-at + 7d; human sweep-after preserved; unparsable review-at fallback; panel/report text; no force flag in the module.
  • tests/test_branch_sweep.py (14 tests): expired sweepable, future and same-day protected, no record protected, another repo's record does not answer for this one, delete removes only the expired branch.
  • Full Brain suite: 834 passed (one deselect: the pre-existing Cortex worktree-symlink test, filed as draft/bug/pyautobrain/cortex_test_worktree_symlink.md). bash -n and YAML loads on all three workflows.
  • Real-repo smoke with --integration only: report renders, git ls-remote origin 'refs/heads/integration/*' empty on PyAutoBrain/PyAutoFit/PyAutoArray afterwards. No real --push was run — the first push of a slot against PyAutoLabs repos is the human's call, in front of a packet with the sweep-after date in view.
Full API Changes (for automation & release notes)

Added

  • _integration.py: push_repo(row, wt, slot, notes), run(..., push=False), NOT_LOCAL_PUSH, MAX_SUFFIX.
  • _batch.py: --push, sweep_after_default(review_at, notes), SWEEP_DAYS, _fill_key use for sweep-after, integration-remote stamp, remote/expiry in _integ_detail / _integration_report / _integration_panel.
  • bin/branch_sweep.sh: --records, integration_sweep_after(), integration/* case arm.
  • Workflows: --records in branch_sweep.yml (+ PyAutoMind checkout) and branch_sweep_all.yml.
  • Docs: AUTONOMY.md clause; batch AGENTS.md "Pushing the integration branch (--push)"; batch.sh; skills/batch/batch.md.

Removed

  • none

Migration

  • none; opt-in and additive. Companion PyAutoMind PR documents the record keys and passes --records in the Mind's own sweep workflow.

Generated by the PyAutoLabs agent workflow.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NR2L4MT5kTP8Lu9eR7dPUP

Jammy2211 and others added 4 commits September 2, 2026 17:33
…ed (#339)

`push_repo` is the only remote write the batch makes: one throwaway
`integration/<slot>` review ref per repo, never a pull request and never a
base for one.

Nothing already on origin is ever moved. There is no force flag and no lease
in the module at all; the decision is four arms in order — skipped merge
publishes nothing; an identical TREE on `origin/<branch>` is not re-pushed
(the branch is re-cut every run, so commit SHAs always differ and comparing
them would pile up `-2 … -20` on every refresh); a genuine fast-forward is
pushed plainly; a diverged branch is published beside the old ref as the
first free `-N`, leaving what a reviewer may be reading exactly where it is.

A push that fails is a note and a `push_note`, never a change of `status`:
the merge verdict is a fact about the merge, and a network failure must not
turn a clean integration into a conflicted one.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NR2L4MT5kTP8Lu9eR7dPUP
…e packet (#339)

`--push` is a collect flag that needs `--integration` (a usage error, rc 2,
the same path as `plan --integration`) and is refused on `plan` through
COLLECT_ONLY. The record cannot ask for it: `- integration: yes` requests the
LOCAL preview, and putting a ref on GitHub stays an act the human types.

What was published is stamped on the record as `- integration-remote:
<Repo>:<branch>, …` — rewritten on every push, because the current
publication is the truth, and under the name `branch_sweep.sh --name` matches
on. `- sweep-after:` is the date the sweep may delete those refs: `review-at:`
plus a week by default, filled once and never overwritten, because a date the
human typed is a decision about their own review. An unreadable `review-at:`
falls back to today plus a week and says so in the notes.

The report and the packet both name the remote branch and the expiry, through
the one `_integ_detail` helper, and the panel withdraws its "nothing is
pushed" promise exactly when it stops being true.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NR2L4MT5kTP8Lu9eR7dPUP
An `integration/*` ref is a merge preview — cut from the base with every
member's head merged in — so it is unmergeable by construction and no
containment proof will ever clear it. Under the existing gates it would sit on
origin forever, which is how a review aid becomes litter.

So it is cleared by date alone: the `- sweep-after:` on the batch record whose
`- integration-remote:` names this repo and this branch. The records come from
`--records <dir>`, a checkout of PyAutoMind's `batches/` — the Mind's own
sweeper already IS that repo and the org-wide sweeper already checks it out at
`.mind`, so only the Brain's per-repo sweeper needed a checkout step of its
own. No API paging, no second credential, no JSON in bash.

Every failure direction points at KEEP. No records dir, no record naming the
branch, no date on the record: protected. The date is compared >= today, not >
today, because `sweep-after: <today>` is the morning the human sits down with
the preview — expiry starts the day after. The repo half of `<Repo>:<branch>`
is matched too: one slot publishes the same branch NAME into every affected
repo, so branch-only matching would let one repo's record expire another's ref.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NR2L4MT5kTP8Lu9eR7dPUP
`AUTONOMY.md`'s network bullet named exactly one exception, and the batch's
`--fetch`/`--integration` had quietly become a second. It says so now, and the
push leg with it: opt-in, non-default, laptop-only, throwaway `integration/*`
refs and nothing else, never forced, always with an expiry.

The conductor's `AGENTS.md` gains the subsection the flag needed — what is
published (including a conflicted repo's partial branch, with the left-out
members still named), why there is no `--force` anywhere in the path, why the
refresh compares trees rather than commits, and how the ref dies. Plus a
doctrine-table row, the three new row keys and two block keys in the JSON, and
the two record keys under "What it stamps on the record".

`batch.sh`'s usage and the `batch` skill's collect bullet say the same thing in
one line each, because the flag is discovered from those two places long before
anyone opens the conductor's doc.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NR2L4MT5kTP8Lu9eR7dPUP
…339)

The tenant firewall flags 'PyAutoFit' and 'pyautolabs.github.io' as instance
facts in organ code; the comments now use generic placeholders.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NR2L4MT5kTP8Lu9eR7dPUP
@Jammy2211
Jammy2211 merged commit fb82aab into main Sep 2, 2026
2 checks passed
@Jammy2211
Jammy2211 deleted the feature/batch-review-integration-p3 branch September 2, 2026 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: batch --integration --push — publish review refs, never forced, swept by sweep-after

1 participant