Files
paperclip-docs/scripts/sync/state.example.json
T
Aron PrinsandClaude Opus 4.7 28af20be39 Fix correctness gotchas in /sync-docs design
Several issues found while reviewing the skill — most stemming from
the incremental-diff model that the first cut used. The fix is a
shift to cumulative diffs (always from the last release tag) plus
explicit reconciliation handling.

Changes:

- Cumulative diff window for BOTH modes. Nightly was using
  yesterday's SHA as the diff base; now it uses base_release_tag
  like release mode does. This makes reverts auto-cancel in the
  manifest (they're net-zero across the cumulative window) instead
  of needing message-regex filtering.

- Remove skip_patterns from anchor-map.json. They were dangerous:
  filtering ^revert by message would HIDE the undo signal when a
  previously-processed commit got reverted. The proper filter is
  surface impact via watcher path globs + cumulative-diff cancellation.

- Add Phase 3.5 (Reconciliation) to the SKILL. Catches the remaining
  case: a doc edit was committed in a prior run for a feature that
  has since been reverted. The manifest_hash + last_applied_manifest_hash
  comparison surfaces "disappeared" entries as ⚠ Reconcile flags for
  manual review — the skill never auto-undoes prose edits.

- auto_merge_safety: add explicit forbid_kinds: [removed, renamed].
  A 1-line rename is still a breaking change and was previously
  guarded only by SKILL prose.

- Rename state fields for clarity. synced_to/synced_sha were
  ambiguous between branches. New schema: branch_mode,
  base_release_tag, base_release_sha, last_seen_parent_sha,
  last_applied_manifest_hash. base_release_tag is the diff base
  and only bumps on a successful release merge — the invariant
  that makes cumulative diffs stable.

- Release mode is now self-sufficient (doesn't require nightly
  drafts to exist). Fixes the chicken-and-egg for the first run
  catching up multiple releases.

- PENDING.md is regenerated each run, not appended, so it never
  carries stale entries from reverted commits.

- New special-cases entries for parent renames, nightly-with-open-PRs
  at release time, and quarantine race conditions.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
2026-05-13 10:30:12 +02:00

18 lines
1.2 KiB
JSON

{
"$comment": "Template for .sync-state.json at the repo root. Committed per-branch. Edit the real file, not this one.",
"branch_mode": "release",
"base_release_tag": "v2026.318.0",
"base_release_sha": "REPLACE_WITH_PARENT_COMMIT_SHA_AT_TAG",
"last_seen_parent_sha": null,
"last_applied_manifest_hash": null,
"last_run_at": null,
"last_run_outcome": null,
"$field_notes": {
"branch_mode": "release on `main` branch, nightly on `nightly` branch.",
"base_release_tag": "The parent release tag this branch builds atop. Same on both branches — main has shipped this version live, nightly is accumulating drafts on top of it.",
"base_release_sha": "Parent commit SHA at base_release_tag. Used as the diff base for ALL runs (cumulative diff). Both modes diff `base_release_sha → target`.",
"last_seen_parent_sha": "Informational only — the parent main HEAD at the last nightly run. Lets us tell the user how many new commits exist. NOT used as a diff base.",
"last_applied_manifest_hash": "Hash of the manifest from the last applied run. Lets us detect when entries have DISAPPEARED from the cumulative diff (i.e. a revert landed) so we can flag previously-applied doc edits for reconciliation."
}
}