Skip to content

fix: carry finalized site mutation authority - #195

Merged
noeltock merged 1 commit into
mainfrom
block-theme/finalized-authority
Oct 12, 2026
Merged

noeltock merged 1 commit into
mainfrom
block-theme/finalized-authority

Conversation

@noeltock

@noeltock noeltock commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Problem

A media-bound page can stop before its database write because the native operation marker round-trips through PHP’s associative JSON decoder. Empty objects in the pending intent body become arrays, so the full marker no longer matches the confirmed JavaScript authority even though the final block content is valid.

Solution

After the existing compile gates finish, page and synced-pattern mutations carry their compiled desired state and mutation metadata. The four compile-only fields are omitted from that final mutation authority.

Behaviour that changes or must stay true Read first Proof
Final page and pattern markers exclude pending compilation input src/site/apply.ts Regression exercises empty-object normalization in the marker transport
Identity, ownership, before-state and desired-content checks stay exact src/site/apply.ts Apply/media/pattern suites: 63 passed
Native media-backed page update completes applySite WordPress 7.1 / PHP 8.4.26 live update completed; four previously imported attachments retained

Diff

+20 −6 · 2 files · no public API change

 compile pattern/page with resolved dependencies
 check complete gate result
- perform({ ...pendingOperation, desired })
+ omit body, pendingBindings, pendingPatternUses, requiresFinalization
+ perform({ ...finalizedOperation, desired })

Testing & verification

Reviewed revision: b02f962a7f2a33dea8de5c79c73505599bd3f88c · Environment: Node 22.23.1; local WordPress 7.1 / PHP 8.4.26 on OrbStack.

  • npm test -- dev/test/site-apply.test.ts dev/test/site-media.test.ts dev/test/site-media-import.test.ts dev/test/site-patterns.test.ts: 63 passed.
  • npm run typecheck, npm run build, npm run check:private, git diff --check: passed.
  • Live CLI update: completed with four existing media IDs retained, followed by actual native heading/image edits, Save and reopen. All 266 page blocks were valid; mounted serialization agreed with edited content. Restoring through the editor recovered the exact compiled page bytes.
  • The live update resumed after explicit operator reconciliation of this known pre-write marker failure. Original failure evidence was preserved. This is not clean one-shot bootstrap evidence.

Not verified: live synced-pattern finalization with this exact empty-object shape; covered by the shared code path and focused pattern suite. Required CI passed on this exact revision: Node 22.13.0 and 24.0.0 verification/packed-consumer checks, package boundary, WordPress 7.1 native proof and scope classification (run 38306092487). Both advisors found no blocking defect in the bounded source/recovery review; they did not independently replay WordPress.

Risk / rollout

No authority check is weakened. Final mutations use their complete compiled state; pending compilation input remains in the confirmed plan. No automatic recovery is added for existing failed journals. Older interrupted journals carrying these compile-only fields are not migrated and can still refuse; completed receipt replay keeps its existing exact checks.

Detection: a marker mismatch still refuses the operation. Rollback: revert this commit; existing failed journals continue to require explicit operator reconciliation.

@noeltock
noeltock merged commit 10ec438 into main Oct 12, 2026
8 checks passed
@noeltock
noeltock deleted the block-theme/finalized-authority branch October 12, 2026 21:00
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