toga-ai 1.0.27 → 1.0.29

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.
@@ -19,6 +19,7 @@ files:
19
19
  related:
20
20
  - ../architecture.md
21
21
  - ../../api2/architecture.md
22
+ - ../../../../clients/compass-usa/features/asn-to-item-fulfillment.md
22
23
  ---
23
24
 
24
25
  ## Summary
@@ -16,5 +16,6 @@ _Auto-generated by `knowledge.js index`. Do not hand-edit._
16
16
 
17
17
  ## Clients
18
18
 
19
- _No client knowledge captured yet._
19
+ - **compass-canada** [clients/compass-canada/INDEX.md](clients/compass-canada/INDEX.md)
20
+ - **compass-usa** → [clients/compass-usa/INDEX.md](clients/compass-usa/INDEX.md)
20
21
 
@@ -0,0 +1,5 @@
1
+ # Client: compass-canada
2
+
3
+ | Doc | Framework | Summary | Files |
4
+ |-----|-----------|---------|-------|
5
+ | [Compass Canada](profile.md) | 2.0 | Compass Canada is the Canadian arm of the Compass account — a separate TOGA tenant, related to but distinct from Compass USA. | |
@@ -0,0 +1,33 @@
1
+ ---
2
+ title: Compass Canada
3
+ framework: "2.0"
4
+ project: _Underscore
5
+ client: compass-canada
6
+ type: profile
7
+ status: active
8
+ updated: 2026-06-08
9
+ owners: [jcardinal]
10
+ files: []
11
+ related:
12
+ - ../compass-usa/profile.md
13
+ ---
14
+
15
+ ## Summary
16
+ Compass Canada is the Canadian arm of the Compass account — a separate TOGA tenant, related
17
+ to but distinct from Compass USA. Like Compass USA it spans the **2.0** commerce/API platform
18
+ (`_underscore`) and the **1.0** worker tier.
19
+
20
+ ## Platforms & data
21
+ - **2.0:** `_underscore` backend, prod schema `Client_CompassCanada` (archive
22
+ `Archive_CompassCanada`, logs `Logs_CompassCanada`). Client-specific model overrides live
23
+ under `_underscore/Model/Compass/Canada/` (a sub-client of the Compass model tree).
24
+ - **1.0:** worker crons under `worker/crons/toga2/compasscanada/`.
25
+
26
+ ## Vendors & integrations
27
+ - Not yet captured. Confirm vendors / ASN ingestion paths before relying on them.
28
+
29
+ ## Notes
30
+ - **Stub** — created alongside the Compass USA profile for disambiguation. The 2026-06-08 ASN
31
+ → ItemFulfillment work was for **Compass USA**, not Compass Canada. Expand this profile as
32
+ Compass Canada behavior is investigated.
33
+ - Related: [Compass USA](../compass-usa/profile.md).
@@ -0,0 +1,6 @@
1
+ # Client: compass-usa
2
+
3
+ | Doc | Framework | Summary | Files |
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 |
6
+ | [Compass USA](profile.md) | 2.0 | Compass USA is a TOGA client running a multi-tier supply-chain commerce operation. | |
@@ -0,0 +1,63 @@
1
+ ---
2
+ title: Compass ASN → ItemFulfillment Auto-Creation
3
+ framework: "2.0"
4
+ project: _Underscore
5
+ client: compass-usa
6
+ type: client-feature
7
+ status: active
8
+ updated: 2026-06-08
9
+ owners: [jcardinal]
10
+ files:
11
+ - _underscore/Model/Compass/AdvanceShippingNotice.php
12
+ related:
13
+ - ../../../2.0/apps/_underscore/features/recursive-item-fulfillments.md
14
+ ---
15
+
16
+ ## Summary
17
+ For Compass USA, posting an AdvanceShippingNotice (ASN) auto-creates the ItemFulfillment (IF)
18
+ on the upstream SalesOrder. `_Model_Compass_AdvanceShippingNotice::postPost` walks PO → SO,
19
+ then creates the IF (named after the SO number), one IFI per still-unfulfilled ASN item,
20
+ IFIUs for serialized units, and IF packages for tracking. ASNs arrive two ways: Office Depot
21
+ **cXML** (direct V2 API) and the worker email cron
22
+ `3b_import_strategic_systems_advance_shipping_notices.php`.
23
+
24
+ ## Key files / entry points
25
+ - `_underscore/Model/Compass/AdvanceShippingNotice.php` — `postPost(&$api, &$payload)`.
26
+ - Fires only when the Compass ASN `ApiPayloadInterceptors` rows exist (interceptor is DB-driven).
27
+
28
+ ## How it works
29
+ 1. Read ASN → resolve PO → SO via `SalesOrders_PurchaseOrders`; skip if no SO.
30
+ 2. Select ASN items whose SOI still has unfulfilled qty (`SOI.quantity > SUM(IFI.quantity)`).
31
+ 3. Reuse the IF if one already exists with the SO number, else POST a new IF.
32
+ 4. Per ASN item: POST an IFI (qty = ASN item qty), then read its ASN units.
33
+ 5. Per ASN unit: if it has a Unit (serialized) → POST an IFIU; if it is tracking-only
34
+ (`unitId IS NULL`) → collect its tracking number for an IF package instead.
35
+ 6. Create one IF package per unique tracking number (header-level tracking merged with
36
+ tracking-only ASN-unit tracking, deduped by tracking-number uuid).
37
+
38
+ ## Data model
39
+ - `AdvanceShippingNoticeUnits.unitId` is nullable (tracking-only units have NULL).
40
+ - `ItemFulfillmentItemUnits.unitId` is **NOT NULL** — a tracking-only unit can never be an
41
+ IFIU; its tracking belongs on an `ItemFulfillmentPackage`.
42
+ - Compass tracking lives in `ItemFulfillmentPackages` (header-level); IFIUs are only for
43
+ genuinely serialized units.
44
+
45
+ ## Client variations
46
+ Compass USA handler (`Model/Compass/`), extending `_Model_Client_AdvanceShippingNotice`.
47
+ Compass Canada (`Model/Compass/Canada/`) is a separate sub-client.
48
+
49
+ ## Gotchas / known issues
50
+ - **Tracking-only ASN units (the majority — ~56k of ~101k in prod):** before 2026-06-08 the
51
+ IFIU query used `INNER JOIN Units`, silently dropping NULL-`unitId` rows, so cXML shipments
52
+ produced an IF + IFI with **no IFIU and no package — tracking was lost**. Fixed: `LEFT
53
+ OUTER JOIN Units` + route tracking-only units to IF packages. Historical records (e.g.
54
+ SO SA132502 / IF 66997) are **not backfilled** — fix-forward only; a one-time repair is
55
+ still an open decision.
56
+ - Interceptor is **DB-driven**: `postPost` does nothing without the Compass
57
+ `ApiPayloadInterceptors` rows in that env.
58
+ - The IF is named after the SO number; an already-existing IF with that number is reused.
59
+ - Separate latent bug in the 1.0 worker: the Strategic Systems cron's no-serials branch
60
+ builds `$itemLevelTrackingNumbers` but never attaches it to the ASN payload.
61
+
62
+ ## Related docs
63
+ - Recursive Item Fulfillments (upstream mirroring) — the engine these IFs/packages feed.
@@ -0,0 +1,43 @@
1
+ ---
2
+ title: Compass USA
3
+ framework: "2.0"
4
+ project: _Underscore
5
+ client: compass-usa
6
+ type: profile
7
+ status: active
8
+ updated: 2026-06-08
9
+ owners: [jcardinal]
10
+ files: []
11
+ related:
12
+ - features/asn-to-item-fulfillment.md
13
+ ---
14
+
15
+ ## Summary
16
+ Compass USA is a TOGA client running a multi-tier supply-chain commerce operation. Customer
17
+ SalesOrders spawn PurchaseOrders to vendors; when vendors ship, AdvanceShippingNotices (ASNs)
18
+ drive ItemFulfillment creation and (via the shared engine) upstream fulfillment mirroring.
19
+ Compass USA spans both frameworks: the **2.0** commerce/API platform (`_underscore`, DB
20
+ `Client_Compass`) and the **1.0** worker tier for scheduled integrations. Compass Canada is a
21
+ separate, related client (see its own profile).
22
+
23
+ ## Platforms & data
24
+ - **2.0:** `_underscore` backend, prod schema `Client_Compass` (worker link `db_compass`).
25
+ Client-specific model overrides live under `_underscore/Model/Compass/`.
26
+ - **1.0:** worker crons under `worker/crons/toga2/compass/` handle email-based imports and
27
+ notifications.
28
+ - Storefront: compass.togacommerce.com / compass.togahub.com.
29
+
30
+ ## Vendors & integrations
31
+ - **Office Depot (ODP)** — vendor id 1. ASNs arrive via **cXML** (direct V2 API) and via the
32
+ email cron's ODP CSV format.
33
+ - **Strategic Systems** — ASNs via the email cron's SS CSV format (serial numbers → Units).
34
+ - ASN ingestion entry points: cXML to the V2 API (logged in `Logs_Compass.Api`) and
35
+ `worker/crons/toga2/compass/workflow/3b_import_strategic_systems_advance_shipping_notices.php`.
36
+
37
+ ## Key features (this client)
38
+ - [Compass ASN → ItemFulfillment Auto-Creation](features/asn-to-item-fulfillment.md) — the
39
+ `_Model_Compass_AdvanceShippingNotice::postPost` handler.
40
+
41
+ ## Notes
42
+ - Built on the shared 2.0 Recursive Item Fulfillments engine (upstream mirroring).
43
+ - This profile is a starting point; expand as more Compass-specific behavior is captured.
package/knowledge.js CHANGED
@@ -28,7 +28,7 @@ const path = require('path');
28
28
  const ROOT = path.join(__dirname, 'knowledge');
