سامانه صدور فاکتور و حسابداری
docs: verify request workflow D2 cutover
davoodmehraban89 committed
Oct 1, 2026 at 22:45 UTC
f43d96f9b16761b4a9823356a24c1b60b22b5b4a
1 file changed
+57
docs/REQUEST_WORKFLOW_D2_CUTOVER_VERIFICATION.md
new
+57
@@ -0,0 +1,57 @@
1
+# Request Workflow Slice D2 — UI / Read-Model Cutover Verification
2
+
3
+Date: 2026-10-01
4
+
5
+## Scope
6
+D2 cuts the Requests UI/runtime away from legacy `records` requestTypes/requests for new operation and onto the server-authorized D1 model. Legacy records are retained non-destructively for rollback/audit.
7
+
8
+## Implemented
9
+- `js/request-workflow-d2.js` loads after legacy office automation and replaces the Requests render/runtime surface.
10
+- Request types and published immutable versions are read from `request_type_definitions` / `request_type_versions`.
11
+- Publishing uses `request_publish_type_version` with expected definition revision; stale revisions refresh rather than overwrite.
12
+- New request creation uses `request_create_instance` and retains the same client idempotency key across a failed retry.
13
+- Configure actions are hidden/blocked unless `requests_workflow.configure` is effective; creation requires create capability.
14
+- Published-version and unsaved UI draft-change state are visible.
15
+- Legacy request-store writes are not used by D2.
16
+
17
+## Production data cutover
18
+Archived repo migration: `supabase/migrations/20261001223500_request_workflow_d2_legacy_cutover.sql`.
19
+Production Supabase migration history name: `request_workflow_d2_legacy_cutover` (production version `20261001190938`).
20
+
21
+The migration is non-destructive and traceable:
22
+- Adds `legacy_record_id` trace columns and `legacy_number` on request instances.
23
+- Imports legacy request types into D1 definitions + immutable version 1 + workflow snapshot.
24
+- Imports legacy requests into pinned D1 instances with `legacy_import` immutable evidence.
25
+- Uses deterministic IDs / unique legacy indexes / conflict-safe inserts so rerun is idempotent.
26
+- Does not delete or update source `public.records` rows.
27
+
28
+Production reconciliation immediately after migration:
29
+- legacy request types in `records`: 2
30
+- legacy requests in `records`: 4
31
+- migrated D1 definitions: 2
32
+- migrated D1 type versions: 2
33
+- migrated D1 request instances: 4
34
+- immutable `legacy_import` events: 4
35
+
36
+## Performance hardening
37
+Archived repo migration: `supabase/migrations/20261001224500_request_workflow_d2_fk_indexes.sql`.
38
+Production migration applied as `request_workflow_d2_fk_indexes`.
39
+Eight covering FK indexes were added for request actor/instance/version/requester/publisher relations. The production Supabase performance advisor was re-run afterwards: the prior request-workflow `unindexed_foreign_keys` findings were eliminated; only unused-index informational findings remained for the newly created/other low-traffic indexes.
40
+
41
+## Security verification
42
+Production Supabase security advisor after D2 reports no new request-workflow security warning. The D1 public request RPCs remain SECURITY INVOKER wrappers; the advisor still reports the pre-existing 20 public SECURITY DEFINER warnings outside D1/D2, the three pre-existing private C8 RLS-without-policy informational findings, and leaked-password protection disabled.
43
+
44
+## Automated verification
45
+Quality run `36912668369` on commit `ef3e9c1c9e580ab273beb6372027523a9aec03ca` completed successfully:
46
+- JavaScript syntax: SUCCESS
47
+- all existing static/accounting/platform/office gates: SUCCESS
48
+- Request Workflow D1 static/security gates: SUCCESS
49
+- Request Workflow D2 UI/read-model static gate: SUCCESS
50
+- Real DOM smoke suite including `scripts/request-workflow-d2.spec.js`: SUCCESS
51
+- C8 disposable PostgreSQL suite: SUCCESS
52
+- D1 + D2 disposable PostgreSQL suite: SUCCESS
53
+
54
+D2 database assertions cover legacy preservation, immutable version/workflow snapshots, migrated submitted instances, legacy number/value preservation, immutable import evidence, migration idempotency, and all eight FK covering indexes.
55
+
56
+## Verified boundary
57
+D2 does not yet implement the D3 visual workflow designer, sequential/parallel step semantics, conditions DSL, SLA/escalation, delegation/substitution, or cross-module outbox actions. Those remain next-slice work. External BPM/provider integration remains outside verified scope.