Copies of design docs removed in Phase 09, preserved in sw-block/docs/archive/ for historical reference. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
4.8 KiB
V2 Engine Slicing Plan
Date: 2026-03-29
Status: historical slicing plan
Purpose: define the first real V2 engine slices after prototype and Phase 4.5 closure
Goal
Move from:
- standalone design/prototype truth under
sw-block/prototype/
to:
- a real V2 engine core under
sw-block/
without dragging V1.5 lifecycle assumptions into the implementation.
Planning Rules
- reuse V1 ideas and tests selectively, not structurally
- prefer narrow vertical slices over broad skeletons
- each slice must preserve the accepted V2 ownership/fencing model
- keep simulator/prototype as validation support, not as the implementation itself
- do not mix V2 engine work into
weed/storage/blockvol/
First Engine Stage
The first engine stage should build the control/recovery core, not the full storage engine.
That means:
- per-replica sender identity
- one active recovery session per replica per epoch
- sender-owned execution authority
- explicit recovery outcomes:
- zero gap
- bounded catch-up
- rebuild
- rebuild execution shell only
- do not hard-code final snapshot + tail vs full base decision logic yet
- keep real rebuild-source choice tied to Slice 3 recoverability inputs
Recommended Slice Order
Slice 1: Engine Ownership Core
Purpose:
- carry the accepted
enginev2ownership/fencing model into the real engine core
Scope:
- stable per-replica sender object
- stable recovery-session object
- session identity fencing
- endpoint / epoch invalidation
- sender-group or equivalent ownership registry
Acceptance:
- stale session results cannot mutate current authority
- changed-address and epoch-bump invalidation work in engine code
- the 4 V2-boundary ownership themes remain provable
Slice 2: Engine Recovery Execution Core
Purpose:
- move the prototype execution APIs into real engine behavior
Scope:
- connect / handshake / catch-up flow
- bounded
CatchUp - explicit
NeedsRebuild - sender-owned rebuild execution path
- rebuild execution shell without final trusted-base selection policy
Acceptance:
- bounded catch-up does not chase indefinitely
- rebuild is exclusive from catch-up
- session completion rules are explicit and fenced
Slice 3: Engine Data / Recoverability Core
Purpose:
- connect recovery behavior to real retained-history / checkpoint mechanics
Scope:
- real recoverability decision inputs
- trusted-base decision for rebuild source
- minimal real checkpoint/base-image integration
- real truncation / safe-boundary handling
This is the first slice that should decide, from real engine inputs, between:
snapshot + tailfull base
Acceptance:
- engine can explain why recovery is allowed
- rebuild-source choice is explicit and testable
- historical correctness and truncation rules remain intact
Slice 4: Engine Integration Closure
Purpose:
- bind engine control/recovery core to real orchestration and validation surfaces
Scope:
- real assignment/control intent entry path
- engine-facing observability
- focused real-engine tests for V2-boundary cases
- first integration review against real failure classes
Acceptance:
- key V2-boundary failures are reproduced and closed in engine tests
- engine observability is good enough to debug ownership/recovery failures
- remaining gaps are system/performance gaps, not control-model ambiguity
What To Reuse
Good reuse candidates:
- tests and failure cases from V1 / V1.5
- narrow utility/data helpers where not coupled to V1 lifecycle
- selected WAL/history concepts if they fit V2 ownership boundaries
Do not structurally reuse:
- V1/V1.5 shipper lifecycle
- address-based identity assumptions
SetReplicaAddrs-style behavior- old recovery control structure
Where The Work Should Live
Real V2 engine work should continue under:
sw-block/
Recommended next area:
sw-block/core/orsw-block/engine/
Exact path can be chosen later, but it should remain separate from:
sw-block/prototype/weed/storage/blockvol/
Validation Plan For Engine Slices
Each engine slice should be validated at three levels:
- prototype alignment
- does engine behavior preserve the accepted prototype invariant?
- focused engine tests
- does the real engine slice enforce the same contract?
- scenario mapping
- does at least one important V1/V1.5 failure class remain closed?
Non-Goals For First Engine Stage
Do not try to do these immediately:
- full Smart WAL expansion
- performance optimization
- V1 replacement/migration plan
- full product integration
- all storage/backend redesign at once
Immediate Next Assignment
The first concrete engine-planning task should be:
- choose the real V2 engine module location under
sw-block/ - define Slice 1 file/module boundaries
- write a short engine ownership-core spec
- map 3-5 acceptance scenarios directly onto Slice 1 expectations