Skip to content

Add constrained-runtime primary storage and explicit flush contract #125

Description

@chubes4

Problem

MDI primary mode can reconstruct WordPress from portable Markdown/JSON, but constrained and serverless runtimes currently need to reach into internal classes and rely on PHP shutdown to discover persisted changes. A Cloudflare Workers integration proved canonical Markdown cold restoration, but normal SQL interception and full bootstrap cannot yet be orchestrated through a bounded, explicit runtime contract.

Proposed contract

Add generic primary-runtime APIs that:

  • bootstrap MDI in storage-only mode without CLI, recovery, migration, or abilities machinery;
  • accept a caller-provided disposable SQLite index cache and identify the canonical manifest/hash it represents;
  • explicitly flush pending writes without requiring process shutdown;
  • return exact canonical paths created, changed, and deleted;
  • support writing a canonical post/option mutation through public MDI APIs;
  • keep object-store and Cloudflare concerns outside MDI.

Acceptance criteria

  1. A fixture canonical root builds or hydrates a disposable SQLite index.
  2. A normal WordPress post and option mutation can be explicitly flushed.
  3. The flush result reports deterministic changed/deleted relative paths.
  4. Destroying SQLite and reopening from the resulting Markdown/JSON reconstructs the mutation.
  5. Tests prove SQLite is cache machinery and canonical files are sufficient.
  6. Existing mirror and primary behavior remains compatible.

Context

This is the owning-layer primitive needed by serverless runtimes, offline editing, object-store revision systems, and agent sandboxes. Callers will stage a synchronous filesystem and replicate returned paths themselves.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions