feat: expand EasyCode software factory workflows

This commit is contained in:
王鹏
2026-07-15 12:48:50 +08:00
parent fcfa4374d7
commit 79dea897bc
1108 changed files with 163774 additions and 21593 deletions

View File

@@ -0,0 +1,101 @@
# Plugin Transition Durable Outbox Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Move Plugin Transition execution out of the request transaction into a leased, recoverable database Outbox without enabling real external writes.
**Architecture:** The request service atomically inserts a queued execution, pending step receipts, and one Outbox command. A scheduled Worker claims the command with a tokenized lease, executes each step outside database transactions, and uses a transactional coordinator for receipt/outbox state changes and expired-lease recovery.
**Tech Stack:** Java 8, Spring transactions, MyBatis XML, MySQL 5.7-compatible SQL, JUnit 4, Mockito, Vue 2, Element UI, Node test runner.
## Global Constraints
- The configured Executor remains `dry-run:v1` by default and must not modify external systems.
- No Spring transaction or Transition row lock may span `PluginContributionTargetExecutor.execute`.
- Every redelivery must reuse the D8e1 logical `stepIdempotencyKey`.
- MySQL 5.7 compatibility rules out a dependency on `SKIP LOCKED`.
- Existing plaintext development credentials and TLS verification settings remain out of scope by explicit user decision.
---
### Task 1: Durable State Contracts
**Files:**
- Modify: `ruoyi-generator/src/main/java/com/ruoyi/generator/factory/plugin/model/PluginTransitionExecution.java`
- Modify: `ruoyi-generator/src/main/java/com/ruoyi/generator/factory/plugin/model/PluginTransitionStepReceipt.java`
- Create: `ruoyi-generator/src/main/java/com/ruoyi/generator/factory/plugin/model/PluginTransitionOutbox.java`
- Modify: `ruoyi-generator/src/main/java/com/ruoyi/generator/config/PluginExecutionProperties.java`
- Test: `ruoyi-generator/src/test/java/com/ruoyi/generator/factory/plugin/execution/PluginTransitionOutboxContractTest.java`
- [x] Write failing tests for queued/pending/outbox states and bounded lease configuration.
- [x] Add the Outbox model, nested execution summary, status constants, and configuration properties.
- [x] Run the contract tests and confirm they pass.
### Task 2: Enqueue Instead Of Inline Execution
**Files:**
- Create: `ruoyi-generator/src/main/java/com/ruoyi/generator/factory/plugin/execution/PluginTransitionWorkResolver.java`
- Modify: `ruoyi-generator/src/main/java/com/ruoyi/generator/service/PluginTransitionExecutionService.java`
- Modify: `ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/factory/PluginTransitionExecutionMapper.java`
- Test: `ruoyi-generator/src/test/java/com/ruoyi/generator/service/PluginTransitionExecutionServiceTest.java`
- [x] Rewrite service tests so execute/retry/compensate create `QUEUED` executions, ordered `PENDING` receipts, and one `PENDING` Outbox command without calling the Executor.
- [x] Extract shared immutable-plan verification/resolution and implement transactional enqueueing.
- [x] Preserve idempotent state guards, attempt numbering, legacy-plan compensation rejection, and stable logical step keys.
- [x] Run service tests and confirm they pass.
### Task 3: Lease Coordinator And Worker
**Files:**
- Create: `ruoyi-generator/src/main/java/com/ruoyi/generator/service/PluginTransitionOutboxCoordinator.java`
- Create: `ruoyi-generator/src/main/java/com/ruoyi/generator/service/PluginTransitionOutboxWorker.java`
- Modify: `ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/factory/PluginTransitionExecutionMapper.java`
- Modify: `ruoyi-generator/src/main/resources/mapper/factory/PluginTransitionExecutionMapper.xml`
- Test: `ruoyi-generator/src/test/java/com/ruoyi/generator/service/PluginTransitionOutboxCoordinatorTest.java`
- Test: `ruoyi-generator/src/test/java/com/ruoyi/generator/service/PluginTransitionOutboxWorkerTest.java`
- [x] Write failing tests for conditional claiming, lease-token ownership, successful delivery, completed-step skipping, failed delivery, and reclaimed ambiguous steps.
- [x] Implement short transactional coordinator methods for claim/start/succeed/fail/complete/renew.
- [x] Implement non-transactional Worker polling and Executor invocation with stable-key redelivery.
- [x] Run coordinator and Worker tests and confirm they pass.
### Task 4: Schema And Reconciliation API
**Files:**
- Modify: `sql/factory_plugin_registry.sql`
- Modify: `sql/front_workbench.sql`
- Modify: `sql/db.sql`
- Modify: `ruoyi-generator/src/main/resources/mapper/factory/PluginTransitionExecutionMapper.xml`
- Modify: `ruoyi-generator/src/main/java/com/ruoyi/generator/controller/FeaturePluginController.java`
- Modify: `ruoyi-generator/src/test/java/com/ruoyi/generator/factory/plugin/PluginRegistrySchemaScriptTest.java`
- Modify: `ruoyi-generator/src/test/java/com/ruoyi/generator/controller/FeaturePluginControllerTest.java`
- [x] Write failing schema/controller tests for the Outbox table, lease indexes, reconciliation route, and Mapper state transitions.
- [x] Add MySQL 5.7-compatible Outbox DDL and execution/receipt status upgrades to all three scripts.
- [x] Add ownership-checked reconciliation that only releases an expired lease and never steals an active lease.
- [x] Run schema and controller tests and confirm they pass.
### Task 5: Plugin UI Operations
**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 failing static contracts for queued status, Outbox delivery details, and reconciliation action.
- [x] Update execution actions to report enqueueing instead of synchronous completion.
- [x] Add Outbox status/lease information and an icon-only reconciliation control with a tooltip.
- [x] Run the static test and production build.
### Task 6: Documentation And Regression
**Files:**
- Modify: `ruoyi-admin/src/main/resources/application.yml`
- Modify: `docs/superpowers/specs/2026-07-10-ai-software-factory-roadmap.md`
- Modify: `docs/superpowers/plans/2026-07-10-plugin-transition-durable-outbox.md`
- [x] Document D8e2a configuration, state transitions, recovery semantics, and the D8e2b real-adapter boundary.
- [x] Run focused Plugin execution/Outbox tests.
- [x] Run generator full regression and compare with the documented 18 baseline failures.
- [x] Run admin critical tests, frontend static tests, and the production build.
- [x] Confirm local EasyCode and RuoYi UI endpoints still return HTTP 200.