Planetary Ledger Verification Dossier
The planetary ledger extends the Planetary Orchestrator Fabric with a deterministic, checkpointable account of every shard, node, and spillover event. This dossier documents how the ledger is validated, the tooling used to cross-check invariants, and the deliberate reflection cycle executed before shipping.
Multi-Layer Verification Strategy
- Automated Accounting Invariants – Each ledger snapshot embeds seven invariant checks covering submissions, completions, failures, cancellations, spillovers, reassignments, and pending job reconciliation. These invariants run every tick and appear inside
ledger.jsonand the dashboard. - Unit Tests (
planetary_fabric.test.ts) – The test suite now exercisesgetLedgerSnapshot()directly:testLedgerAccountingproves ledger totals match orchestrator metrics and that invariant status is always green.testLedgerCheckpointPersistencerestores from a checkpoint and compares pre/post ledger totals and event samples to guarantee persistence.
- Acceptance Harness Cross-Checks – The existing acceptance autopilot reads the generated
summary.json. With the new ledger metadata embedded, the harness implicitly verifies ledger presence and ensures the restart drill continues producing valid totals. - Dashboard Inspection – The zero-config console (
ui/dashboard.html) or run-specificreports/<label>/dashboard.htmlfetchesledger.json, renders spillover diagrams via Mermaid, and surfaces invariant statuses. Any mismatch turns the invariant cards amber/red, providing immediate human feedback. - CI Artifact Validation – The dedicated workflow checks for
ledger.json, parses its totals, and fails the pipeline if invariants diverge from orchestrator metrics.
Verification Tooling Used
| Tool / Method | Purpose |
|---|---|
Node assertion suite (npm run test:planetary-orchestrator-fabric) |
Validates TypeScript logic, ledger accounting, and checkpoint durability. |
Acceptance runner (npm run demo:planetary-orchestrator-fabric:acceptance) |
Exercises high-load + restart scenarios to observe ledger behaviour under stress. |
Dashboard rendering (ui/dashboard.html / reports/<label>/dashboard.html) |
Visual confirmation of spillover flows, invariants, and ledger event samples. |
CI workflow (.github/workflows/demo-planetary-orchestrator-fabric.yml) |
Enforces presence of ledger artifacts and cross-checks totals during PR validation. |
Manual Node.js inspection (node -e "...") |
Spot-check ledger totals against summary.json when debugging or auditing runs. |
Anticipated Pitfalls & Mitigations
- Partial Checkpoints: A power loss during checkpoint writes could desynchronise ledger data. Mitigation: checkpoints serialize ledger state atomically alongside queue/node snapshots, and invariants flag discrepancies immediately.
- Event Sample Truncation: The ledger keeps a bounded event sample (2,048 entries). In ultra-long runs the sample may omit early history. Mitigation:
totalEventstracks the full count and the dashboard labels the sample size so auditors know exactly how much history is present. - Cross-Shard Naming Collisions: Mermaid diagrams require alphanumeric node IDs. Non-alphanumeric shard names are normalised before rendering so diagrams remain legible.
- Invariant Drift After Resume: Restored orchestrators rehydrate ledger totals before replaying ticks. The persistence test ensures resumed runs inherit identical totals and invariants.
Deliberate Reflection Cycle
After implementing the ledger, we performed a structured review:
- Re-derive Requirements: Re-read the task to confirm the ledger satisfied empowerment, owner control, fault tolerance, and CI-green goals.
- Cross-Tool Validation: Compared ledger totals with orchestrator metrics using both automated tests and manual
nodescripts, ensuring independent confirmation. - Scenario Audit: Re-ran mental simulations for outages, spillovers, and restarts to confirm ledger data stays coherent.
- Final Pause & Re-evaluation: Took a final pass over the reasoning chain from initial design through tests, looking for hidden assumptions (e.g., ledger omission in checkpoint payloads, dashboard fetch failures). No gaps found—ledger state is saved, restored, visualised, and tested.
The ledger provides inspectable simulator accounting and tested invariants. It is not a financial ledger, proof of useful work, authenticated provider history, or settlement evidence. Review the exact run, its pending/failed jobs and its invariant results.