toga-ai 1.0.124 → 1.0.125
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.
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
|-----|---------|-------|
|
|
5
5
|
| [TOGa Supply (toga2-supply) Architecture](architecture.md) | `toga2-supply` is the **React + Vite frontend** for TOGa Supply — warehouse fulfillment tooling (shipment selection, fulfill & ship against carrier APIs, NetSui | toga2-supply/src/api/toga.ts, toga2-supply/src/pages/ShipmentItems/view/ShipmentItemsPage.tsx, toga2-supply/src/pages/EditShipment/view/EditShipmentPage.tsx, toga2-supply/src/pages/EditShipment/api/UpdateShipmentApi.ts, toga2-supply/src/pages/Shipments/view/components/ShipmentsCardTableForm/ShipmentsCardTableForm.tsx |
|
|
6
6
|
| [Fulfill & Ship](features/fulfill-and-ship.md) | Fulfill & Ship lets a warehouse user select sales-order line items, enter serials, pick a carrier/method, and in one action: create the Item Fulfillment records | toga2-supply/src/pages/ShipmentItems/view/ShipmentItemsPage.tsx, toga2-supply/src/pages/EditShipment/view/EditShipmentPage.tsx, toga2-supply/src/pages/EditShipment/view/components/forms/EditShipmentForm.tsx, toga2-supply/src/pages/EditShipment/api/UpdateShipmentApi.ts, toga2-supply/src/pages/Shipments/view/components/ShipmentsCardTableForm/ShipmentsCardTableForm.tsx, toga2-supply/src/pages/Shipments/api/ShipmentsApi.ts, _underscore/Model/Client/ItemFulfillment.php, _underscore/Trait/Netsuite/ItemFulfillment.php, _underscore/Component/Library/Carriers/Ups/Ups.php |
|
|
7
|
-
| [AWS Amplify Build & Deploy (non-prod environments)](workflows/amplify-build-and-deploy.md) | How `toga2-supply` (React + Vite) builds and deploys
|
|
7
|
+
| [AWS Amplify Build & Deploy (non-prod environments)](workflows/amplify-build-and-deploy.md) | How `toga2-supply` (React + Vite) builds and deploys on **AWS Amplify**. | toga2-supply/amplify.yml, toga2-supply/.github/workflows/sync-stage-environments.yml, toga2-supply/.env.qc-security |
|
|
@@ -6,7 +6,7 @@ project: TOGa Supply
|
|
|
6
6
|
client: shared
|
|
7
7
|
type: workflow
|
|
8
8
|
status: active
|
|
9
|
-
updated: 2026-06-
|
|
9
|
+
updated: 2026-06-18
|
|
10
10
|
owners: ["jcardinal"]
|
|
11
11
|
files:
|
|
12
12
|
- toga2-supply/amplify.yml
|
|
@@ -18,87 +18,90 @@ related:
|
|
|
18
18
|
|
|
19
19
|
## Summary
|
|
20
20
|
|
|
21
|
-
How `toga2-supply` (React + Vite) builds and deploys
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
`
|
|
38
|
-
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
`_stage` on each push**, triggering each branch's Amplify build with its own mode.
|
|
21
|
+
How `toga2-supply` (React + Vite) builds and deploys on **AWS Amplify**. Each Amplify
|
|
22
|
+
**branch is one environment** (`_production`, `_beta`, `_gamma`, `_stage`, `_qc-security`,
|
|
23
|
+
`_qc-performance`, …). The first Amplify build failed with a JavaScript heap OOM, and a later
|
|
24
|
+
attempt **broke production** by silently pointing it at beta — this doc records both the heap
|
|
25
|
+
fix and the branch→mode mapping that prevents the mis-pointing.
|
|
26
|
+
|
|
27
|
+
## Deployment model — one branch per environment
|
|
28
|
+
|
|
29
|
+
- Branch names are **underscore-prefixed** (`_production`, `_qc-security`); the Vite **mode**
|
|
30
|
+
and `.env` file are the **same name WITHOUT the underscore** (`production`, `qc-security`).
|
|
31
|
+
- The repo-root **`amplify.yml` drives the build for every branch** (it overrides the Amplify
|
|
32
|
+
console build spec for the whole app — including `_production`). It:
|
|
33
|
+
- Sets `NODE_OPTIONS=--max-old-space-size=8192` (the OOM fix; matches production), runs
|
|
34
|
+
`npm ci --legacy-peer-deps`, caches `.npm`.
|
|
35
|
+
- Derives the mode by **stripping the leading underscore** from `$AWS_BRANCH`
|
|
36
|
+
(`MODE="${AWS_BRANCH#_}"`), then runs `npx tsc && npx vite build --mode "$MODE"`.
|
|
37
|
+
- **Fails the build loudly** (`exit 1`) if `.env.$MODE` does not exist — see the gotcha below.
|
|
38
|
+
- `_stage` is **both** the Stage environment (builds `--mode stage`) **and** the integration
|
|
39
|
+
source for the QC environments. The `sync-stage-environments.yml` GitHub Action fans `_stage`
|
|
40
|
+
out to `_qc-security` and `_qc-performance` on every push (fast-forward `--force-with-lease`),
|
|
41
|
+
triggering each QC branch's own Amplify build.
|
|
43
42
|
|
|
44
43
|
```
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
_production ──▶ Amplify ──▶ build --mode production (.env.production)
|
|
45
|
+
_beta ──▶ Amplify ──▶ build --mode beta
|
|
46
|
+
_gamma ──▶ Amplify ──▶ build --mode gamma
|
|
47
|
+
_stage ──▶ Amplify ──▶ build --mode stage
|
|
48
|
+
│ push → sync-stage-environments.yml fast-forwards ↓
|
|
49
|
+
├──▶ _qc-security ──▶ Amplify ──▶ build --mode qc-security
|
|
50
|
+
└──▶ _qc-performance ──▶ Amplify ──▶ build --mode qc-performance
|
|
50
51
|
```
|
|
51
52
|
|
|
52
53
|
## Steps
|
|
53
54
|
|
|
54
|
-
1.
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
3. **
|
|
61
|
-
|
|
62
|
-
4.
|
|
63
|
-
|
|
55
|
+
1. **Connect one Amplify branch per environment** (underscore-prefixed). Within a single
|
|
56
|
+
Amplify app a branch connects only once — you cannot point multiple environments at the same
|
|
57
|
+
branch connection, which is why each environment is its own branch.
|
|
58
|
+
2. **Commit a matching `.env.<mode>` file** (no underscore): `.env.production`, `.env.beta`,
|
|
59
|
+
`.env.gamma`, `.env.alpha`, `.env.stage`, `.env.qc-security`. A new environment needs its
|
|
60
|
+
file before it can deploy (otherwise the build fails loudly by design).
|
|
61
|
+
3. **For a fanned-out QC environment, add its underscore branch to the sync matrix** in
|
|
62
|
+
`sync-stage-environments.yml`.
|
|
63
|
+
4. Push; Amplify builds each branch with its own mode. **Roll out `amplify.yml` changes on a
|
|
64
|
+
non-prod branch first** (it overrides production's build spec too).
|
|
64
65
|
|
|
65
66
|
## Systems involved
|
|
66
67
|
|
|
67
|
-
- AWS Amplify (build + hosting) — one branch per environment
|
|
68
|
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
|
|
68
|
+
- AWS Amplify (build + hosting) — one branch per environment; branch name (minus `_`) selects
|
|
69
|
+
the Vite mode and `.env` file.
|
|
70
|
+
- GitHub Actions — `sync-stage-environments.yml` mirrors `_stage` → `_qc-security`,
|
|
71
|
+
`_qc-performance`. (Separately, `alpha/beta/gamma/production.yml` are the older GitHub-Actions
|
|
72
|
+
build path into `agilantsolutions/toga2-supply-build`.)
|
|
73
|
+
- Vite 4 (`vite build --mode <mode>`), TypeScript `tsc` precompile. Source maps are **on**
|
|
74
|
+
(`build.sourcemap: true` in `vite.config.ts`).
|
|
72
75
|
|
|
73
76
|
## Edge cases & escalation
|
|
74
77
|
|
|
75
|
-
- **
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
78
|
+
- **Silent wrong-endpoint trap (caused a production outage):** When Vite is given a `--mode`
|
|
79
|
+
with no matching `.env.<mode>`, it **silently falls back to the base `.env`** (which points at
|
|
80
|
+
beta) instead of erroring. An `amplify.yml` that built `--mode "$AWS_BRANCH"` therefore ran
|
|
81
|
+
`--mode _production` (no `.env._production`) and shipped beta endpoints to production. **Fix:**
|
|
82
|
+
strip the underscore to get the real mode, AND guard with `[ -f ".env.$MODE" ] || exit 1` so a
|
|
83
|
+
missing env file fails the build instead of mis-pointing.
|
|
84
|
+
- **`amplify.yml` overrides production.** A repo-root `amplify.yml` replaces the console build
|
|
85
|
+
spec for **all** branches including `_production`. Validate any change on a non-prod branch
|
|
86
|
+
before it can reach production.
|
|
87
|
+
- **OOM root cause:** Amplify gives Node the default ~2 GB old-space heap; this app
|
|
88
|
+
(1793 modules + source maps) exceeds it during Rollup's `rendering chunks` phase →
|
|
89
|
+
`FATAL ERROR: Ineffective mark-compacts near heap limit`. Fix = raise `NODE_OPTIONS`
|
|
90
|
+
(`8192` in production). Raising it only helps if the build instance has that much RAM; if it
|
|
91
|
+
still OOMs, use the **Large build instance**.
|
|
92
|
+
- **Env branches are disposable deployment pointers** — the sync Action force-updates
|
|
93
|
+
`_qc-security`/`_qc-performance` to match `_stage`. Never commit to them directly.
|
|
91
94
|
- **Secret hygiene:** `.env.<mode>` files have historically carried a live `SENTRY_AUTH_TOKEN`.
|
|
92
95
|
Prefer rotating it and moving it to an Amplify env var rather than committing it.
|
|
93
96
|
|
|
94
97
|
## Change history
|
|
95
98
|
|
|
96
|
-
- 2026-06-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
- 2026-06-17 —
|
|
101
|
-
|
|
99
|
+
- 2026-06-18 — Fixed production-breaking deploy: `amplify.yml` now strips the leading `_` from
|
|
100
|
+
`$AWS_BRANCH` to get the Vite mode and **fails loudly** if `.env.$MODE` is missing (was
|
|
101
|
+
silently falling back to beta); heap set to 8192; sync workflow targets underscore-prefixed
|
|
102
|
+
`_qc-security`/`_qc-performance`. (jcardinal)
|
|
103
|
+
- 2026-06-17 — Initial Amplify setup for a new QC environment: added root `amplify.yml` with
|
|
104
|
+
raised Node heap (OOM fix); renamed `.env.qc-security.beta` → `.env.qc-security`. (jcardinal)
|
|
102
105
|
|
|
103
106
|
## Related docs
|
|
104
107
|
|
package/package.json
CHANGED