toga-ai 1.0.141 → 1.0.142

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.
@@ -100,6 +100,26 @@ None — uniform (platform-wide Forecast2 sync).
100
100
  handler sees them). NB: `App_ApiTransaction::execute(false)` returns a raw JSON **string** for a record
101
101
  GET — `json_decode` it directly; double-encoding it (`json_decode(json_encode($resp))`) silently yields
102
102
  an empty object and a false "empty record" reading.
103
+ - **REST `item.items` sublist has read-after-write LAG → partial or empty syncs that freeze (this is the deeper root of the gotcha above).** The handler builds `OpenOrderItems` from the REST record GET's
104
+ `item.items` sublist, and that sublist **trails the committed record for seconds after edits** — it can
105
+ return *fewer lines than the order actually has*. Because `syncOpenLines` reconciles to exactly what it
106
+ read (upsert + delete-not-returned), a lagged read commits a **partial** line set (N of M) or an **empty**
107
+ one (0 of 1), and it **freezes there** — no later webhook fires to correct it, so the only repair is a
108
+ re-sync/trueup. **Confirmed live 2026-06-18 on SO 7170669** (tranId 279851): 14 PUT jobs ran **strictly
109
+ sequentially on one instance, in order** (`dtStarted`/`instanceId` proven — *not* concurrent, *not*
110
+ out-of-order); the **last** (authoritative) read at 18:03:49 committed **4 lines**, while the order has
111
+ **15** ($4,634 of $8,714 — short $4,080). A later REST GET returned all 15 (the sublist had caught up),
112
+ and SuiteQL `transactionline` showed 15 throughout. SO 7152319 is the 0-of-1 form. **Ruled OUT:**
113
+ concurrency/ordering (jobs were serial on one instance) and enqueue/drain (jobs all `isSuccess=1`) — so
114
+ "trust the current REST state" fails specifically because the REST *sublist isn't reliably current*.
115
+ **Fix direction (not yet implemented):** source the open lines from **SuiteQL `transactionline`** (which
116
+ was consistent exactly when the REST sublist lagged — same query `probe_open_order_lines.php` uses)
117
+ rather than the REST `expandSubResources` sublist; *or* re-read until the line count is stable before
118
+ committing. A `lastModifiedDate` freshness/ordering guard does **NOT** help — it isn't an ordering bug.
119
+ The fix **must stay real-time** — do **not** defer to the 15-min cron (see the AMQ real-time constraint /
120
+ `project_amq_realtime_requirement` in dev memory). Diagnose with `probe_open_order_lines.php` (SuiteQL vs
121
+ Forecast) + `probe_so_rest_lines.php` (live REST sublist count) + the `WorkerJobs` `dtStarted`/`instanceId`
122
+ timing (to confirm serial-vs-concurrent before blaming ordering).
103
123
  - **REST shape ≠ SOAP shape.** The cron reads the SOAP-shim shape; this handler reads the REST record
104
124
  (`status->refName`, line `quantityBilled`, `class->refName`, `entity->id`, `salesRep->id`,
105
125
  `shippingCost`). Verified against live orders via `test/@dave/probe_salesorder_rest_shape.php`.
@@ -154,6 +174,15 @@ and are a candidate to extract into a shared `_Component_Forecast_Db` before the
154
174
 
155
175
  ## Change history
156
176
 
177
+ - 2026-06-18 — **Root-caused the open-order delta to REST `item.items` read-after-write lag** (not the
178
+ drainer/enqueue fixes, not ordering). SO 7170669 committed 4 of 15 open lines despite 14 *strictly
179
+ sequential, single-instance, in-order* PUTs — the last authoritative read returned a lagged partial
180
+ sublist; REST later caught up to 15 and SuiteQL showed 15 throughout. Disproved the earlier
181
+ out-of-order/concurrency hypothesis (verified via `WorkerJobs.dtStarted`/`instanceId`) and a
182
+ `lastModified` ordering guard (irrelevant — reads were in order). Fix direction recorded: source open
183
+ lines from **SuiteQL `transactionline`** instead of the REST sublist (or re-read until line count is
184
+ stable), keeping the path real-time (no cron deferral). New diagnostic: cross-check
185
+ `probe_open_order_lines.php` (SuiteQL) vs `probe_so_rest_lines.php` (REST sublist). (dfranks)
157
186
  - 2026-06-18 — **Verified live in production** after the SalesOrder enqueuer left Testing. 14 orders
158
187
  reconciled against NetSuite SuiteQL (`probe_open_order_lines.php`); 13 at $0.00 delta. Found one
159
188
  miss — SO 7151688 (open, ~$20.31, 0 rows) — traced to the **async-recalc race** above (see new
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toga-ai",
3
- "version": "1.0.141",
3
+ "version": "1.0.142",
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",