Skip to content

feat(control): unit-of-work and checkpoint-locator ports; placement-resolved image - #39

Merged
jiashuoz merged 1 commit into
mainfrom
feat/control-uow-locator
Sep 3, 2026
Merged

feat(control): unit-of-work and checkpoint-locator ports; placement-resolved image#39
jiashuoz merged 1 commit into
mainfrom
feat/control-uow-locator

Conversation

@jiashuoz

@jiashuoz jiashuoz commented Sep 3, 2026

Copy link
Copy Markdown
Member

Summary

Task 1 of docs/superpowers/plans/2026-08-30-control-outbox-checkpoint-capabilities.md (O9 plan 8) — the plan's one coordinated control change. Additive, and non-behavioral on the wire.

  • control.UnitOfWork: the application will say "these writes commit together"; the host carries its transaction in the context, and no transaction type crosses the seam. control.CheckpointLocator + CheckpointLocation: the host's knowledge of where a checkpoint can boot (portable, named runners, or nowhere). TransitionOpts.Image: a placement records the image it resolved.
  • Per the hosted PRD §9, RunnerEvent and Event carry the session's PlacementGeneration, and ApplyRunnerEvent already fences on it: non-zero and different from the row is ErrStale before any effect; zero fences nothing. Nothing sends a non-zero value yet (Task 5).
  • Every controlapp service requires the new ports and stores them; nothing calls Run or LocateCheckpoint yet (Tasks 3 and 4). controld composes a direct unit of work and a locator that names the snapshot's holder — exactly today's affinity.

Test plan

  • TestIdealCallSite builds both ports from the external package; the fence test (TestApplyRunnerEventFencesOnPlacementGeneration: match, mismatch, zero) fails when the guard is removed and passes with it; every constructor rejects a nil port
  • gofmt, go vet ./..., go test ./control ./controlapp -race, go test ./internal/controld/... -race with the pgstore suite against a real PostgreSQL 16, scripts/check-public-control.sh (silent, allowlist empty), make verify, git diff --check — run by the worker and rerun by the reviewer

🤖 Generated with Claude Code

https://claude.ai/code/session_01GiKRhqhzgJ1UDaLBynMyj3

…esolved image

O8 left the application with no way to say "these writes commit together" and
no portable answer to "where can this checkpoint boot", so an event could
outlive the mutation it describes and a cached snapshot pinned its session to
one runner. Add the three additive pieces the rest of the plan builds on: a
UnitOfWork port that carries the host's atomicity without any transaction type
crossing the seam, a CheckpointLocator answering with a CheckpointLocation
(portable, named runners, or nowhere), and TransitionOpts.Image so a placement
can record the image it actually resolved.

The runner event and the application event gain the session's placement
generation, per the hosted PRD §9, and ApplyRunnerEvent fences on it now: a
non-zero value that differs from the row's is ErrStale before any effect,
while zero — an old runner that carries nothing — fences nothing. No sender
puts a non-zero value on the wire yet.

Every controlapp service now requires the new ports and stores them; nothing
calls Run or LocateCheckpoint in this change. controld composes a direct unit
of work (the self-hosted stores have no transactions yet) and a locator that
names the runner holding a snapshot, which is exactly the affinity the stores
derive today. Behavior on the wire and in every existing test is unchanged.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GiKRhqhzgJ1UDaLBynMyj3
@jiashuoz
jiashuoz merged commit b7748b6 into main Sep 3, 2026
@jiashuoz
jiashuoz deleted the feat/control-uow-locator branch September 3, 2026 04:28
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