toga-ai 1.0.99 → 1.0.100

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
2
 
3
3
  | Doc | Framework | Summary | Files |
4
4
  |-----|-----------|---------|-------|
5
- | [Compass ASN → ItemFulfillment Auto-Creation](features/asn-to-item-fulfillment.md) | 2.0 | For Compass USA, posting an AdvanceShippingNotice (ASN) auto-creates the ItemFulfillment (IF) on the upstream SalesOrder. | _underscore/Model/Compass/AdvanceShippingNotice.php, api2/Component/Api/Cxml/Cxml.php, dbchanges2/Client_Compass/2026-06-11 - AsnItemTrackingNumberAcl.sql, dbchanges2/Client_Compass/2026-06-15b - BackfillSA132781ItemFulfillmentTracking.sql |
5
+ | [Compass ASN → ItemFulfillment Auto-Creation](features/asn-to-item-fulfillment.md) | 2.0 | For Compass USA, posting an AdvanceShippingNotice (ASN) auto-creates the ItemFulfillment (IF) on the upstream SalesOrder. | _underscore/Model/Compass/AdvanceShippingNotice.php, _underscore/Model/Compass/PurchaseOrder.php, api2/Component/Api/Cxml/Cxml.php, dbchanges2/Client_Compass/2026-06-11 - AsnItemTrackingNumberAcl.sql, dbchanges2/Client_Compass/2026-06-15b - BackfillSA132781ItemFulfillmentTracking.sql, dbchanges2/Client_Compass/2026-06-16 - CleanupSA132763CrossLineTracking.sql, dbchanges2/Client_Compass/2026-06-16b - CleanupSA132743CrossLineTracking.sql, dbchanges2/Client_Compass/2026-06-16c - BackfillSA132763C40QYUCTracking.sql |
6
6
  | [Compass: Item-Fulfillment TableViews (for-sales-order-items & for-sales-orders, tracking via bridge)](features/item-fulfillment-tracking-tableview.md) | 2.0 | Two sibling Compass TableViews in `Client_Compass` display fulfilled items in toga2-supply, both driven by `TableViews` / `TableViewJoins` / `TableViewFields` c | dbchanges2/Client_Compass/2026-06-10 - ItemFulfillmentsForSalesOrderItemsTableView.sql, dbchanges2/Client_Compass/2026-06-11 - ItemFulfillmentsForSalesOrdersTableView.sql, dbchanges2/Client_Compass/2026-06-15a - FixItemFulfillmentTrackingNumberJoins.sql |
7
7
  | [Compass MITS PO → SO Item Linking](features/mits-po-to-so-item-linking.md) | 2.0 | MITS sends Compass inbound Purchase Orders (`POST /v2/purchase-orders`) against a Sales Order (`mitsSalesOrder`). | _underscore/Model/Compass/PurchaseOrder.php, worker/crons/toga2/compass/workflow/3a_import_office_depot_purchase_orders.php |
8
8
  | [Compass USA](profile.md) | 2.0 | Compass USA is a TOGA client running a multi-tier supply-chain commerce operation. | |
@@ -5,13 +5,17 @@ project: _Underscore
5
5
  client: compass-usa
6
6
  type: client-feature
7
7
  status: active
8
- updated: 2026-06-15
8
+ updated: 2026-06-16
9
9
  owners: [jcardinal]
10
10
  files:
11
11
  - _underscore/Model/Compass/AdvanceShippingNotice.php
12
+ - _underscore/Model/Compass/PurchaseOrder.php
12
13
  - api2/Component/Api/Cxml/Cxml.php
13
14
  - dbchanges2/Client_Compass/2026-06-11 - AsnItemTrackingNumberAcl.sql
14
15
  - dbchanges2/Client_Compass/2026-06-15b - BackfillSA132781ItemFulfillmentTracking.sql
16
+ - dbchanges2/Client_Compass/2026-06-16 - CleanupSA132763CrossLineTracking.sql
17
+ - dbchanges2/Client_Compass/2026-06-16b - CleanupSA132743CrossLineTracking.sql
18
+ - dbchanges2/Client_Compass/2026-06-16c - BackfillSA132763C40QYUCTracking.sql
15
19
  related:
16
20
  - ../../../2.0/apps/_underscore/features/recursive-item-fulfillments.md
17
21
  ---
@@ -143,9 +147,43 @@ Compass Canada (`Model/Compass/Canada/`) is a separate sub-client. The Compass c
143
147
  number) straight into queries. These are now passed through `_Database::escape()`.
