Skip to content

Persist and approve Studio diagram edit revisions #282

Description

@anandpant

Goal

Make browser edits in Studio durable: save an edited drawing as a new immutable revision and let the user explicitly approve a revision.

Current baseline

  • Studio project and diagram records in packages/studio/projects point to one source artifact and do not model revisions or approval.
  • apps/playground/src/routes/diagrams_/$diagramId/edit.tsx detects edits but only offers an Excalidraw download.
  • Code Mode derived artifacts and the CLI revision store provide useful provenance and recovery precedents, but they are separate persistence systems and should not become a compatibility layer.

Scope

  • Define a small Studio revision model around the existing Cloudflare object-store boundary.
  • Persist an edited drawing as a derivative of its source artifact while keeping the source recoverable.
  • Retain the source relationship, diagram type, content identity, and available generation metadata.
  • Add an explicit approval action and record which revision was approved.
  • Refactor the touched Studio edit data-loading lifecycle to TanStack Query or event-driven state; do not add or preserve direct useEffect synchronization in product code.
  • Verify the real Studio edit/save/approve flow in a browser.

Non-goals

  • Collaborative editing or event sourcing.
  • Automatic prompt/model optimization.
  • Reusing the CLI's local manifest format as Studio's storage contract.
  • Community templates or publishing workflows.

Acceptance criteria

  • A Studio edit can be saved and reloaded as a new immutable revision.
  • The prior revision and source artifact remain recoverable.
  • Approval is explicit, durable, and attached to one revision.
  • Unit/integration coverage proves revision and provenance invariants.
  • Browser coverage proves the current Studio edit flow can save, reload, and approve.

Current touchpoints

  • apps/playground/src/routes/diagrams_/$diagramId/edit.tsx
  • packages/studio/projects/src/contracts.ts
  • packages/studio/projects/src/server/service.ts
  • packages/diagram/agent/src/lib/code-mode-artifacts.ts
  • apps/cli/src/storage.ts (precedent only)

This replaces the persistence-and-approval portion of #63 against the current repository.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions