5.8 KiB
Absolutely — here’s a formal draft for federation propagation rules and cross-node deterministic replay for ASL + TGK + PEL. This ensures deterministic, snapshot-safe execution across multiple nodes while preserving artifact provenance and DAG integrity.
Federation and Cross-Node Deterministic Replay Specification
1. Purpose
This specification defines:
- How artifacts, PERs, and TGK edges are propagated across federation nodes.
- How deterministic replay is guaranteed on remote nodes.
- How snapshots, shards, and logs are used to synchronize state.
- Rules for conflict resolution, tombstone handling, and provenance integrity.
2. Key Concepts
- Node: Independent system with access to ASL/TGK storage and PEL execution environment.
- Federation: Set of nodes that share artifacts, execution receipts, and TGK edges.
- ArtifactKey: Canonical identifier for artifacts or PERs.
- SnapshotID: Unique identifier of a ZFS snapshot (per pool or globally assigned).
- Log Sequence (logseq): Monotonic sequence ensuring ordering for deterministic replay.
- Execution Receipt (PER): Artifact describing the deterministic output of a PEL program.
3. Propagation Rules
3.1 Artifact & PER Propagation
-
New artifacts or PERs are assigned a global canonical ArtifactKey.
-
Each node maintains a local shard mapping; shard boundaries may differ per node.
-
Artifacts are propagated via snapshot-delta sync:
-
Only artifacts logseq > last replicated logseq are transmitted.
-
Each artifact includes:
ArtifactKeylogseqtype_tag(optional)- Payload checksum (hash)
-
-
PER artifacts are treated the same as raw artifacts but may include additional PEL DAG metadata.
3.2 TGK Edge Propagation
-
TGK edges reference canonical ArtifactKeys and NodeIDs.
-
Each edge includes:
- From nodes list
- To nodes list
- Edge type key
- Roles (from/to/both)
- logseq
-
Edges are propagated incrementally, respecting snapshot boundaries.
-
Deterministic ordering:
- Edges sorted by
(logseq, canonical_edge_id)on transmit - Replay nodes consume edges in the same order
- Edges sorted by
3.3 Snapshot and Log Management
-
Each node maintains:
- Last applied snapshot per federation peer
- Sequential write log for artifacts and edges
-
Replay on a remote node:
- Apply artifacts and edges sequentially from log
- Only apply artifacts ≤ target snapshot
- Merge multiple logs deterministically via
(logseq, canonical_id)tie-breaker
4. Conflict Resolution
-
ArtifactKey collisions:
- If hash matches existing artifact → discard duplicate
- If hash differs → flag conflict, require manual reconciliation or automated deterministic resolution
-
TGK edge conflicts:
- Multiple edges with same
from/to/typebut different logseq → pick latest ≤ snapshot - Shadowed edges handled via TombstoneShadow operator
- Multiple edges with same
-
PER replay conflicts:
- Identical PEL DAG + identical inputs → skip execution
- Divergent inputs → log error, optionally recompute
5. Deterministic Replay Algorithm
void FederationReplay(log_buffer_t *incoming_log, snapshot_range_t target_snapshot) {
// Sort incoming log deterministically
sort(incoming_log, by_logseq_then_canonical_id);
for (uint64_t i = 0; i < incoming_log->count; i++) {
record_t rec = incoming_log->records[i];
// Skip artifacts beyond target snapshot
if (rec.logseq > target_snapshot.logseq_max) continue;
// Apply artifact or TGK edge
if (rec.type == ARTIFACT || rec.type == PER) {
ApplyArtifact(rec);
} else if (rec.type == TGK_EDGE) {
ApplyTGKEdge(rec);
}
// Shadow tombstones deterministically
if (rec.is_tombstone) {
ApplyTombstone(rec.canonical_id, rec.logseq);
}
}
}
- Guarantees deterministic replay across nodes.
- Uses logseq + canonical ID ordering for tie-breaking.
6. Shard-Local Execution
-
After federation sync, local shards may differ.
-
Execution plan operators (SegmentScan, IndexFilter, TGKTraversal) operate on local shards.
-
Global determinism maintained by:
- Deterministic merge of shards
- Snapshot constraints
- Canonical ordering of artifacts and edges
7. Provenance and Audit
-
Each node maintains:
- Snapshot provenance table: snapshot ID → list of applied artifacts/PERs
- Federation log table: peer node → last applied logseq
-
Deterministic execution allows replay and auditing:
- Verify that
final_outputis identical across nodes - Provenance tables ensure full traceability
- Verify that
8. Multi-Node DAG Execution
-
PEL programs may span multiple nodes:
- Inputs and intermediate PERs propagated deterministically
- DAG nodes executed locally when all inputs are available
-
Determinism guaranteed because:
- Inputs constrained by snapshot + logseq
- Operators are deterministic
- Merge, shadowing, and projection preserve canonical ordering
9. Summary
Federation and cross-node deterministic replay:
- Uses logseq + canonical IDs for deterministic ordering
- Supports PER and TGK artifacts across nodes
- Enforces snapshot constraints
- Enables federated PEL program execution
- Preserves provenance, tombstones, and deterministic DAG evaluation
- Compatible with SIMD/shard acceleration and ENC-ASL-TGK-INDEX memory layout
Next step could be drafting a formal overall architecture diagram showing:
- PEL programs
- ASL/TGK storage
- Execution plan operators
- Shard/SIMD execution
- Federation propagation and replay paths
Do you want me to draft that architecture diagram next?