swarm: harness-sync — ourcloud .sandcastle is canonical; the shared libs reach matou-app mechanically, never by memory #250

Closed
opened 2026-07-31 23:58:56 +00:00 by ben · 1 comment
Owner

Parent

Swarm ops (self-healing-swarm design). Sibling of #238 (multi-project queue hygiene — that ticket namespaces the runtime; this one keeps the code of the two harnesses from diverging).

What's true today

  • One runner drives two repos (Matou/ourcloud, Matou/matou-app); each carries its own .sandcastle/ harness. The generic infrastructure files are maintained by copy-paste.
  • Proof of the failure mode, found 2026-07-31: matou-app's healer was three generations behind ourcloud's — no #197 stage-aware seam signatures, no #235 run-window scoping, still the global healer lock + repo-agnostic evidence prefix that #238 exists to kill. Every one of those fixes shipped into ourcloud's copy via a ticket, and matou-app silently kept the bug (limit-guard-storm class: fixed in one place, re-erupts in the other).
  • A first manual sync landed as matou-app 4342c01 (heal.sh, heal-lib.sh, heal-prompt.md from ourcloud canonical, transform: Matou/ourcloud → Matou/matou-app). limit-lib.sh, ask-human.sh, notify-mattermost.sh were verified identical. Dockerfile/README.md/check-verifications.sh/gate*/preflight-triage.sh/list-ready-tasks.sh differ and were deliberately NOT touched — repo-specific until ruled otherwise.

What to build

In ourcloud (the canonical side):

  • .sandcastle/harness-manifest — the explicit list of shared files (start: heal.sh heal-lib.sh heal-prompt.md limit-lib.sh ask-human.sh notify-mattermost.sh) and the single allowed transform (the repo-slug substitution).
  • .sandcastle/sync-harness.sh — renders each manifest file for a target repo and, when the rendered result differs from the target's tip, commits + pushes it (shallow clone, own workdir — never the locked swarm workdirs, the resume-asks pattern). Idempotent; a no-op sync makes no commit.
  • A trigger: workflow on push-to-main paths-filtered to .sandcastle/ (or fold into an existing cron). Credential: verify the runner's existing token can push to matou-app; if not, that is one ask-human for a repo-scoped token — do not widen silently.
  • Drift alarm on the far side: matou-app's ci gains a check that re-renders the manifest files from the recorded canonical revision and goes red if its own copies were edited directly (the fix belongs in ourcloud, or the file belongs out of the manifest).

Acceptance criteria

  • Given a fix lands in a manifest file on ourcloud main, When the sync runs, Then matou-app receives the rendered file in its own commit naming the canonical revision, and an unchanged manifest produces no commit
  • Given someone edits a manifest file directly in matou-app, Then matou-app ci goes red naming the file and the canonical rule
  • Given the sync cannot push (credential), Then it fails loud via ask-human — never a silent skip
  • Given a file is repo-specific, Then it is absent from the manifest and the sync never touches it

Task manifest

task: swarm:harness-sync
implements_seam: "harness-manifest + sync-harness.sh (canonical: ourcloud .sandcastle)"
interface: "shared harness fixes propagate to matou-app mechanically"
seam: "sync dry-run test against a fixture clone; drift check red on direct far-side edit"
acceptance:
  - given: fix in manifest file on ourcloud; when: sync runs; then: matou-app commit with canonical rev, idempotent
