toga-ai 1.0.256 → 1.0.257
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.
|
@@ -6,7 +6,7 @@ project: Library
|
|
|
6
6
|
client: shared
|
|
7
7
|
type: feature
|
|
8
8
|
status: active
|
|
9
|
-
updated: 2026-06-
|
|
9
|
+
updated: 2026-06-30
|
|
10
10
|
owners: ["dfranks"]
|
|
11
11
|
files:
|
|
12
12
|
- library/app/api/netsuite/rest.php
|
|
@@ -330,9 +330,23 @@ numbers. Budget hours for multi-year runs and launch them under `nohup`/`tmux`.
|
|
|
330
330
|
(PHP 8.0) is for running probes on the laptop only, **not** for compat checking.
|
|
331
331
|
- Field/relationship availability varies by NetSuite account **and** record type — probe the live
|
|
332
332
|
account before assuming a column exists.
|
|
333
|
+
- **`IS NOT NULL` on a custom `transactionline` column inside an aggregate query is a ~15× planner
|
|
334
|
+
trap — prefer `> 0` (or `NVL(col,0) <> 0`).** Filtering a custom employee-ref column
|
|
335
|
+
(`custcol_sales_rep_line`) with `AND tl.custcol_sales_rep_line IS NOT NULL` inside a
|
|
336
|
+
`GROUP BY` / power-sum aggregate (`MOD(SUM(MOD(id*id,P)),P)`) made the planner scan
|
|
337
|
+
pathologically: **~122s** vs **~8s** for the semantically identical `AND tl.custcol_sales_rep_line
|
|
338
|
+
> 0` (employee internalIds are always positive) — a ~15× regression purely from the predicate form.
|
|
339
|
+
Measured against the Forecast2 reconciliation checker (TRUE-79968). Use `> 0` / `NVL(col,0) <> 0`
|
|
340
|
+
for a custom ref column you only need to test for presence in an aggregate; reserve `IS NOT NULL`
|
|
341
|
+
for non-aggregate row filters.
|
|
333
342
|
|
|
334
343
|
## Change history
|
|
335
344
|
|
|
345
|
+
- 2026-06-30 — **Recorded the `IS NOT NULL` vs `> 0` planner trap for custom `transactionline`
|
|
346
|
+
columns in aggregate queries** (TRUE-79968): a custom employee-ref column filtered with
|
|
347
|
+
`IS NOT NULL` inside a power-sum `GROUP BY` aggregate scanned ~15× slower (~122s) than the
|
|
348
|
+
identical `> 0` predicate (~8s). Prefer `> 0` / `NVL(col,0) <> 0` for presence tests in
|
|
349
|
+
aggregates. (dfranks)
|
|
336
350
|
- 2026-06-25 — **Documented Journal Entry line structure + the JE→Forecast.Sales deferral.** JEs
|
|
337
351
|
invert the `mainline` rule — **all** JE `transactionline` rows are `mainline='T'` (no `'F'` detail
|
|
338
352
|
split), so a `mainline='F'` revenue query over a JE returns empty. Also: `tl.salesrep` does not
|
|
@@ -233,6 +233,22 @@ by reconciling a chosen tranDate range directly against NetSuite.
|
|
|
233
233
|
are correctly excluded **by design** (e.g. JE 7213407 = a Bank↔Equity reclass, 0 allowlist lines → never
|
|
234
234
|
imported — not a miss). An accrual JE and its NetSuite auto-reversal are **separate transactions**, each
|
|
235
235
|
reconciled independently by its own `internalId`.
|
|
236
|
+
- **The rep-only-NS-side / unfiltered-FC-side asymmetry is DELIBERATE and load-bearing — do NOT add
|
|
237
|
+
a rep filter to any Forecast-side query (TRUE-79968, dfranks 2026-06-30).** The importer now keeps
|
|
238
|
+
**only JE lines that carry a raw `custcol_sales_rep_line`** (see the sale-import doc). To make the
|
|
239
|
+
fixer be the **cleanup mechanism** for any pre-existing no-rep JE rows (there is no separate delete
|
|
240
|
+
script), the **NS-side** JE SuiteQL in both `checker.php` (`journalEntryNsTotals` arm of the sales
|
|
241
|
+
`nsSub`) and `fixer.php` (`journalEntryNsTotals` FIND + `fixJournalEntries` FIX) is scoped to
|
|
242
|
+
**rep-bearing lines** (mirroring the importer), while the **Forecast-side** reads in both tools stay
|
|
243
|
+
**UNFILTERED** (still SUM all JE rows, incl. any `salesRepEmployeeId IS NULL`). That asymmetry is
|
|
244
|
+
what surfaces the stale rows: NS (rep-only) **<** FC (still holds no-rep rows) → FIND flags the JE →
|
|
245
|
+
the existing per-`'journalEntry'` orphan-delete in `fixJournalEntries` removes them. **If the FC side
|
|
246
|
+
were ALSO rep-filtered, both sides would match and the stale rows would be invisible / never purged.**
|
|
247
|
+
A blanket `DELETE WHERE salesRepEmployeeId IS NULL` is the wrong fix — locally-null also means
|
|
248
|
+
"rep present in NetSuite but unmapped to `Forecast.Employees`," which must survive; the fixer sweep
|
|
249
|
+
correctly re-derives "no raw rep" from NetSuite. One-time cleanup =
|
|
250
|
+
`fixer.php --commit --prod --category sales` over the JE window, then `checker.php` to confirm
|
|
251
|
+
(in current prod this was a no-op — 0 no-rep JE rows — so the importer filter is preventative).
|
|
236
252
|
- **JE item dimension is NULL today; here is how to enable it later.** `itemId` is null on JE Sales rows
|
|
237
253
|
because the JE import path reads item **only** via the configurable `JE_LINE_ITEM_FIELD` (currently null)
|
|
238
254
|
— it does **not** read native `transactionline.item`, so even a populated native `tl.item` would NOT flow
|
|
@@ -468,11 +484,32 @@ None — Forecast2 is a single shared dataset.
|
|
|
468
484
|
invariant, any field added to the open-order **importer** (TRUE-79162) must also be added to this
|
|
469
485
|
OOI path (and ideally behind the same `forecastColumnExists` guard pattern) or `fixer.php`/`looper`
|
|
470
486
|
will overwrite the importer's value to NULL on its next run.
|
|
487
|
+
- **`IS NOT NULL` on a CUSTOM `transactionline` column inside a SuiteQL aggregate is a ~15× planner
|
|
488
|
+
trap — use `> 0` instead.** Filtering `custcol_sales_rep_line` (an employee-ref custom column) with
|
|
489
|
+
`AND tl.custcol_sales_rep_line IS NOT NULL` inside checker's UNION'd moment-fingerprint (the
|
|
490
|
+
`MOD(SUM(MOD(id*id,P)),P)` power-sum aggregates) made the planner scan pathologically: a full-window
|
|
491
|
+
checker run measured **~122s** with `IS NOT NULL` vs **~8s** with the semantically identical
|
|
492
|
+
`AND tl.custcol_sales_rep_line > 0` (employee internalIds are always positive). Applied to
|
|
493
|
+
`checker.php` (JE arm) and `fixer.php` (both JE queries) with inline comments warning against
|
|
494
|
+
reverting. See the SuiteQL API reference for the general rule. (Use `> 0`, or `NVL(col,0) <> 0`,
|
|
495
|
+
never `IS NOT NULL`, for a custom employee-ref `transactionline` column in a SuiteQL aggregate.)
|
|
471
496
|
- These tools live in `test/@dave/` (developer tooling), but `trueup_open_orders` has been run
|
|
472
497
|
against production. The `Defaults`/checkpoint mechanics of the scheduled sync are separate.
|
|
473
498
|
|
|
474
499
|
## Change history
|
|
475
500
|
|
|
501
|
+
- 2026-06-30 — **Made the fixer the cleanup mechanism for no-rep JE rows + killed a ~15× SuiteQL
|
|
502
|
+
planner trap (TRUE-79968, dfranks).** The importer now keeps only rep-bearing JE lines (see the
|
|
503
|
+
sale-import doc); to let `fixer.php` purge any pre-existing no-rep `Forecast.Sales` JE rows with no
|
|
504
|
+
separate delete script, the **NS-side** JE SuiteQL in both `checker.php` and `fixer.php` was scoped
|
|
505
|
+
to rep-bearing lines while the **FC-side reads stay UNFILTERED** — a deliberate, load-bearing
|
|
506
|
+
asymmetry (NS rep-only < FC still-has-no-rep → FIND flags → existing per-`'journalEntry'` orphan
|
|
507
|
+
delete removes them; filtering the FC side too would hide them forever). A blanket
|
|
508
|
+
`DELETE WHERE salesRepEmployeeId IS NULL` is wrong (locally-null also = NS-present-but-unmapped rep,
|
|
509
|
+
which must survive). **Perf:** replaced `AND tl.custcol_sales_rep_line IS NOT NULL` with
|
|
510
|
+
`AND ... > 0` in checker (JE arm) + fixer (both JE queries) — a clean full-window checker run dropped
|
|
511
|
+
from **~122s to ~8s** purely from the predicate form, with inline anti-revert comments. Current prod
|
|
512
|
+
had 0 no-rep JE rows, so the cleanup sweep was a no-op (filter is preventative). (dfranks)
|
|
476
513
|
- 2026-06-30 — **Folded JOURNAL ENTRIES into the SALES reconciliation in `fixer.php` + `checker.php`
|
|
477
514
|
(TRUE-79862).** Architecture decision (dfranks): a JE is **not its own category** — JE rows live in the
|
|
478
515
|
same `Forecast.Sales` table (`netsuiteTransactionType='journalEntry'`) as the four sale types, so the
|
|
@@ -6,7 +6,7 @@ project: _Underscore
|
|
|
6
6
|
client: shared
|
|
7
7
|
type: feature
|
|
8
8
|
status: active
|
|
9
|
-
updated: 2026-06-
|
|
9
|
+
updated: 2026-06-30
|
|
10
10
|
owners: [dfranks]
|
|
11
11
|
files:
|
|
12
12
|
- _underscore/Component/Forecast/SaleImport/SaleImport.php
|
|
@@ -163,6 +163,19 @@ location, memo). Handler `_Worker_Netsuite_JournalEntry`: `post`/`put` → `sync
|
|
|
163
163
|
item-line upsert/reconcile machinery (`syncLines`/`guardedInsert`/`deleteRows`).
|
|
164
164
|
|
|
165
165
|
**Mapping model (durable design):**
|
|
166
|
+
- **Only JE lines that carry a sales rep are imported (TRUE-79968, dfranks 2026-06-30).**
|
|
167
|
+
`buildJournalEntryRows` applies a **PER-LINE** filter **before** the (salesRep,item)
|
|
168
|
+
bucketing: a GL line whose **raw** `custcol_sales_rep_line` is empty is **skipped**
|
|
169
|
+
(`continue`). Consequences — a JE with no rep on any line yields **zero** `Forecast.Sales`
|
|
170
|
+
rows; a mixed JE keeps only its rep-bearing groups; offset/balancing lines (which omit the
|
|
171
|
+
custom column) drop out naturally. **The test is on the RAW NetSuite line field, NOT the
|
|
172
|
+
mapped local `salesRepEmployeeId`** — so a rep present in NetSuite but **not yet mapped** to
|
|
173
|
+
a local `Forecast.Employees` row **still qualifies** (its group keeps a null
|
|
174
|
+
`salesRepEmployeeId`). This is deliberate: it keeps no-rep JE noise out of Forecast revenue
|
|
175
|
+
while not silently dropping a real-but-unmapped rep's revenue. (A blanket
|
|
176
|
+
`DELETE WHERE salesRepEmployeeId IS NULL` would be **wrong** for the same reason — locally
|
|
177
|
+
null also means "rep present in NS but unmapped"; any cleanup must re-derive "no raw rep"
|
|
178
|
+
from NetSuite. See the reconciliation doc for how the fixer sweep does exactly that.)
|
|
166
179
|
- **Sales rep is now LIVE on JE lines** as the custom column **`custcol_sales_rep_line`**
|
|
167
180
|
(`JE_LINE_SALESREP_FIELD = 'custcol_sales_rep_line'`, wired 2026-06-29 after live Apr–May
|
|
168
181
|
2026 probing). The value is a NetSuite **employee REFERENCE object** `{links, id, refName}`;
|
|
@@ -429,6 +442,20 @@ record is deleted in NetSuite.)
|
|
|
429
442
|
- The cron's sign handling is not portable here — see Sign convention.
|
|
430
443
|
|
|
431
444
|
## Change history
|
|
445
|
+
- 2026-06-30 — **JE import now keeps ONLY rep-bearing lines** (TRUE-79968, dfranks).
|
|
446
|
+
`buildJournalEntryRows` skips any GL line whose **raw** `custcol_sales_rep_line` is empty,
|
|
447
|
+
applied **per-line before** the (salesRep,item) bucketing: a no-rep JE → 0 Sales rows, a
|
|
448
|
+
mixed JE keeps only rep-bearing groups. The filter tests the **RAW NS field**, not the
|
|
449
|
+
mapped local `salesRepEmployeeId`, so a rep present in NetSuite but unmapped to
|
|
450
|
+
`Forecast.Employees` still qualifies (group stays null `salesRepEmployeeId`) — which is also
|
|
451
|
+
why a blanket `DELETE WHERE salesRepEmployeeId IS NULL` is wrong; cleanup must re-derive
|
|
452
|
+
"no raw rep" from NetSuite. No-rep cleanup is handled by the existing `fixer.php` orphan-
|
|
453
|
+
delete sweep (see the reconciliation doc), not a separate delete script — in current prod
|
|
454
|
+
there were 0 no-rep JE rows so the filter is preventative going forward.
|
|
455
|
+
**Confirmed the JE webhook handler `_Worker_Netsuite_JournalEntry`
|
|
456
|
+
(worker2/Worker/Netsuite/JournalEntry.php) holds no business logic** — post/put delegate to
|
|
457
|
+
`_Component_Forecast_SaleImport::syncJournalEntry`, delete to `removeAllJournalEntry`; editing
|
|
458
|
+
the importer in `_underscore` is the single correct entry point for JE import changes. (dfranks)
|
|
432
459
|
- 2026-06-29 — **Wired JE sales-rep ingestion live** (TRUE-79862): set
|
|
433
460
|
`JE_LINE_SALESREP_FIELD = 'custcol_sales_rep_line'` after live Apr–May 2026 probing
|
|
434
461
|
confirmed the rep is now present on JE lines as that custom column — a NetSuite employee
|
package/package.json
CHANGED