# Plugin Menu Target Executor Implementation Plan > **For agentic workers:** Implement task-by-task with tests first. Steps use checkbox (`- [ ]`) syntax for tracking. **Goal:** Bind approved execution batches to the configured JDBC environment and deliver reviewed RuoYi admin menus through a real, idempotent adapter with target ownership and conservative compensation. **Architecture:** The Worker propagates the frozen execution environment into every contribution context, and a shared policy rejects JDBC target mismatches before connection. A strict JSON parser produces a semantic menu document; `menu-jdbc:v1` reuses the isolated target connection and durable receipt lease while a dedicated repository owns fixed prepared statements for RuoYi menu, role grant, and ownership tables. **Tech Stack:** Java 8, Spring Boot 2.5, JDBC, Fastjson2, MySQL 5.7-compatible SQL, H2 MySQL mode, JUnit 4, Vue 2, Element UI. ### Task 1: Approved Environment Gate **Files:** - Modify: `PluginContributionExecutionContext.java` - Modify: `PluginTransitionOutboxWorker.java` - Create: `PluginJdbcTargetEnvironmentPolicy.java` - Modify: SQL and permission JDBC Executors and their tests - [x] Propagate the execution batch's frozen environment to every target context. - [x] Reject blank or mismatched approved environments before opening a JDBC connection. - [x] Apply the shared policy to SQL, permission, and menu adapters. - [x] Prove Worker propagation and zero-connection mismatch failure. ### Task 2: Menu Document Contract **Files:** - Create: `PluginMenuDocument.java` - Create: `PluginMenuDocumentParser.java` - Test: `PluginMenuDocumentParserTest.java` - [x] Write tests for strict fields, canonical roles, identity mismatch, unsafe paths, invalid routes, wildcards, and bounds. - [x] Implement bounded JSON parsing and semantic fingerprints. - [x] Run parser tests. ### Task 3: Target Ownership And Real Executor **Files:** - Modify: `sql/factory_plugin_sql_target.sql` - Create: `PluginMenuTargetRepository.java` - Create: `MenuJdbcPluginContributionTargetExecutor.java` - Test: `MenuJdbcPluginContributionTargetExecutorTest.java` - [x] Add menu and role-grant ownership tables with ACTIVE/REMOVED lifecycle state. - [x] Support only `MENU + admin_frontend + idempotent=true` and APPLY/ROLLBACK. - [x] Require an active factory-owned permission dependency, existing parent/roles, full parent-menu access, and the required permission grant. - [x] Reject unowned path/route collisions, drift, unmanaged grants, and child menus. - [x] Reuse durable receipt leases and deterministic external receipts. - [x] Use one lock order for menu ownership and permission dependency. ### Task 4: First Menu Delivery Plugin **Files:** - Create: `PreviewMenuBaselinePlugin.java` - Create: `plugin-delivery/preview-menu/delivery-verification.json` - Create: `plugin-delivery/preview-menu/rollback-delivery-verification.json` - Test: `PreviewMenuBaselinePluginTest.java` - [x] Publish one trusted reversible menu contribution with an explicit permission Plugin dependency. - [x] Prove permission apply, menu apply, duplicate delivery, role visibility, reverse compensation, and receipt history end to end. ### Task 5: Probe And Delivery Page **Files:** - Modify: `PluginSqlTargetProbeService.java` - Modify: `PluginSqlTargetProbeStatus.java` - Create: `PluginDeliveryVerificationStatus.java` - Modify: `FeaturePluginController.java` - Create: `ruoyi-ui/src/views/generator/delivery/index.vue` - Modify: Plugin API, Plugin page, and static tests - [x] Require permission and menu ownership tables when `menu-jdbc:v1` is routed. - [x] Expose a distinct non-secret menu-schema failure state. - [x] Add a dedicated permission-protected delivery verification endpoint. - [x] Implement the real component declared by the menu document. - [x] Show menu ownership readiness and recognize `menu-jdbc:v1` in Plugin management. ### Task 6: Documentation And Regression **Files:** - Create: `docs/superpowers/specs/2026-07-11-plugin-menu-target-executor-design.md` - Create: `docs/superpowers/plans/2026-07-11-plugin-menu-target-executor.md` - Modify: `docs/superpowers/specs/2026-07-10-ai-software-factory-roadmap.md` - [x] Document activation, environment binding, ownership, dependencies, and compensation boundaries. - [x] Run 149 focused Plugin tests. - [x] Run generator full regression against the 18 known baseline failures. - [x] Run 38 admin critical tests, four frontend static tests, and the production build. - [x] Confirm EasyCode and RuoYi UI development endpoints return HTTP 200.