toga-ai 1.0.131 → 1.0.133

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.
@@ -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)_ — 4 doc(s) → [1.0/apps/library/INDEX.md](1.0/apps/library/INDEX.md)
8
- - **worker** (Worker) — 9 doc(s) → [1.0/apps/worker/INDEX.md](1.0/apps/worker/INDEX.md)
8
+ - **worker** (Worker) — 10 doc(s) → [1.0/apps/worker/INDEX.md](1.0/apps/worker/INDEX.md)
9
9
  - **togadesk** (TOGa Desk) — 7 doc(s) → [1.0/apps/togadesk/INDEX.md](1.0/apps/togadesk/INDEX.md)
10
10
  - **togaview** (TOGa View) — 6 doc(s) → [1.0/apps/togaview/INDEX.md](1.0/apps/togaview/INDEX.md)
11
11
  - **webhook** (Webhook) — 1 doc(s) → [1.0/apps/webhook/INDEX.md](1.0/apps/webhook/INDEX.md)
@@ -2,7 +2,7 @@
2
2
 
3
3
  | Doc | Framework | Summary | Files |
4
4
  |-----|-----------|---------|-------|
5
- | [Compass ASN → ItemFulfillment Auto-Creation](features/asn-to-item-fulfillment.md) | 2.0 | For Compass USA, posting an AdvanceShippingNotice (ASN) auto-creates the ItemFulfillment (IF) on the upstream SalesOrder. | _underscore/Model/Compass/AdvanceShippingNotice.php, _underscore/Model/Compass/PurchaseOrder.php, api2/Component/Api/Cxml/Cxml.php, dbchanges2/Client_Compass/2026-06-11 - AsnItemTrackingNumberAcl.sql, dbchanges2/Client_Compass/2026-06-15b - BackfillSA132781ItemFulfillmentTracking.sql, dbchanges2/Client_Compass/2026-06-16 - CleanupSA132763CrossLineTracking.sql, dbchanges2/Client_Compass/2026-06-16b - CleanupSA132743CrossLineTracking.sql, dbchanges2/Client_Compass/2026-06-16c - BackfillSA132763C40QYUCTracking.sql, dbchanges2/Client_Compass/2026-06-18a - CleanupSA132898DuplicateTracking.sql |
5
+ | [Compass ASN → ItemFulfillment Auto-Creation](features/asn-to-item-fulfillment.md) | 2.0 | For Compass USA, posting an AdvanceShippingNotice (ASN) auto-creates the ItemFulfillment (IF) on the upstream SalesOrder. | _underscore/Model/Compass/AdvanceShippingNotice.php, _underscore/Model/Compass/PurchaseOrder.php, api2/Component/Api/Cxml/Cxml.php, dbchanges2/Client_Compass/2026-06-11 - AsnItemTrackingNumberAcl.sql, dbchanges2/Client_Compass/2026-06-15b - BackfillSA132781ItemFulfillmentTracking.sql, dbchanges2/Client_Compass/2026-06-16 - CleanupSA132763CrossLineTracking.sql, dbchanges2/Client_Compass/2026-06-16b - CleanupSA132743CrossLineTracking.sql, dbchanges2/Client_Compass/2026-06-16c - BackfillSA132763C40QYUCTracking.sql, dbchanges2/Client_Compass/2026-06-18a - CleanupSA132898DuplicateTracking.sql, dbchanges2/Client_Compass/2026-06-18b - CleanupSA132881DuplicateTracking.sql |
6
6
  | [Compass: Item-Fulfillment TableViews (for-sales-order-items & for-sales-orders, tracking via bridge)](features/item-fulfillment-tracking-tableview.md) | 2.0 | Two sibling Compass TableViews in `Client_Compass` display fulfilled items in toga2-supply, both driven by `TableViews` / `TableViewJoins` / `TableViewFields` c | dbchanges2/Client_Compass/2026-06-10 - ItemFulfillmentsForSalesOrderItemsTableView.sql, dbchanges2/Client_Compass/2026-06-11 - ItemFulfillmentsForSalesOrdersTableView.sql, dbchanges2/Client_Compass/2026-06-15a - FixItemFulfillmentTrackingNumberJoins.sql |
7
7
  | [Compass MITS PO → SO Item Linking](features/mits-po-to-so-item-linking.md) | 2.0 | MITS sends Compass inbound Purchase Orders (`POST /v2/purchase-orders`) against a Sales Order (`mitsSalesOrder`). | _underscore/Model/Compass/PurchaseOrder.php, worker/crons/toga2/compass/workflow/3a_import_office_depot_purchase_orders.php |
8
8
  | [Compass USA](profile.md) | 2.0 | Compass USA is a TOGA client running a multi-tier supply-chain commerce operation. | |
@@ -17,6 +17,7 @@ files:
17
17
  - dbchanges2/Client_Compass/2026-06-16b - CleanupSA132743CrossLineTracking.sql
18
18
  - dbchanges2/Client_Compass/2026-06-16c - BackfillSA132763C40QYUCTracking.sql
