toga-ai 1.0.794 → 1.0.796
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/2.0/apps/_underscore/features/calculated-sql-fields.md +19 -0
- package/knowledge/2.0/apps/_underscore/features/page-meta-context-field-settings.md +23 -2
- package/knowledge/2.0/apps/_underscore/features/tableview-joins.md +34 -1
- package/knowledge/2.0/apps/_underscore/features/units-for-items-for-purchase-orders.md +56 -3
- package/knowledge/2.0/apps/api2/features/request-logging.md +37 -1
- package/knowledge/2.0/apps/api2/features/v2-api-error-codes.md +12 -1
- package/knowledge/INDEX.md +1 -1
- package/knowledge/clients/nychh/profile.md +51 -0
- package/knowledge/clients/prudential/INDEX.md +1 -0
- package/knowledge/clients/prudential/features/service-request-auth-rejection-alert.md +156 -0
- package/knowledge/clients/prudential/features/service-request-rejection-alert-email.md +12 -1
- package/knowledge/clients/prudential/profile.md +12 -2
- package/package.json +1 -1
|
@@ -20,6 +20,8 @@ files:
|
|
|
20
20
|
- api2/Component/Api/V2/V2.php
|
|
21
21
|
- _underscore/Model/Quad/Item.php
|
|
22
22
|
- _underscore/Model/Quad/VendorItem.php
|
|
23
|
+
- _underscore/Model/Nychh/Unit.php
|
|
24
|
+
- dbchanges2/Client_Nychh/2026-09-10a - UnitsForPoTableViewRebaseAndTransferLocationField.sql
|
|
23
25
|
- dbchanges2/Client/2026-08-11b - SalesOrderPurchaseOrdersField.sql
|
|
24
26
|
- dbchanges2/Client/2026-08-25 - SalesOrderPurchaseOrdersFieldAllClients.sql
|
|
25
27
|
related:
|
|
@@ -253,6 +255,23 @@ characters — that is the standard of evidence for touching a field that runs o
|
|
|
253
255
|
[save-cascade stored-field deadlocks](./model-save-parent-cascade-stored-field-deadlock.md).
|
|
254
256
|
|
|
255
257
|
## Change history
|
|
258
|
+
- 2026-09-10 — Added two NYCHH-only calc fields on `_Model_Nychh_Unit`
|
|
259
|
+
(`_underscore/Model/Nychh/Unit.php`) for the rebuilt `units-for-items-for-purchase-orders` grid,
|
|
260
|
+
both plain `FIELD_SQL` (text — no `FIELDOPT_SQL_TYPE`): **(a)** an **override** of
|
|
261
|
+
`_unitDisposition()` — NYCHH does **not** use the `UnitDispositions` lookup; disposition is derived
|
|
262
|
+
purely from the transfer chain (`Deployed` if an `ItemFulfillmentItems` with
|
|
263
|
+
`transferOrderItemId IS NOT NULL` exists for the unit, else `Available`). The override **matches the
|
|
264
|
+
parent's untyped signature exactly** (the contravariance fatal above). **(b)** a **new**
|
|
265
|
+
`_transferLocation` field returning the transfer-order destination location name via
|
|
266
|
+
Units → ItemFulfillmentItemUnits → ItemFulfillmentItems → TransferOrderItems → TransferOrders →
|
|
267
|
+
destinationLocationId → Locations (`ORDER BY` fulfillment id `DESC LIMIT 1`), registered as a
|
|
268
|
+
`Client_Nychh.CustomRecordFields` row (record 31) + Base-role `AclCustomFieldPermissions` grant in
|
|
269
|
+
`Client_Nychh/2026-09-10a`. **Why a calc field and not a TableView join:** the location chain
|
|
270
|
+
re-uses `ItemFulfillmentItems`/`ItemFulfillmentItemUnits` a **second** time, and `TableViewJoins`'
|
|
271
|
+
`onB` renders the raw table name — so a chain off a duplicated table binds to the wrong copy (the
|
|
272
|
+
duplicate-join hazard in [tableview-joins](./tableview-joins.md)). A calc field sidesteps the alias
|
|
273
|
+
problem entirely. Column header labeled via a `ClientCustomRecordFieldSettings` `label-singular`
|
|
274
|
+
row ("Location"). (jcardinal)
|
|
256
275
|
- 2026-09-10 — **Fixed `_Model_Client_Location::_addressState()` to return the state CODE, not
|
|
257
276
|
`Addresses.stateId`** (addresses rendered as `Bronx, 33 10451-5504`). Added
|
|
258
277
|
`LEFT JOIN States ON States.id = Addresses.stateId` inside the subquery and selected `States.code`
|
|
@@ -6,8 +6,8 @@ project: _Underscore
|
|
|
6
6
|
client: shared
|
|
7
7
|
type: feature
|
|
8
8
|
status: active
|
|
9
|
-
updated: 2026-
|
|
10
|
-
owners: [tcox, bala]
|
|
9
|
+
updated: 2026-09-10
|
|
10
|
+
owners: [tcox, bala, jcardinal]
|
|
11
11
|
files:
|
|
12
12
|
- _underscore/Model/Core/Page.php
|
|
13
13
|
- _underscore/Model/Client/TableView.php
|
|
@@ -64,6 +64,19 @@ record route resolved through `$lookupRecordIdFromCustomRecordFieldId` →
|
|
|
64
64
|
metadata**, and no amount of adding/correcting those rows will move the header. (Measured
|
|
65
65
|
2026-08-26: two hours lost adding label rows that could never be read.)
|
|
66
66
|
|
|
67
|
+
> **⚠ SCOPE — this "dead metadata" is the legacy `Page.php` / `toga2-supply` path ONLY. On the
|
|
68
|
+
> `toga25-supply` table path it WORKS.** `toga25-supply` reads its grid headers from
|
|
69
|
+
> `/table-views/meta` (`_Model_Client_TableView::meta()`), which fetches
|
|
70
|
+
> `ClientCustomRecordFieldSettings` directly — so a **base** custom-field column (both context
|
|
71
|
+
> columns NULL) IS labeled by a `ClientCustomRecordFieldSettings` row with `settingId = 5`
|
|
72
|
+
> (`Core.Settings.slug = 'label-singular'`), `isOverridable = 1`. Verified live 2026-09-10: this is
|
|
73
|
+
> exactly how `Client_Elite` labels its custom unit columns (`c_grade` → "Grade", `c_chargingBrick`
|
|
74
|
+
> → "Charging Brick", …), and it is how NYCHH's `_transferLocation` column on
|
|
75
|
+
> `units-for-items-for-purchase-orders` gets its "Location" header
|
|
76
|
+
> (`Client_Nychh/2026-09-10c - TransferLocationColumnLabel.sql`). Do **not** move a custom field to
|
|
77
|
+
> a Core `RecordField` just to get a header on a `toga25-supply` grid — the client custom-field
|
|
78
|
+
> settings row is enough. The dead-metadata trap above still holds for the old `Page.php` consumers.
|
|
79
|
+
|
|
67
80
|
Where the label must come from instead, for such a column:
|
|
68
81
|
|
|
69
82
|
- **`Core.DefaultRecordFieldSettings`** on the underlying **Core** `RecordField`, or
|
|
@@ -181,6 +194,14 @@ data change, is what makes it fatal.
|
|
|
181
194
|
customization. The guard belongs in the framework.
|
|
182
195
|
|
|
183
196
|
## Change history
|
|
197
|
+
- 2026-09-10 — Scoped the "custom record field's label row is dead metadata" finding to the **legacy
|
|
198
|
+
`Page.php` / `toga2-supply`** consumer only. On the **`toga25-supply`** grid (headers from
|
|
199
|
+
`/table-views/meta` via `_Model_Client_TableView::meta()`, which fetches
|
|
200
|
+
`ClientCustomRecordFieldSettings` directly) a **base** custom-field column IS labeled by a
|
|
201
|
+
`ClientCustomRecordFieldSettings` row (both context columns NULL, `settingId = 5` =
|
|
202
|
+
`label-singular`, `isOverridable = 1`) — so the field need NOT be promoted to a Core `RecordField`
|
|
203
|
+
for a header. Verified against `Client_Elite`'s custom unit columns and NYCHH's `_transferLocation`
|
|
204
|
+
("Location") on the units-for-items-for-purchase-orders view. (jcardinal)
|
|
184
205
|
- 2026-08-26 - Documented that a grid column's **type** and its **header label** come from two
|
|
185
206
|
different endpoints: type/formatting (the currency icon) from `/table-views/meta`
|
|
186
207
|
`table.fields[].type` via `generateDynamicConfig` → `formatTableData`, header text from
|
|
@@ -6,7 +6,7 @@ project: _Underscore
|
|
|
6
6
|
client: shared
|
|
7
7
|
type: feature
|
|
8
8
|
status: active
|
|
9
|
-
updated: 2026-09-
|
|
9
|
+
updated: 2026-09-10
|
|
10
10
|
owners: [bala, apeterson, jcardinal]
|
|
11
11
|
files:
|
|
12
12
|
- _underscore/Model/Client/TableView.php
|
|
@@ -19,6 +19,8 @@ files:
|
|
|
19
19
|
- dbchanges2/Client_Nychh/2026-08-28a - TransferOrdersTableView.sql
|
|
20
20
|
- dbchanges2/Client_Nychh/2026-08-31a - PurchaseOrdersTableViewRebase.sql
|
|
21
21
|
- dbchanges2/Client_Nychh/2026-09-02a - PurchaseOrderItemsTableViewRebase.sql
|
|
22
|
+
- dbchanges2/Client_Nychh/2026-09-10a - UnitsForPoTableViewRebaseAndTransferLocationField.sql
|
|
23
|
+
- dbchanges2/Client_Nychh/2026-09-10b - UnitsForPoBridgeBaseAclGrant.sql
|
|
22
24
|
related:
|
|
23
25
|
- ../../api2/features/tableview-field-metadata.md
|
|
24
26
|
- ./page-meta-context-field-settings.md
|
|
@@ -232,6 +234,29 @@ So a role gap only 500s when a **visible column** hangs off the missing join —
|
|
|
232
234
|
client tolerates ACL gaps on records another client cannot. A new joined table (here
|
|
233
235
|
`Manufacturers`, record 20) needs its `AclRecordPermissions` grant in the same migration.
|
|
234
236
|
|
|
237
|
+
#### A dropped BRIDGE join in the middle of a chain 1054s even with NO column on it
|
|
238
|
+
|
|
239
|
+
The "harmless until a column hangs off it" rule has a sharp exception: a **bridge** join that sits
|
|
240
|
+
**in the middle of a chain**. Nothing shows a column from the bridge, but a **later** join's `onB`
|
|
241
|
+
names the bridge's raw table. When ACL drops the bridge, that later join emits an ON clause
|
|
242
|
+
referencing a table that was never added → **MySQL 1054**, not the readable
|
|
243
|
+
`AclRecordPermissions`-message from mode (b).
|
|
244
|
+
|
|
245
|
+
Confirmed NYCHH 2026-09-10 on the rebuilt `units-for-items-for-purchase-orders` view. The bridge
|
|
246
|
+
record **`PurchaseOrderItems_SalesOrderItems`** (Core record **290**) carried only an **API-role**
|
|
247
|
+
read grant in `Client_Nychh`. Records 30/29/15/18 in the chain already had a **Base** grant, so a
|
|
248
|
+
Base user's joins query dropped only the bridge — and the next join's ON referenced it:
|
|
249
|
+
|
|
250
|
+
```
|
|
251
|
+
Unknown column 'PurchaseOrderItems_SalesOrderItems.purchaseOrderItemId' in 'on clause'
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
Fix: add the **Base** read grant as the full 4-table ACL chain (`AclRecordPermissions` →
|
|
255
|
+
`AclLogicGroups` → `AclLogicGroupExpressions`), reusing record 290's existing `all`
|
|
256
|
+
`AclRecordExpression` (`Client_Nychh/2026-09-10b - UnitsForPoBridgeBaseAclGrant.sql`). Watch for
|
|
257
|
+
**bridge records that ship with API-only grants** — a view that only ever ran for an API caller
|
|
258
|
+
(or in an environment tested as API) hides this until a Base user opens it.
|
|
259
|
+
|
|
235
260
|
### The debugging signature: 500 + EMPTY body + NO row in `Logs_<client>.Api`
|
|
236
261
|
|
|
237
262
|
Mode (a) throws *before* the response is assembled, so the caller gets a **500 with an empty
|
|
@@ -347,6 +372,14 @@ Core-level reference ids used (identical across all clients and environments): *
|
|
|
347
372
|
|
|
348
373
|
## Change history
|
|
349
374
|
|
|
375
|
+
- 2026-09-10 — Added the **bridge-in-a-chain ACL-drop = 1054** exception to mode (b): a dropped
|
|
376
|
+
bridge join with **no column on it** still breaks, because the next join's `onB` names the bridge's
|
|
377
|
+
raw table. NYCHH's rebuilt `units-for-items-for-purchase-orders` view 1054'd for a **Base** user —
|
|
378
|
+
bridge record 290 (`PurchaseOrderItems_SalesOrderItems`) had only an **API-role** grant while the
|
|
379
|
+
rest of the chain (30/29/15/18) had Base; error *"Unknown column
|
|
380
|
+
'PurchaseOrderItems_SalesOrderItems.purchaseOrderItemId' in 'on clause'"*. Fixed with the full
|
|
381
|
+
4-table Base ACL chain reusing record 290's `all` expression (`Client_Nychh/2026-09-10b`). Watch
|
|
382
|
+
for bridge records that ship with API-only grants. (jcardinal)
|
|
350
383
|
- 2026-09-03 — Added the **filter-only join counterpart** to the PO-items rebase: dropping a
|
|
351
384
|
column-less join that only *filtered* rows (SalesOrders→bridge→PurchaseOrders, ids 123/124/141)
|
|
352
385
|
breaks any row-filter still targeting that table. NYCHH's `items-for-purchase-orders`
|
|
@@ -6,12 +6,18 @@ project: _Underscore
|
|
|
6
6
|
client: shared
|
|
7
7
|
type: feature
|
|
8
8
|
status: active
|
|
9
|
-
updated: 2026-
|
|
10
|
-
owners: ["bala", "tcox"]
|
|
9
|
+
updated: 2026-09-10
|
|
10
|
+
owners: ["bala", "tcox", "jcardinal"]
|
|
11
11
|
files:
|
|
12
12
|
- _underscore/Model/Client/ServiceRequest.php
|
|
13
|
+
- _underscore/Model/Nychh/Unit.php
|
|
13
14
|
- dbchanges2/Client/2026-08-11a - ServiceRequestsInventoryUnitsTableViews.sql
|
|
15
|
+
- dbchanges2/Client_Nychh/2026-09-10a - UnitsForPoTableViewRebaseAndTransferLocationField.sql
|
|
16
|
+
- dbchanges2/Client_Nychh/2026-09-10b - UnitsForPoBridgeBaseAclGrant.sql
|
|
17
|
+
- dbchanges2/Core/2026-09-10a - InventoryGroupingsUnitsLeafPoItemFilter.sql
|
|
14
18
|
related:
|
|
19
|
+
- ./calculated-sql-fields.md
|
|
20
|
+
- ./tableview-joins.md
|
|
15
21
|
- ./tracking-number-bridges.md
|
|
16
22
|
- ../../../clients/elite/features/supply2-tableview-config-drift.md
|
|
17
23
|
- ../../../clients/prudential/features/supply-orders-csv-export.md
|
|
@@ -74,6 +80,41 @@ a *different field per client*, so client custom columns (and their
|
|
|
74
80
|
Elite's four columns at index 14-17 (`grade`, `chargingBrick`, `chargingCable`, `wipeStatus` via
|
|
75
81
|
`c_deviceStatus`).
|
|
76
82
|
|
|
83
|
+
## NYCHH rebuilt the view onto the FULFILLMENT chain (2026-09-10)
|
|
84
|
+
|
|
85
|
+
This is the "resolver/view change that also walks the fulfillment path" the first gotcha below asks
|
|
86
|
+
for — shipped for one tenant. `Client_Nychh`'s `units-for-items-for-purchase-orders` view (base
|
|
87
|
+
record **Units 31**) was rebuilt to list the serialized units for a clicked **purchase-order item**,
|
|
88
|
+
showing Serial #, Asset Tag, Disposition, Location. The old 25-join / 12-column config (inaccurate)
|
|
89
|
+
was replaced with an **INNER** chain:
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
Units
|
|
93
|
+
-> ItemFulfillmentItemUnits (30)
|
|
94
|
+
-> ItemFulfillmentItems (29)
|
|
95
|
+
-> PurchaseOrderItems_SalesOrderItems bridge (290)
|
|
96
|
+
-> PurchaseOrderItems (18)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
plus a **filter-only** `SalesOrderItems (15)` join kept so the `itemsByPOs` drill path (which filters
|
|
100
|
+
by `SalesOrderItems.uuid`) still works. The grid is filtered at drill-down time by
|
|
101
|
+
`(PurchaseOrderItems.uuid:eq:...)`. File:
|
|
102
|
+
`dbchanges2/Client_Nychh/2026-09-10a - UnitsForPoTableViewRebaseAndTransferLocationField.sql`.
|
|
103
|
+
|
|
104
|
+
Two column values come from **NYCHH-only calc fields** on `_Model_Nychh_Unit`, not joins —
|
|
105
|
+
Disposition (`_unitDisposition`, overridden to derive from the transfer chain) and Location
|
|
106
|
+
(`_transferLocation`, new). Location is a calc field precisely because its chain re-uses
|
|
107
|
+
`ItemFulfillmentItems`/`ItemFulfillmentItemUnits` a **second** time, which the TableView alias model
|
|
108
|
+
cannot express (see [calculated-sql-fields](./calculated-sql-fields.md) and the duplicate-join hazard
|
|
109
|
+
in [tableview-joins](./tableview-joins.md)).
|
|
110
|
+
|
|
111
|
+
Two failures surfaced during this rebuild, both documented on
|
|
112
|
+
[tableview-joins](./tableview-joins.md): the mid-chain bridge record 290 shipped with an **API-only**
|
|
113
|
+
ACL grant, so a Base user 1054'd on `PurchaseOrderItems_SalesOrderItems.purchaseOrderItemId` in the
|
|
114
|
+
next join's ON clause (fixed by `Client_Nychh/2026-09-10b`); and the Inventory `posByItems` **leaf**
|
|
115
|
+
`additionalDataSlug` had to be the bare table name `PurchaseOrderItems` (the FE appends `.uuid`, so a
|
|
116
|
+
stored `PurchaseOrderItems.uuid` doubled to `.uuid.uuid` and 500'd — `Core/2026-09-10a`).
|
|
117
|
+
|
|
77
118
|
## Serial numbers for a Service Request - the bridge table is empty, use the fulfillment chain
|
|
78
119
|
|
|
79
120
|
`_Model_Client_ServiceRequest::_serialNumbers` (a `FIELD_SQL` field, so every client inherits it)
|
|
@@ -143,7 +184,10 @@ None — uniform. The linkage structure is framework-level and identical across
|
|
|
143
184
|
- **Missing item bridge → no units**, even when units were received. Without a
|
|
144
185
|
`SalesOrderItems_PurchaseOrderItems` row, the receipt path has no starting link.
|
|
145
186
|
- **A present bridge is not sufficient.** If the bridged PO line has no
|
|
146
|
-
`ItemReceiptItemUnits`, the receipt path still resolves to nothing.
|
|
187
|
+
`ItemReceiptItemUnits`, the receipt path still resolves to nothing. The **fulfillment-chain**
|
|
188
|
+
analog (NYCHH rebuild): a PO line with a bridge **and** a fulfillment but **zero
|
|
189
|
+
`ItemFulfillmentItemUnits`** (no serialized units captured) correctly shows an **empty grid** — that
|
|
190
|
+
is not a bug, just a line with no serials recorded.
|
|
147
191
|
- **`inventoryType` determines unit existence**: `SERIALIZED` and `HYBRID` items can produce
|
|
148
192
|
unit records; `NON_SERIALIZED` (bulk/consumable) never do. `HYBRID` items fulfilled as a
|
|
149
193
|
plain quantity (no serial capture) also produce no units — legitimately blank.
|
|
@@ -172,6 +216,15 @@ None — uniform. The linkage structure is framework-level and identical across
|
|
|
172
216
|
rather than reading the SQL.
|
|
173
217
|
|
|
174
218
|
## Change history
|
|
219
|
+
- 2026-09-10 - `Client_Nychh` **rebuilt this view onto the fulfillment chain** (Units → 30 → 29 →
|
|
220
|
+
290 bridge → PurchaseOrderItems 18, filtered by `(PurchaseOrderItems.uuid:eq:...)`), the first
|
|
221
|
+
"resolver that walks the fulfillment path" — lists serialized units for a clicked PO item with
|
|
222
|
+
Serial #, Asset Tag, Disposition, Location. Disposition/Location come from NYCHH-only
|
|
223
|
+
`_Model_Nychh_Unit` calc fields (`_unitDisposition` override, new `_transferLocation`) because the
|
|
224
|
+
location chain re-uses `ItemFulfillmentItems` twice. Added the empty-grid gotcha (bridge +
|
|
225
|
+
fulfillment but zero `ItemFulfillmentItemUnits` = correctly blank). Cross-refs the bridge Base-ACL
|
|
226
|
+
1054 and the surface-leaf slug-doubling fixes on [tableview-joins](./tableview-joins.md). Files:
|
|
227
|
+
`Client_Nychh/2026-09-10a`, `Client_Nychh/2026-09-10b`, `Core/2026-09-10a`. (jcardinal)
|
|
175
228
|
- 2026-08-28 - Corrected the `ServiceRequests_Units` "0 rows" note: that is an **Elite** measurement,
|
|
176
229
|
not a schema fact - `Client_Prudential` has **30,268 rows** and the bridge is the only unit-to-order
|
|
177
230
|
route there for never-shipped units (`SalesOrderItems_CommittedUnits` is the empty one on Prudential,
|
|
@@ -6,7 +6,7 @@ project: API
|
|
|
6
6
|
client: shared
|
|
7
7
|
type: feature
|
|
8
8
|
status: active
|
|
9
|
-
updated: 2026-09-
|
|
9
|
+
updated: 2026-09-10
|
|
10
10
|
owners: ["mhammontree", "dfranks", "bala", "jcardinal"]
|
|
11
11
|
files:
|
|
12
12
|
- api2/Component/Api/V2/V2.php
|
|
@@ -21,6 +21,7 @@ related:
|
|
|
21
21
|
- ./environment-variable-drives-underscore-branch.md
|
|
22
22
|
- ../../_underscore/features/error-reporting-issue-event.md
|
|
23
23
|
- ../../../../clients/aig/features/entitlement-intake.md
|
|
24
|
+
- ../../../../clients/prudential/features/service-request-auth-rejection-alert.md
|
|
24
25
|
- ../../../../clients/compass-usa/features/mits-po-to-so-item-linking.md
|
|
25
26
|
- ../../../../clients/compass-usa/workflows/order-lifecycle-and-data-integrity.md
|
|
26
27
|
---
|
|
@@ -53,6 +54,24 @@ In `api2/Component/Api/V2/V2.php` (~L2168) every request is logged and routed:
|
|
|
53
54
|
- There is also a **config-gated branch** (~L2166): when `_Config::api('log_filepath')` is set,
|
|
54
55
|
the log entry is written to a **file** on the host instead of the DB.
|
|
55
56
|
|
|
57
|
+
### 401 lands in base `Logs`; 403 lands in `Logs_<Client>`
|
|
58
|
+
|
|
59
|
+
The pre-scope/post-scope split above has a sharp, practical edge on the two auth codes:
|
|
60
|
+
|
|
61
|
+
- **401** (`EN-1`..`EN-6`, e.g. an expired token) is decided in the auth chain in `V2.php`
|
|
62
|
+
(~L2088, inside `execute()`) **before routing**, so the client is not resolved and the row can
|
|
63
|
+
only go to the **shared base `Logs`**.
|
|
64
|
+
- **403** happens **after** the client IS known, so that row lands in **`Logs_<Client>`**.
|
|
65
|
+
|
|
66
|
+
Verified on Prudential for 2026-08-31 – 09-01: `Logs_Prudential.Api` held **56** rows for
|
|
67
|
+
`/v2/service-requests`, **all 201**, while every one of the **36 401s** sat in base `Logs`.
|
|
68
|
+
|
|
69
|
+
**A 401 therefore can never reach a model interceptor** — no `prePost`/`postPost` hook can alert on
|
|
70
|
+
it, because routing and the model are never reached. Anything that must react to refused inbound
|
|
71
|
+
traffic has to **scan the base log**, not hook the model. The caller is still identifiable: decode
|
|
72
|
+
the Bearer token in `requestHeaders` and read `id.client.uuid`. See
|
|
73
|
+
[Prudential refused-REQ alert](../../../../clients/prudential/features/service-request-auth-rejection-alert.md).
|
|
74
|
+
|
|
56
75
|
### A rejected request (HTTP 400) is NOT unlogged
|
|
57
76
|
|
|
58
77
|
`api2/Controller/Index.php` (L369-377) handles a non-success response by **committing** the
|
|
@@ -359,6 +378,13 @@ The working pattern, in order:
|
|
|
359
378
|
> a field its response echo omitted (see the [V2 query contract](v2-rest-query-contract.md) PUT-echo
|
|
360
379
|
> gotcha).
|
|
361
380
|
|
|
381
|
+
> **What is actually indexed (checked with `SHOW INDEX`, 2026-09-10):** `dtStamp` **IS** indexed
|
|
382
|
+
> — `Api_dtStamp_IDX` — in **both** the base `Logs` (~3.67M rows) and `Logs_Prudential` (~7.86M
|
|
383
|
+
> rows). `route` and `responseCode` are **NOT** indexed. So a *tight* `dtStamp` window is cheap
|
|
384
|
+
> (a 15-minute slice is trivial), but a **wide** `dtStamp` range combined with a `route` filter
|
|
385
|
+
> still times out — a 2.5-month grouped query aborted at 300 s. Narrow the time window first;
|
|
386
|
+
> the other predicates do no work for you.
|
|
387
|
+
|
|
362
388
|
1. **Narrow with indexed / non-text columns only** — a `dtStamp` range plus `route`,
|
|
363
389
|
`method`, `responseCode`, `hostname`. A
|
|
364
390
|
`GROUP BY hostname, route, method, responseCode` over one day is cheap and is the fastest way
|
|
@@ -400,6 +426,16 @@ re-send.
|
|
|
400
426
|
> replay operationally, not by pasting payloads into the KB.
|
|
401
427
|
|
|
402
428
|
## Change history
|
|
429
|
+
- 2026-09-10 — Sharpened the client-vs-core routing on the auth codes: a **401 always lands in the
|
|
430
|
+
base `Logs`** (decided in the auth chain ~L2088 before routing, client unresolved) while a **403
|
|
431
|
+
lands in `Logs_<Client>`** (client already known) — verified on Prudential 31 Aug–1 Sep, where
|
|
432
|
+
`Logs_Prudential.Api` held 56 rows for `/v2/service-requests` (all 201) and all **36 401s** were
|
|
433
|
+
in base `Logs`. Consequence: **no model interceptor can ever fire for a 401**, so alerting on
|
|
434
|
+
refused inbound traffic must scan the base log; the caller is recoverable by decoding
|
|
435
|
+
`id.client.uuid` from the Bearer token. Also corrected the index picture with `SHOW INDEX`:
|
|
436
|
+
`Logs.Api.dtStamp` **is** indexed (`Api_dtStamp_IDX`) in both base `Logs` (~3.67M rows) and
|
|
437
|
+
`Logs_Prudential` (~7.86M rows), but `route`/`responseCode` are **not** — a tight window is cheap,
|
|
438
|
+
a wide window plus a route filter still aborts at 300 s. No code change. (bala)
|
|
403
439
|
- 2026-09-01 — **Fixed the duplicate-`transactionId` 500** (`Logs.Issue CT`, `TRUE-81056` /
|
|
404
440
|
`db94a26`): the log-save at the end of `execute()` did a **check-then-insert**, which cannot work
|
|
405
441
|
under concurrency because the rival copy's row is still uncommitted and therefore invisible to the
|
|
@@ -6,7 +6,7 @@ project: API
|
|
|
6
6
|
client: shared
|
|
7
7
|
type: feature
|
|
8
8
|
status: active
|
|
9
|
-
updated: 2026-
|
|
9
|
+
updated: 2026-09-10
|
|
10
10
|
owners: [mhammontree, tcox, jcardinal, ajean, bala, apeterson]
|
|
11
11
|
files:
|
|
12
12
|
- api2/Component/Api/V2/V2.php
|
|
@@ -140,6 +140,13 @@ migration instead of re-deriving it. All field/script ACL rows live in the **CLI
|
|
|
140
140
|
`error.id` like `"8K-6"`. The part **before the dash** is `Logs.Issue.reference` —
|
|
141
141
|
`SELECT * FROM Logs.Issue WHERE reference = '8K'` gives the full `errorMessage` and stack
|
|
142
142
|
trace. The envelope itself tells you nothing useful; always go to `Logs.Issue`.
|
|
143
|
+
**A developer will often hand you this id verbally (e.g. "V7-6") to investigate — split on the
|
|
144
|
+
hyphen: the first part (`V7`) is `Logs.Issue.reference`, the second (`6`) is
|
|
145
|
+
`Logs.Event.eventNumber`. The two tables join on `Logs.Event.issueId = Logs.Issue.id`, so the
|
|
146
|
+
exact occurrence (and its `Logs.Event.clientId` tenant) is
|
|
147
|
+
`SELECT * FROM Logs.Event JOIN Logs.Issue ON Logs.Event.issueId = Logs.Issue.id WHERE
|
|
148
|
+
Logs.Issue.reference = 'V7' AND Logs.Event.eventNumber = 6`.** (`Logs.Issue` has no `dtUpdated`
|
|
149
|
+
column.)
|
|
143
150
|
Corollary: if `transactionId`, `authority` and `audience` are **all NULL** in the error
|
|
144
151
|
envelope, the request failed **before client context was established**.
|
|
145
152
|
|
|
@@ -292,6 +299,10 @@ Full mechanics:
|
|
|
292
299
|
- The response-envelope shape and code families: see [api2 architecture](../architecture.md).
|
|
293
300
|
|
|
294
301
|
## Change history
|
|
302
|
+
- 2026-09-10 — Made the developer-shorthand decode of an `error.id` explicit under diagnosis note 9:
|
|
303
|
+
a verbally-provided id like "V7-6" splits into `Logs.Issue.reference` (before the hyphen) +
|
|
304
|
+
`Logs.Event.eventNumber` (after), joined by `Logs.Event.issueId = Logs.Issue.id`; added the ready
|
|
305
|
+
`Logs.Event JOIN Logs.Issue` lookup and noted `Logs.Issue` has no `dtUpdated` column. (jcardinal)
|
|
295
306
|
- 2026-08-27 — Added three codes/notes from the NYCHH transfer-order POST work: **EV-10** (a NOT NULL
|
|
296
307
|
column received NULL — `originLocationId cannot be null`; resolve upstream or default in the ORM), a
|
|
297
308
|
second **EV-12** flavor (`searchableIdentifierFields:[id]` — a nested FK resolved *through* a `c_`
|
package/knowledge/INDEX.md
CHANGED
|
@@ -5,7 +5,7 @@ _Auto-generated by `knowledge.js index`. Do not hand-edit._
|
|
|
5
5
|
## 1.0 framework
|
|
6
6
|
|
|
7
7
|
- **library** (Library) _(framework core)_ — 25 doc(s) → [1.0/apps/library/INDEX.md](1.0/apps/library/INDEX.md)
|
|
8
|
-
- **worker** (Worker) —
|
|
8
|
+
- **worker** (Worker) — 35 doc(s) → [1.0/apps/worker/INDEX.md](1.0/apps/worker/INDEX.md)
|
|
9
9
|
- **dbchanges** (Database Changes) _(framework core)_ — 1 doc(s) → [1.0/apps/dbchanges/INDEX.md](1.0/apps/dbchanges/INDEX.md)
|
|
10
10
|
- **worker1.5** (Worker 1.5) — 0 doc(s) → [1.0/apps/worker1.5/INDEX.md](1.0/apps/worker1.5/INDEX.md)
|
|
11
11
|
- **togadesk** (TOGa Desk) — 13 doc(s) → [1.0/apps/togadesk/INDEX.md](1.0/apps/togadesk/INDEX.md)
|
|
@@ -33,6 +33,12 @@ files:
|
|
|
33
33
|
- dbchanges2/Client/2026-09-01a - PurchaseOrderItemQtyFieldsApiRoleRead.sql
|
|
34
34
|
- dbchanges2/Client_Nychh/2026-09-02a - TalosAssistantEnable.sql
|
|
35
35
|
- dbchanges2/Client_Nychh/2026-09-09c - UpdateLocationShippingAddresses.sql
|
|
36
|
+
- _underscore/Model/Nychh/Unit.php
|
|
37
|
+
- dbchanges2/Client_Nychh/2026-09-10a - UnitsForPoTableViewRebaseAndTransferLocationField.sql
|
|
38
|
+
- dbchanges2/Client_Nychh/2026-09-10b - UnitsForPoBridgeBaseAclGrant.sql
|
|
39
|
+
- dbchanges2/Client_Nychh/2026-09-10c - TransferLocationColumnLabel.sql
|
|
40
|
+
- dbchanges2/Core/2026-09-10a - InventoryGroupingsUnitsLeafPoItemFilter.sql
|
|
41
|
+
- dbchanges2/Core/2026-09-10b - UnitDispositionColumnLabel.sql
|
|
36
42
|
related:
|
|
37
43
|
- ./features/location-shipping-addresses.md
|
|
38
44
|
- ../../2.0/apps/dbchanges2/workflows/deleting-contacts-from-a-client-database.md
|
|
@@ -206,6 +212,51 @@ table views. Client-specific DB change-sets live in `dbchanges2/Client_Nychh/`.
|
|
|
206
212
|
`PurchaseOrders.id` 81, onB `PurchaseOrderItems.purchaseOrderId` 90, sortOrder 7, no column). No
|
|
207
213
|
new ACL — record 17 already has Base/Developer/API read. Mechanism:
|
|
208
214
|
[tableview-joins](../../2.0/apps/_underscore/features/tableview-joins.md).
|
|
215
|
+
- **`units-for-items-for-purchase-orders` view rebuilt to list serials for a clicked PO item
|
|
216
|
+
(2026-09-10).** Base record Units (31). The old 25-join / 12-column config (inaccurate) was replaced
|
|
217
|
+
with an INNER chain **Units → ItemFulfillmentItemUnits (30) → ItemFulfillmentItems (29) →
|
|
218
|
+
PurchaseOrderItems_SalesOrderItems bridge (290) → PurchaseOrderItems (18)**, plus a **filter-only**
|
|
219
|
+
`SalesOrderItems (15)` join kept so the `itemsByPOs` drill (filters by `SalesOrderItems.uuid`) still
|
|
220
|
+
works. Filtered at drill-down by `(PurchaseOrderItems.uuid:eq:...)`. Columns: Serial #, Asset Tag,
|
|
221
|
+
Disposition, Location. File `Client_Nychh/2026-09-10a -
|
|
222
|
+
UnitsForPoTableViewRebaseAndTransferLocationField.sql`. Four connected pieces:
|
|
223
|
+
1. **Two NYCHH-only calc fields on `_Model_Nychh_Unit`** (`_underscore/Model/Nychh/Unit.php`), both
|
|
224
|
+
plain `FIELD_SQL` text. **`_unitDisposition` is OVERRIDDEN** — NYCHH does **not** use the
|
|
225
|
+
`UnitDispositions` lookup; disposition is `Deployed` if an `ItemFulfillmentItems` with
|
|
226
|
+
`transferOrderItemId IS NOT NULL` exists for the unit, else `Available` (override matches the
|
|
227
|
+
parent's untyped signature exactly). **`_transferLocation` is NEW** — the transfer-order
|
|
228
|
+
destination location name via Units → ItemFulfillmentItemUnits → ItemFulfillmentItems →
|
|
229
|
+
TransferOrderItems → TransferOrders → destinationLocationId → Locations (`ORDER BY` fulfillment
|
|
230
|
+
id `DESC LIMIT 1`); registered as a `Client_Nychh.CustomRecordFields` row (record 31) + Base
|
|
231
|
+
`AclCustomFieldPermissions`. It is a calc field, **not** a join, because the chain re-uses
|
|
232
|
+
`ItemFulfillmentItems`/`ItemFulfillmentItemUnits` a second time and the TableView alias model
|
|
233
|
+
would bind to the wrong copy. See
|
|
234
|
+
[calculated-sql-fields](../../2.0/apps/_underscore/features/calculated-sql-fields.md).
|
|
235
|
+
2. **Bridge Base ACL grant** — record 290 (`PurchaseOrderItems_SalesOrderItems`) shipped with only
|
|
236
|
+
an **API-role** read grant, so a Base user's joins query dropped the bridge and the next join's
|
|
237
|
+
ON errored `Unknown column 'PurchaseOrderItems_SalesOrderItems.purchaseOrderItemId' in 'on
|
|
238
|
+
clause'` (MySQL 1054). Fixed with the full 4-table Base ACL chain reusing record 290's `all`
|
|
239
|
+
expression: `Client_Nychh/2026-09-10b - UnitsForPoBridgeBaseAclGrant.sql`. Records 30/29/15/18
|
|
240
|
+
already had Base. Mechanism: [tableview-joins](../../2.0/apps/_underscore/features/tableview-joins.md).
|
|
241
|
+
3. **Surface drill-down LEAF slug** — the `inventory-list-groupings` `posByItems` **leaf**
|
|
242
|
+
`additionalDataSlug` had to be the bare table name `PurchaseOrderItems` (NOT
|
|
243
|
+
`PurchaseOrderItems.uuid`); the FE appends `.uuid` itself, so a stored `.uuid` doubled to
|
|
244
|
+
`.uuid.uuid` and 500'd (1054). Same doubling rule as the swap level above, one level deeper. This
|
|
245
|
+
is `Core.SurfaceElements` (all-client, no NYCHH override); `Core/2026-09-10a -
|
|
246
|
+
InventoryGroupingsUnitsLeafPoItemFilter.sql` (guard covers both `SalesOrderItems.uuid` and the
|
|
247
|
+
interim `PurchaseOrderItems.uuid`). Confirmed in toga25-supply
|
|
248
|
+
`useInventoryPageViewModel.tsx` (getAdditionalData).
|
|
249
|
+
4. **Column labels (settings layer, `Core.Settings` id 5 = `label-singular`)** — Disposition via a
|
|
250
|
+
`Core.DefaultRecordFieldSettings` row on Core field 619 (`_unitDisposition`), value "Disposition"
|
|
251
|
+
(`Core/2026-09-10b - UnitDispositionColumnLabel.sql`); Location via a
|
|
252
|
+
`Client_Nychh.ClientCustomRecordFieldSettings` row on `_transferLocation` (context columns NULL,
|
|
253
|
+
settingId 5, `isOverridable 1`), value "Location" (`Client_Nychh/2026-09-10c -
|
|
254
|
+
TransferLocationColumnLabel.sql`). Without a label row the grid falls back to the raw
|
|
255
|
+
`TableViewFields.slug`.
|
|
256
|
+
- **Empty grid for a given PO item is correct** when that line has a bridge + fulfillment but zero
|
|
257
|
+
`ItemFulfillmentItemUnits` (no serialized units captured) — not a bug.
|
|
258
|
+
- **Deploy:** the `_underscore` model change must land on **`_production`** and **`_sandbox-client`**
|
|
259
|
+
(api2 pulls `_underscore` per environment by branch); the SQL files run on prod + client-sandbox.
|
|
209
260
|
- **`inventory_units` table view carries item detail as of 2026-08-18** — Part Number, Manufacturer
|
|
210
261
|
and Item Description sit directly after Asset Tag, reached through a **chained** Units → Items →
|
|
211
262
|
Manufacturers join (`dbchanges2/Client_Nychh/2026-08-18 - InventoryUnitsItemColumns.sql`, identical
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
| [Prudential: OneUptime order-pipeline backlog monitors (Monitor/Prudential/*)](features/oneuptime-order-pipeline-monitors.md) | 2.0 | Three worker2 OneUptime push monitors (TRUE-80587) that watch the Prudential/Dell order pipeline for **stalls**, which were previously invisible — a stuck pipel |
|
|
9
9
|
| [Prudential: order email PDF attachments (which guide goes on which email)](features/order-email-pdf-attachments.md) | 1.0 | Every customer-facing Prudential order email carries S3-hosted PDF guides, and **which** guide is attached is decided by the service request type. |
|
|
10
10
|
| [Prudential: Service Request Regional Address Validation](features/service-request-address-validation.md) | 2.0 | The `prePost` interceptor on `_Model_Prudential_ServiceRequest` validates `deliverToAddress` fields differently depending on which Prudential regional customer |
|
|
11
|
+
| [Prudential: refused REQ alert (401/403 on POST /v2/service-requests)](features/service-request-auth-rejection-alert.md) | 1.0 | ServiceNow posts every Prudential REQ to `POST /v2/service-requests`. |
|
|
11
12
|
| [Prudential: Service Request rejection alert email](features/service-request-rejection-alert-email.md) | 2.0 | When a Prudential ServiceNow→TOGa service-request submission (`POST /v2/service-requests`) is **rejected by validation**, TOGa now sends a real-time internal al |
|
|
12
13
|
| [Prudential: Sales Orders CSV export (TOGa 2.5 Supply)](features/supply-orders-csv-export.md) | 2.0 | The **Export** button on the TOGa 2.5 Supply *Sales Orders* page is **Prudential-only**: it downloads a 22-column CSV (`prudential-orders-<YYYY-MM-DD>.csv`) cov |
|
|
13
14
|
| [Prudential Order Shipped Email — transmit_ordershipped_updates_prudential.php](features/transmit-ordershipped-email.md) | 1.0 | Cron script that transmits "Order Shipped" updates to ServiceNow (RITM) and sends a shipped notification email to the end user. |
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Prudential: refused REQ alert (401/403 on POST /v2/service-requests)"
|
|
3
|
+
framework: "1.0"
|
|
4
|
+
repo: worker
|
|
5
|
+
project: Worker
|
|
6
|
+
client: prudential
|
|
7
|
+
type: client-feature
|
|
8
|
+
status: active
|
|
9
|
+
updated: 2026-09-10
|
|
10
|
+
owners: ["bala"]
|
|
11
|
+
files:
|
|
12
|
+
- worker/crons/notifications/reports/prudential/prudential_auth_rejection_alert.php
|
|
13
|
+
- worker/schedules/cron.worker.notification.json
|
|
14
|
+
- worker/crons/notifications/reports/prudential_exception_report.php
|
|
15
|
+
- worker/crons/notifications/reports/prudential/prudential_api_500_retry.php
|
|
16
|
+
related:
|
|
17
|
+
- service-request-rejection-alert-email.md
|
|
18
|
+
- service-request-address-validation.md
|
|
19
|
+
- ../profile.md
|
|
20
|
+
- ../../../2.0/apps/api2/features/request-logging.md
|
|
21
|
+
- ../../../2.0/apps/api2/features/v2-api-error-codes.md
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Summary
|
|
25
|
+
|
|
26
|
+
ServiceNow posts every Prudential REQ to `POST /v2/service-requests`. When we **refuse** that
|
|
27
|
+
request at the door — **401** (login token bad or expired) or **403** (permissions) — no
|
|
28
|
+
ServiceRequest row is created, no interceptor runs, and **no existing report shows it**. The REQ
|
|
29
|
+
simply does not exist on our side and nobody is told. The cron
|
|
30
|
+
`worker/crons/notifications/reports/prudential/prudential_auth_rejection_alert.php` closes that
|
|
31
|
+
gap: every 15 minutes it reads refused inbound REQs straight from the API logs and emails them
|
|
32
|
+
with the full payload, so they can be resubmitted the same hour instead of being found weeks later.
|
|
33
|
+
|
|
34
|
+
This is the **auth-layer** sibling of the 2.0 validation alert
|
|
35
|
+
([service-request-rejection-alert-email.md](service-request-rejection-alert-email.md)), which
|
|
36
|
+
covers 400s. The two never overlap: a 400 reaches the model, a 401 never does.
|
|
37
|
+
|
|
38
|
+
## Why it exists (the 2026-08/09 incident)
|
|
39
|
+
|
|
40
|
+
REQ4492868 was reported missing. It **did** reach us on 2026-08-31 09:45:18 (POST
|
|
41
|
+
`/v2/service-requests`, BREAKFIX, RITM6763537) and came back **401 `EN-4` "The provided token has
|
|
42
|
+
expired"**. ServiceNow (sourceIp `199.91.136.12`) collected a JWT at 07:40:47 that expired at
|
|
43
|
+
08:40:47 (1-hour life) and then kept reusing that same dead token for hours — every refused row
|
|
44
|
+
carries the **identical `exp`**. **36 REQs** were refused this way across 31 Aug and 1 Sep. 14 were
|
|
45
|
+
later resent and created fine (the Reclaims, replayed 1 Sep ~15:00); **22, including REQ4492868,
|
|
46
|
+
were never resent and are still missing.** The whole class of failure was silent for a week.
|
|
47
|
+
|
|
48
|
+
## Why nothing else caught it
|
|
49
|
+
|
|
50
|
+
- `worker/crons/notifications/reports/prudential_exception_report.php` (daily, 9:00 AM) only queries
|
|
51
|
+
response codes **201, 400 and 500**, and only against **`Logs_Prudential`** (`db_prod_logs_prudential`).
|
|
52
|
+
- `prudential_api_500_retry.php` only queries **500**.
|
|
53
|
+
|
|
54
|
+
So **401 and 403 were the two codes nobody was looking at** — and a 401 is not even in the schema
|
|
55
|
+
those reports read. This is also why the new cron cannot double-report: no other job touches these
|
|
56
|
+
codes.
|
|
57
|
+
|
|
58
|
+
## Where a refused request is actually logged (the load-bearing fact)
|
|
59
|
+
|
|
60
|
+
- **401 → the SHARED BASE `Logs` schema** (`db_prod_logs`), **not** `Logs_Prudential`. The
|
|
61
|
+
expired-token check runs in the auth chain in `api2/Component/Api/V2/V2.php` (~L2088, inside
|
|
62
|
+
`execute()`) **before** routing, so the client is not resolved yet and the row cannot be written
|
|
63
|
+
to the client log schema.
|
|
64
|
+
- **403 → `Logs_Prudential`.** By then the client **is** known.
|
|
65
|
+
|
|
66
|
+
Verified for 31 Aug – 1 Sep: `Logs_Prudential.Api` holds **56 rows** for `/v2/service-requests`,
|
|
67
|
+
**all 201**; every one of the **36 401s** is in base `Logs`.
|
|
68
|
+
|
|
69
|
+
**Consequence: a model `prePost` / interceptor can NEVER fire for a 401** — the request never
|
|
70
|
+
reaches routing or the model. That is why this alert had to be a log scan and not a hook. The
|
|
71
|
+
client is still identifiable: decode the expired Bearer token and read `id.client.uuid`.
|
|
72
|
+
|
|
73
|
+
## How it works
|
|
74
|
+
|
|
75
|
+
1. Floor the clock to the quarter hour and read exactly `[end - 15 min, end)`.
|
|
76
|
+
2. Read **401s from base `Logs`** (`db_prod_logs`) and **403s from `Logs_Prudential`**
|
|
77
|
+
(`db_prod_logs_prudential`), both filtered to `direction = 'IN'`, `method = 'POST'`,
|
|
78
|
+
`route = '/v2/service-requests'`.
|
|
79
|
+
3. Decode the Bearer token in `requestHeaders` to confirm the caller is Prudential
|
|
80
|
+
(`App_Api_Toga2::CLIENT_UUID_PRUDENTIAL`). A **missing** token yields no uuid — those rows are
|
|
81
|
+
**still reported**, deliberately, rather than dropped.
|
|
82
|
+
4. Map the `EN-*` code from the response payload to a plain-English sentence
|
|
83
|
+
(`EN-1` no token sent · `EN-2` unreadable · `EN-3` not valid · `EN-4` expired · `EN-5` altered ·
|
|
84
|
+
`EN-6` address not allowed), and classify the row as **Login** (401) or **Permissions** (403).
|
|
85
|
+
5. Email one grouped HTML table — REQ number, RITM number, type, time raised in ServiceNow, time it
|
|
86
|
+
reached us, reason — plus a **CSV attachment whose last column carries the full request
|
|
87
|
+
payload**, so the mail can be forwarded to Prudential as proof of what they sent.
|
|
88
|
+
6. Send **nothing** on a quiet run. Cap of `MAX_ROWS_PER_RUN = 500` so one bad hour cannot produce a
|
|
89
|
+
giant email.
|
|
90
|
+
|
|
91
|
+
Schedule entry in `worker/schedules/cron.worker.notification.json`: `"*/15 * * * *"` →
|
|
92
|
+
`notifications/reports/prudential/prudential_auth_rejection_alert.php` (notification worker role).
|
|
93
|
+
Recipients: `vburks`, `rgirish`, `ADiamond`, `kmaramreddy` @togatech.com.
|
|
94
|
+
|
|
95
|
+
## Design decision — no state table, no state file (clock-aligned window instead)
|
|
96
|
+
|
|
97
|
+
The first design kept a "last processed log id" marker. Both marker forms were rejected:
|
|
98
|
+
|
|
99
|
+
- **A file marker is wrong here.** The worker cache folder is `/var/www/cache`, **local to each
|
|
100
|
+
Elastic Beanstalk instance** and recreated on every deploy (see
|
|
101
|
+
`worker/ebs/setup_export_cache_folders.php`). The same rejections would be emailed once *per
|
|
102
|
+
instance*, and the marker is lost on every deploy.
|
|
103
|
+
- **A DB marker table** was drafted, then rejected as too much machinery for the value.
|
|
104
|
+
|
|
105
|
+
**Final design:** each run floors the clock to the quarter hour and reads `[end - 15 min, end)`.
|
|
106
|
+
Consecutive slices touch but never overlap, so no row can be read twice — **with no state at all.**
|
|
107
|
+
|
|
108
|
+
**Known trade-off, accepted:** a skipped run (deploy, restart) loses that 15-minute slice. Do not
|
|
109
|
+
"fix" this by re-adding a marker without re-reading the two reasons above.
|
|
110
|
+
|
|
111
|
+
## Gotchas
|
|
112
|
+
|
|
113
|
+
- **Filter `method = 'POST'` or you get browser noise.** Unauthenticated **GET**s on this route from
|
|
114
|
+
human sourceIps (`99.179.145.25`, `107.139.5.190`) also log 401, with an **empty `requestPayload`**
|
|
115
|
+
— they show up as REQ "Unknown". Only a POST is a real ServiceNow submission.
|
|
116
|
+
- **`prudential_api_500_retry.php` is broken and has almost certainly never worked.** At lines 57
|
|
117
|
+
and 70 it references a bare constant **`PRUDENTIAL_CLIENT_UUID` that is defined nowhere** in any
|
|
118
|
+
repo (grep returns only its own two uses); it should be `App_Api_Toga2::CLIENT_UUID_PRUDENTIAL`.
|
|
119
|
+
On PHP 8 an undefined constant is a **fatal Error**, so the cron dies every run; on PHP 7 it
|
|
120
|
+
evaluates to the literal string and the client check never matches, so it silently retries
|
|
121
|
+
nothing. It also appears in **no** `schedules/*.json` file, so it may never have been registered.
|
|
122
|
+
**Not fixed as of 2026-09-10 — reported only.**
|
|
123
|
+
- **`Logs.Api.dtStamp` IS indexed** (`Api_dtStamp_IDX`) in both base `Logs` and `Logs_Prudential`,
|
|
124
|
+
which is what makes the 15-minute window read cheap. But `route` and `responseCode` are **not**
|
|
125
|
+
indexed, so a wide `dtStamp` range plus a route filter still times out (a 2.5-month grouped query
|
|
126
|
+
aborted at 300 s). Keep the window tight. See
|
|
127
|
+
[request-logging.md](../../../2.0/apps/api2/features/request-logging.md).
|
|
128
|
+
|
|
129
|
+
## Telling "we refused it" from "they never sent it"
|
|
130
|
+
|
|
131
|
+
Two different failure shapes get reported the same way ("REQ is missing"):
|
|
132
|
+
|
|
133
|
+
- **Refused by us** — there IS an inbound POST row on `/v2/service-requests` with a 401/403 and a
|
|
134
|
+
full `requestPayload`. That is REQ4492868. Prudential must resubmit.
|
|
135
|
+
- **Never sent** — no inbound row at all. That is **REQ4398272**: absent from
|
|
136
|
+
`Client_Prudential.ServiceRequests` under both `c_reqNumber` and `c_ritmNumber`, and absent from
|
|
137
|
+
`Logs_Prudential.Api` (1 May – 15 Jul) and base `Logs.Api` (10–16 May) — no POST, no 401, no 400,
|
|
138
|
+
no 500. By the surrounding REQ numbers it would have been raised 2026-05-12 between 11:23 and
|
|
139
|
+
12:53 (REQ4398185 landed 11:23, REQ4398357 landed 12:53). Base `Logs` retention reaches back to
|
|
140
|
+
Aug 2025, so the window is genuinely covered. The problem is on the ServiceNow side.
|
|
141
|
+
|
|
142
|
+
Always check **both** schemas before answering — a 401 will not be in `Logs_Prudential`.
|
|
143
|
+
|
|
144
|
+
## Change history
|
|
145
|
+
- 2026-09-10 — Created. New 15-minute cron
|
|
146
|
+
`notifications/reports/prudential/prudential_auth_rejection_alert.php` alerting on Prudential REQs
|
|
147
|
+
refused with **401 (base `Logs`) or 403 (`Logs_Prudential`)**, with an HTML table plus a
|
|
148
|
+
full-payload CSV for forwarding to Prudential. Found after REQ4492868 was reported missing: it was
|
|
149
|
+
refused 2026-08-31 09:45:18 with `EN-4` (expired token), one of **36** refused across 31 Aug–1 Sep
|
|
150
|
+
from a JWT ServiceNow collected at 07:40:47 and reused past its 08:40:47 expiry — **22 still
|
|
151
|
+
missing**. Recorded why nothing caught it (the daily exception report reads only 201/400/500 and
|
|
152
|
+
only `Logs_Prudential`), why a `prePost` hook cannot work for a 401, the **no-state clock-aligned
|
|
153
|
+
window** decision (the `/var/www/cache` marker is per-instance and dies on deploy), the
|
|
154
|
+
**POST-only** filter that excludes browser 401 noise, that `dtStamp` is indexed while
|
|
155
|
+
`route`/`responseCode` are not, and that `prudential_api_500_retry.php` is dead on an undefined
|
|
156
|
+
`PRUDENTIAL_CLIENT_UUID` constant. (bala)
|
|
@@ -6,13 +6,14 @@ project: Worker
|
|
|
6
6
|
client: prudential
|
|
7
7
|
type: client-feature
|
|
8
8
|
status: active
|
|
9
|
-
updated: 2026-
|
|
9
|
+
updated: 2026-09-10
|
|
10
10
|
owners: ["bala"]
|
|
11
11
|
files:
|
|
12
12
|
- worker2/Worker/Client/Prudential/reports/ReqRejectionEmail.php
|
|
13
13
|
- _underscore/Model/Prudential/ServiceRequest.php
|
|
14
14
|
related:
|
|
15
15
|
- service-request-address-validation.md
|
|
16
|
+
- service-request-auth-rejection-alert.md
|
|
16
17
|
- ../../../2.0/apps/_underscore/features/email-send-pipeline.md
|
|
17
18
|
- ../profile.md
|
|
18
19
|
---
|
|
@@ -79,11 +80,21 @@ known residual risk.
|
|
|
79
80
|
validation block completes (e.g. the unguarded `serviceRequestUnits[0]->unit` access — see
|
|
80
81
|
`service-request-address-validation.md`) produces a **500 and no alert**. Fix that guard to
|
|
81
82
|
keep the alert reliable.
|
|
83
|
+
- **This alert only covers 400s — a 401/403 never reaches `prePost` at all.** An expired or bad
|
|
84
|
+
ServiceNow token is refused in the auth chain *before* routing, so the model never runs and no
|
|
85
|
+
interceptor can fire; the row is also logged to the **base `Logs`** schema, not `Logs_Prudential`.
|
|
86
|
+
Those refusals are alerted separately by the 1.0 worker cron in
|
|
87
|
+
[service-request-auth-rejection-alert.md](service-request-auth-rejection-alert.md). Do not extend
|
|
88
|
+
this interceptor to try to catch them.
|
|
82
89
|
- **"Plain text" is transmitted HTML anyway.** `setIsHtml(false)` is honored by `_Email` when it
|
|
83
90
|
queues the row, but the worker2 `Infrastructure/Email/Send` action calls `IsHTML(true)`
|
|
84
91
|
unconditionally, so the message is sent HTML-mode regardless (see `email-send-pipeline.md`).
|
|
85
92
|
|
|
86
93
|
## Change history
|
|
94
|
+
- 2026-09-10 — Scoped: this alert fires only for **validation 400s**. A **401/403** is decided in
|
|
95
|
+
the auth chain before routing, so `prePost` never runs and this email never sends for it — those
|
|
96
|
+
refused REQs are covered by the separate 15-minute worker cron
|
|
97
|
+
`prudential_auth_rejection_alert.php`. No code change. (bala)
|
|
87
98
|
- 2026-07-28 — Created: real-time internal alert on `POST /v2/service-requests` validation
|
|
88
99
|
rejection. `prePost()` now collects all validation errors and enqueues the
|
|
89
100
|
`ReqRejectionEmail/sendRejectionEmail` worker task (REQ# + reason + full payload) before
|
|
@@ -15,7 +15,7 @@ project: _Underscore
|
|
|
15
15
|
client: prudential
|
|
16
16
|
type: profile
|
|
17
17
|
status: active
|
|
18
|
-
updated: 2026-
|
|
18
|
+
updated: 2026-09-10
|
|
19
19
|
owners: ["jcardinal", "rgirish", "bala", "mhammontree"]
|
|
20
20
|
files: []
|
|
21
21
|
related:
|
|
@@ -23,10 +23,13 @@ related:
|
|
|
23
23
|
- features/dell-asn-units-interceptor.md
|
|
24
24
|
- features/service-request-address-validation.md
|
|
25
25
|
- features/service-request-rejection-alert-email.md
|
|
26
|
+
- features/service-request-auth-rejection-alert.md
|
|
26
27
|
- features/dell-lch-iop-transmissions.md
|
|
27
28
|
- features/device-information-import-and-contact-linking.md
|
|
28
29
|
- workflows/http2-alb-workaround.md
|
|
29
|
-
- features/
|
|
30
|
+
- features/service-request-auth-rejection-alert.md — the 15-minute refused-REQ (401/403) alert cron,
|
|
31
|
+
where each code is logged, and how to tell "we refused it" from "they never sent it".
|
|
32
|
+
- features/supply-orders-csv-export.md
|
|
30
33
|
- features/order-email-pdf-attachments.md
|
|
31
34
|
---
|
|
32
35
|
|
|
@@ -89,6 +92,13 @@ The order-created cron branches on this id; the shipped/delivered crons branch o
|
|
|
89
92
|
(E_ALL→ErrorException), so `!== false` guards do not work — use the `safeFetchPdf()` pattern. See
|
|
90
93
|
the exception report and the transmit-ordershipped-email feature doc.
|
|
91
94
|
|
|
95
|
+
- **Inbound REQs we refuse (401/403) are invisible in `Logs_Prudential`.** A 401 is logged to the
|
|
96
|
+
**shared base `Logs`** schema because the client is not resolved yet; only a 403 lands in
|
|
97
|
+
`Logs_Prudential`. The daily `prudential_exception_report.php` reads only 201/400/500 in the
|
|
98
|
+
client schema, so refused REQs went unseen for a week in Aug 2026 (36 refused, 22 never resent).
|
|
99
|
+
The 15-minute `prudential_auth_rejection_alert.php` cron now alerts on them — see
|
|
100
|
+
features/service-request-auth-rejection-alert.md.
|
|
101
|
+
|
|
92
102
|
## Monitoring
|
|
93
103
|
- `Monitor/Prudential/{SalesOrderGenerationBacklog,DellPurchaseOrderTransmissionBacklog,OrderShippedUpdateBacklog}`
|
|
94
104
|
(worker2 → OneUptime) watch the order pipeline for stalls. Thresholds are DB-tunable and the
|
package/package.json
CHANGED