Files
yidaima/RuoYi-Vue/docs/superpowers/plans/2026-07-10-generation-run-persistence.md

2.9 KiB

Generation Run Persistence Implementation Plan

Goal: Persist every successful ProjectSpec generation manifest with its Spec and environment fingerprints, then compare any two historical runs by target and file path.

Architecture: Keep ProjectSpecGenerationService responsible for deterministic source generation. After all targets are generated and inspected successfully, it computes an environment fingerprint and delegates one transactional write to ProjectSpecGenerationRunService. Runs, target summaries, and file manifests use normalized tables. Query and Diff APIs read only persisted manifests; generated ZIP bytes remain transient.

Tech Stack: Java 8, Spring, MyBatis, MySQL, JUnit 4, Mockito, Vue 3, Element Plus, Node test runner, Vite.

Task 1: Schema And Persistence Contract

  • Add factory_generation_run, factory_generation_target, and factory_generation_file to the upgrade and base SQL scripts.
  • Store Spec, Adapter, Plugin, Template, environment, target, and aggregate content fingerprints.
  • Add immutable insert/read-only MyBatis contracts and schema tests.

Task 2: Environment Fingerprints And Run Store

  • Compute deterministic Adapter, Plugin, Template, and aggregate environment fingerprints from ProjectSpec and selected targets.
  • Persist one successful run, all target summaries, and file manifests in one transaction.
  • List and load runs with project ownership checks.
  • Diff files by templateType + path, with added, removed, changed, and unchanged counts.

Task 3: Generation And HTTP Integration

  • Persist a run only after deterministic generation completes successfully.
  • Return generationRunId, creation time, status, and environment fingerprints from the existing generate endpoint.
  • Add list, detail, and run Diff endpoints to the Factory controller and frontend API.

Task 4: Factory Workspace

  • Replace the in-memory-only manifest view with persisted generation history.
  • Show run/Spec identity and Adapter, Plugin, Template, and environment fingerprints.
  • Add run selectors and a file-level artifact Diff table.
  • Keep generation ZIP download and certified artifact actions out of this phase.

Task 5: Verification And Roadmap

  • Run Factory backend tests, all frontend source-contract tests, and the Vite production build.
  • Run git diff --check and update the AI Software Factory roadmap with P1-G boundaries.

Explicit Boundaries

  • Only successful synchronous generations are persisted in P1-G.
  • ZIP bytes and generated source files are not stored; manifests and hashes are stored.
  • Adapter and Template fingerprints identify the current legacy contracts. P2 will replace these provisional contracts with first-class versioned Adapter and Template Pack descriptors.
  • A persisted run is traceable output evidence, not a certified artifact or deployment.