depends_on: []
out_of_scope: [runtime namespacing (#238), ruling additional files into/out of the manifest, third repos]
## Parent Swarm ops (self-healing-swarm design). Sibling of #238 (multi-project queue hygiene — that ticket namespaces the *runtime*; this one keeps the *code* of the two harnesses from diverging). ## What's true today - One runner drives two repos (`Matou/ourcloud`, `Matou/matou-app`); each carries its own `.sandcastle/` harness. The generic infrastructure files are maintained by **copy-paste**. - Proof of the failure mode, found 2026-07-31: matou-app's healer was **three generations behind** ourcloud's — no #197 stage-aware seam signatures, no #235 run-window scoping, still the global healer lock + repo-agnostic evidence prefix that #238 exists to kill. Every one of those fixes shipped into ourcloud's copy via a ticket, and matou-app silently kept the bug (limit-guard-storm class: fixed in one place, re-erupts in the other). - A first manual sync landed as matou-app `4342c01` (heal.sh, heal-lib.sh, heal-prompt.md from ourcloud canonical, transform: `Matou/ourcloud` → `Matou/matou-app`). `limit-lib.sh`, `ask-human.sh`, `notify-mattermost.sh` were verified identical. `Dockerfile`/`README.md`/`check-verifications.sh`/`gate*`/`preflight-triage.sh`/`list-ready-tasks.sh` differ and were deliberately NOT touched — repo-specific until ruled otherwise. ## What to build In **ourcloud** (the canonical side): - `.sandcastle/harness-manifest` — the explicit list of shared files (start: `heal.sh heal-lib.sh heal-prompt.md limit-lib.sh ask-human.sh notify-mattermost.sh`) and the single allowed transform (the repo-slug substitution). - `.sandcastle/sync-harness.sh` — renders each manifest file for a target repo and, when the rendered result differs from the target's tip, commits + pushes it (shallow clone, own workdir — never the locked swarm workdirs, the resume-asks pattern). Idempotent; a no-op sync makes no commit. - A trigger: workflow on push-to-main paths-filtered to `.sandcastle/` (or fold into an existing cron). Credential: verify the runner's existing token can push to matou-app; if not, that is one ask-human for a repo-scoped token — do not widen silently. - **Drift alarm on the far side**: matou-app's ci gains a check that re-renders the manifest files from the recorded canonical revision and goes red if its own copies were edited directly (the fix belongs in ourcloud, or the file belongs out of the manifest). ## Acceptance criteria - [ ] Given a fix lands in a manifest file on ourcloud main, When the sync runs, Then matou-app receives the rendered file in its own commit naming the canonical revision, and an unchanged manifest produces no commit - [ ] Given someone edits a manifest file directly in matou-app, Then matou-app ci goes red naming the file and the canonical rule - [ ] Given the sync cannot push (credential), Then it fails loud via ask-human — never a silent skip - [ ] Given a file is repo-specific, Then it is absent from the manifest and the sync never touches it ## Task manifest ```yaml task: swarm:harness-sync implements_seam: "harness-manifest + sync-harness.sh (canonical: ourcloud .sandcastle)" interface: "shared harness fixes propagate to matou-app mechanically" seam: "sync dry-run test against a fixture clone; drift check red on direct far-side edit" acceptance: - given: fix in manifest file on ourcloud; when: sync runs; then: matou-app commit with canonical rev, idempotent depends_on: [] out_of_scope: [runtime namespacing (#238), ruling additional files into/out of the manifest, third repos] ```
Author
Owner

Landed in 7643818 on main.

ourcloud is canonical. New pieces:

  • .sandcastle/harness-manifest — the generic shared files (heal.sh, heal-lib.sh, heal-prompt.md, limit-lib.sh, ask-human.sh, notify-mattermost.sh, check-harness-drift.sh) + the one allowed transform (the repo-slug substitution). Repo-specific files (Dockerfile/README.md/gate*/run-swarm.sh/…) are deliberately OFF the manifest and never touched (AC4).
  • .sandcastle/sync-harness.sh Matou/matou-app — renders each manifest file in its own throwaway workdir (never a locked swarm workdir), commits + pushes only on a diff naming the canonical rev, idempotent (unchanged manifest → no commit, AC1), rebase-retry so a concurrent push is not misread as auth failure, and fails LOUD via ask-human on a push it cannot land — never a silent skip (AC3). Ships a .harness-canonical marker + a harness-drift.yml into the target.
  • .sandcastle/check-harness-drift.sh — far-side alarm: re-renders the manifest files from the recorded canonical rev and reds ci if a copy was edited directly, naming the file + the canonical rule (AC2). Generic (no slug); no-marker repos are a green no-op.
  • .forgejo/workflows/harness-sync.yml — trigger on push to main paths .sandcastle/**; runs the sync against Matou/matou-app on the same runner token that already pushes matou-app main (credential expected present; sync fails loud if narrowed).

Credential note (from the ticket): the runners SWARM_FORGEJO_TOKEN already pushes to Matou/matou-app main (swarm.yml), so no new token was needed; if it is ever narrowed, sync-harness.sh surfaces it via ask-human rather than drifting.

Seam / evidence: .sandcastle/tests/sync-harness-test.sh — 7 groups over local git fixtures (no network), pinning all four ACs: the slug transform + rev-named commit, the dry-run/idempotent no-op, the credential-fail ask-human, and the drift check going red on a direct far-side edit. bash -n clean on all three scripts. STATUS.md updated (new lead + #238 deferred item closed); README documents the trio.

Deferred, honest: the first real sync commit into matou-app and its drift-check going live are one push-to-main away — verified offline in-sandbox only (the workflow fires on the next .sandcastle/** push to ourcloud main). AC5-style far-side wiring is shipped BY the sync (it writes harness-drift.yml into matou-app), so no manual matou-app edit is required.

Landed in `7643818` on `main`. **ourcloud is canonical.** New pieces: - `.sandcastle/harness-manifest` — the generic shared files (`heal.sh`, `heal-lib.sh`, `heal-prompt.md`, `limit-lib.sh`, `ask-human.sh`, `notify-mattermost.sh`, `check-harness-drift.sh`) + the one allowed transform (the repo-slug substitution). Repo-specific files (`Dockerfile`/`README.md`/`gate*`/`run-swarm.sh`/…) are deliberately OFF the manifest and never touched (AC4). - `.sandcastle/sync-harness.sh Matou/matou-app` — renders each manifest file in its own throwaway workdir (never a locked swarm workdir), commits + pushes only on a diff naming the canonical rev, idempotent (unchanged manifest → no commit, AC1), rebase-retry so a concurrent push is not misread as auth failure, and fails LOUD via ask-human on a push it cannot land — never a silent skip (AC3). Ships a `.harness-canonical` marker + a `harness-drift.yml` into the target. - `.sandcastle/check-harness-drift.sh` — far-side alarm: re-renders the manifest files from the recorded canonical rev and reds ci if a copy was edited directly, naming the file + the canonical rule (AC2). Generic (no slug); no-marker repos are a green no-op. - `.forgejo/workflows/harness-sync.yml` — trigger on push to main paths `.sandcastle/**`; runs the sync against `Matou/matou-app` on the same runner token that already pushes matou-app main (credential expected present; sync fails loud if narrowed). **Credential note (from the ticket):** the runners SWARM_FORGEJO_TOKEN already pushes to `Matou/matou-app` main (swarm.yml), so no new token was needed; if it is ever narrowed, `sync-harness.sh` surfaces it via ask-human rather than drifting. **Seam / evidence:** `.sandcastle/tests/sync-harness-test.sh` — 7 groups over local git fixtures (no network), pinning all four ACs: the slug transform + rev-named commit, the dry-run/idempotent no-op, the credential-fail ask-human, and the drift check going red on a direct far-side edit. `bash -n` clean on all three scripts. STATUS.md updated (new lead + #238 deferred item closed); README documents the trio. **Deferred, honest:** the first real sync commit into matou-app and its drift-check going live are one push-to-main away — verified offline in-sandbox only (the workflow fires on the next `.sandcastle/**` push to ourcloud main). AC5-style far-side wiring is shipped BY the sync (it writes `harness-drift.yml` into matou-app), so no manual matou-app edit is required.
ben closed this issue 2026-08-01 00:18:52 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/idss#250
No description provided.