Skip to content

feat(fast-forward): deterministic harness and the remaining ideas - #147

Merged
synthet merged 3 commits into
mainfrom
af/scf-9wg8d-fast-forward-deterministic-harne
Nov 29, 2026
Merged

synthet merged 3 commits into
mainfrom
af/scf-9wg8d-fast-forward-deterministic-harne

Conversation

@synthet

@synthet synthet commented Nov 29, 2026 •

Copy link
Copy Markdown
Owner

Refs scf-9wg8d

Builds on #141 (scf-sh3h2, merged): that PR shipped the SKILL.md from the draft.

The owner asked for the fast-forward skill built from every idea in docs/fast-forward. This PR adds the deterministic harness and the remaining ideas.

What changed

  • scripts/fast_forward.py (stdlib) with three commands:
    • inventory: read-only facts per repository.
    • plan: rule-based rows: noop, ff, ff-ref, archive-ff, switch or needs-human, each with its reason.
    • apply: runs only the fast-forward rows, and refuses a row when HEAD, the SHAs, the holder, the tracked changes or the collision hashes moved since planning. It checks the git config digest after every action and stops on drift, then writes a receipt with undo commands.
    • Git always gets an argument list (no shell) with prompts off, and each repository has its own timeout.
  • SKILL.md:
    • sync (the default) and land modes;
    • scope, and asking other sessions before a write;
    • the harness and its rows;
    • an occupied default branch is fast-forwarded in its own worktree, not by moving the ref;
    • git switch --no-track -c and git branch -f --no-track; in a temp repo, branch -f <default> origin/<default> did write tracking into .git/config;
    • bounded polling of check state instead of a fixed five-minute wait;
    • section 7, after the fast-forward: 0 0 is not deployed; binaries held open; [gone] and squash-merged branches are listed; retries;
    • the per-repo report table, and the config-digest comparison for land.
  • references/details.md: CI states that look wrong, cross-PC rules, Windows details and generated snapshots.
  • tests/test_fast_forward.py: 19 cases on temp repos with a local bare origin and an isolated git config (CI runs tests/, not skill-local tests). Mutation checks were run on stale-plan refusal, different-copy detection, switching with a dirty tree and ignored-file collisions. Each mutation failed its test and was then restored.
  • The eval fixture pins the new rules, plus must_not_contain "Wait about five minutes". CHANGELOG, the inventory row and the generated inventory are updated.

Ideas map

