Skip to content

chore(pylon): harden fork synchronization - #7

Merged
rynfar merged 1 commit into
pylonfrom
chore/pylon-fork-sync-api
Aug 29, 2026
Merged

chore(pylon): harden fork synchronization#7
rynfar merged 1 commit into
pylonfrom
chore/pylon-fork-sync-api

Conversation

@rynfar

@rynfar rynfar commented Aug 29, 2026

Copy link
Copy Markdown

Problem

The mirror workflow updates main with a direct Git push and carries an optional App-token path. That prevents us from locking the mirror branch without either weakening protections or exposing a credential that could trigger inherited upstream publication.

Fix

  • update main through GitHub's fork merge-upstream API only after a readable, exact-main repository ruleset proves the workflow token cannot bypass the update, deletion, linear-history, and non-fast-forward rules;
  • verify the registered Prime parent, API source/result, and exact post-sync SHA, with no direct-push or privileged-token fallback;
  • make candidate branches deterministic and validate their parents, tree, and stored verification run before reuse;
  • reuse CI only when the Actions API proves the candidate-bound build-check-test aggregate succeeded; otherwise rerun verification;
  • keep manual PR handoff idempotent and preserve the exact draft title, body, label, branch, and CI evidence;
  • document the zero-bypass ruleset and future-upstream-merge stop condition.

The workflow intentionally fails closed until the live repository ruleset is provisioned. After this lands, maintainers must enable squash merging as GitHub's linear-history prerequisite, create and audit the zero-bypass exact-main ruleset, remove the superseded classic main protection, and validate a real dispatch before calling the mirror locked.

Verification

  • bash -n scripts/pylon-sync-upstream.sh
  • shellcheck scripts/pylon-sync-upstream.sh
  • actionlint .github/workflows/pylon-upstream-sync.yml
  • git diff --check
  • disposable fork tests for ruleset rejection, API fast-forward, deterministic candidate creation and reuse, stale issue recovery, successful CI reuse, and failed CI re-verification
  • historical failed sync run rejected as reusable evidence
  • npm run check via the signed commit hook
  • two independent final reviews: no code blockers

Refs #1.

Implemented by GPT-5.6 in Prime Agent, orchestrated through Pylon.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Use GitHub fork synchronization behind a fail-closed exact-main ruleset, keep review candidates idempotent, and retain verified CI evidence without adding a privileged token.
@rynfar
rynfar merged commit 81faafa into pylon Aug 29, 2026
16 checks passed
@rynfar
rynfar deleted the chore/pylon-fork-sync-api branch August 29, 2026 05:35
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