# Preview SQL Delivery Rehearsal Implementation Plan > **For agentic workers:** Implement task-by-task with tests first. Steps use checkbox (`- [ ]`) syntax for tracking. **Goal:** Add the first reviewed real SQL delivery Plugin, a non-secret manual target probe, and an end-to-end isolated rehearsal. **Architecture:** A normal installed `FeaturePlugin` owns immutable classpath apply/rollback SQL. Existing Plan 1.2 and `sql-jdbc:v1` execute it. A separate read-only probe validates the guarded target connection and receipt ledger without executing a contribution. **Tech Stack:** Java 8, Spring Boot 2.5, JDBC, Druid MySQL AST, H2 1.4.200, JUnit 4, Mockito, Vue 2. ## Global Constraints - Installing the Plugin must not publish or execute it automatically. - The SQL target remains disabled by default. - Probe and Registry APIs must never expose URL, username, password, SQLState, or driver errors. - Tests use the real SQL resources, planner, resolver, parser, Executor, and H2 target ledger. - Existing plaintext development credentials and TLS verification settings remain out of scope by explicit user decision. ### Task 1: Delivery Plugin Contract **Files:** - Create: `ruoyi-generator/src/main/java/com/ruoyi/generator/factory/plugin/delivery/PreviewDatabaseBaselinePlugin.java` - Create: `ruoyi-generator/src/main/resources/plugin-delivery/preview-baseline/V1__preview_delivery_baseline.sql` - Create: `ruoyi-generator/src/main/resources/plugin-delivery/preview-baseline/U1__preview_delivery_baseline.sql` - Test: `ruoyi-generator/src/test/java/com/ruoyi/generator/factory/plugin/delivery/PreviewDatabaseBaselinePluginTest.java` - [x] Write failing tests for trusted manifest identity, declared payload/resource identity, idempotence, reversibility, and parser acceptance. - [x] Implement the installed Plugin and dedicated apply/rollback resources. - [x] Run the Plugin contract tests and confirm they pass. ### Task 2: End-To-End Preview Rehearsal **Files:** - Modify: `ruoyi-generator/src/test/java/com/ruoyi/generator/factory/plugin/delivery/PreviewDatabaseBaselinePluginTest.java` - [x] Write a failing H2 test for Plan 1.2 apply, trusted re-resolution, execution, duplicate delivery, and compensation. - [x] Reuse production planner, resolver, SQL parser, Executor, and target ledger in the test. - [x] Confirm one marker row, one apply execution, one compensation execution, and final table removal. ### Task 3: Read-Only Target Probe **Files:** - Create: `ruoyi-generator/src/main/java/com/ruoyi/generator/factory/plugin/model/PluginSqlTargetProbeStatus.java` - Create: `ruoyi-generator/src/main/java/com/ruoyi/generator/factory/plugin/execution/sql/PluginSqlTargetProbeService.java` - Modify: `ruoyi-generator/src/main/java/com/ruoyi/generator/controller/FeaturePluginController.java` - Test: `ruoyi-generator/src/test/java/com/ruoyi/generator/factory/plugin/execution/sql/PluginSqlTargetProbeServiceTest.java` - Test: `ruoyi-generator/src/test/java/com/ruoyi/generator/controller/FeaturePluginControllerTest.java` - [x] Write failing tests for disabled, invalid, ready, unreachable, and ledger-unavailable states. - [x] Implement the guarded zero-row receipt-ledger probe and generic status messages. - [x] Expose the permission-protected probe endpoint and prove the response model has no secret fields. - [x] Run probe and controller tests and confirm they pass. ### Task 4: Admin Probe State **Files:** - Modify: `ruoyi-ui/src/api/generator/plugin.js` - Modify: `ruoyi-ui/src/views/generator/plugin/index.vue` - Modify: `ruoyi-ui/test/pluginRegistryView.test.mjs` - [x] Write a failing static contract for the probe API, loading state, result state, and non-secret rendering. - [x] Add the manual probe command and concise last-result label to the Registry status band. - [x] Run frontend static tests and the production build. ### Task 5: Documentation And Regression **Files:** - Modify: `docs/superpowers/specs/2026-07-10-ai-software-factory-roadmap.md` - Modify: `docs/superpowers/plans/2026-07-11-preview-sql-delivery-rehearsal.md` - [x] Document the first delivery Plugin, activation order, probe semantics, and remaining production boundary. - [x] Run focused Plugin/SQL/probe tests. - [x] Run the generator full regression and compare with the 18 documented baseline failures. - [x] Run admin critical tests, frontend static tests, and production build. - [x] Confirm EasyCode and RuoYi UI endpoints return HTTP 200.