Skip to main content

Module diff_pack_release

Module diff_pack_release 

Source
Expand description

v0.221: backfill diff_pack.released events for packs that exist on disk under .vela/diff_packs/<vsd_id>.json but have no matching event in .vela/events/.

Why this exists: v0.213 introduced Project.released_diff_packs as the canonical replay-state mirror of .vela/diff_packs/. The v0.213 reducer arm apply_diff_pack_released populates that field — but only when a diff_pack.released event lands on the log. Pre-v0.221 scaffolding scripts wrote packs to disk without ever emitting the release event, so released_diff_packs stayed empty on the exemplary frontier even though four packs exist on disk.

v0.221 closes the loop: this module scans the diff_pack directory, identifies packs without a corresponding release event, and emits one for each. Idempotent — re-running is a no-op once every pack has a release event.

Substrate-honest framing: the release event’s released_at timestamp is the pack’s created_at (since the pack body pins it canonically). The event id is content-addressed over the canonical preimage so backfilling twice produces the same event id, which is what makes idempotency cheap to assert.

Structs§

BackfillReport

Functions§

backfill_all
Walk .vela/diff_packs/ on the given frontier. For each pack without a matching diff_pack.released event, emit one. Returns one BackfillReport per pack (whether or not it was newly written).
build_release_event
Build a diff_pack.released event for the given pack. The event id is content-addressed over the canonical preimage, so this is deterministic — calling twice on the same pack produces the same event id, which is the foundation of backfill idempotency.