toga-ai 1.0.28 → 1.0.30

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.28",
3
+ "version": "1.0.30",
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",
@@ -6,6 +6,13 @@ Never commit directly to `_main`. All changes go through feature branches and pu
6
6
 
7
7
  Never force-push to `_main` under any circumstances.
8
8
 
9
+ > **Exception — the team knowledge/harness repo (`agilantsolutions/claude`, cloned to
10
+ > `~/toga-tech`).** This rule governs the TOGA *application* repos (worker2, api2, library,
11
+ > worker, _underscore). The knowledge repo's entire model is direct pushes to `_main` via the
12
+ > `/capture` skill — that is intended and is not a violation. Direct commits to `_main` are
13
+ > still **forbidden in all application repos**, and force-pushing `_main` is **never** allowed
14
+ > in any repo, including the knowledge repo.
15
+
9
16
  ## Branch naming
10
17
 
11
18
  Use one of these prefixes followed by a short hyphenated description:
@@ -183,8 +183,8 @@ commits that already exist (no waiting on CI), so the push fast-forwards cleanly
183
183
 
184
184
  ```bash
185
185
  git -C "<TEAM_REPO>" fetch origin
186
- git -C "<TEAM_REPO>" rebase origin/feature/ai-harness-improvements
187
- git -C "<TEAM_REPO>" push origin HEAD:feature/ai-harness-improvements
186
+ git -C "<TEAM_REPO>" rebase origin/_main
187
+ git -C "<TEAM_REPO>" push origin HEAD:_main
188
188
  ```
189
189
 
190
190
  > **Do NOT "pull after push" instead** — the bump commit for *this* push is created
@@ -198,10 +198,10 @@ expected occasional race, not an error — do not report it as a failure unless
198
198
  exhausted.
199
199
 
200
200
  **If push succeeds:**
201
- > "✓ 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`."
202
202
 
203
203
  **If push fails** — show exact git error, then:
204
- > "⚠ 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`"
205
205
 
206
206
  ## Step 8 — Report
207
207