Fence Metasrv Publications Implementation Plan
For Claude: REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
Goal: Make every production Metasrv metadata publication atomic with the latest live leadership lease while preserving engine-commit recovery.
Architecture: Successful election rounds publish an immutable exact lease
guard beside the local monotonic deadline. A production-only MetaStore
adapter fetches the latest guard immediately before each target CAS/delete and
maps it to the native guarded transaction; election retains the raw store.
Tech Stack: Rust, Tokio, async-trait, RocksDB, DynamoDB transactions, serde, snafu, agent-spec.
Task 1: Publish exact lease guards
- Add failing election/leadership tests for exact installed bytes, epoch, local expiry, renewal replacement, and takeover replacement.
- Return an owned lease guard from successful campaigns and publish it with the local monotonic deadline.
- Expose a fail-closed
current_guardsnapshot to the write path.
Task 2: Add the production fenced metastore adapter
- Add failing adapter tests for create/update/delete, stale takeover, fresh renewal, same-key rejection, and missing/expired authority.
- Delegate reads and translate target CAS/delete into issue #33’s native guarded mutation using a fresh guard per call.
- Wire production ControlPlane and maintenance to the adapter while election retains the raw store.
Task 3: Prove mutation coverage and recovery
- Instrument the raw store in tests and exercise registry create/version, append record/fence/terminal cleanup, maintenance, and operation GC.
- Add a deterministic paused-leader engine-commit recovery test with the same append operation identity.
- Fail the remote production drop request before engine removal until the durable tombstone task lands.
Task 4: Verify and publish
- Document publication fencing and the explicit destructive-drop boundary.
- Run explicit jj candidate spec lifecycle, strict Clippy, LocalStack, clean gate, and rustdoc.
- Obtain independent reviewer APPROVE and verifier PASS before merge.