toga-ai 1.0.200 → 1.0.201

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.
@@ -68,6 +68,12 @@ by reconciling a chosen tranDate range directly against NetSuite.
68
68
  still go to stderr.
69
69
  - **`--verbose`** was trimmed — removed per-line MATCH/EXCLUDE/NOOP and the always-on per-SO summary;
70
70
  the per-SO header now prints lazily, once, only when the order has an INSERT/UPDATE/DELETE.
71
+ - **Step 4 per-statement SQL audit (added 2026-06-25).** The Step 4 results block now lists, one line
72
+ per statement, `<NetSuite SO internal id> <SQL>` — the exact statement that **was run** (live) or
73
+ **would be run** (`--dry-run`), so you can audit a dry-run before applying or trace an unexpected
74
+ insert/update/delete back to its source order. Previously `emit()` executed-or-counted each write but
75
+ discarded the SQL string, leaving only aggregate counts. The listing inherits the existing `--quiet`
76
+ gating (prints only on a changed pass) and the `--dry-run` header wording ("would run" vs "applied").
71
77
  - `loop_trueup_open_orders.php [--prod] [--dry-run] [--verbose] [--quiet] [--sleep=N] [--days-back=N]`
72
78
  — continuous runner that recomputes a rolling `[today−N .. today]` window each pass and re-invokes
73
79
  `trueup_open_orders.php --by-lastmodified` until Ctrl-C. Uses `PHP_BINARY` + `passthru` with
@@ -113,6 +119,18 @@ by reconciling a chosen tranDate range directly against NetSuite.
113
119
  **classify a drift set as whole-missing vs. present-but-different**, and to scope a
114
120
  `Logs.Webhook`/`WorkerJobs` search window from the lastmodified timestamps.
115
121
 
122
+ - **`trueup_open_orders` SQL-audit collector.** A global `$sqlLog` (alongside `$opCount`) collects
123
+ `['soid'=>.., 'sql'=>..]` for every write **in both live and dry-run modes**; `emit($sql, $db, $soId=null)`
124
+ records first, then executes only when not `--dry-run`. Every main-loop `emit()` passes the in-scope
125
+ NetSuite SO internal id (`$nsSoId`) — closed-order DELETE, both Classifications INSERT/UPDATE, the
126
+ OpenOrderItems UPDATE/INSERT, and the per-order DELETE flush. The Step 3b stale-cleanup DELETE is batched
127
+ by local row id across many SOs, so it keeps the default null `$soId` and is labelled `stale` (the full
128
+ stale SO id set is printed once above the listing). Each statement is whitespace-collapsed
129
+ (`preg_replace('/\s+/', ' ', trim(...))`) so multi-line built SQL renders on one line, and the listing is
130
+ appended to the existing `$resultLines` array (inheriting `--quiet` gating + `--dry-run` wording). Memory
131
+ stays bounded under the existing 1G `memory_limit`. (This corrected a prior docblock claim that `$sqls`
132
+ was never accumulated globally.)
133
+
116
134
  ## Data model
117
135
 
118
136
  `Forecast.Sales`, `Forecast.OpenOrderItems` on the **core2** cluster
@@ -253,6 +271,14 @@ None — Forecast2 is a single shared dataset.
253
271
 
254
272
  ## Change history
255
273
 
274
+ - 2026-06-25 — **`trueup_open_orders` Step 4 now lists the exact per-statement SQL** (`<NS SO id> <SQL>`,
275
+ one line per statement) for both live and `--dry-run` passes, so a dry-run is auditable and any
276
+ unexpected insert/update/delete is traceable to its source order. Implemented via a global `$sqlLog`
277
+ collector + `emit($sql,$db,$soId)` (records always, executes only when not dry-run); each main-loop emit
278
+ passes `$nsSoId`, and the batched Step 3b stale-cleanup DELETE is labelled `stale`. Inherits existing
279
+ `--quiet` gating and `--dry-run` wording; whitespace-collapsed to one line per statement. Corrects the
280
+ prior "`$sqls` never accumulated globally" docblock. `php -l` clean (PHP 7.2); not executed live/dry-run
281
+ this session. (dfranks)
256
282
  - 2026-06-25 — **`trueup_open_orders` gained `--by-lastmodified` / `--quiet` / leaner `--verbose`; added
257
283
  `loop_trueup_open_orders.php` as the stopgap for the real-time billed-order removal gap.**
258
284
  `--by-lastmodified` windows both Step 1 and Step 3b on `lastmodifieddate` (ET TIMESTAMP bounds) and
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toga-ai",
3
- "version": "1.0.200",
3
+ "version": "1.0.201",
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",