This is an internal working record, not an everyday instruction. It was written while the system was being rebuilt, for whoever maintains it. If you are here to do today's work, use the everyday documents instead: Procedures · Processes · Runbooks · The working day, step by step
MK Trade, Cost, Rate And Document Outputs — Parity And Cutover Matrix¶
- Status:
MIGRATION INPUT / NO WAVE ACTIVATED - Source baseline:
qa@d96498360bb9c3541a1b5f862284596a7ed217b9 - Rebuild packet:
MK_TRADE_COST_RATE_DOCUMENT_OUTPUTS_CAPABILITY_REBUILD_PACKET.md - Policy matrix:
MK_TRADE_COST_RATE_DOCUMENT_OUTPUTS_POLICY_DECISION_MATRIX.md
1. Migration Rule¶
one capability + one selected cohort
= one authoritative writer
Read-only projections can run in shadow. Mutable commands cannot dual-write.
Trade/Document reads:
PHP read + TypeScript shadow allowed
Export Brokerage / Cost / Rate:
PHP writer or TypeScript writer, never both for the same cohort
The migration unit is an accepted capability, not a PHP file or route.
2. Parity Classes¶
| Class | Meaning |
|---|---|
EXACT |
target preserves accepted current behavior |
APPROVED DIFFERENCE |
target intentionally fixes accepted defect/debt |
NOT APPLICABLE |
no target equivalent is needed |
BLOCKED |
policy/evidence required before cutover |
RETIRE |
compatibility is removed after caller-zero |
3. Trade Summary Parity¶
| Area | Current | Target | Parity class | Evidence |
|---|---|---|---|---|
| tenant/equipment filters | current API/session query | typed tenant/equipment query | EXACT | TRADE-SCN-010 |
| aliases | trade-summary and deal-ledger aliases | stable route plus compatibility redirects | EXACT then RETIRE | caller inventory |
| source rows | equipment/order/Booking/transaction joins | versioned source classes | APPROVED DIFFERENCE | source-breakdown parity |
| AP/AR totals | mixed source rules | explicit per-source status/deleted policy | BLOCKED | accounting decision |
| status | formula-derived labels | same accepted formula or renamed derived labels with explanation | BLOCKED | policy and role review |
| detail | incomplete source coverage | complete source breakdown | APPROVED DIFFERENCE | header/detail reconciliation |
| deleted/multiple links | inconsistent/silent | excluded or conflict | APPROVED DIFFERENCE | fixture matrix |
| CSV | browser local | exact reviewed-fingerprint CSV | EXACT | zero-write export |
| mutation | none | none | EXACT | write audit zero |
Cutover can occur before mutable family commands when read parity and explainability are accepted.
4. Export Brokerage Parity¶
| Area | Current | Target | Parity class | Evidence |
|---|---|---|---|---|
| feature/profile gate | config + module compatibility | semantic capability + config | APPROVED DIFFERENCE | role/config matrix |
| AI extraction | proposal | proposal | EXACT | EB-SCN-100 |
| Booking selection | required for Ocean; current generated compatibility may exist | explicit REUSED/CREATED disposition | BLOCKED | policy/fixtures |
| child set | Purchase/Transload/Lot/Outbound/Equipment/Allocation | explicit owner commands and manifest | EXACT outcome, improved contract | child parity |
| generated markers | remark strings | typed provenance plus compatibility marker | APPROVED DIFFERENCE | coexistence readback |
| transaction | one local DB request | one local transaction while accepted; durable workflow if split | BLOCKED | architecture/owner decision |
| idempotency | absent | Job/request token | APPROVED DIFFERENCE | duplicate/response loss |
| result | immediate child IDs | durable Job/child manifest | APPROVED DIFFERENCE | result query |
| cancel | guarded compensation | explicit child compensation/residual manifest | EXACT outcome, improved contract | cancel fixtures |
| unknown result | manual child search | Job result/reconcile query | APPROVED DIFFERENCE | EB-SCN-040/080 |
| broad helper ownership | current cross-module helper calls | typed application contracts | RETIRE | P5 caller-zero |
No Export writer cutover until supported shape, provenance, balance, cancel and request identity are accepted.
5. Outbound Cost Parity¶
| Area | Current | Target | Parity class | Evidence |
|---|---|---|---|---|
| order assertion | Sales/Outbound order | same | EXACT | normal/denied |
| cost ownership | any order-linked AP/latest fallback | typed Outbound Cost target | APPROVED DIFFERENCE / BLOCKED | ownership policy |
| mutable statuses | CREATED/OPEN/DRAFT | accepted state policy | BLOCKED | accounting review |
| header fields | forced/defaulted | explicit patch/full DTO with preservation | APPROVED DIFFERENCE | metadata fixture |
| lines | replace-all | accepted replace-all or stable lines with version | BLOCKED | line policy |
| amount | explicit or quantity×rate | versioned decimal formula | BLOCKED | formula matrix |
| update concurrency | last-write | expected version/status | APPROVED DIFFERENCE | concurrent scenario |
| delete | soft-delete mutable header/lines | same accepted effect + dependency warning | EXACT outcome | file/sibling checks |
| files | independent | independent | EXACT | file link readback |
| Trade impact | immediate derived projection | explicit source class/freshness | APPROVED DIFFERENCE | Trade readback |
| response loss | AP inventory manual | request token/result lookup | APPROVED DIFFERENCE | unknown-result scenario |
6. Packing Rate Parity¶
| Area | Current | Target | Parity class | Evidence |
|---|---|---|---|---|
| eligible rows | Booking-linked active Sales Outbound items | same | EXACT | target/foreign/deleted matrix |
| rate authority | T_LOAD_ITEM.RATE |
same repository authority | EXACT | DB readback |
| batch result | silent skip + count | all-or-nothing or explicit per-item | APPROVED DIFFERENCE / BLOCKED | policy |
| valid range | no accepted guard | accepted range/UOM/base | BLOCKED | accounting policy |
| concurrency | last-write | expected prior rate/version | APPROVED DIFFERENCE | stale scenario |
| audit | generic only | accepted correction evidence | BLOCKED | owner decision |
| UI trigger | blur autosave | explicit save or fully visible autosave | APPROVED DIFFERENCE | target-role UX |
| print race | possible | print readiness based on server reread | APPROVED DIFFERENCE | delayed-failure test |
| amount field | transient | explicitly calculated/transient | EXACT | reload test |
7. Document Projection Parity¶
7.1 Shared¶
| Area | Current | Target | Parity class |
|---|---|---|---|
| source | current live rows | same accepted source + fingerprint | EXACT |
| template | implicit PHP/template constants | explicit template version/config | APPROVED DIFFERENCE |
| output state | none | none in initial read migration | EXACT |
| browser print | current browser | browser print | EXACT |
| durable file/email | none | none unless separately approved | NOT APPLICABLE initially |
| source mutation | none | none | EXACT |
| role/tenant | page-specific compatibility | consistent semantic guard | APPROVED DIFFERENCE |
| stable Wiki topic | existing | preserve | EXACT |
7.2 Packing¶
| Area | Current | Target | Class |
|---|---|---|---|
| equipment commodity source | complete-coverage path | accepted same source policy | BLOCKED |
| whole-document fallback | current fallback | explicit warning or accepted per-row policy | BLOCKED |
| fixed terms/ports/currency | constants | versioned profile/template | APPROVED DIFFERENCE |
| transient edits | browser-only | clearly transient or removed | APPROVED DIFFERENCE |
| rate correction | separate PATCH | separate Rate command | EXACT boundary |
7.3 Purchase Local Invoice¶
| Area | Current | Target | Class |
|---|---|---|---|
| formula | MT/LT/ST/EACH/fallback | accepted decimal/UOM formula | BLOCKED |
| invoice identity | order number label | same label or accepted durable invoice | BLOCKED Product decision |
| role gate | direct-page gap | consistent role/record guard | APPROVED DIFFERENCE |
| current-source render | yes | yes | EXACT |
7.4 Booking Confirmation¶
| Area | Current | Target | Class |
|---|---|---|---|
| role gate | explicit current page role | semantic equivalent | EXACT |
| Sales ref precedence | current helper | accepted source precedence | BLOCKED |
| current date/fixed text | current render | versioned template/source | APPROVED DIFFERENCE |
| confirmation state | none | none unless separate Product process | EXACT |
7.5 Sales Weight Ticket¶
| Area | Current | Target | Class |
|---|---|---|---|
| source | order/items/equipment | same accepted projection | EXACT |
| physical Scale required | no | remain separate | EXACT boundary |
| mixed UOM | raw aggregation possible | block/convert under accepted policy | BLOCKED |
| generic physical IDS branch | separate role/tenant path | separate Scale owner | EXACT boundary |
8. Migration Waves¶
TCRD-W0 Characterization¶
- source/schema/role/menu/API/direct URL inventory;
- current Wiki rows/rendered pages;
- formula/template snapshots;
- Export child/cancel fixtures;
- Cost/AP and rate source fixtures;
- current caller logs.
Exit: accepted current baseline and open policy register.
TCRD-W1 Trade TypeScript Read Shadow¶
- typed source classes;
- complete breakdown;
- current formula parity and warning differences;
- no user-facing writer.
Exit: list/detail/filter/export parity under controlled fixtures.
TCRD-W2 React + Next.js Read-Only Trade And Documents¶
- Trade Workspace;
- Packing/Invoice/Confirmation/Weight previews;
- current PHP writer/output remains available;
- stable Wiki links point to accepted current route only after release.
Exit: target-role read/browser parity and rollback.
TCRD-W3 Packing Rate One Writer¶
- accepted range/batch/version/audit policy;
- per-item readback;
- print-pending UX;
- selected cohort routing.
Exit: rate normal/partial/stale/unknown and rollback evidence.
TCRD-W4 Outbound Cost One Writer¶
- typed ownership/subtype;
- header/line preservation;
- expected version/status;
- file/sibling/Trade readback.
Exit: cost normal/immutable/multiple AP/concurrent/unknown and rollback evidence.
TCRD-W5 Export Job Identity And Create¶
- durable job/request/manifest;
- supported shape;
- explicit child commands;
- balance parity;
- selected cohort one writer.
Exit: create/duplicate/response-loss/child-readback evidence.
TCRD-W6 Export Cancel And Reconciliation¶
- child blockers;
- compensation/residual manifest;
- unknown cancel recovery;
- generated marker coexistence.
Exit: safe cancel, blocked cancel, rollback and caller-zero inputs.
TCRD-W7 Optional Durable Document Effects¶
Only if Product accepts:
- snapshot identity/template/source fingerprint;
- file object/link;
- delivery intent/provider result;
- retention/supersede/void.
Otherwise skip as NOT APPLICABLE.
TCRD-W8 Stabilization And Wiki¶
- target-role field acceptance;
- rendered/publication readback;
- current/future links;
- observation metrics/errors;
- support/recovery.
TCRD-W9 Caller-Zero¶
- remove PHP routes/helpers/pages only after static/runtime caller-zero;
- preserve redirects/stable Wiki topics;
- remove numeric-client report branch only after profile contract parity;
- remove compatibility markers only after provenance migration.
TCRD-W10 PostgreSQL Later¶
- decimal/UOM/formula parity;
- request/job unique constraints;
- collations/reference matching;
- JSON manifest/version;
- source fingerprint/template version;
- soft-delete/audit parity.
9. Rollback Matrix¶
| Wave | Rollback action | Preserve |
|---|---|---|
| Trade read | route back to PHP query | zero source writes |
| document read | route back to PHP page/helper | generated browser copies remain external custody |
| rate writer | route selected cohort back to PHP after reconciling in-flight token | committed item rates/history |
| cost writer | route cohort back after resolving in-flight request | transactions/lines/files/sibling AP |
| Export create | stop new target claims, reconcile in-flight jobs, route new cohort to PHP | created children/job manifests |
| Export cancel | stop new cancel claims, finish/reconcile current compensation | preserved/cancelled/residual children |
| optional document effect | stop worker claims, reconcile provider/file intents | snapshots/files/provider evidence |
Rollback never means:
- delete and recreate orders/transactions;
- restore rate/cost without evidence;
- replay unknown Export jobs;
- resend/print automatically;
- dual-write PHP and TypeScript.
10. Caller-Zero Matrix¶
| Legacy surface | Caller-zero proof |
|---|---|
| Trade Summary aliases/helper | page/API/report callers migrated; logs zero |
| Export Brokerage page/routes/helper | create/cancel/AI/search callers migrated; no in-flight unknown jobs |
| Outbound Cost helper/routes/UI | all cost commands and read consumers migrated; generic AP ambiguity resolved |
| Packing rate PATCH/autosave | all rate writes and print readiness use target application |
| Packing PHP page/helper | current links/print/Wiki use target; no popup/direct callers |
| Local Invoice direct page/helper | current links/API/direct URL migrated or redirected |
| Booking Confirmation direct page/helper | current links/direct URL migrated or redirected |
| Sales Weight ORDER_ID page/helper | current links migrated; physical IDS remains Scale owner |
| numeric Client report branches | profile/config target provides equivalent accepted behavior |
Observation window and log source are defined in the activated P12 wave.
11. Required Verification Matrix¶
| Family | Normal | Denied | Duplicate/stale | Partial/unknown | Correction/rollback |
|---|---|---|---|---|---|
| Trade | source-explained list/detail/export | role/tenant/module | source changed | header/detail unresolved | source-owner correction only |
| Export | supported create/cancel | role/config/record | duplicate token | response loss/child partial | guarded compensation |
| Cost | exact typed create/update/delete | immutable/foreign | expected-version conflict | unknown response/multiple AP | typed correction/rollback |
| Rate | exact item set | wrong Booking/tenant | stale expected rate | mixed per-item/response loss | reasoned correction/restore |
| Documents | exact source/render/print | direct URL/feature/record | source fingerprint changed | print unknown/fallback conflict | source correction or human reprint |
No M4 status is reached until required role/browser/DB/accounting/output evidence is accepted.
---¶
Source:
docs/processes/MK_TRADE_COST_RATE_DOCUMENT_OUTPUTS_PARITY_AND_CUTOVER_MATRIX.md— ctc repository · This page is an English translation of the source document. Identifiers, file paths and code symbols are unchanged.