updates: a community founded from a build AHEAD of the feed has no replay floor — it auto-applies the feed's OLDER release and walks itself backwards #1690

Closed
opened 2026-09-21 15:40:09 +00:00 by ben · 3 comments
Owner

What

Orchestrator.Poll (internal/update/update.go:354-394) protects against replay/downgrade (#1579) with a per-channel high-water mark. A freshly founded community gets that floor ONLY by adoptOwnReleaseSequence — i.e. only when the feed's newest revision equals the revision stamped on its control plane (#1674: builds stamp the revision, never the signed sequence).

If the operator app's payload was built from a commit the rail has not published yet (main HEAD ahead of testing — true for every laptop/dev build made between rail cuts, and for any commit the rail skipped because main was red), then on the first poll:

  • rel.Revision != current.Revision → no adoption, current.Sequence stays 0;
  • knows() is false, highWaterFor(channel) is 0 → the floor check is skipped;
  • the feed's newest — an older commit than the one running — is tracked as StateAutomatic (the rail cuts everything as patch).

So the community walks itself backwards onto older code in its first 02:00–04:00 window, unattended, and U1 offers a downgrade as an "update". Observed state today: main a3513a26, feed 5b910ef3 (seq 2573), four commits behind.

The reverse case is also unhandled: a payload stamped at a commit the rail never published and never will (red main) has no sequence to adopt, ever.

Proposed default (ADR 0174)

Founding must carry a floor of its own, not borrow one from the feed:

  1. assemble-payload.sh reads the feed at build time and stamps founding.ReleaseChannelSequence with the newest signed sequence whose revision is an ancestor-or-equal of HEAD (it has git; the gateway does not) — so a payload ahead of the feed starts its floor AT the feed's newest and refuses it as stale.
  2. Or, cheaper and safe: when current.Sequence == 0 and the feed's newest revision is not ours, do not track it as automatic — surface it as pending (human approves) until a sequence is adopted.
  3. package-app.sh warns loudly when HEAD is not a revision the pinned channel has served.

Workaround used for the Whakatōhea Demo hand re-founding: build the app from a worktree checked out AT the feed's current revision.

Blocks #1562 (a community "deployed from now on" by anyone building off main is exposed). Relates to #1579, #1631, #1674.

## What `Orchestrator.Poll` (`internal/update/update.go:354-394`) protects against replay/downgrade (#1579) with a per-channel high-water mark. A freshly founded community gets that floor ONLY by `adoptOwnReleaseSequence` — i.e. only when the feed's newest revision **equals** the revision stamped on its control plane (#1674: builds stamp the revision, never the signed sequence). If the operator app's payload was built from a commit the rail has **not published yet** (main HEAD ahead of `testing` — true for every laptop/dev build made between rail cuts, and for any commit the rail skipped because main was red), then on the first poll: - `rel.Revision != current.Revision` → no adoption, `current.Sequence` stays 0; - `knows()` is false, `highWaterFor(channel)` is 0 → the floor check is skipped; - the feed's newest — an **older** commit than the one running — is tracked as `StateAutomatic` (the rail cuts everything as `patch`). So the community **walks itself backwards** onto older code in its first 02:00–04:00 window, unattended, and U1 offers a downgrade as an "update". Observed state today: main `a3513a26`, feed `5b910ef3` (seq 2573), four commits behind. The reverse case is also unhandled: a payload stamped at a commit the rail never published and never will (red main) has no sequence to adopt, ever. ## Proposed default (ADR 0174) Founding must carry a floor of its own, not borrow one from the feed: 1. `assemble-payload.sh` reads the feed at build time and stamps `founding.ReleaseChannelSequence` with the newest signed sequence whose revision is an **ancestor-or-equal** of HEAD (it has git; the gateway does not) — so a payload ahead of the feed starts its floor AT the feed's newest and refuses it as stale. 2. Or, cheaper and safe: when `current.Sequence == 0` and the feed's newest revision is not ours, do not track it as automatic — surface it as pending (human approves) until a sequence is adopted. 3. `package-app.sh` warns loudly when HEAD is not a revision the pinned channel has served. Workaround used for the Whakatōhea Demo hand re-founding: build the app from a worktree checked out AT the feed's current revision. Blocks #1562 (a community "deployed from now on" by anyone building off main is exposed). Relates to #1579, #1631, #1674.
Author
Owner

Ruled by agent under ADR 0174 — veto anytime: build options 2 and 3 (never auto-track a release while the community has no adopted sequence; loud warning at package time). Option 1 (build-time sequence stamp) is left for a later ticket if 2 proves too quiet. Two-way door: a commit reverts it, the Updates seam tests + #1614 drive prove it.

Ruled by agent under ADR 0174 — veto anytime: build options **2 and 3** (never auto-track a release while the community has no adopted sequence; loud warning at package time). Option 1 (build-time sequence stamp) is left for a later ticket if 2 proves too quiet. Two-way door: a commit reverts it, the Updates seam tests + #1614 drive prove it.

swarm-claim host=bens-mac-04 run=29329
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=bens-mac-04 run=29329 (automated multi-host claim — lowest live claim id works this ticket)

close-report for #1690 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 1690,
  "status": "success",
  "commits": [
    "f02ec48f469eb3dcb78036d05a6cb9c89127e805"
  ],
  "changed_files": [
    "STATUS.md",
    "internal/update/downgrade_test.go",
    "internal/update/update.go",
    "scripts/package-app.sh"
  ],
  "tests": [
    {
      "command": "nix develop .#go-ci -c go test ./internal/update/...",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci -c go build ./...",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci -c gofmt -l internal/update/update.go internal/update/downgrade_test.go",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci -c go vet ./internal/update/",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Option 2 (Ben's ruling): a community with no replay floor never auto-tracks the feed's release — it is surfaced pending until a sequence is adopted": "internal/update/update.go — Poll computes noFloor = rel.Sequence > 0 && floor == 0; when noFloor, state stays StatePending (never StateAutomatic) and recordAccepted is skipped so the mark is not advanced from an unordered offer. Proven by TestPoll_NoFloorSurfacesFeedAsPendingNotAutomatic (downgrade_test.go): a build founded ahead (current.Sequence 0) offered the feed's older rev-old seq 5 surfaces Pending, Automatic stays empty, floor stays 0, and the next still-older release also stays out of automatic.",
    "The healthy path is preserved: once a floor exists (founding-stamped or adopted via adoptOwnReleaseSequence) the normal policy split resumes, and a pre-sequence fixture (rel.Sequence 0) keeps its legacy classification": "internal/update/update.go — the gate fires only for rel.Sequence > 0 && floor == 0; all existing internal/update seam tests (classification, downgrade, adopt-own-sequence) pass unchanged.",
    "Option 3 (Ben's ruling): package-app.sh warns loudly at package time that an ahead-of-rail HEAD build has no replay floor": "scripts/package-app.sh — a #1690 NOTE block prints HEAD's short sha and the ahead-of-feed hazard plus the worktree workaround before the dev-shell re-exec.",
    "STATUS.md updated in the same commit": "STATUS.md — new newest-first milestone entry for #1690 CLOSED."
  },
  "summary": "A community founded from a build ahead of the feed no longer auto-applies the feed's older release with no replay floor — it surfaces it pending for the operator, and package-app.sh warns at build time.",
  "reason": "",
  "blockers": [],
  "no_code_change": ""
}
**close-report** for #1690 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1690, "status": "success", "commits": [ "f02ec48f469eb3dcb78036d05a6cb9c89127e805" ], "changed_files": [ "STATUS.md", "internal/update/downgrade_test.go", "internal/update/update.go", "scripts/package-app.sh" ], "tests": [ { "command": "nix develop .#go-ci -c go test ./internal/update/...", "exit_code": 0 }, { "command": "nix develop .#go-ci -c go build ./...", "exit_code": 0 }, { "command": "nix develop .#go-ci -c gofmt -l internal/update/update.go internal/update/downgrade_test.go", "exit_code": 0 }, { "command": "nix develop .#go-ci -c go vet ./internal/update/", "exit_code": 0 } ], "criteria": { "Option 2 (Ben's ruling): a community with no replay floor never auto-tracks the feed's release — it is surfaced pending until a sequence is adopted": "internal/update/update.go — Poll computes noFloor = rel.Sequence > 0 && floor == 0; when noFloor, state stays StatePending (never StateAutomatic) and recordAccepted is skipped so the mark is not advanced from an unordered offer. Proven by TestPoll_NoFloorSurfacesFeedAsPendingNotAutomatic (downgrade_test.go): a build founded ahead (current.Sequence 0) offered the feed's older rev-old seq 5 surfaces Pending, Automatic stays empty, floor stays 0, and the next still-older release also stays out of automatic.", "The healthy path is preserved: once a floor exists (founding-stamped or adopted via adoptOwnReleaseSequence) the normal policy split resumes, and a pre-sequence fixture (rel.Sequence 0) keeps its legacy classification": "internal/update/update.go — the gate fires only for rel.Sequence > 0 && floor == 0; all existing internal/update seam tests (classification, downgrade, adopt-own-sequence) pass unchanged.", "Option 3 (Ben's ruling): package-app.sh warns loudly at package time that an ahead-of-rail HEAD build has no replay floor": "scripts/package-app.sh — a #1690 NOTE block prints HEAD's short sha and the ahead-of-feed hazard plus the worktree workaround before the dev-shell re-exec.", "STATUS.md updated in the same commit": "STATUS.md — new newest-first milestone entry for #1690 CLOSED." }, "summary": "A community founded from a build ahead of the feed no longer auto-applies the feed's older release with no replay floor — it surfaces it pending for the operator, and package-app.sh warns at build time.", "reason": "", "blockers": [], "no_code_change": "" } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
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#1690
No description provided.