toga-ai 1.0.154 → 1.0.156
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/1.0/apps/test/INDEX.md +1 -0
- package/knowledge/1.0/apps/test/architecture.md +6 -2
- package/knowledge/1.0/apps/test/features/talos-kb-pipeline.md +145 -0
- package/knowledge/INDEX.md +1 -1
- package/knowledge/clients/compass-usa/INDEX.md +1 -0
- package/knowledge/clients/compass-usa/features/mits-po-to-so-item-linking.md +1 -0
- package/knowledge/clients/compass-usa/features/mits-po-transmission-to-vendors.md +89 -0
- package/knowledge/clients/compass-usa/workflows/order-lifecycle-and-data-integrity.md +1 -0
- package/package.json +1 -1
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
| [Developer Generators (password, UUID)](features/dev-generators.md) | Two tiny **1.0 `App_` framework** convenience scripts for everyday developer needs. | test/team/generate_password.php, test/team/uuid.php |
|
|
10
10
|
| [Forecast vs NetSuite Discrepancy Analysis](features/forecast-netsuite-discrepancy-analysis.md) | `team/forecast-netsuite/discrepancy_analysis.php` detects discrepancies between our **Forecast database** and **NetSuite** (the source of truth for all sales da | test/team/forecast-netsuite/discrepancy_analysis.php |
|
|
11
11
|
| [TableView Builder (2.0 TableViews SQL generator)](features/tableview-builder.md) | `team/tableViewBuilder/` generates SQL `INSERT` statements for the **2.0 `TableViews`**, `TableViewFields`, and `TableViewJoins` tables from a plain SQL `SELECT | test/team/tableViewBuilder/TableViewGenerator.php, test/team/tableViewBuilder/index.php, test/team/tableViewBuilder/Instructions.md |
|
|
12
|
+
| [Talos Knowledge Base Pipeline (Uploader + Processor)](features/talos-kb-pipeline.md) | `team/talos/` holds the two-script web tooling that feeds the **TOGa Talos** (TOGa IQ) AI knowledge bases. | test/team/talos/kb_uploader.php, test/team/talos/kb_processor.php, test/team/talos/kb_processor.ini |
|
|
12
13
|
| [TOGa 2.0 Client Onboarding SQL Generator](features/toga2-client-onboarding-sql.md) | `team/generate_toga2_onboarding_sql.php` generates the SQL needed to **onboard a new client** onto the 2.0 platform. | test/team/generate_toga2_onboarding_sql.php |
|
|
13
14
|
| [TOGa 2.0 User Cross-Client Access SQL Generator](features/toga2-user-cross-client-access-sql.md) | `team/generate_toga2_user_access_sql.php` generates SQL to grant an existing 2.0 user from a **home client** access to a **cross client**. | test/team/generate_toga2_user_access_sql.php |
|
|
14
15
|
| [URL & Domain Markdown Document Builder](features/url-domain-markdown-document.md) | `team/build_url_domain_markdown_document.php` generates a **markdown document of our URLs and domains** by pulling environments and domains from the 2.0 platfor | test/team/build_url_domain_markdown_document.php |
|
|
@@ -6,7 +6,7 @@ project: Test
|
|
|
6
6
|
client: shared
|
|
7
7
|
type: architecture
|
|
8
8
|
status: active
|
|
9
|
-
updated: 2026-06-
|
|
9
|
+
updated: 2026-06-22
|
|
10
10
|
owners: [jcardinal]
|
|
11
11
|
files:
|
|
12
12
|
- test/team/
|
|
@@ -20,6 +20,7 @@ related:
|
|
|
20
20
|
- ./features/active-directory-auth-test.md
|
|
21
21
|
- ./features/url-domain-markdown-document.md
|
|
22
22
|
- ./features/dev-generators.md
|
|
23
|
+
- ./features/talos-kb-pipeline.md
|
|
23
24
|
---
|
|
24
25
|
|
|
25
26
|
## Summary
|
|
@@ -81,9 +82,12 @@ manually against the target database; they do not execute changes themselves.
|
|
|
81
82
|
| `generate_toga2_onboarding_sql.php` | 1.0 | 2.0 client DBs | [toga2-client-onboarding-sql](./features/toga2-client-onboarding-sql.md) |
|
|
82
83
|
| `generate_toga2_user_access_sql.php` | 1.0 | 2.0 client DBs | [toga2-user-cross-client-access-sql](./features/toga2-user-cross-client-access-sql.md) |
|
|
83
84
|
| `generate_password.php`, `uuid.php` | 1.0 | dev utility | [dev-generators](./features/dev-generators.md) |
|
|
85
|
+
| `talos/kb_uploader.php`, `talos/kb_processor.php` | standalone | S3 + AWS Bedrock KBs | [talos-kb-pipeline](./features/talos-kb-pipeline.md) |
|
|
84
86
|
|
|
85
|
-
**Retired / not documented:** `team/DOA_gitbook/`
|
|
87
|
+
**Retired / not documented:** `team/DOA_gitbook/` is being retired.
|
|
86
88
|
|
|
87
89
|
## Change history
|
|
88
90
|
|
|
89
91
|
- 2026-06-16 — Initial capture of the `team/` folder. Registered repo in `registry.json`.
|
|
92
|
+
- 2026-06-22 — Un-retired `team/DOA_talos/` → `team/talos/`; documented its uploader +
|
|
93
|
+
processor in [talos-kb-pipeline](./features/talos-kb-pipeline.md).
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Talos Knowledge Base Pipeline (Uploader + Processor)
|
|
3
|
+
framework: "1.0"
|
|
4
|
+
repo: test
|
|
5
|
+
project: Test
|
|
6
|
+
client: shared
|
|
7
|
+
type: feature
|
|
8
|
+
status: active
|
|
9
|
+
updated: 2026-06-22
|
|
10
|
+
owners: [jcardinal]
|
|
11
|
+
files:
|
|
12
|
+
- test/team/talos/kb_uploader.php
|
|
13
|
+
- test/team/talos/kb_processor.php
|
|
14
|
+
- test/team/talos/kb_processor.ini
|
|
15
|
+
related:
|
|
16
|
+
- ../architecture.md
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Summary
|
|
20
|
+
|
|
21
|
+
`team/talos/` holds the two-script web tooling that feeds the **TOGa Talos** (TOGa IQ) AI
|
|
22
|
+
knowledge bases. Content flows through S3 folders and ends up in **AWS Bedrock** knowledge
|
|
23
|
+
bases, which back the internal AI agent that answers developer questions.
|
|
24
|
+
|
|
25
|
+
- **`kb_uploader.php`** — the *intake* page. A user pastes a meeting transcript or uploads a
|
|
26
|
+
document; it lands in the S3 `upload/` folder of a chosen knowledge base.
|
|
27
|
+
- **`kb_processor.php`** — the *review/approve* console. A reviewer cleans transcripts (AI +
|
|
28
|
+
automated text rules), approves files into the `approved/` folder, writes a Bedrock metadata
|
|
29
|
+
sidecar, archives the raw source, and triggers a Bedrock ingestion (sync) job.
|
|
30
|
+
|
|
31
|
+
Both are **standalone PHP pages** — they do **not** bootstrap the 1.0 `App_` framework. They
|
|
32
|
+
load the AWS SDK from `../../vendor/autoload.php` (Composer `aws/aws-sdk-php`) and read all
|
|
33
|
+
settings from a shared `kb_processor.ini`. Target PHP 7.2+.
|
|
34
|
+
|
|
35
|
+
> History: this folder was previously named `DOA_talos` (the `DOA_` prefix marked it as
|
|
36
|
+
> deprecated-but-live). It was un-retired and renamed to `talos` on 2026-06-22.
|
|
37
|
+
|
|
38
|
+
## S3 layout
|
|
39
|
+
|
|
40
|
+
All paths are relative to `S3_BUCKET` (`togaiq`) under `S3_ROOT_PATH` (`development-team/`).
|
|
41
|
+
Each **knowledge base** is a folder one level under the root (e.g. `development-team/<kb>/`),
|
|
42
|
+
discovered by listing common prefixes. Within each KB:
|
|
43
|
+
|
|
44
|
+
| Folder (config key) | Default | Role |
|
|
45
|
+
|---|---|---|
|
|
46
|
+
| `S3_UPLOAD_FOLDER` | `upload` | Raw intake — where the uploader drops files |
|
|
47
|
+
| `S3_APPROVED_FOLDER` | `approved` | Reviewed/approved content (+ `.metadata.json` sidecars) — the Bedrock data source |
|
|
48
|
+
| `S3_ARCHIVE_FOLDER` | `archive` | Raw source files after they've been approved |
|
|
49
|
+
|
|
50
|
+
A KB named **`general`** is treated specially: it is never auto-synced on approve/delete;
|
|
51
|
+
instead it is synced in bulk via the "Sync All General" flow.
|
|
52
|
+
|
|
53
|
+
## kb_uploader.php — intake
|
|
54
|
+
|
|
55
|
+
Single page with two POST forms (toggled by a client-side mode switcher):
|
|
56
|
+
|
|
57
|
+
1. **Meeting Transcription** (`submit_meeting`) — fields: date, meeting name, KB, raw
|
|
58
|
+
transcript. The meeting name is slash-sanitized; the transcript's repeated blank lines are
|
|
59
|
+
collapsed; the file is named **`YYYY-MM-DD - {MEETING_NAME}.txt`** and `putObject`'d to
|
|
60
|
+
`<root>/<kb>/upload/`. This filename pattern is what the processor later recognizes as a
|
|
61
|
+
meeting (`isMeetingTranscript()` regex).
|
|
62
|
+
2. **File Upload** (`submit_file`) — fields: KB, document name, file. Extension is validated
|
|
63
|
+
against `ALLOWED_EXTENSIONS`; the file is stored as `{documentName}.{ext}` in the same
|
|
64
|
+
`upload/` folder via `putObject` with `SourceFile`.
|
|
65
|
+
|
|
66
|
+
Knowledge-base options come from `getKnowledgeBases()`. All output is escaped with
|
|
67
|
+
`htmlspecialchars()`.
|
|
68
|
+
|
|
69
|
+
## kb_processor.php — review & approve
|
|
70
|
+
|
|
71
|
+
The page lists everything in every KB's `upload/` folder, split into **meetings** (filename
|
|
72
|
+
matches `^\d{4}-\d{2}-\d{2} - .+\.txt$`) and **documents**. It exposes AJAX actions (POST
|
|
73
|
+
`action=...`, JSON responses) plus an **Approved Files Browser** modal. Key actions:
|
|
74
|
+
|
|
75
|
+
| `action` | Purpose |
|
|
76
|
+
|---|---|
|
|
77
|
+
| `get_file_content` | Return an S3 object's text (transcript editor / file viewer) |
|
|
78
|
+
| `prepare_transcript` | AI clean → automated clean → prepend `date - title` header |
|
|
79
|
+
| `save_to_kb` | Approve a file (see flow below) |
|
|
80
|
+
| `download_file` | Stream any S3 key to the browser as an attachment (`Content-Disposition`) |
|
|
81
|
+
| `delete_file` / `delete_approved_file` | Delete from `upload/` / `approved/` (latter re-syncs the KB) |
|
|
82
|
+
| `list_approved_files` / `count_approved_files` | Populate the Approved Files Browser |
|
|
83
|
+
| `start_sync_all_general` / `sync_next_kb` / `get_sync_progress` | Session-backed batch sync of every KB's `general` data source, polled from the front-end |
|
|
84
|
+
|
|
85
|
+
### Transcript cleaning (`prepare_transcript`)
|
|
86
|
+
|
|
87
|
+
1. **AI cleaning** — `callAICleaningAPI()` POSTs to `AI_API_ENDPOINT` (the TOGa IQ AI service,
|
|
88
|
+
model `AI_MODEL_ID`, Bedrock Claude Haiku 4.5) with an `output_schema` requesting a single
|
|
89
|
+
`knowledge_doc` string. The lengthy `AI_SYSTEM_PROMPT` enforces a strict lossless plain-text
|
|
90
|
+
format (OVERVIEW + topical sections, verbatim code blocks, PascalCase tables / camelCase
|
|
91
|
+
columns). Retries twice with backoff on network errors and HTTP 429/5xx.
|
|
92
|
+
2. **Automated cleaning** — `applyAutomatedCleaning()` strips markdown artifacts (backticks,
|
|
93
|
+
`> ` quoting, `# ` headings), normalizes blank lines around headings/lists, removes
|
|
94
|
+
`:contentReference[...]` markers, and applies the `REPLACEMENTS[...]` map from the ini
|
|
95
|
+
(mishear corrections, e.g. `Talus → Talos`). Replacement keys support `:c` (case-sensitive)
|
|
96
|
+
and `:w` (whole-word) flags.
|
|
97
|
+
3. For meeting files, a `YYYY-MM-DD - Title` header is prepended.
|
|
98
|
+
|
|
99
|
+
### Approve flow (`save_to_kb`)
|
|
100
|
+
|
|
101
|
+
1. Write the approved content to `<root>/<newKb>/approved/<filename>` — uploading the cleaned
|
|
102
|
+
text for meetings, or copying the original S3 object directly for documents.
|
|
103
|
+
2. Write a **Bedrock metadata sidecar** `<filename>.metadata.json`
|
|
104
|
+
(`buildApprovedMetadataJson()`): `metadataAttributes` with `slug`, `client` (the KB name),
|
|
105
|
+
`state=approved`, `approved_at`, `filename`, each `includeForEmbedding: false`.
|
|
106
|
+
3. **Archive** the raw source: move `upload/<file>` → `archive/<file>` (copy + delete).
|
|
107
|
+
4. **Sync** the Bedrock knowledge base unless the KB is `general`:
|
|
108
|
+
`syncKnowledgeBaseDataSource()` resolves the KB by name (`KB_PREFIX + kb`, e.g.
|
|
109
|
+
`development-team-<kb>`), finds the matching data source, and `startIngestionJob()`s it with
|
|
110
|
+
a UUID client token. Retries on `ConflictException` / throttling up to `KB_CONFLICT_MAX_RETRIES`.
|
|
111
|
+
|
|
112
|
+
### Approved Files Browser
|
|
113
|
+
|
|
114
|
+
Modal listing the chosen KB's `approved/` files with size/modified, plus per-row **view**
|
|
115
|
+
(text types open in a viewer via `get_file_content`), **download** (⬇️ — form-POSTs
|
|
116
|
+
`download_file` so the browser saves the file locally), and **delete** (re-syncs the KB).
|
|
117
|
+
Added 2026-06-22: the per-row download button (`downloadApprovedFile()`), reusing the
|
|
118
|
+
existing `download_file` handler.
|
|
119
|
+
|
|
120
|
+
## Configuration (`kb_processor.ini`)
|
|
121
|
+
|
|
122
|
+
Shared by both scripts via `parse_ini_file(..., true)`. Sections: AWS creds/region, S3 bucket
|
|
123
|
+
+ folder names, Bedrock (`KB_PREFIX`, sync delays, conflict-retry tuning), `ALLOWED_EXTENSIONS`,
|
|
124
|
+
AI settings (`AI_API_ENDPOINT`, `AI_MODEL_ID`, `AI_API_KEY`, temperature/tokens/timeout, the
|
|
125
|
+
system prompt), and the `REPLACEMENTS[...]` mishear-correction map.
|
|
126
|
+
|
|
127
|
+
> **⚠️ Security:** `kb_processor.ini` currently stores **live AWS access/secret keys and the AI
|
|
128
|
+
> API key in plaintext, committed to the repo.** These should be rotated and moved out of source
|
|
129
|
+
> (per-developer config or environment) — do not copy these values into other files or docs.
|
|
130
|
+
|
|
131
|
+
## Gotchas
|
|
132
|
+
|
|
133
|
+
- **Not framework code** — no `_.php` / `App_Framework_Sandbox`. Don't assume `App_*` helpers
|
|
134
|
+
are available here; everything goes through the AWS SDK and the ini.
|
|
135
|
+
- **`general` KB is special-cased** everywhere — approve/delete skip its per-file sync; use the
|
|
136
|
+
batch "Sync All General" flow instead.
|
|
137
|
+
- **Filename convention is load-bearing**: the `YYYY-MM-DD - Name.txt` pattern is the only thing
|
|
138
|
+
that distinguishes a meeting (gets AI cleaning) from a document (copied as-is).
|
|
139
|
+
- Batch sync state lives in `$_SESSION['sync_progress']` and is driven by front-end polling
|
|
140
|
+
(`sync_next_kb`), one KB per request with a `KB_SYNC_DELAY_SECONDS` pause between.
|
|
141
|
+
|
|
142
|
+
## Change history
|
|
143
|
+
|
|
144
|
+
- 2026-06-22 — Un-retired the folder (`DOA_talos` → `talos`); added a per-file **Download**
|
|
145
|
+
button to the Approved Files Browser; initial knowledge capture of the uploader + processor.
|
package/knowledge/INDEX.md
CHANGED
|
@@ -10,7 +10,7 @@ _Auto-generated by `knowledge.js index`. Do not hand-edit._
|
|
|
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)
|
|
12
12
|
- **walmarttechservices** (Walmart Tech Services) — 1 doc(s) → [1.0/apps/walmarttechservices/INDEX.md](1.0/apps/walmarttechservices/INDEX.md)
|
|
13
|
-
- **test** (Test) —
|
|
13
|
+
- **test** (Test) — 11 doc(s) → [1.0/apps/test/INDEX.md](1.0/apps/test/INDEX.md)
|
|
14
14
|
|
|
15
15
|
## 2.0 framework
|
|
16
16
|
|
|
@@ -5,5 +5,6 @@
|
|
|
5
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
|
+
| [Compass MITS PO Transmission to Vendors](features/mits-po-transmission-to-vendors.md) | 2.0 | The 1.0 worker cron `2_transmit_mits_purchase_orders_to_vendors.php` transmits Compass PurchaseOrders to their vendors (Office Depot, Strategic Systems, Compass | worker/crons/toga2/compass/workflow/2_transmit_mits_purchase_orders_to_vendors.php, library/app/client/compass.php |
|
|
8
9
|
| [Compass USA](profile.md) | 2.0 | Compass USA is a TOGA client running a multi-tier supply-chain commerce operation. | |
|
|
9
10
|
| [Compass Order Lifecycle & Data-Integrity Invariants](workflows/order-lifecycle-and-data-integrity.md) | 2.0 | End-to-end map of how a Compass order flows through the `Client_Compass` (2.0) database and the **expected raw-data shape** at each link/ASN/IF level. | |
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Compass MITS PO Transmission to Vendors
|
|
3
|
+
framework: "2.0"
|
|
4
|
+
project: _Underscore
|
|
5
|
+
client: compass-usa
|
|
6
|
+
type: client-feature
|
|
7
|
+
status: active
|
|
8
|
+
updated: 2026-06-22
|
|
9
|
+
owners: ["rgirish"]
|
|
10
|
+
files:
|
|
11
|
+
- worker/crons/toga2/compass/workflow/2_transmit_mits_purchase_orders_to_vendors.php
|
|
12
|
+
- library/app/client/compass.php
|
|
13
|
+
related:
|
|
14
|
+
- mits-po-to-so-item-linking.md
|
|
15
|
+
- order-lifecycle-and-data-integrity.md
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Summary
|
|
19
|
+
The 1.0 worker cron `2_transmit_mits_purchase_orders_to_vendors.php` transmits Compass
|
|
20
|
+
PurchaseOrders to their vendors (Office Depot, Strategic Systems, Compass, Presidio). Each
|
|
21
|
+
vendor's `Integration` decides the channel: **CXML** (HTTP POST of a cXML OrderRequest) or
|
|
22
|
+
**EMAIL** (a generated PDF emailed via `App_Email`). On success it writes "transmitted to
|
|
23
|
+
Vendor" log rows and stamps `PurchaseOrders.dtSubmitted`.
|
|
24
|
+
|
|
25
|
+
## Key files / entry points
|
|
26
|
+
- `worker/crons/toga2/compass/workflow/2_transmit_mits_purchase_orders_to_vendors.php` — the cron.
|
|
27
|
+
- `library/app/client/compass.php` — `App_Client_Compass` constants:
|
|
28
|
+
`CUSTOMER_ID__COMPASS = 2`, `CUSTOMER_ID__OFFICE_DEPOT = 1`, `CUSTOMER_ID__AGILANT = 3`;
|
|
29
|
+
`VENDOR_ID__OFFICE_DEPOT = 1`, `VENDOR_ID__STRATEGIC_SYSTEMS = 25`, `VENDOR_ID__COMPASS = 26`,
|
|
30
|
+
`VENDOR_ID__PRESIDIO = 4`.
|
|
31
|
+
|
|
32
|
+
## How it works
|
|
33
|
+
1. **Outer query** selects POs to send: `customerId = CUSTOMER_ID__COMPASS (2)`,
|
|
34
|
+
`dtSubmitted IS NULL`, and `vendorId IN (1, 25, 26, 4)`. (So it only ever transmits
|
|
35
|
+
`customerId = 2` POs — `customerId = 1` ODP-as-customer POs are out of scope here.)
|
|
36
|
+
2. **Per PO**, an inner query loads `PurchaseOrderItems` and groups them by integration
|
|
37
|
+
(`VendorItems.overridePoSubmissionIntegrationId` else the vendor's
|
|
38
|
+
`defaultPoSubmissionIntegrationId`).
|
|
39
|
+
3. **Per integration group** (the `foreach`): build + send the cXML POST or the PDF email,
|
|
40
|
+
then INSERT two `Logs_Compass.Record` rows
|
|
41
|
+
(`"Purchase Order <number> transmitted to Vendor via <CXML|EMAIL>. Part numbers: ..."`,
|
|
42
|
+
recordId 17 = PO and 14 = SO).
|
|
43
|
+
4. **After the integration loop**, `UPDATE PurchaseOrders SET dtSubmitted = NOW()` and `sleep(10)`.
|
|
44
|
+
|
|
45
|
+
Routing note: Office Depot (vendor 1) `defaultPoSubmissionIntegrationId = 2`, which is an
|
|
46
|
+
**EMAIL** integration ("Office Depot / Yes") — so ODP POs are emailed PDFs by default, not
|
|
47
|
+
cXML, unless a `VendorItem` overrides it. There is also a CXML integration (id 1,
|
|
48
|
+
"Office Depot / No") that is NOT the default.
|
|
49
|
+
|
|
50
|
+
## Data model
|
|
51
|
+
- `Client_Compass.PurchaseOrders.dtSubmitted` — set by step 4; the outer query's `IS NULL`
|
|
52
|
+
guard means a PO is only ever picked up once.
|
|
53
|
+
- `Logs_Compass.Record` — `recordId` 17 (PurchaseOrder) / 14 (SalesOrder), `primaryKeyId` =
|
|
54
|
+
the PO/SO `id`. The "transmitted to Vendor" note is the success marker.
|
|
55
|
+
|
|
56
|
+
## Client variations
|
|
57
|
+
Compass Canada has a parallel `compasscanada/workflow/2_transmit_...` keyed on
|
|
58
|
+
`CUSTOMER_ID__COMPASS_CANADA`.
|
|
59
|
+
|
|
60
|
+
## Gotchas / known issues
|
|
61
|
+
- **Item-less PO is silently marked submitted without being sent (the "logs show not sent
|
|
62
|
+
but dtSubmitted is set" symptom).** The `dtSubmitted = NOW()` UPDATE runs **unconditionally
|
|
63
|
+
after** the per-integration `foreach`, not inside it. If a PO has **zero
|
|
64
|
+
`PurchaseOrderItems`**, the inner items query returns nothing, `$itemsToSubmitByIntegration`
|
|
65
|
+
stays empty, the `foreach` body never runs — so **nothing is transmitted and no
|
|
66
|
+
"transmitted to Vendor" `Record` row is written** — yet `dtSubmitted` still gets stamped.
|
|
67
|
+
The PO then never re-qualifies for transmission (`dtSubmitted IS NULL` no longer matches).
|
|
68
|
+
**Diagnostic signature:** PO has `dtSubmitted` set but there is NO
|
|
69
|
+
`Logs_Compass.Record` "transmitted to Vendor" note (only "received from MITS") → the PO had
|
|
70
|
+
no line items. Confirmed on MR241298 / PO 50298575-1 (2026-06-21): `dtSubmitted` 23:20:04,
|
|
71
|
+
zero PurchaseOrderItems, no transmit log, no outbound Api log.
|
|
72
|
+
- **Root cause is upstream at MITS, not this cron.** MITS created the order header-only:
|
|
73
|
+
`POST /v2/sales-orders` and `POST /v2/purchase-orders` were both received with
|
|
74
|
+
`"salesOrderItems":[]` / `"purchaseOrderItems":[]` (both 201). The V2 API accepts an order
|
|
75
|
+
with no items (no empty-items rejection), TOGA stored exactly that, and the cron then masked
|
|
76
|
+
it. To confirm what MITS actually sent, read the inbound `requestPayload` in `Logs_Compass.Api`
|
|
77
|
+
(`direction = 'IN'`, `route` `/v2/purchase-orders` or `/v2/sales-orders`, `apiId = 2`).
|
|
78
|
+
- **No try/catch around the log INSERTs or the dtSubmitted UPDATE**, and they write to
|
|
79
|
+
different DBs (`Logs_Compass` vs `Client_Compass`) — a `Logs_Compass` failure can still leave
|
|
80
|
+
`dtSubmitted` stamped without a log (separate, previously-observed failure mode).
|
|
81
|
+
|
|
82
|
+
## Change history
|
|
83
|
+
- 2026-06-22 — Documented the cron and the unconditional-`dtSubmitted` gotcha: item-less POs
|
|
84
|
+
get marked submitted without transmitting or logging; diagnosed via MR241298 inbound MITS
|
|
85
|
+
payload showing empty item arrays. No code change made (diagnosis only). (rgirish)
|
|
86
|
+
|
|
87
|
+
## Related docs
|
|
88
|
+
- [Compass MITS PO → SO Item Linking](mits-po-to-so-item-linking.md)
|
|
89
|
+
- [Compass Order Lifecycle & Data-Integrity Invariants](../workflows/order-lifecycle-and-data-integrity.md)
|
|
@@ -13,6 +13,7 @@ related:
|
|
|
13
13
|
- clients/compass-usa/features/asn-to-item-fulfillment.md
|
|
14
14
|
- clients/compass-usa/features/mits-po-to-so-item-linking.md
|
|
15
15
|
- clients/compass-usa/features/item-fulfillment-tracking-tableview.md
|
|
16
|
+
- clients/compass-usa/features/mits-po-transmission-to-vendors.md
|
|
16
17
|
---
|
|
17
18
|
|
|
18
19
|
## Summary
|
package/package.json
CHANGED