Skip to content

MK Trade Current Source Authority — 2026-08-10

  • Task: CTC-CDOC-001
  • Status: CURRENT STATIC SOURCE AUTHORITY / ENVIRONMENT EVIDENCE REQUIRED
  • Current source baseline: qa/master@44a8866954075787c3d3a696460a4b7c26484325
  • Repository documentation head at inspection: master@8981a02f7b2a2fa256a7365d6921f3d7636f1fe2
  • Historical detached packet ref: d96498360bb9c3541a1b5f862284596a7ed217b9
  • Lineage reconciliation: MK_TRADE_CURRENT_LINEAGE_RECONCILIATION_2026-08-10.md
  • Phase implementation: USER HOLD
  • Effects performed: DOCUMENTATION ONLY

1. Authority Rule

For current MK Trade / Cost / Rate / Document behavior:

source at 44a886...
> accepted current business policy
> this authority map
> older source-reconciled packet
> historical/candidate material

This file supersedes older baseline labels only for current-source interpretation. It does not delete or rewrite historical evidence.

2. Capability Ownership

Capability Current source owners Authority type
Trade Summary / Deal Ledger app/systems/OMS/trade-summary/api_routes.php, trade_summary_query_helper.php, current Trade page and route config read projection
Export Brokerage app/systems/OMS/export-brokerage/api_routes.php, inbound-order helper, delivery helper, Export Brokerage page composite local orchestration
Outbound Cost app/systems/OMS/outbound-order/cost_helper.php, Outbound route/handler/UI, BMS transaction records local AP transaction mutation
Packing Rate app/systems/TMS/booking/api_routes.php, mkPackingList.php, T_LOAD_ITEM.RATE Booking-linked Sales item mutation
Packing Document mkPackingList.php, app/addons/reports/query_helper.php::packing_list() browser projection
Purchase Local Invoice localInvoice.php, purchase_local_invoice() browser projection
Booking Confirmation bookingConfirmation.php, booking_confirmation() browser projection
Sales Weight Ticket scaleticket.php, sales_weight_ticket() order/scale-derived browser projection by branch

No page, report helper or composite orchestration becomes the universal owner of all child state.

3. Trade Summary Authority

Current API

GET /oms/trade-summary
GET /oms/trade-summary/{equipmentId}
GET /oms/deal-ledger
GET /oms/deal-ledger/{equipmentId}

All four current routes use module key oms.trade-summary and call the Trade Summary query helper.

Record authority

Equipment
-> V_EQUIPMENT_DEAL_LINK
-> inbound/outbound Load/Order relationships
-> Booking/shipping references
-> equipment-linked AP/AR
-> outbound-order-linked AP
-> derived totals / margin / DEAL_STATUS

Current derived state:

material AP or AR -> CLOSED
otherwise shipment marker -> SHIPPED
otherwise -> OPEN

CLAIMED -> negative margin + material AP/AR filter

These labels are report logic. They are not accounting settlement or a durable Trade state machine.

4. Export Brokerage Authority

Current routes

GET  /oms/export-brokerage/bookings/search
POST /oms/export-brokerage/documents/ai-extract
POST /oms/export-brokerage/jobs
POST /oms/export-brokerage/jobs/cancel

The route is guarded by tenant workflow configuration and required related modules. AI extraction is proposal input; it is not Create authorization.

Current child authority

Current source can orchestrate or relate:

Purchase / inbound Load + items
Transload
Inventory Lot
Outbound Sales Load + items
Booking
Equipment / Equipment Load
Allocation

The route defines [EB:generated] and [EB:generated-booking]. Those are compatibility provenance markers, not an immutable command/job identity.

Current source returns child IDs but does not establish a universal persisted ExportBrokerageJob with request token, input fingerprint, immutable manifest and durable reconciliation result.

Effect boundary

Create committed
!= every child independently reconciled
!= response-loss safe replay

Cancel committed
!= all downstream effects reversed
!= physical/provider reversal

Unknown result requires readback/search before any replay.

5. Outbound Cost Authority

Current persisted authority is an AP transaction and line set linked to an Outbound Order.

T_TRANSACTION
+ T_TRANSACTION_LIST
+ outbound relation

Current helper behavior includes:

  • active AP candidate lookup;
  • explicit transaction targeting when supplied;
  • compatibility fallback that can select a latest matching AP when exact identity is absent;
  • mutable statuses including CREATED, OPEN, DRAFT;
  • rejection of mutation for CONFIRMED and CLOSED;
  • replace-all line semantics on update;
  • local transaction boundaries.

There is no proven universal Outbound-Cost subtype/discriminator that removes ambiguity when multiple active AP rows exist. That ownership question remains open for policy/runtime evidence.

File/document lifecycle is separate from Cost mutation.

6. Packing Rate Authority

Persisted rate authority:

T_LOAD_ITEM.RATE

Current writer:

app/systems/TMS/booking/api_routes.php::tmsBookingApiUpdatePackingListRates()

Current eligibility is constrained by the Booking-linked active Sales/Outbound relationship and tenant scope. Current handling can skip ineligible requested item IDs, so aggregate success/update count is not item-complete evidence.

Open policy includes accepted rate range, zero/negative behavior, precision/rounding, currency/UOM, stale-write handling and correction history.

7. Document Output Authority

Packing Document

Sources: Booking, Outbound Sales items, Equipment Load/commodity, company and RATE. Direct page currently uses requirePageRoleAccess('mkPackingList'). Current source still contains compatibility/profile-specific report behavior and fallback rules that require policy/evidence review.

Purchase Local Invoice

Sources: Purchase order/items and company. The displayed invoice number is an order label rather than proof of a separate invoice lifecycle record. Browser opening recomputes current source values. Existing source review does not prove direct-page and API role gates are equivalent.

Booking Confirmation

Sources: Booking/company/optional Sales reference. Direct page has requirePageRoleAccess('bookingConfirmation'). Current template/date/reference rendering is not a durable versioned confirmation state.

Sales Weight Ticket

ORDER_ID is an order-derived output branch. IDS[] can be a physical Scale-ticket branch. They must not be collapsed:

ORDER_ID render != physical measurement evidence

Mixed UOM aggregation remains evidence/policy work.

Common completion boundary

rendered != saved snapshot
printed != print acknowledgement
printed != approved
printed != emailed
printed != file retained
printed != business process completed

8. Caller And Effect Authority Matrix

Caller Owner route/helper Command/query class Local effect Required evidence before acceptance
Trade Summary page Trade GET routes/query helper query none current source-class explanation
Deal Ledger alias same query none alias parity and target-role access
Export Brokerage Booking selector Booking search route query none tenant/active Booking result
Export Brokerage AI extraction AI extraction route provider-backed proposal no child mutation provider/response provenance separately
Export Brokerage Create jobs POST composite command multi-child local writes child manifest + readback + duplicate search
Export Brokerage Cancel jobs/cancel POST compensation command multi-child local compensation residual/per-child result
Outbound Cost editor/API cost helper query/command AP header/lines exact transaction identity/readback
Packing List rate editor Booking rate route command T_LOAD_ITEM.RATE per-item reread
document pages report query/page query/render none from render source branch, role and render evidence

9. Current Relationship Map

flowchart LR
    EQ[Equipment] --> LK[V_EQUIPMENT_DEAL_LINK]
    LK --> IN[Inbound Purchase/Load]
    LK --> OUT[Outbound Sales/Load]
    OUT --> BK[Booking]
    OUT --> OI[Sales Load Items / RATE]
    EQ --> TXE[Equipment AP/AR]
    OUT --> TXO[Outbound AP Cost]
    TXE --> TR[Trade Projection]
    TXO --> TR
    IN --> TR
    OUT --> TR
    BK --> TR
    BK --> DOC[Packing / Booking outputs]
    OI --> DOC
    EQ --> DOC
    OUT --> WT[Order-derived Weight Ticket]
    ST[T_SCALE_TICKET] --> WT2[Physical ticket output branch]

The diagram shows relationships, not a single transaction boundary.

10. Historical And Candidate Disposition

  • d964983...: HISTORICAL SOURCE FACT as an old packet checkout.
  • its unique Loader-side commit: CANDIDATE-ONLY FACT, not Trade authority.
  • 4f6165..., 216305..., a71386e...: prior reconciliation anchors, retained as history only.
  • 44a886...: CURRENT SOURCE FACT baseline for this task.

No current statement in this authority map relies solely on the detached candidate.

11. Target Design — Not Current Runtime

TARGET DESIGN

  • typed Trade Projection query/explanation;
  • durable Export Brokerage request/job/result identity and reconciliation;
  • explicit Outbound Cost ownership and optimistic/stale-write contract;
  • per-item Packing Rate result/version/readback;
  • typed document projection with separately approved durable file/email/snapshot delivery when required;
  • React + Next.js presentation/adapters over framework-independent TypeScript applications and MySQL repositories first.

Phase implementation remains USER HOLD.

12. Evidence Required

OPEN / EVIDENCE REQUIRED

  • deployed source/config identity;
  • schema/index/constraint verification;
  • live relation and duplicate distributions;
  • intended/denied role matrix for each page/API/action/record;
  • current browser rendering and print behavior;
  • accounting acceptance of cost/status/formula rules;
  • current Wiki row/render/findability evidence;
  • response-loss/partial/duplicate recovery fixtures;
  • provider/file/physical evidence only if separately authorized.

The bounded read-only definition is RBR-MK-TRADE-002. It has not been executed.

---

Source: docs/reconstruction/MK_TRADE_CURRENT_SOURCE_AUTHORITY_2026-08-10.md — ctc repository · This page is an English translation of the source document. Identifiers, file paths and code symbols are unchanged.