29
29
  const REGISTRY = path.join(ROOT, 'registry.json');
30
30
  const FRAMEWORKS = ['1.0', '2.0'];
31
- const DOC_TYPES = ['feature', 'client-feature', 'workflow', 'architecture', 'standard'];
31
+ const DOC_TYPES = ['feature', 'client-feature', 'workflow', 'architecture', 'standard', 'profile'];
32
32
  const ELEVATED_TYPES = ['architecture', 'standard'];
33
33
 
34
34
  /* ------------------------------------------------------------------ */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toga-ai",
3
- "version": "1.0.27",
3
+ "version": "1.0.29",
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",
@@ -163,22 +163,45 @@ git -C "<TEAM_REPO>" status --short knowledge/
163
163
  ```
164
164
  If empty — report "No new knowledge to push" and exit cleanly.
165
165
 
166
- **Push:**
166
+ **Commit:**
167
167
  ```bash
168
168
  git -C "<TEAM_REPO>" add knowledge/
169
169
  git -C "<TEAM_REPO>" diff --cached --quiet || \
170
170
  git -C "<TEAM_REPO>" commit -m "knowledge: <one-line summary>"
171
- git -C "<TEAM_REPO>" push origin HEAD:feature/ai-harness-improvements
172
171
  ```
173
172
 
174
173
  Never stage files outside `knowledge/`. If `git diff --cached` includes anything outside
175
174
  `knowledge/`, abort and warn before committing.
176
175
 
176
+ **Sync, then push (rebase BEFORE pushing — this prevents the version-bump conflict):**
177
+
178
+ Every push to this branch triggers a CI job that commits a `chore: bump version [skip ci]`
179
+ back to the branch. So after *any* prior push (e.g. an earlier capture in the same session),
180
+ your local branch is one commit behind the remote, and a naive push is rejected as a
181
+ non-fast-forward. Rebase your fresh commit onto the remote **before** pushing — this pulls in
182
+ commits that already exist (no waiting on CI), so the push fast-forwards cleanly:
183
+
184
+ ```bash
185
+ git -C "<TEAM_REPO>" fetch origin
186
+ git -C "<TEAM_REPO>" rebase origin/_main
187
+ git -C "<TEAM_REPO>" push origin HEAD:_main
188
+ ```
189
+
190
+ > **Do NOT "pull after push" instead** — the bump commit for *this* push is created
191
+ > asynchronously by CI a few seconds later, so pulling immediately afterward races CI and
192
+ > usually grabs nothing. Rebasing *before* the push is what reliably avoids the conflict,
193
+ > with zero dependency on npm build/publish timing.
194
+
195
+ **If the push is still rejected** (a bump commit landed in the brief window between your
196
+ rebase and push), simply repeat `fetch` → `rebase` → `push`, up to 2 more times. This is an
197
+ expected occasional race, not an error — do not report it as a failure unless all retries are
198
+ exhausted.
199
+
177
200
  **If push succeeds:**
178
- > "✓ Pushed to `feature/ai-harness-improvements` — CI publishes new npm version. Teammates get it on `npx toga-ai`."
201
+ > "✓ Pushed to `_main` — CI publishes new npm version. Teammates get it on `npx toga-ai`."
179
202
 
180
203
  **If push fails** — show exact git error, then:
181
- > "⚠ Push failed: `<error>`. Run manually: `git -C <TEAM_REPO> push origin HEAD:feature/ai-harness-improvements`"
204
+ > "⚠ Push failed: `<error>`. Run manually: `git -C <TEAM_REPO> push origin HEAD:_main`"
182
205
 
183
206
  ## Step 8 — Report
184
207