MK Trade / Cost / Rate / Document Outputs — Current Lineage Refresh — 2026-08-09¶
- Status:
CURRENT LINEAGE AND STATIC SOURCE REFRESH COMPLETE / ENVIRONMENT EVIDENCE REQUIRED - Historical packet ref:
d96498360bb9c3541a1b5f862284596a7ed217b9 - Historical/current merge-base authority:
4f6165bc4c53a7d98b0c246392dd9ed5bd75c21c - Current Runtime-bearing source ref reviewed:
2163051c30380585f07b9541ccd15cbc28d7e7fe - Existing source authority:
MK_TRADE_COST_RATE_DOCUMENT_OUTPUTS_SOURCE_AUTHORITY.md - Existing rebuild packet:
MK_TRADE_COST_RATE_DOCUMENT_OUTPUTS_CAPABILITY_REBUILD_PACKET.md - Current effect matrix:
MK_TRADE_COST_RATE_DOCUMENT_CURRENT_EFFECT_MATRIX_2026-08-09.md - Read-only preflight:
RBR-MK-TRADE-001-READONLY-CURRENT-SURFACE-PREFLIGHT.md - Phase implementation:
USER HOLD - Effects: repository source inspection and documentation only
1. Purpose¶
The existing MK Trade packet was written while the inspected checkout was identified by the detached ref d964983…. Later cross-family review established that this ref is not a clean current ancestor: it contains one candidate-only Loader implementation commit, while current qa/master continued from the earlier common ancestor and later accepted different operational changes.
The packet therefore cannot be refreshed by replacing one SHA in its header.
This document separates:
historical candidate checkout identity
!= candidate-only source facts
!= MK Trade current source facts
!= accepted target design
!= current environment evidence
It re-anchors the MK Trade, Export Brokerage, Outbound Cost, Packing Rate and document-output family to the current Runtime lineage without discarding valid design and source analysis from the existing packet.
2. Lineage Disposition¶
2.1 Historical checkout¶
Detached packet ref:
d96498360bb9c3541a1b5f862284596a7ed217b9
Common ancestor with the accepted current line:
4f6165bc4c53a7d98b0c246392dd9ed5bd75c21c
The detached ref's unique commit belongs to the Loader Assign Work / Clock Out candidate family. It is not the authority for MK Trade, Export Brokerage, Outbound Cost, Packing Rate or document-output behavior.
Therefore:
Fact observed only because of d964983 candidate-only Loader code
-> HISTORICAL CANDIDATE EVIDENCE
Fact observed in an MK owner file unchanged from the common ancestor/current line
-> CURRENT STATIC SOURCE FACT
Fact observed in an MK owner file later changed on the current line
-> TARGETED CURRENT REVALIDATION REQUIRED
2.2 Current source anchor¶
The current Runtime-bearing source ref used by this refresh is:
2163051c30380585f07b9541ccd15cbc28d7e7fe
Later documentation commits may move qa/master without changing the reviewed Runtime blobs. Every future refresh must record both:
repository document head
current Runtime-bearing source ref
2.3 Candidate-only non-implication¶
The previous packet remains useful because its MK source observations were not created by the candidate-only Loader feature. However, the detached ref must no longer be presented as the current MK system baseline.
Correct statement:
Existing MK packet
= detailed historical/source-reconciled input
+ this current-lineage refresh
+ current environment evidence still required
Incorrect statement:
Existing MK packet at d964983
= current Runtime verified
3. Current Family Inventory¶
| Capability | Current authority | Current source disposition | Current evidence gap |
|---|---|---|---|
| Trade Summary | derived read projection over commercial/order/booking/AP/AR/shipping sources | no material targeted semantic drift located | current rows, totals, source-class reconciliation, role/Wiki |
| Export Brokerage | composite local orchestration creating/canceling related MK records | no material targeted semantic drift located | current markers, duplicate/partial rows, cancellation residue, role |
| Outbound Cost | outbound-order-linked local AP transaction family | adjacent shared-helper changes exist; cost semantics require bounded current evidence | exact cost transaction identity, duplicate active AP, update/delete target |
| Packing Rate | T_LOAD_ITEM.RATE on Booking-linked outbound Sales items |
current route block remains present; surrounding Booking file changed for adjacent features | item-by-item result, stale update, accepted range/UOM |
| Packing Document | current Booking/Sales/Equipment projection and browser output | current source present | fallback/provenance, saved-rate parity, render/print evidence |
| Purchase Local Invoice | Purchase/local-invoice projection and browser output | current source present | formula/UOM examples, role/direct-page, durable-output policy |
| Booking Confirmation | Booking/customer/template projection and browser output | current source present | selected Sales reference, template/date policy, role evidence |
| Sales Weight Ticket | Sales-order derived branch plus physical Scale-ticket branch | current source present | projection/evidence distinction, role/direct-page, current rows |
No material targeted semantic drift located does not mean environment correctness, role acceptance or migration readiness.
4. Trade Summary — Current Contract¶
4.1 Nature¶
Trade Summary is a read-only derived projection. It combines data including:
Equipment
Purchase / Sales orders
Booking
Equipment-linked AP / AR
Outbound-order-linked AP
ETA / ETD / SWB and related shipping fields
It is not the writer for any of those records.
4.2 Derived state¶
The existing packet identified a derived deal-state family equivalent to:
AP or AR absolute amount >= 0.005
-> CLOSED
otherwise ETA / ETD / SWB present
-> SHIPPED
otherwise
-> OPEN
CLOSED is a report label. It is not proof of:
- accounting close;
- settlement;
- provider delivery;
- operational completion;
- immutable business state.
The CLAIMED view is also a filter derived from negative margin and monetary evidence, not a persisted claim lifecycle.
4.3 Current risks retained¶
- Header totals can aggregate more source classes than the detail explains.
- Equipment AP/AR and Outbound AP can use different lifecycle/deleted-row filters.
- Compatibility selection of one linked order can hide multiple or conflicting links.
- A report CSV is a browser export of the current projection, not an accounting file or durable snapshot.
- A rerun at another time can produce different results without a Trade record changing directly.
4.4 Required current query result¶
A future typed query should expose:
query timestamp
source revision
source fingerprint
source class totals
status/deleted/date policy
selected and conflicting links
derived-state explanation
unresolved provenance
5. Export Brokerage — Current Contract¶
5.1 Current behavior¶
Export Brokerage is a composite local operation involving multiple child families, including:
Purchase / items
Transload
Inventory lot
Booking relation
Outbound orders / items
Equipment / equipment loads
Allocations
compatibility markers
Current source contains generated-record markers including:
[EB:generated]
[EB:generated-booking]
These markers improve record recognition but are not a durable job identity.
5.2 Missing durable identity¶
The current source still does not establish a universal Export Brokerage object containing all of:
job ID
request token
input fingerprint
immutable child manifest
per-child result
cancel preview
compensation result
residual manifest
5.3 Unknown-result risk¶
child set committed
-> browser response missing
-> operator repeats create
-> duplicate composite set possible
and:
some compensation committed
-> cancel response missing
-> operator repeats cancel
-> duplicate or conflicting compensation possible
Current recovery must begin with marker/relationship/readback evidence. It must not begin by blindly replaying Create or Cancel.
5.4 Child ownership¶
Export Brokerage orchestrates but does not replace the owner of:
- Purchase;
- Booking;
- Outbound Sales;
- Inventory Lot;
- Allocation;
- Equipment;
- Scale.
A child must be corrected through its owning command unless an approved composite compensation explicitly owns the correction.
6. Outbound Cost — Current Contract¶
6.1 Current authority¶
Outbound Cost is represented through outbound-order-linked AP transaction data rather than a fully isolated cost subtype with its own immutable identity.
Potential ambiguity remains when one Outbound Order has more than one relevant AP transaction.
6.2 Unsafe compatibility¶
A path that selects the latest AP when an exact Transaction ID is absent cannot become the target contract.
missing transaction ID
-> latest AP
can modify the wrong cost record when multiple AP records exist.
6.3 Replace-all line behavior¶
Current update behavior can soft-delete existing lines and recreate the submitted set. Therefore omission can mean deletion rather than no change.
Required evidence:
- exact selected AP identity;
- current status;
- submitted versus omitted header fields;
- submitted versus existing lines;
- resulting totals;
- sibling AP rows;
- Trade Summary readback.
6.4 Adjacent current-line change¶
The shared BMS transaction helper later received Street Turn compensation logic. That adjacent change does not automatically change Outbound Cost semantics, but the shared file can no longer be treated as byte-identical to the historical packet baseline.
Disposition:
Outbound Cost source model remains current input
+ targeted current-row and command evidence required
7. Packing Rate — Current Contract¶
7.1 Authority¶
T_LOAD_ITEM.RATE
for an active Sales item whose parent order:
belongs to the same tenant
is linked to the selected Booking
is SALES
is OUTBOUND
is not deleted
7.2 Current result weakness¶
The current update route can process a list of item IDs and skip IDs that do not match the Booking/Tenant/active Sales predicate. A total updated count does not prove every intended item changed.
Required per-item outcome:
UPDATED
UNCHANGED
STALE
DENIED
NOT_FOUND
INVALID
7.3 Open policies¶
- accepted rate range;
- whether zero is valid;
- whether negative is valid;
- currency and UOM;
- decimal precision and rounding;
- expected previous rate/version;
- correction reason/history;
- print readiness after asynchronous browser save.
7.4 Print boundary¶
browser value changed
!= persisted rate changed
save request started
!= save committed
print clicked
!= current server rate included
The document is print-ready only after authoritative server reread confirms every intended item result.
8. Document Output Contracts¶
8.1 Common boundary¶
The current document pages primarily render current source data in the browser.
Rendered
!= Saved Snapshot
Printed
!= Print Acknowledgement
Printed
!= Approved
Printed
!= Emailed
Printed
!= File Stored
Printed
!= Business Process Completed
A durable PDF/file/email/provider result requires a separate approved capability.
8.2 Packing Document¶
Current source combines Booking, Sales items, Equipment Loads, Equipment Commodity and Rate data.
Known risks retained:
- numeric tenant compatibility in report behavior;
- broad fallback from Equipment Commodity to outbound-item data;
- fixed/default Port, Terms, Currency or Date values;
- browser-only text/amount edits;
- save/print race for rates.
8.3 Purchase Local Invoice¶
Current formula family:
MT NET_WEIGHT * RATE / 2204.590
LT NET_WEIGHT * RATE / 2240.000
ST NET_WEIGHT * RATE / 2000.000
EACH QUANTITY * RATE
other NET_WEIGHT * RATE
Total:
item amount
+ trucking fee
- credit
The displayed order number is not by itself a separate invoice lifecycle record.
8.4 Booking Confirmation¶
The current direct page has a page-role guard in source. Remaining open policy includes:
- Sales-reference selection priority;
- template owner/version;
- current-date versus business-date semantics;
- recipient and branding;
- retention and durable-output requirements.
8.5 Sales Weight Ticket¶
Two branches must remain separate:
ORDER_ID
= Sales-order-derived weight projection
IDS[]
= physical T_SCALE_TICKET output
A Sales Weight Ticket derived from an order is not proof that a physical scale event occurred.
9. Current Caller / Surface Inventory¶
The current family spans multiple layers rather than one module:
BMS report/query helpers
BMS transaction helpers
OMS Export Brokerage
OMS Outbound Order
TMS Booking routes and pages
BMS invoice/scale-ticket pages
shared report outputs
browser print/export code
A current access or migration matrix must enumerate each exact page, API, helper and report branch. Module access to one page must not be treated as permission for every cost/rate/document command.
10. Current Effect Boundaries¶
| Action | Local write | External/file effect | Completion means | Does not mean |
|---|---|---|---|---|
| Trade query | no | optional browser CSV | projection returned | source reconciled/accounting closed |
| Export Brokerage create | yes, composite | no provider required | local child set reported | every child independently accepted |
| Export Brokerage cancel | yes, compensation | no provider required | reported compensation result | all downstream effects reversed |
| Outbound Cost save | yes | no provider required | exact AP write committed | QBO/Trade/accounting close |
| Packing Rate save | yes | none | matching item rows updated | every requested item updated unless per-item proven |
| Document render | no or browser-local | browser print | current render produced | durable file/email/approval |
| Document email/file, if later added | separate | yes | owner-specific result | business process complete |
11. Current Evidence Required¶
Source and caller¶
- current Runtime-bearing SHA;
- exact owner files and targeted blocks;
- current pages and API routes;
- candidate-only facts excluded;
- adjacent shared-helper changes classified.
Schema and rows¶
- order, item, Booking, Equipment, transaction and line schema;
- relevant indexes/constraints;
- duplicate/multiple-link candidates;
- generated-marker population;
- active/deleted/status distributions;
- rate and UOM distributions.
Runtime and role¶
- intended and denied roles;
- normal menu and direct page access;
- bounded GET/read projections;
- separately authorized write scenarios only;
- record-tenant and state denial;
- mobile/print behavior.
Recovery¶
- missing response after create/save/cancel;
- duplicate child set;
- partial compensation;
- wrong/missing AP identity;
- partial rate update;
- print before persistence;
- document source conflict.
Wiki¶
- current named pages;
- current/stale/target classification;
- rendered content;
- role findability;
- formula and recovery wording;
- non-implication wording.
12. Target Reconstruction Disposition¶
The target remains:
React presentation
+ Next.js adapter
+ framework-independent TypeScript query/command applications
+ explicit MySQL repositories first
+ one authoritative writer per capability/cohort
+ rollback
+ caller-zero
+ PostgreSQL only after stabilization
Do not migrate the current family as one large TradeService or one route handler.
Required bounded applications include:
GetTradeProjection
GetTradeExplanation
ExportTradeProjection
PreviewExportBrokerageJob
CreateExportBrokerageJob
GetExportBrokerageJobResult
PreviewExportBrokerageCancellation
CancelExportBrokerageJob
ReconcileExportBrokerageUnknownResult
GetOutboundCostCandidates
GetOutboundCostDetail
CreateOutboundCost
UpdateOutboundCost
DeleteOutboundCost
CorrectOutboundCost
GetPackingRateState
CorrectPackingRates
GetPackingRateCommandResult
RenderPackingDocument
RenderPurchaseLocalInvoice
RenderBookingConfirmation
RenderSalesWeightTicket
Durable snapshot/file/email/provider commands remain separate capabilities.
13. Current Classification¶
Historical detached checkout:
PRESERVED
Candidate-only Loader commit:
NOT MK TRADE AUTHORITY
Current Runtime lineage:
RE-ANCHORED
Trade static source:
CURRENT INPUT / ENVIRONMENT EVIDENCE REQUIRED
Export Brokerage static source:
CURRENT INPUT / ENVIRONMENT EVIDENCE REQUIRED
Outbound Cost static source:
CURRENT INPUT WITH ADJACENT SHARED-HELPER DRIFT
Packing Rate and document outputs:
CURRENT INPUT / TARGETED RUNTIME AND ROLE EVIDENCE REQUIRED
Read-only current preflight:
DEFINED SEPARATELY
M3:
NO
M4:
NO
Phase progress:
NONE
14. Maintenance¶
Refresh this document when any of the following changes:
- Trade aggregation/source filters;
- Export Brokerage child set or marker format;
- Outbound Cost identity/update policy;
- Packing Rate route or persistence;
- document formula/template/source selection;
- page/API/action/record access;
- durable file/email/provider output;
- current Runtime-bearing source ref;
- accepted business policy;
- environment evidence;
- migration writer or rollback boundary.
---¶
Source:
docs/reconstruction/MK_TRADE_COST_RATE_DOCUMENT_CURRENT_LINEAGE_REFRESH_2026-08-09.md— ctc repository · This page is an English translation of the source document. Identifiers, file paths and code symbols are unchanged.