Sources: docs/fast-forward/README.md is on main (#145). The draft SKILL.md, ideas.md, ideas-2026-11-28.md and ideas-multi-pc-sync.md are untracked working notes in the owner's checkout, written by other sessions. They are deliberately not committed here.

Idea (source) Status
fetch + merge --ff-only origin/<default>, no upstream needed (README, 2026-11-28 §4) implemented (ff)
fetch origin main:main when main isn't checked out (README) implemented as ff-ref (update-ref with the expected old SHA), only when no worktree holds it
occupied default branch: respect its worktree (2026-11-28 §4) implemented: needs-human with the path
identical untracked copies: archive, verify, retry (README, 2026-11-28 §3) implemented (archive-ff, --backup-dir outside the repo, sha256 checks); ignored files included
different or unknown untracked / overlapping edits are preserved (README, 2026-11-28 §3) implemented: needs-human
EOL-only vs real edits, junk names (README, ideas.md) implemented as notes, never removed
squash-merged current branch, exact-head PR evidence (README, 2026-11-28 §6) implemented (--gh, headRefOid must equal HEAD)
switch-and-ff for a merged clean branch (README) implemented (switch)
.git/config digest as a contract; no -u; --no-track (2026-11-28 §2) implemented and tested with autoSetupMerge=always / autoSetupRemote
gh pr merge --delete-branch + branch -d (2026-11-28 §2) kept: with --no-track and an explicit refspec push there is no tracking section to remove; land compares the digest before and after
evidence re-check before apply, stale plan refused (2026-11-28 §5, §7) implemented and tested
no prompts, per-repo timeout, kill the child tree, parallel fetch (multi-PC) implemented; the timeout is tested, the tree kill is best effort
receipt with old/new SHAs and undo (README, 2026-11-28 §7) implemented
linked-build / stale dist/ hint (README) implemented as a note
deploy probe beyond dist/; sessions holding binaries (multi-PC) SKILL.md rule; probe deferred: scf-mii7c
zero checks is unknown, setting-caused failures, broken base (multi-PC) SKILL.md + references/details.md
no fixed five-minute wait (2026-11-28 table) implemented in SKILL.md
sync / land / cleanup modes (2026-11-28 §1) sync + land implemented; cleanup deferred: scf-hte5y
ask live sessions, split repos, pass findings (multi-PC) SKILL.md §0; claim file deferred: scf-drhwq
rescue-then-ff / carry edits to a fresh branch (README, ideas.md) deferred: scf-xn8n6 (harness returns needs-human)
cross-PC: scan/plan only on peers, hostnames + HostKeyAlias, match by origin + root commits (README, multi-PC) references/details.md; reuse of repo-inventory / cross-pc-ssh
Windows: MSYS path rewriting, CR-stripped compare (multi-PC) the harness avoids the shell; details.md documents MSYS_NO_PATHCONV=1
permission refusals are not retried in another form (README, 2026-11-28 table) SKILL.md Never list
renamed repos: "This repository moved" is harmless, so don't rewrite the remote URL (README) SKILL.md Never list
retries query state first; no repeated commit/PR (2026-11-28 §7) SKILL.md §7
report shape with one row per repo/PC, collapsed no-ops (multi-PC) SKILL.md Report
named stashes (ideas.md) rejected: the skill never stashes (#141 rule, stricter doc wins)
paste-ready git branch -D for squash-merged branches (multi-PC) rejected for now: listed only; deletion belongs to cleanup (scf-hte5y)
JSONL snapshot merge by record timestamps (README) rejected: timestamps don't authorize a winner (2026-11-28 §3); use the tracker's own export, else needs-human
run tests after a fast-forward (README open question) conservative default: report only
scope default (open question) current repo + repos this conversation touched; no folder sweep

Checks (Windows, local)

  • Passed: sync_assistant_trees --check, check_agent_frontmatter, generate_agent_asset_inventory --check, check_skill_portability, run_agent_eval_fixtures (17), okf_lint, and pytest tests (338).
  • The added lines were scanned for host names, user paths and addresses; nothing was found.

🤖 Generated with Claude Code

synthet and others added 3 commits November 28, 2026 21:58
Add scripts/fast_forward.py (stdlib): inventory, rule-based plan rows
(noop, ff, ff-ref, archive-ff, switch, needs-human) and an apply that runs
only fast-forward rows after re-checking the planned evidence, checks the
git config digest after each action and writes a receipt. Fetch runs with
prompts off and a per-repo timeout that stops the whole process tree.

SKILL.md gains sync (default) and land modes, scope and multi-session
rules, the harness, --no-track branch creation, bounded check polling,
the after-fast-forward deploy and retry rules, and the per-repo report.
references/details.md holds CI-state, cross-PC, Windows and snapshot notes.

Refs scf-9wg8d

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ignored files the incoming commits add now count as collisions (a
fast-forward overwrites them silently); merge and switch run with
--no-overwrite-ignore. git branch -f from origin/<default> set up
tracking in .git/config, so the land step uses --no-track. Land compares
the config digest before and after. Tests cover both, plus the git
timeout.

Refs scf-9wg8d

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The intro said typing /fast-forward approves a commit, push, PR and merge,
contradicting sync as the default. Land approvals now apply only when the
typed request also says commit, push or merge; the capability line says
the same, and the eval fixture pins it.

Refs scf-9wg8d

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@synthet
synthet merged commit 06ae5fa into main Nov 29, 2026
1 check passed
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.

1 participant