19
19
  - dbchanges2/Client_Compass/2026-06-18a - CleanupSA132898DuplicateTracking.sql
20
+ - dbchanges2/Client_Compass/2026-06-18b - CleanupSA132881DuplicateTracking.sql
20
21
  related:
21
22
  - ../../../2.0/apps/_underscore/features/recursive-item-fulfillments.md
22
23
  ---
@@ -204,7 +205,9 @@ Dated one-liners, newest first.
204
205
  (`itemFulfillmentItemHasTracking()`), stopping duplicate/different tracking numbers from
205
206
  vendor ASN re-transmissions piling onto fully-fulfilled lines (qty-1 SA132898 / USB31CC1 had
206
207
  2). Distinct root cause from the 2026-06-16 cross-line contamination. SA132898 repaired by
207
- `2026-06-18a` (cleanup-only; original tracking already correct). (jcardinal)
208
+ `2026-06-18a` and SA132881 (960-001075, same pattern) by `2026-06-18b` — both cleanup-only,
209
+ original tracking already correct. Two such orders surfaced the same day, so more duplicates
210
+ likely remain; a detection sweep (IFI item-level tracking count > fulfilled qty) is advisable. (jcardinal)
208
211
  - 2026-06-16 — Identified cross-line tracking contamination root cause: bad
