toga-ai 1.0.1053 → 1.0.1055
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.
- package/knowledge/1.0/apps/library/features/transfer-order-purchase-order-link-reconcile.md +3 -1
- package/knowledge/1.0/apps/worker/features/netsuite-togasupply-per-client-sync.md +23 -1
- package/knowledge/2.0/apps/_underscore/features/contact-customer-required-internal-customer.md +3 -0
- package/knowledge/clients/nychh/profile.md +1 -0
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ project: Library
|
|
|
6
6
|
client: shared
|
|
7
7
|
type: feature
|
|
8
8
|
status: active
|
|
9
|
-
updated: 2026-10-
|
|
9
|
+
updated: 2026-10-16
|
|
10
10
|
owners: [jcardinal]
|
|
11
11
|
files:
|
|
12
12
|
- library/app/api/toga2.php
|
|
@@ -61,9 +61,11 @@ Deletes are logged: grep `reconcileTransferOrderPurchaseOrderLinks` in the worke
|
|
|
61
61
|
- **Repair model = re-process, not SQL.** Fix the code so a re-run heals, then reset cursors / replay ([per-client sync](../../worker/features/netsuite-togasupply-per-client-sync.md)) or run [process_netsuite_order.php](../../worker/workflows/reprocessing-one-netsuite-order.md) for one order. No data-repair SQL.
|
|
62
62
|
- **Pre-2026-09-24 upstream rows were polluted.** The old `linkPurchaseOrderToTransferOrder` path (PO `createdFrom` a TO) and old `retireStale` wrote vendor POs into 325/329. `Client_Nychh` before fix: ~533/1,593 rows in 325 and 3,981/5,893 in 329 were vendor POs; GroWrk/Elite a few. Example: NYCHH TO id 11 (NS SO 71759 / internal 1582638) had vendor POs 49338 + 49324 upstream and its real customer PO EIT0005971 was never imported. After re-process: EIT0005971 created (PO id 1005, 20 lines, customer 28908) upstream; 49324 lines 1-15 + 49338 lines 1-5 downstream; 0 vendor rows upstream.
|
|
63
63
|
- **Old upstream matcher picked wrong lines (fixed 2026-10-02, `1bc4de52`).** It took the first same-item line (often an unstocked line created from a TO) and its "each PO line once" rule made new empty PO lines when a TO had the same item twice. Fix = upstream ranking above; downstream kept strict. Heal by re-processing the TO. Tests: `test/@jeff/netsuite/test_match_transfer_order_purchase_order_lines.php`.
|
|
64
|
+
- **Exception to "one method owns every write":** a TO line removed in NetSuite is deleted by `deleteTransferOrderLineRemovedInNetsuite()`, which first deletes that line's PO/SO link rows (else FK 1451 freezes SALES_ORDERS); this reconcile runs right after and rebuilds the links. See [per-client sync](../../worker/features/netsuite-togasupply-per-client-sync.md) (TRUE-82859).
|
|
64
65
|
- Stale test: `test/@Bala/tests/netsuite_transferorder_payload_tests.php` "PO number from the column" case fails since the `TransferOrders.purchaseOrderId` drop ([transfer-orders page](../../../2.0/apps/toga25-supply/features/transfer-orders-page.md)).
|
|
65
66
|
|
|
66
67
|
## Change history
|
|
68
|
+
- 2026-10-16 — TO line removed in NetSuite: link rows deleted before the line, then reconcile rebuilds. TRUE-82859. (jcardinal)
|
|
67
69
|
- 2026-10-09 — Upstream rank adds cost == TO rate after stocked; [merge step](customer-po-line-merge-and-quantity.md) runs per upstream customer PO (empty lines now auto-deleted). TRUE-82606. (jcardinal)
|
|
68
70
|
- 2026-10-02 — Upstream line matching: stocked-line ranking + reuse; new PO line only when item absent; RELINK log; downstream unchanged. CTO alternative (soft claim, upstream only) adopted. (jcardinal)
|
|
69
71
|
- 2026-09-24 — Created: two-direction reconcile replaces the upstream-only linker; fixed vendor POs written upstream; 326/330 now live + ACL'd. Prod-verified. (jcardinal)
|
|
@@ -6,7 +6,7 @@ project: Worker
|
|
|
6
6
|
client: shared
|
|
7
7
|
type: feature
|
|
8
8
|
status: active
|
|
9
|
-
updated: 2026-10-
|
|
9
|
+
updated: 2026-10-16
|
|
10
10
|
owners: ["dfranks", "bala", "jcardinal", "mhammontree", "snaredla", "rgirish"]
|
|
11
11
|
files:
|
|
12
12
|
- worker/crons/toga2/netsuite/common_sync_togasupply.php
|
|
@@ -156,6 +156,9 @@ plain thrown warning instead.
|
|
|
156
156
|
newest first, `LIMIT 1` + tight date filter.
|
|
157
157
|
- **`Logs.Issue` keeps only the FIRST trace per fingerprint** — its trace can name the wrong client and line.
|
|
158
158
|
Use `Logs.Event` (has `clientId`) or `Logs_<Client>.Api` instead.
|
|
159
|
+
- The toga-db MCP rejects any SQL containing the word `DELETE` — filter `Logs_<Client>.Api` by `responseCode`, not `method`.
|
|
160
|
+
- Poison-record check: NetSuite SuiteQL `transactionline` on the order shows which lines are gone;
|
|
161
|
+
`TO_CHAR(lastmodifieddate, ...)` shows the order sits just past the frozen cursor.
|
|
159
162
|
- Fleet check: one query on prod-client, `UNION` over every `Client_*.Parameters`
|
|
160
163
|
(`WHERE name LIKE 'NETSUITE_EXECUTION_MODE_%'`). Wrap text columns in
|
|
161
164
|
`CONVERT(... USING utf8mb4) COLLATE utf8mb4_general_ci` or the UNION fails on mixed collations.
|
|
@@ -1033,6 +1036,24 @@ fulfillment with same product, minus stale ones), its dup/orphan self-heal (dup
|
|
|
1033
1036
|
`retireStaleSalesOrderForTransferOrder`. >1 candidate → link to all (same never-drop rule as
|
|
1034
1037
|
`pairInventoryAdjustmentLinesToFulfillmentLines`); 0 candidates with links → throw.
|
|
1035
1038
|
|
|
1039
|
+
### ⚠ A TO line removed in NetSuite must drop its PO/SO link rows first (fixed 2026-10-16, TRUE-82859)
|
|
1040
|
+
|
|
1041
|
+
`syncTransferOrderFromNetsuite` "delete items no longer in NS" sent a bare `DELETE /v2/transfer-order-items/<uuid>`.
|
|
1042
|
+
A line with `PurchaseOrderItems_TransferOrderItems` / `TransferOrderItems_PurchaseOrderItems` rows → `EV-11` /
|
|
1043
|
+
1451 → SALES_ORDERS frozen `1-RUNNING`. NYCHH: NS SO 7342575 (TO 285145), first 3 lines removed in NS, TOIs
|
|
1044
|
+
7181-7183, `Logs.Issue` 445, 254 events 10-15 → 10-16.
|
|
1045
|
+
|
|
1046
|
+
- Fix (library `f351465a`): `deleteTransferOrderLineRemovedInNetsuite()` — throws if the line has
|
|
1047
|
+
`ItemFulfillmentItems` (never delete history), deletes the 4 PO/SO link tables
|
|
1048
|
+
(`RETIRE_TRANSFER_ORDER_LINE_LEFTOVER_LINKS`), then the line. `reconcileTransferOrderPurchaseOrderLinks` runs
|
|
1049
|
+
right after and rebuilds correct PO links ([reconcile](../../library/features/transfer-order-purchase-order-link-reconcile.md)).
|
|
1050
|
+
Self-healed on deploy; no SQL, no mode reset.
|
|
1051
|
+
- **OPEN (0 rows in NYCHH prod 2026-10-16, no live risk):** (a) a removed TO line with
|
|
1052
|
+
`ItemReceiptItems.transferOrderItemId` still fails the FK (loud) — `/item-receipt-items` is not in
|
|
1053
|
+
`CLOSED_ORDER_DELETE_ROUTES`. (b) The SALES_ORDERS "delete items no longer in NS" loop (toga2.php ~1950-1975)
|
|
1054
|
+
does not clear `SalesOrderItems_TransferOrderItems` / `TransferOrderItems_SalesOrderItems` first, and its
|
|
1055
|
+
`continue` skips are silent.
|
|
1056
|
+
|
|
1036
1057
|
### ⚠ TWO code paths create `PurchaseOrderItems` — only one stamped `fulfillmentType` (fixed 2026-09-17)
|
|
1037
1058
|
|
|
1038
1059
|
`fulfillmentType` was stamped by `syncPurchaseOrderFromNetsuite()` (from the order-level
|
|
@@ -2142,6 +2163,7 @@ library (or vice versa) crashes GroWrk and Adyen on their next sync run.
|
|
|
2142
2163
|
[NetSuite Sync Alert Monitor](../../library/features/netsuite-sync-alert-monitor.md).
|
|
2143
2164
|
|
|
2144
2165
|
## Change history
|
|
2166
|
+
- 2026-10-16 — NYCHH SALES_ORDERS froze on a TO line removed in NetSuite (FK 1451, Issue 445); TO-line delete now clears PO/SO links first. Library only, prod-verified. TRUE-82859. (jcardinal)
|
|
2145
2167
|
- 2026-10-09 — Customer PO duplicate lines: merge step (all TO clients) + SO-QTY opt-in (hh); [doc](../../library/features/customer-po-line-merge-and-quantity.md). Library + worker deploy together. TRUE-82606. (jcardinal)
|
|
2146
2168
|
- 2026-10-09 — **Item-fulfillment tracking numbers now carry a carrier** (TRUE-82527). The fan-out passes the fulfillment’s shipping-method carrier into ; the number decides, the method is only a fallback, and no carrier row is ever created. (bala)
|
|
2147
2169
|
- 2026-10-06 — Added "Fix rules" section: self-heal, repair-by-code, fail-loud, dependencies-first, no forward cursor skip, links-are-data, Compass delete boundary. (jcardinal)
|
package/knowledge/2.0/apps/_underscore/features/contact-customer-required-internal-customer.md
CHANGED
|
@@ -45,6 +45,8 @@ Rejected: a `Customers.slug` marker column; app-level validation instead of a DB
|
|
|
45
45
|
- Backfill must run BEFORE the code that sends `customer`: api2 matches nested contacts on `customerId` too (gotcha below), so an un-backfilled NULL contact would be duplicated.
|
|
46
46
|
- Running `b` before the code fix breaks every unfixed create path.
|
|
47
47
|
|
|
48
|
+
**Status: LIVE in prod** (verified read-only 2026-10-16): `a` + `b` ran, code deployed. All 37 live client DBs: `customerId` NOT NULL, Internal row present, 0 contacts without a customer; no new Logs.Issue/Event errors. Only `Client_Compass_20260831_120000` (old snapshot, not live) is still nullable — ignore it.
|
|
49
|
+
|
|
48
50
|
## How it works
|
|
49
51
|
|
|
50
52
|
- Constant: `_Model_Client_Customer::INTERNAL_CUSTOMER_UUID` (`_underscore/Model/Client/Customer.php`). Front-ends keep their own `INTERNAL_CUSTOMER_UUID` in `src/utils/internalCustomer.ts` (toga25-supply, toga2-commerce).
|
|
@@ -78,5 +80,6 @@ Rejected: a `Customers.slug` marker column; app-level validation instead of a DB
|
|
|
78
80
|
- Backfill/ALTER technique (`dtUpdated = dtUpdated`, strict-mode in-place ALTER): [rerunnable-additive-inserts](../../dbchanges2/features/rerunnable-additive-inserts.md).
|
|
79
81
|
|
|
80
82
|
## Change history
|
|
83
|
+
- 2026-10-16 — Rollout verified live in prod: all 37 client DBs NOT NULL + Internal row; snapshot DB skipped (TRUE-82841). (jcardinal)
|
|
81
84
|
- 2026-10-16 — Row named after the client (find by uuid only); backfill moved into `a` (before deploy) because 1651 is an identifier and unmatched contacts get duplicated, not overwritten; commerce signup ACL check (TRUE-82841). (jcardinal)
|
|
82
85
|
- 2026-10-16 — Initial. Internal customer (fixed uuid, every tenant) + `Contacts.customerId` NOT NULL; every contact-create path fixed (TRUE-82841). (jcardinal)
|
|
@@ -71,6 +71,7 @@ TOGA 2.0 client on `_underscore`, prod schema `Client_Nychh`. Supply-chain / ful
|
|
|
71
71
|
- **Worker tiers:** `worker2` (2.0) runs the NYCHH asset-tag backfill; `worker`/`library` (1.0) run the NetSuite→TOGa Supply sync and the asset-tag verification/backfill diagnostics.
|
|
72
72
|
|
|
73
73
|
## Key features (this client)
|
|
74
|
+
- **SALES_ORDERS froze `1-RUNNING` 2026-10-15 → 10-16 (Issue 445) — fixed + prod-verified 2026-10-16 (library `f351465a`, TRUE-82859).** Stocking SO 7342575 (TO 285145) had 3 lines removed in NetSuite; their PO links blocked the line delete (FK 1451). Cursor now past `7342575`. See [per-client sync](../../1.0/apps/worker/features/netsuite-togasupply-per-client-sync.md).
|
|
74
75
|
- **ITEM_FULFILLMENTS froze `1-RUNNING` 2026-09-30 → 2026-10-06 (Event issue 483) — fixed + prod-verified 2026-10-06 (library).** NS order 4512137 (#165198, stocking) existed twice: stale TransferOrder 508 (pre-2026-09-03 stocking rule) + SalesOrder 168. IF reconcile tried to delete TO line 7409 that an IA line linked to → FK 1451. New reverse retire (TO→SO) + IA-link move before IF-line deletes; TO 508 retired, cursor past `4605943`. Remaining doubles: #233366 (SO 172 / TO 1811 — retires when its IF 2392 syncs), #290752 (SO 167 / TO 1958, no IFs — waits for SALES_ORDERS feed). See [per-client sync](../../1.0/apps/worker/features/netsuite-togasupply-per-client-sync.md).
|
|
75
76
|
- **Transfer-order "Order Shipped" email fires on the first tracking number, not the NetSuite shipped stage (2026-10-05, prod).** Warehouse marks shipped after delivery. NYCHH is the only client emailing off the NS shipped stage. See [TO notification emails](./features/transfer-order-notification-emails.md). Alarm when one stays owed > 24h: [emails owed monitor](./features/oneuptime-transfer-order-emails-owed-monitor.md) (TRUE-82758, not deployed 2026-10-16).
|
|
76
77
|
- **Prod NetSuite feeds (2026-10-02):** only ITEM_FULFILLMENTS + INVENTORY_ADJUSTMENTS run (worker `511a7fd9`, 2026-09-30), cursors rewound to 2022/2023.
|
package/package.json
CHANGED