status/finish: alarm when the local default branch is ahead of origin #224

Closed
opened 2026-07-17 17:17:27 +00:00 by hexajon · 0 comments
hexajon commented 2026-07-17 17:17:27 +00:00 (Migrated from codeberg.org)

Detection layer for the recoverable-guard tier (#222): damage that arrives by any route (raw git, another tool, a confused process) shows up as the local default branch being AHEAD of its origin counterpart - in a branch-and-merge flow, nothing should land there directly. madt_status already computes the ahead count; during the incident it dutifully reported "ahead 1" and nothing treated it as an alarm.

Behavior:

  • madt_status: when the inspected repo's DEFAULT branch is ahead of origin/, the report carries a prominent warning line (not buried in the ahead/behind numbers). Feature branches are unaffected (being ahead is their normal state).
  • madt_finish: the mainline-return step surfaces the same warning when it lands back on a local default that is ahead of origin. It warns; it does not block (the anomaly may predate the finish and is the user's to resolve).
  • CLI status/finish output mirrors both.

Pinned warning text (counts and branch names dynamic):

"warning: local 'main' is 2 commit(s) AHEAD of origin/main - in a branch-and-merge flow nothing should land on the local default branch directly. Inspect with: git log origin/main..main. If the commits are wanted, move them to a branch and finish normally; if not, your own shell can reset main back to origin."

Note the last clause deliberately points at the user's own shell for the reset - madtea does not carry a ref-rewind operation and must not name one.

Acceptance criteria:

  • Fixture with local default ahead: status (both surfaces) shows the warning with correct count; finish's return step shows it; exit codes unchanged (warning, not failure).
  • Local default in sync or behind: no warning; feature branches ahead: no warning.
  • raw_json carries a structured field (e.g. defaultBranchAhead) alongside the text.
  • Docs regenerated where the status output shape is documented.

Depends on #222.

Detection layer for the recoverable-guard tier (#222): damage that arrives by any route (raw git, another tool, a confused process) shows up as the local default branch being AHEAD of its origin counterpart - in a branch-and-merge flow, nothing should land there directly. madt_status already computes the ahead count; during the incident it dutifully reported "ahead 1" and nothing treated it as an alarm. Behavior: - madt_status: when the inspected repo's DEFAULT branch is ahead of origin/<default>, the report carries a prominent warning line (not buried in the ahead/behind numbers). Feature branches are unaffected (being ahead is their normal state). - madt_finish: the mainline-return step surfaces the same warning when it lands back on a local default that is ahead of origin. It warns; it does not block (the anomaly may predate the finish and is the user's to resolve). - CLI status/finish output mirrors both. Pinned warning text (counts and branch names dynamic): "warning: local 'main' is 2 commit(s) AHEAD of origin/main - in a branch-and-merge flow nothing should land on the local default branch directly. Inspect with: git log origin/main..main. If the commits are wanted, move them to a branch and finish normally; if not, your own shell can reset main back to origin." Note the last clause deliberately points at the user's own shell for the reset - madtea does not carry a ref-rewind operation and must not name one. Acceptance criteria: - Fixture with local default ahead: status (both surfaces) shows the warning with correct count; finish's return step shows it; exit codes unchanged (warning, not failure). - Local default in sync or behind: no warning; feature branches ahead: no warning. - raw_json carries a structured field (e.g. defaultBranchAhead) alongside the text. - Docs regenerated where the status output shape is documented. Depends on #222.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sixfold-space/madtea#224
No description provided.