Skip to content

fix(platform): re-inline sub-rules on redeploy and rollback (silent corruption)#162

Merged
Pama-Lee merged 1 commit into
mainfrom
fix/platform-publish-inline-2
Jul 9, 2026
Merged

fix(platform): re-inline sub-rules on redeploy and rollback (silent corruption)#162
Pama-Lee merged 1 commit into
mainfrom
fix/platform-publish-inline-2

Conversation

@Pama-Lee

@Pama-Lee Pama-Lee commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Re-parented onto current main (replaces #161, whose branch history conflicted after the stacked #158/#160 squash-merges). Single commit; identical change.

The bug (silent data corruption)

A direct publish stores the authored (un-inlined) studio draft in its deployment row, and rows predating inlining have no sub-rule graph either. Redeploy and rollback-to-version then dispatched that stored snapshot verbatim: its SubRule steps referenced a graph that wasn't in the payload, and studio→engine conversion drops a dangling sub-rule reference silently (ConvertError::SubRuleNotFound is defined but never returned). So the "same version" redeployed or rolled back to ran with its sub-rule decision logic missing, with no error surfaced. The governed release path is unaffected (it inlines + freezes at request-creation time).

The fix

Re-inline the snapshot at both dispatch points before rolling it out. Inlining is idempotent (an already-inlined graph is skipped via the sub_rules.contains_key guard), so it heals old/direct-publish rows and no-ops on already-inlined (governed) ones. Redeploy inlines before creating the deployment row (fail-fast on a missing sub-rule, no orphaned Dispatched row); rollback maps an unassemblable snapshot to SetupDependencyMissing so it settles RollbackFailed instead of looping.

Verified: cargo check -p ordo-platform clean on top of current main (includes #158+#160).

A direct publish stores the *authored* (un-inlined) studio draft in its
deployment row, and rows predating inlining have no sub-rule graph
either. Redeploy and rollback-to-version then dispatched that stored
snapshot verbatim: its SubRule steps referenced a graph that wasn't
there, and studio->engine conversion drops a dangling reference
silently (ConvertError::SubRuleNotFound is defined but never returned).
The 'same version' redeployed or rolled back to therefore ran with its
sub-rule logic missing, changing decisions with no error surfaced.

Re-inline the snapshot at both dispatch points before rolling it out.
Inlining is idempotent (an already-inlined graph is skipped via the
sub_rules.contains_key guard), so it heals old/direct-publish rows and
no-ops on already-inlined ones (governed releases). Redeploy inlines
before creating the deployment row so a now-missing sub-rule fails fast
without orphaning a Dispatched deployment; rollback maps an
unassemblable snapshot to SetupDependencyMissing so it settles as
RollbackFailed instead of looping.
@vercel

vercel Bot commented Jul 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ordo_docs Ready Ready Preview, Comment Jul 9, 2026 12:51pm

@Pama-Lee
Pama-Lee merged commit 7f576c9 into main Jul 9, 2026
15 checks passed
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