Skip to content

feat(dispatcher): re-sync a consumer's copied contract when its producer merges - #135

Merged
Ardnived merged 1 commit into
mainfrom
claude/feat-contract-sync-job
Sep 28, 2026
Merged

Ardnived merged 1 commit into
mainfrom
claude/feat-contract-sync-job

Conversation

@Ardnived

@Ardnived Ardnived commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

A consumer's copy of a SahajCloud file now re-syncs itself: the moment a SahajCloud PR that touches it merges, the dispatcher opens one bot PR per affected consumer. No ticket, no verb, no session in the common case.

Merge after #132. It adds the contractSync values this job reads. Until then the job finds no producer and does nothing, so the order is safe either way.

The failure it prevents

WeMeditateWeb and SahajAtlasWeb commit SahajCloud's generated payload-types.ts, and the WordPress plugin commits the atlas URL contract. Each copy has exactly one correct content, and nothing brought it up to date except Thursday's survey filing a Task, which then waited for a proposal review, a human implement verb and a session to run one command. Meanwhile the consumer's types were quietly wrong — no build error, just a stale shape — for up to a week.

What it does

  • contracts-plan runs on a merged PR. It lists the PR's files, a rename's old name included, and names each consumer whose contractSync.sources it touched. It runs only for a merge into the producer's default branch.
  • contracts-sync runs once per named consumer. It checks out the consumer's main, runs the consumer's own sync command (pnpm run types:cms, or the curl for the URL contract), and:
    • opens one draft bot PR on contractSync.branch when the copy changed;
    • adds a commit to that PR instead when it is already open, so a fix-ci commit there survives;
    • does nothing when the copy is already current.
  • The loop carries the PR like any other: CI, fix-ci if the new shape breaks the consumer, then your approval and auto-merge.
  • A sync PR skips the critic when it changes no more files than the copy has, and the skip comment says why. Once fix-ci touches consumer code the file count grows, and the critic runs as usual.

Nothing runs for any other event, so there is no cost between merges. Every value, including the commands, comes from loop-config.json on main; the job never checks out a PR head.

Gate

Notes for reviewer

  • This is the first dispatcher job that writes to a repo other than the one whose event it handles. It pushes one claude/* branch and opens one PR in a consumer, with SYDEVS_BOT_PAT, from commands named in loop-config.json. Please check that you are happy with that reach.
  • Not tested live. The real proof is the next SahajCloud merge that changes payload-types.ts. BOT_DISPATCH=dry skips the sync job, and the plan job's log names the consumers it would have synced.

🤖 Generated with Claude Code

…cer merges

A consumer's copy of a SahajCloud file — the generated Payload types in
WeMeditateWeb and SahajAtlasWeb, the atlas URL contract in the WordPress
plugin — has one correct content, and nothing brought it up to date but a
Thursday survey ticket that then waited for a human verb and a session.

Two jobs join dispatcher.yml. On a merged PR, `contracts-plan` lists its
files and names each consumer whose `contractSync.sources` it touched. For
each, `contracts-sync` checks out the consumer's main, runs the consumer's
own sync command, and opens one bot draft PR on `contractSync.branch` — or
adds a commit to the open one, so a fix-ci commit there survives. Nothing
runs for any other event, so there is no cost between merges.

The loop then carries the PR like any other: CI, fix-ci if the new shape
breaks the consumer, then your approval and auto-merge. A PR that changes
no more files than the copy has skips the critic, with a comment saying
why. Once fix-ci touches consumer code the count grows and the critic runs.

Every value comes from `contractSync` in loop-config.json, which the
skill-side PR adds. Until it merges this job finds no producer and does
nothing.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

1 participant