209
212
  `SalesOrderItems_PurchaseOrderItems` rows (PO-local lineNumber collision in
210
213
  `_Model_Compass_PurchaseOrder`, fixed forward 2026-06-11 `ec935478`; and the worker ODP-PO
@@ -4,5 +4,6 @@
4
4
  |-----|-----------|---------|-------|
5
5
  | [Prudential: Dell ASN units PRE/POST interceptor (legacy key + flat tracking)](features/dell-asn-units-interceptor.md) | 2.0 | After the tracking-number bridge migration, the ASN unit route was renamed (`advance-shipping-notice-units` → `advance-shipping-notice-item-units`), so the inhe | _underscore/Model/Prudential/AdvanceShippingNotice.php, dbchanges2/Client_Prudential/2026-06-10 - AsnUnitsInterceptor.sql |
6
6
  | [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 | _underscore/Model/Prudential/ServiceRequest.php |
7
+ | [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. | worker/crons/toga2/prudential/transmit_ordershipped_updates_prudential.php |
7
8
  | [Prudential Financial](profile.md) | 2.0 | Prudential is a TOGA client whose device-fulfillment flow is driven by **Dell** via the Dell API (`Client_Prudential.Apis.id = 2`). | |
8
9
  | [Prudential: Dell ASN failed POST backfill replay](workflows/dell-asn-backfill-replay.md) | 2.0 | When Dell ASN POSTs fail in bulk (e.g. | |
@@ -0,0 +1,86 @@
1
+ ---
2
+ title: Prudential Order Shipped Email — transmit_ordershipped_updates_prudential.php
3
+ framework: "1.0"
4
+ repo: worker
5
+ project: Worker
6
+ client: prudential
7
+ type: client-feature
8
+ status: active
9
+ updated: 2026-06-18
10
+ owners: ["rgirish"]
11
+ files:
12
+ - worker/crons/toga2/prudential/transmit_ordershipped_updates_prudential.php
13
+ related:
14
+ - ../profile.md
15
+ ---
16
+
17
+ ## Summary
18
+ Cron script that transmits "Order Shipped" updates to ServiceNow (RITM) and sends a
19
+ shipped notification email to the end user. Runs on the `notification` worker role.
20
+ Stamps two fields on `PurchaseOrders` to track progress: `c_dtTransmittedOrderShippedUpdateToPrudential`
21
+ and `c_dtEmailSentOrderShipped`.
22
+
23
+ ## How it works
24
+
25
+ **Phase 1 — Transmit to ServiceNow:**
26
+ Selects all Dell POs that have at least one ASN and have not yet been transmitted
27
+ (`c_dtTransmittedOrderShippedUpdateToPrudential IS NULL`). For each:
28
+ 1. Calls Prudential SNOW API (`PUT /gbts/v1/sn_pcaas/ritm`) to update RITM state to "Order Shipped".
29
+ 2. Allocates units to the contact, updates asset state to "In Transit" in SNOW CMDB.
30
+ 3. Stamps `c_dtTransmittedOrderShippedUpdateToPrudential = NOW()` on the PO immediately.
31
+
32
+ **Phase 2 — Send shipped email:**
33
+ Iterates the same POs collected in Phase 1. For each:
34
+ 1. Fetches PO details via TOGa API (`GET /purchase-orders/<uuid>`).
35
+ 2. Fetches tracking number via TOGa API (`GET /tracking-numbers`).
36
+ 3. Builds and sends the shipped email based on `serviceRequestType`:
37
+ - **New** — "Your new hire equipment has shipped" with 3 PDF attachments (Win11 guide, return instructions, Mac setup guide).
38
+ - **Breakfix / Refresh** — "Your equipment has been shipped" with 2 PDF attachments (Win11 + Mac setup guide), skipped for Reclaim.
39
+ - **Reclaim** — "Your equipment has been shipped" with no PDF attachments.
40
+ 4. Stamps `c_dtEmailSentOrderShipped = NOW()` on the PO.
41
+
42
+ ## Data model
43
+ - `Client_Prudential.PurchaseOrders.c_dtTransmittedOrderShippedUpdateToPrudential` — stamped after SNOW transmission
44
+ - `Client_Prudential.PurchaseOrders.c_dtEmailSentOrderShipped` — stamped after email send
45
+ - Both fields are checked by `prudential_exception_report.php` to detect discrepancies
46
+
47
+ ## Exception report link
48
+ `worker/crons/notifications/reports/prudential_exception_report.php` flags any PO where
49
+ `c_dtTransmittedOrderShippedUpdateToPrudential IS NOT NULL` AND `c_dtEmailSentOrderShipped IS NULL`
50
+ as "Order Shipped Email Not Sent". This appears daily in the Prudential REQ Processing Report email.
51
+
52
+ ## Gotchas / known issues
53
+
54
+ **PDF fetch crash kills entire batch (fixed 2026-06-18):**
55
+ The New-type branch fetches 3 PDFs from S3 via `file_get_contents()`. If any S3 URL returns
56
+ a non-200 (e.g. 403 Forbidden), PHP emits a warning which `App_Error::handleError` converts
57
+ to an `ErrorException` — crashing the script mid-loop. Phase 1 has already stamped
58
+ `c_dtTransmittedOrderShippedUpdateToPrudential` for all POs in the batch, but Phase 2 dies
59
+ before writing `c_dtEmailSentOrderShipped` for any remaining POs.
60
+
61
+ Fix applied: added `!== false` guard around all three `file_get_contents` calls in the
62
+ New branch (matching the guard the non-New branch already had). If any PDF fetch fails,
63
+ the email sends without attachments rather than crashing.
64
+
65
+ **Wrong Mac PDF URL (fixed 2026-06-18):**
66
+ The New branch was pointing to `PrudentialMacSetupGuide_15.6_v4.pdf` (403 since ~May 5 2026)
67
+ instead of `PrudentialMacSetupGuide.pdf` (the working URL used by the non-New branch).
68
+
69
+ **Re-queueing stuck POs:**
70
+ If `c_dtEmailSentOrderShipped` is NULL but `c_dtTransmittedOrderShippedUpdateToPrudential`
71
+ is set, the script will never re-process those POs automatically. To re-trigger:
72
+ ```sql
73
+ UPDATE PurchaseOrders
74
+ SET c_dtTransmittedOrderShippedUpdateToPrudential = NULL
75
+ WHERE number IN ('P124878', ...);
76
+ ```
77
+ Then trigger the cron manually. Do NOT null out `c_dtEmailSentOrderShipped` on already-sent
78
+ POs or users will receive duplicate emails.
79
+
80
+ **Single-PO vs batch behavior:**
81
+ When only one New-type PO is in the queue, a crash in Phase 2 on that PO still fires the
82
+ stamp (crash hits the next iteration). With multiple New-type POs, a crash on PO #1 kills
83
+ all subsequent POs in the same run.
84
+
85
+ ## Change history
86
+ - 2026-06-18 — Fixed 403 crash: corrected Mac PDF URL (`_15.6_v4` → `PrudentialMacSetupGuide.pdf`) and added `false` guard on all S3 fetches in New branch (rgirish)
@@ -9,7 +9,7 @@ project: _Underscore
9
9
  client: prudential
10
10
  type: profile
11
11
  status: active
12
- updated: 2026-06-16
12
+ updated: 2026-06-18
13
13
  owners: ["jcardinal", "rgirish"]
14
14
  files: []
15
15
  related:
@@ -38,7 +38,12 @@ order-status transmissions.
38
38
  PRE/POST translation that keeps their feed working after the tracking-number bridge migration.
39
39
  - Service request region is resolved from `Customers.name` string (`'USA'`/`'India'`/`'Ireland'`).
40
40
  Renaming those customer records in the DB would silently break regional validation routing.
41
+ - `transmit_ordershipped_updates_prudential.php` runs in two phases. Phase 1 stamps
42
+ `c_dtTransmittedOrderShippedUpdateToPrudential` immediately; Phase 2 sends the email and stamps
43
+ `c_dtEmailSentOrderShipped`. Any exception in Phase 2 leaves `c_dtEmailSentOrderShipped` NULL
44
+ and the PO is never re-processed automatically. See the exception report and the transmit-ordershipped-email feature doc.
41
45
 
42
46
  ## Related docs
43
47
  - Dell ASN units interceptor.
44
48
  - 2.0 _underscore: Tracking-Number Bridge Migration.
49
+ - features/transmit-ordershipped-email.md
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toga-ai",
3
- "version": "1.0.131",
3
+ "version": "1.0.133",
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",