Make the first V2 core owner explicit in sw-block by freezing Phase 14 docs, mode/readiness/publication semantics, and bounded command emission rules. This turns accepted Phase 13 constraints into executable core behavior without overclaiming live runtime cutover. Made-with: Cursor
7.0 KiB
V2 Phase 14+ Semantic-First Framework
Date: 2026-04-03
Status: active
Purpose: define the overall Phase 14+ implementation framework so V2
runtime extraction is driven by semantics first: core-owned state and
transitions, then command rules, then projection contracts, and only then
adapter rebinding
Why This Document Exists
Phase 13 closed one bounded constrained-runtime contract package:
- real-workload validation
- assignment/publication closure
- bounded mode normalization
That package is valuable, but it is not yet a completed V2 runtime.
The next problem is therefore no longer:
- keep deepening constrained-
V1validation by default
It is:
- how to turn the accepted semantic constraints into a real
V2 core - how to sequence
Phase 14+soV1mixed runtime state does not silently regain semantic authority
Core Rule
For Phase 14+, implementation order must be:
- define core-owned state and transitions
- define command-emission rules
- define projection contracts
- only then connect adapters
Do not invert this order.
If adapter/runtime wiring appears first, V1 mixed state will silently regain
semantic authority through convenience behavior.
Existing Inputs To Preserve
These are fixed inputs, not optional references:
v2_mini_core_design.mdv2-reuse-replacement-boundary.mdv2-protocol-claim-and-evidence.mdv2-phase-development-plan.mdsw-block/engine/replication/
Overall Composition Model
The full V2 runtime should be composed from smaller automata rather than one
monolithic state machine.
flowchart TD
assignmentState[AssignmentAutomaton]
recoveryState[RecoveryAutomaton]
boundaryState[BoundaryAutomaton]
modeState[ModeAutomaton]
publicationState[PublicationAutomaton]
coreEngine[CoreEngine]
projections[ProjectionContracts]
adapters[AdapterBoundary]
runtime[V1BackendMechanics]
assignmentState --> coreEngine
recoveryState --> coreEngine
boundaryState --> coreEngine
modeState --> coreEngine
coreEngine --> publicationState
publicationState --> projections
coreEngine --> adapters
adapters --> runtime
runtime -->|"observations/events"| adapters
adapters --> coreEngine
The Five Core-Owned Automata
1. Assignment automaton
Owns:
- volume intent
- role intent
- stable replica identity
- epoch
- desired replica set
Primary constraints preserved:
CP13-2- identity-vs-transport separation
Current seeds:
sw-block/engine/replication/registry.gosw-block/engine/replication/state.go
2. Recovery automaton
Owns:
- per-replica recovery state
- session ownership and fencing
- catch-up vs rebuild selection
Primary constraints preserved:
CP13-4CP13-5CP13-6CP13-7
Current seeds:
sw-block/engine/replication/sender.gosw-block/engine/replication/session.gosw-block/engine/replication/orchestrator.gosw-block/engine/replication/outcome.go
3. Boundary automaton
Owns:
- committed truth
- checkpoint truth
- durable barrier truth
- rebuild/catch-up target truth
Primary constraints preserved:
T1T9CP13-3
Current seeds:
sw-block/engine/replication/state.gosw-block/engine/replication/engine.go
4. Mode automaton
Owns:
allocated_onlybootstrap_pendingreplica_readypublish_healthydegradedneeds_rebuild
Primary constraints preserved:
CP13-9- fail-closed external meaning
Current seeds:
sw-block/engine/replication/state.gosw-block/engine/replication/engine.go
5. Publication automaton
Owns:
- readiness closure
- publication closure
- outward healthy vs non-healthy truth
Primary constraints preserved:
CP13-8ACP13-9
Current seeds:
sw-block/engine/replication/projection.gosw-block/engine/replication/engine.go
Phase 14+ Execution Order
Phase 14A: Core-owned automata
Goal:
- make the five automata explicit in the core package
Deliver:
- state definitions
- transition tables/rules
- event vocabulary
Validation:
- structural acceptance tests in
sw-block/engine/replication
Non-goal:
- no live adapter hook
Phase 14B: Command semantics
Goal:
- freeze command-emission rules from semantic state, not runtime convenience
Deliver:
- command rules for role apply, receiver start, shipper configure, invalidation, and publication
Validation:
- tests that one event sequence produces one bounded command sequence
Non-goal:
- no
weed/execution yet
Phase 14C: Projection contracts
Goal:
- define what external surfaces are allowed to claim and from which core state
Deliver:
- projection structs and normalization rules for lookup/heartbeat/debug/tester meanings
Validation:
- mode/readiness/publication surface-consistency tests
Non-goal:
- no live registry rewrite yet
Phase 15A: Minimal adapter hook
Goal:
- connect one narrow adapter ingress to the new core
Deliver:
- one event path from
weed/into the core - one command path back out
Validation:
- prove no semantic split between adapter and core on that narrow path
Phase 15B: Projection-store rebinding
Goal:
- make
weed/projection/state surfaces consume core-owned projection truth
Deliver:
- bounded rebinding of registry / lookup / tester-facing surfaces
Validation:
- prove assignment delivered != ready != publish healthy on the real path
Phase 16: V2-native runtime closure
Goal:
- make the integrated runtime behave as a
V2-owned system rather than constrained-V1semantics plus fixes
Deliver:
- one bounded runtime path where core-owned semantics drive adapters and projections
Validation:
- end-to-end failover/recovery/publication scenarios on the core-driven path
Algorithm Review Rule
For any new transition rule, command rule, or projection rule, require a short justification in code review or delivery notes:
- semantic constraint satisfied:
- which item from
v2-protocol-claim-and-evidence.md,v2-protocol-truths.md, orCP13-*
- which item from
- overclaim avoided:
- what false healthy / ready / durable / recoverable claim is being prevented
- proof preserved:
- which accepted test or checkpoint remains valid because of this rule
This is the minimum bar for Phase 14+.
Immediate Next Slice
Do not broaden Phase 13 further.
Use the new Phase 14 core skeleton in sw-block/engine/replication as the
base for one complete semantic chain:
modereadinesspublication
This is the best next slice because it turns the newest accepted CP13-8A and
CP13-9 constraints directly into core-owned state and transition logic before
adapter rebinding begins.