Skip to content

Reconcile provable legacy workflow revisions - #6963

Draft
loganj wants to merge 4 commits into
larry/workflow-revision-foundation-v4from
larry/workflow-legacy-revision-migration-v4
Draft

Reconcile provable legacy workflow revisions#6963
loganj wants to merge 4 commits into
larry/workflow-revision-foundation-v4from
larry/workflow-legacy-revision-migration-v4

Conversation

@loganj

@loganj loganj commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

🤖 I’m Larry, and this migration preserves workflow history without pretending the relay knows more than it does.

Summary

Legacy workflows can now gain an exact revision pointer when the relay can prove that the retained signed workflow definition is the source of the currently stored workflow. Rows that cannot be proven remain unchanged and continue through the existing compatibility fallback. Reconciliation supports the historical channel-less database shape as well as current channel-scoped storage, but always requires the signed event’s channel tag to match.

Historical workflow runs are intentionally never backfilled from current workflow state: the current definition cannot establish which revision an earlier run executed. The final bind also requires the validated workflow snapshot to remain unchanged, preventing an older relay binary from rewriting a workflow during rolling deployment and receiving stale provenance.

Related issue

Stacked on #6960. No separate issue found.

Testing

Validated exact commit dbe2b67af88bd1a68f92d257b31d9d91406902b0 on Blox workstation larry-buzz-workflow-legacy-v4-fix:

  • cargo fmt --all -- --check
  • migrated-Postgres end-to-end test proving a historical events.channel_id IS NULL definition is discovered and bound
  • migrated-Postgres regression proving an intervening legacy-style workflow rewrite rejects the stale bind
  • migrated-Postgres idempotence/run-preservation regression
  • full buzz-db library suite: 112 passed, 203 infrastructure tests ignored
  • full buzz-relay library suite with migrated Postgres configured: 924 passed, 50 infrastructure tests ignored
  • cargo clippy -p buzz-db -p buzz-relay --all-targets -- -D warnings

loganj and others added 4 commits August 27, 2026 17:07
Signed-off-by: Logan Johnson <loganj@squareup.com>
Co-authored-by: Larry <8cf5a83f590ec0955b11647d1c88f796a98e088c30a492c58e0e46c3026ae7a4@buzz.block.builderlab.xyz>
Only bind a legacy workflow when its retained signed NIP-33 head reproduces the exact materialized definition and hash. Historical runs remain unbound because current state cannot prove which revision they executed.

Signed-off-by: Logan Johnson <loganj@squareup.com>
Co-authored-by: Larry <8cf5a83f590ec0955b11647d1c88f796a98e088c30a492c58e0e46c3026ae7a4@buzz.block.builderlab.xyz>
Search the historical NULL-channel event shape while retaining signed channel verification, and bind only when the validated workflow snapshot is unchanged.

Co-authored-by: Larry <8cf5a83f590ec0955b11647d1c88f796a98e088c30a492c58e0e46c3026ae7a4@buzz.block.builderlab.xyz>
Signed-off-by: Logan Johnson <loganj@squareup.com>
Signed-off-by: Logan Johnson <loganj@squareup.com>
Co-authored-by: Larry <8cf5a83f590ec0955b11647d1c88f796a98e088c30a492c58e0e46c3026ae7a4@buzz.block.builderlab.xyz>
@loganj

loganj commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator Author

🤖 I’m Larry. This automatic-backfill approach is retired and must not merge.

Review at b064beb5c39a8ea52c1d43565ddcace10f780ed6 established two failures of its exact-source contract:

  • A pre-foundation writer can update the workflow after reconciliation binds E1 while preserving the newly added pointer. New runs then copy stale provenance.
  • The pre-foundation writer commits workflow materialization independently before committing its signed-event transaction. If an equal-content E2 materialization commits but its event transaction fails, the surviving E1 head can match current JSON/hash without proving it sourced the current row. Snapshot fencing and draining old pods cannot recover missing historical evidence.

Legacy workflows and historical runs must retain the NULL compatibility fallback. No adoption UX is being substituted here. Any future owner-signed save establishes provenance prospectively and needs its own explicit semantics.

The draft and branch are preserved as review evidence, not as a merge candidate. The related foundation rollout also needs protection against legacy writers preserving pointers across subsequent definition updates.

@loganj
loganj force-pushed the larry/workflow-revision-foundation-v4 branch 3 times, most recently from 8368014 to bb7de1e Compare August 28, 2026 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant