docs: define zero-wait shadow safety fixes

This commit is contained in:
zgw
2026-08-12 09:07:05 +08:00
parent 6738eff609
commit 34c4d54669
2 changed files with 62 additions and 11 deletions

View File

@@ -14,6 +14,9 @@
- No license, TLS, Security, frontend, tidy, replay, PDA, WCS callback, reservation, or ACTIVE workflow integration changes.
- Legacy procedures execute exactly once and their current response construction remains authoritative.
- Shadow observation is disabled by default and fails open on every runtime error.
- Legacy request threads never execute, queue behind, or wait for shadow database work.
- A single daemon worker with zero queue capacity admits at most one shadow observation cycle per JVM; busy submissions are dropped.
- Installation refuses an existing `alg` schema; uninstall requires the exact package manifest and object allow-list.
- Shadow database scripts never insert, update, or delete WMS business rows.
- Shadow database scripts never create triggers on WMS business tables.
@@ -139,7 +142,51 @@
- [ ] Document backup-copy rehearsal, IDEA dual-workspace deployment, startup checks, data export, fast application rollback, and full SQL uninstall rollback.
- [ ] Commit as `docs: add IDEA shadow deployment and rollback guide`.
### Task 7: Review, verify, and publish
### Task 7: Remove shadow latency from Legacy threads
**Files:**
- Create: `ruoyi-admin/src/main/java/com/ruoyi/algorithm/shadow/InboundShadowCompletion.java`
- Create: `ruoyi-admin/src/main/java/com/ruoyi/algorithm/shadow/OutboundShadowCompletion.java`
- Modify: `ruoyi-admin/src/main/java/com/ruoyi/algorithm/shadow/ShadowObservationGateway.java`
- Modify: `ruoyi-admin/src/main/java/com/ruoyi/api/service/impl/ToWmsServiceImpl.java`
- Modify: `ruoyi-admin/src/main/java/com/ruoyi/out/outStockout/service/impl/OutStockoutServiceImpl.java`
- Test: `ruoyi-admin/src/test/java/com/ruoyi/algorithm/shadow/ShadowObservationGatewayTest.java`
- Test: `ruoyi-admin/src/test/java/com/ruoyi/api/service/impl/ToWmsServiceImplShadowTest.java`
- Test: `ruoyi-admin/src/test/java/com/ruoyi/out/outStockout/service/impl/OutStockoutServiceImplShadowTest.java`
**Interfaces:**
- Produces: `observeInbound`, `observeProjectOutbound`, and `observeExactStockOutbound`, each returning a nonblocking completion token.
- Guarantees: one daemon worker, `SynchronousQueue`, `AbortPolicy`, no caller-runs fallback, zero queued observations, and background-only comparison.
- [ ] Add gateway tests that block the planning engine and prove submission returns before planning completes, a concurrent submission is dropped, and Legacy completion is accepted without waiting.
- [ ] Update service tests to require order: observation submission, Legacy procedure exactly once, Legacy reload/result construction, completion-token notification.
- [ ] Run focused tests and confirm RED against the synchronous gateway.
- [ ] Implement completion tokens and the dedicated executor; catch rejection, timeout, interruption, and runtime failures inside the gateway.
- [ ] Replace synchronous plan/compare calls in both Legacy services with submit/complete calls only.
- [ ] Run focused tests and confirm GREEN.
- [ ] Commit as `fix: keep shadow work off legacy threads`.
### Task 8: Protect SQL package ownership
**Files:**
- Modify: `fortucky-algorithm/src/main/resources/db/sqlserver/install-shadow.sql`
- Modify: `fortucky-algorithm/src/main/resources/db/sqlserver/uninstall-shadow.sql`
- Modify: `fortucky-algorithm/src/main/resources/db/sqlserver/diagnostics-shadow.sql`
- Modify: `fortucky-algorithm/src/test/java/com/ruoyi/algorithm/repository/ShadowSqlServerMigrationScriptTest.java`
- Modify: `doc/algorithm-shadow/README.md`
**Interfaces:**
- Produces: manifest id `FT546WMS_SHADOW_ONLY` and version `2026-08-12-1`.
- Guarantees: install refuses any existing `alg` schema; uninstall refuses missing/wrong manifest or any unknown top-level `alg` object.
- [ ] Add static tests requiring the exact manifest, fail-fast existing-schema guard, uninstall manifest validation, and unknown-object rejection.
- [ ] Run the SQL migration test and confirm RED.
- [ ] Add `alg.shadow_package_manifest`, fail-fast install guard, and refusal-first uninstall validation before any `DROP`.
- [ ] Add manifest output to diagnostics and exact recovery instructions to the field guide.
- [ ] Run the SQL migration test and confirm GREEN.
- [ ] Commit as `fix: verify shadow SQL package ownership`.
### Task 9: Review, verify, and publish
**Files:**
- Review all changes relative to `origin/main`.