feat: implement issue #2232 — Sync-stub guard for rebase passes: after the rebase, restore a synced stub left in a third state (check and restore, no push blocker) — the rebase half of #2212

DO
5d ago
+703-9

Problem

Sync-stub guard for rebase passes: after the rebase, restore a synced stub left in a third state (check and restore, no push blocker) — the rebase half of #2212

From the issue: A rebase pass (conflict resolution in scripts/dev-lead-fix-reviews.sh) can leave a synced org-standard stub on a standards-sync PR in a third state: equal neither to what the sync commit wrote nor to what the base branch now has. The PR then no longer matches the template it exists to sync. This is the rebase half of #2212; the fix-ci half stays there.

Risk

Low — changes automation shell logic under scripts/, covered by shellcheck (--severity=warning) and the bats suite.

Test plan

Tests added/updated: tests/dev-lead/unit/test_sync_stub_guard_rebase.bats. Verification: bash scripts/dev-lead-lint.sh (shellcheck --severity=warning) ran pre-commit; the bats suite runs in CI.

Rollback

Revert this PR. No non-revertible side effects (no tags, migrations, or external state).

Monitoring

This PR's Lint (shellcheck) and bats checks show pass/fail; watch subsequent dev-lead / pr-review runs for behavioral regressions.

Closes #2232