144
148
  - Separate latent bug in the 1.0 worker: the Strategic Systems cron's no-serials branch
145
149
  builds `$itemLevelTrackingNumbers` but never attaches it to the ASN payload.
150
+ - **Cross-line tracking contamination from bad SOI↔POI bridge rows (root cause, fixed
151
+ forward 2026-06-11):** `postPost` resolves which IFI(s) a tracking number attaches to by
152
+ joining `AdvanceShippingNoticeItems → SalesOrderItems_PurchaseOrderItems → SalesOrderItems`.
153
+ It trusts that bridge completely, so a wrong bridge row silently sends one ASN's tracking
154
+ onto an unrelated part's IFI. Two distinct pre-fix bugs produced bad bridge rows on Compass
155
+ SA orders: (1) `_Model_Compass_PurchaseOrder` linked SO↔PO items by matching
156
+ `SalesOrderItems.lineNumber = PurchaseOrderItems.lineNumber` — but a PO item's lineNumber is
157
+ **PO-local** (each PO starts at 1), so when one SO is split across multiple POs the PO line
158
+ numbers collide with unrelated SO lines (e.g. SA132743: PO `50305071-1` line 1 = 910-006272
159
+ wrongly linked to SO line 1 = C40QYUC). Fixed in `_underscore` commit `ec935478` (2026-06-11,
160
+ "Only link SO/PO items for MR orders") — the lineNumber join is now MR-only; SA orders link
161
+ via `createdFromSalesOrderItem` (item identity). (2) The 1.0 worker cron
162
+ `3a_import_office_depot_purchase_orders.php` paired API-returned PO items to SOIs by array
163
+ index, producing off-by-one neighbor links (fixed forward to pair by lineNumber; see
164
+ SA132763 cleanup file header). **Diagnosing:** a bridge row is provably wrong when its
165
+ `SalesOrderItems.itemId <> VendorItems.itemId` (the linked SOI's product differs from the PO
166
+ item's actual product). The `2026-06-16*` cleanup migrations delete exactly those rows plus
167
+ the tracking they spilled, scoped to one order.
168
+ - **Retroactive cleanup MUST be paired with a backfill — a cleanup-only repair leaves the
169
+ line blank.** Removing the *wrong* tracking from a contaminated IFI does not restore the
170
+ *correct* one: the correct number often never reached the IF side (the SO was fulfilled
171
+ out-of-band before the 2026-06-15 reconcile fix, and the cleanup adds nothing). The original
172
+ `2026-06-16 - CleanupSA132763CrossLineTracking.sql` was cleanup-only and left C40QYUC on
173
+ SA132763 with no tracking at all; `2026-06-16c` backfilled it. When repairing an order, also
174
+ backfill each affected IFI's correct tracking (the tn carried by an ASN item whose
175
+ `VendorItems.itemId` matches the IFI's SOI item) at both item and package level, guarded by
176
+ `NOT EXISTS`. ~116 PO items across other Compass orders share the off-by-one fingerprint and
177
+ are not yet repaired — a broader reviewed backfill is still outstanding.
146
178
 
147
179
  ## Change history
148
180
  Dated one-liners, newest first.
181
+ - 2026-06-16 — Identified cross-line tracking contamination root cause: bad
182
+ `SalesOrderItems_PurchaseOrderItems` rows (PO-local lineNumber collision in
183
+ `_Model_Compass_PurchaseOrder`, fixed forward 2026-06-11 `ec935478`; and the worker ODP-PO
184
+ cron's array-index pairing). Repaired SA132743 (`2026-06-16b`, cleanup + backfill) and
185
+ backfilled SA132763's C40QYUC (`2026-06-16c`) after finding the `2026-06-16` SA132763 cleanup
186
+ was cleanup-only and left the line blank. (jcardinal)
149
187
  - 2026-06-15 — `postPost` + helpers refactored so **UUID is the reference field**, dropping all
150
188
  reliance on the integer `id` returned from `internalApiRequest` (not always present). Helper
151
189
  returns are uuid-only; `$trackingTargets`/`$packageTrackingByItemFulfillment` are uuid-keyed;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toga-ai",
3
- "version": "1.0.99",
3
+ "version": "1.0.100",
4
4
  "description": "TOGA Technology Team Claude Knowledge System — shared AI coding harness with skills, knowledge base CLI, and project installer for Claude Code.",
5
5
  "keywords": [
6
6
  "claude",