Skip to content

refactor: preview generation around a reusable in-memory workspace #250

Description

@lloydrichards

Context

Stack Effect already applies plans to an in-memory filesystem for CLI dry-runs and Recipe Builder previews. The current preview path prepares the virtual repository, runs Apply, reads the generated files, and builds the preview response.

This works today, but it makes preview-specific code responsible for workspace setup and result capture.

Benefits

  • Give CLI previews, browser previews, and tests one consistent way to run Apply in isolation.
  • Keep filesystem setup, path mapping, repository seeding, and cleanup in one module.
  • Ensure the Apply result and captured files describe the same workspace state.
  • Provide a reusable foundation for stronger catalog tests and future programmatic consumers.

Expected changes

  • Introduce a scaffold-layer module that materializes an Apply intent inside an isolated workspace.
  • Let callers inspect the Apply outcome and resulting files without knowing how the filesystem is wired.
  • When a caller plans and applies in one workflow, ensure both operations observe the same owned workspace.
  • Keep the existing preview response stable unless consumers clearly benefit from a change.
  • Keep Effect VFS volume and snapshot types internal unless a stable consumer needs them.

This should remain narrower than #181. It owns isolated workspace creation, seeding, path wiring, and result capture—not end-to-end workflow orchestration, user decisions, presentation, Finalize, or configuration mutation. It must not replace Plan or Apply with filesystem state.

Repository-state authority and drift semantics remain owned by #175. This issue consumes that contract when preparing and materializing the workspace.

Done when

  • Workspace setup and result capture are owned by one scaffold module.
  • The Apply result and captured files always describe the same workspace state.
  • Existing CLI and Recipe Builder preview behavior continues to work.
  • Tests seed an existing repository, materialize an Apply, and assert both the ApplyResult and resulting files.

Blocked by

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions