toga-ai 1.0.304 → 1.0.306
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/2.0/apps/_underscore/INDEX.md +1 -0
- package/knowledge/2.0/apps/_underscore/features/per-client-database-connections.md +8 -4
- package/knowledge/2.0/apps/_underscore/features/tracking-number-bridges.md +13 -2
- package/knowledge/2.0/apps/_underscore/workflows/local-db-refresh-from-beta.md +103 -0
- package/knowledge/INDEX.md +1 -1
- package/knowledge/clients/nychh/profile.md +3 -2
- package/knowledge/sessions/2026-07-09-surface-local-db-replay-apeterson.md +66 -0
- package/package.json +1 -1
|
@@ -21,4 +21,5 @@
|
|
|
21
21
|
| [Surface Resolver (_Model_Core_Surface::resolve — replaces Page::meta)](features/surface-resolver.md) | The runtime for the platform-wide **Surface** UI presentation layer: 9 `_underscore` models plus a cached resolver, `_Model_Core_Surface::resolve(&$api, string | _underscore/Model/Core/Surface.php, _underscore/Model/Client/AclRecordScript.php, _underscore/Model/Core/RecordScript.php, dbchanges2/Core/2026-06-30a - SurfaceMetaGroupAndSalesOrderSections.sql, dbchanges2/Client/2026-06-30a - SurfaceMetaGroupAcl.sql, dbchanges2/Client_Quad/2026-07-01a - GrantSurfacesMetaGroupScriptAcl.sql, dbchanges2/Client_CompassCanada/2026-07-01a - GrantSurfacesMetaGroupScriptAcl.sql, dbchanges2/Core/2026-06-29b - SurfaceMetaPublicReadAcl.sql, dbchanges2/Client/2026-06-29c - SurfaceRecordScriptAcl.sql, dbchanges2/Core/2026-06-29c - SurfaceDebugPhpMethodFix.sql, _underscore/Model/Core/SurfaceElement.php, _underscore/Model/Core/Action.php, _underscore/Model/Core/Vocabulary.php, _underscore/Model/Core/VocabularyTerm.php, _underscore/Model/Core/Message.php, _underscore/Model/Client/SurfaceOverride.php, _underscore/Model/Client/MessageTranslation.php, _underscore/Model/Client/ThemeToken.php, _underscore/Model/Core/Page.php |
|
|
22
22
|
| [Tracking-Number Bridge Migration (ASN / Item Fulfillment / Item Receipt)](features/tracking-number-bridges.md) | Shipment tracking numbers used to live as **scalar FK columns** (`trackingNumberId`, `returnTrackingNumberId`) directly on the lowest-level "unit"/"item" tables | api2/Component/Api/V2/V2.php, _underscore/Model/Client/AdvanceShippingNoticeItemUnit.php, _underscore/Model/Client/AdvanceShippingNoticeItemUnits/TrackingNumber.php, _underscore/Model/Client/ItemFulfillmentItemUnits/TrackingNumber.php, _underscore/Model/Client/ItemFulfillment.php, _underscore/Model/Prudential/AdvanceShippingNotice.php, _underscore/Model/Compass/AdvanceShippingNotice.php, _underscore/Trait/Netsuite/ItemFulfillment.php, api2/Component/Api/Cxml/Cxml.php, dbchanges2/Client/2026-06-10 - TrackingNumberBridges.sql, dbchanges2/Core/2026-06-10 - TrackingNumberBridges.sql, dbchanges2/Client_Prudential/2026-06-15 - ItemFulfillmentTrackingNumberAclLogicGroups.sql, dbchanges2/Client_Quad/2026-06-18a - ItemFulfillmentItemReceiptTrackingNumberAclLogicGroups.sql, dbchanges2/Client_Nychh/2026-06-19b - ItemFulfillmentItemReceiptTrackingNumberAclLogicGroups.sql, dbchanges2/Client_Nychh/2026-06-19a - FixItemFulfillmentTableViewTrackingAndRoot.sql, dbchanges2/Client_Quad/2026-06-19a - FixItemFulfillmentTableViewTrackingAndRoot.sql |
|
|
23
23
|
| [Units for Items for Purchase Orders — Data Structure](features/units-for-items-for-purchase-orders.md) | Describes how unit (serialized inventory) data is linked to sales-order and purchase-order line items behind the `units-for-items-for-purchase-orders` TableView | |
|
|
24
|
+
| [Refreshing a Local Dev Database from Beta (dev-sandbox)](workflows/local-db-refresh-from-beta.md) | How to reset a local 2.0 dev database from the **beta / dev-sandbox** environment: dump each schema (`Core`, `Client_<Id>`, `Logs_<Id>`, …) from the beta host, | api2/Config/, _underscore/Loader.php, _underscore/Model/Client/BundleTranslation.php, api2/Component/Api/V2/V2.php, toga25-supply/sync_compasscanada_schema.sql |
|
|
24
25
|
| [Running a 2.0 App Locally (browser, end-to-end via api2)](workflows/running-a-2.0-app-locally.md) | The full dependency chain required to run a 2.0 client app **through the browser**, end-to-end, against a **local `api2`** (e.g. | _underscore/Environment.php, _underscore/Config.php, _underscore/Database.php, _underscore/Route.php, api2/Component/Api/V2/V2.php, api2/index.php, api2/.htaccess |
|
|
@@ -7,13 +7,14 @@ client: shared
|
|
|
7
7
|
type: feature
|
|
8
8
|
status: active
|
|
9
9
|
updated: 2026-07-09
|
|
10
|
-
owners: ["dfranks", "jcardinal", "mhammontree"]
|
|
10
|
+
owners: ["dfranks", "jcardinal", "mhammontree", "apeterson"]
|
|
11
11
|
files:
|
|
12
12
|
- _underscore/Database.php
|
|
13
13
|
- _underscore/ApiRequest.php
|
|
14
14
|
- _underscore/Model/Client/Logs/Api.php
|
|
15
15
|
related:
|
|
16
16
|
- ../architecture.md
|
|
17
|
+
- ../workflows/local-db-refresh-from-beta.md
|
|
17
18
|
---
|
|
18
19
|
|
|
19
20
|
## Summary
|
|
@@ -84,9 +85,10 @@ registration is region-aware in `api2/Controller/Index.php`; the alias const is
|
|
|
84
85
|
For logs, structure-only is enough (you never need prod log rows locally):
|
|
85
86
|
`mysqldump -h reader1.logs.database.togahub.com -u admin -p<pw> --no-data --no-tablespaces
|
|
86
87
|
--set-gtid-purged=OFF --column-statistics=0 Logs_<Id> | mysql -u root Logs_<Id>` (create the
|
|
87
|
-
empty DB first). Data DB comes from `reader1.client.database.togahub.com
|
|
88
|
-
|
|
89
|
-
disabling logging in
|
|
88
|
+
empty DB first). Data DB comes from `reader1.client.database.togahub.com`, or refresh the whole
|
|
89
|
+
set from beta — see [Refreshing a local dev DB from beta](../workflows/local-db-refresh-from-beta.md).
|
|
90
|
+
This is a **local-environment** gap, not a code bug — do not "fix" it by disabling logging in
|
|
91
|
+
shared code.
|
|
90
92
|
- Related 1.0 analogue: the legacy `App_` worker has the same hazard writing to `Logs.API`
|
|
91
93
|
(`db_logs`) — the laptop trap there is documented separately in the worker NetSuite bootstrap
|
|
92
94
|
notes.
|
|
@@ -94,6 +96,8 @@ registration is region-aware in `api2/Controller/Index.php`; the alias const is
|
|
|
94
96
|
## Change history
|
|
95
97
|
|
|
96
98
|
- 2026-07-09 — Linked the new [Running a 2.0 app locally](../workflows/running-a-2.0-app-locally.md) runbook, which frames these three connections as one requirement of a full local browser run. (mhammontree)
|
|
99
|
+
- 2026-07-09 — Linked the new [local-DB-refresh-from-beta workflow](../workflows/local-db-refresh-from-beta.md)
|
|
100
|
+
from the logs-trap fix (refreshing all local schemas from beta covers the missing `Logs_<Id>`). (apeterson)
|
|
97
101
|
- 2026-07-07 — Noted the new shared **Cache** cluster (`Databases` id 145, alias `DB_CACHE`,
|
|
98
102
|
region-aware) added for the api2 cross-client retrieval engine. (jcardinal)
|
|
99
103
|
- 2026-06-18 — Documented after the `Logs_Growrk`/`Logs_Aig` local 500s while testing the
|
|
@@ -6,8 +6,8 @@ project: _Underscore
|
|
|
6
6
|
client: shared
|
|
7
7
|
type: feature
|
|
8
8
|
status: active
|
|
9
|
-
updated: 2026-
|
|
10
|
-
owners: ["jcardinal", "mhammontree", "dfranks"]
|
|
9
|
+
updated: 2026-07-09
|
|
10
|
+
owners: ["jcardinal", "mhammontree", "dfranks", "apeterson"]
|
|
11
11
|
files:
|
|
12
12
|
- api2/Component/Api/V2/V2.php
|
|
13
13
|
- _underscore/Model/Client/AdvanceShippingNoticeItemUnit.php
|
|
@@ -156,9 +156,20 @@ returnTrackingNumber: {...} }]`, and an IFIU's as `itemFulfillmentItemUnitTracki
|
|
|
156
156
|
(`Client_Nychh/2026-06-19b - ...`, all of 317-322) so far. Each new client is whack-a-mole until
|
|
157
157
|
the chain is folded back into the base migration + blank-client template.
|
|
158
158
|
|
|
159
|
+
- **`Client_CompassCanada` is missing these bridge tables on *beta* (local drift).** Beta's
|
|
160
|
+
`Client_CompassCanada` lacks 17 tables that prod has — including the `*_TrackingNumbers`
|
|
161
|
+
bridges and `AdvanceShippingNoticeItemUnits` — so any local DB reset **from beta** reintroduces
|
|
162
|
+
the drift and a SalesOrders record load 500s with **1146 "table doesn't exist"** (the
|
|
163
|
+
`_trackingNumbers` computed field joins the bridges). Fix locally by re-running
|
|
164
|
+
`toga25-supply/sync_compasscanada_schema.sql` against `Client_CompassCanada` (local-only — prod
|
|
165
|
+
already has the tables). See the
|
|
166
|
+
[local-DB-refresh-from-beta workflow](../workflows/local-db-refresh-from-beta.md).
|
|
159
167
|
- **Porting the item-fulfillment TableView fix to another client is two independent decisions, not a copy-paste.** The **re-root** (Units 31 → ItemFulfillmentItems 29 + OUTER unit chain) is universally portable and fixes the "0 records" bug everywhere. The **tracking source is client-specific**: Compass writes one tracking number per item fulfillment at the **item level (318)**, so its views read 318. Other clients populate different bridge levels — verify with `SELECT COUNT(*)` per bridge before choosing. As of 2026-06-19, **record 318 is empty in `Client_Nychh` and `Client_Quad`**; their tracking lives at the **IF/shipment level (317)** (covers IFIs: NYCHH 7955/10049 ≈ 79%, Quad 4878/4967 ≈ 98%) and the **unit level (319)** (≈ 7–9% — serialized only). Copying Compass's 318 join into a client that doesn't write 318 yields a structurally-correct view with permanently blank tracking until 318 is backfilled. (NYCHH's pre-fix view pointed at the now-deleted record 41 = old IF-level/package bridge, i.e. it originally intended IF-level 317.)
|
|
160
168
|
|
|
161
169
|
## Change history
|
|
170
|
+
- 2026-07-09 — Noted that `Client_CompassCanada` is missing these bridge tables on **beta**, so a local
|
|
171
|
+
reset from beta reintroduces the 17-table drift (1146 on SalesOrders load); fix locally with
|
|
172
|
+
`sync_compasscanada_schema.sql`. Cross-linked the new local-DB-refresh-from-beta workflow. (apeterson)
|
|
162
173
|
- 2026-06-19 — **NYCHH** hit the bridge ACL gap in prod: 403 EZ-1 on `item-fulfillment-tracking-numbers` (DEBUG "No ACL Logic Groups defined", aclRecordPermissionId 318 = record 317, roleId 1, appId NULL). Confirmed all 6 bridge perms (ids 318-323, records 317-322) had 0 logic groups; added the chain via `Client_Nychh/2026-06-19b - ItemFulfillmentItemReceiptTrackingNumberAclLogicGroups.sql` (all 6 bridges, idempotent anti-joins, RANDOM_BYTES uuids, slug='all'/sqlExpression='1', record ids derived from AclRecordPermissions). Same fix pattern as Quad 2026-06-18a / Prudential 2026-06-15. (jcardinal)
|
|
163
174
|
- 2026-06-19 — Applied the Compass item-fulfillment TableView fix to **NYCHH** and **Quad** (`Client_Nychh`/`Client_Quad` `2026-06-19a - FixItemFulfillmentTableViewTrackingAndRoot.sql`): re-rooted views 12 & 13 at ItemFulfillmentItems, item-level tracking via 318, preserving Quad's three Units-level custom columns. Confirmed read-only that record 318 is empty for both clients (tracking blank until backfilled) — their data is at 317 (IF-level, ~79%/~98% coverage) and 319 (unit-level); recorded the portability gotcha. (jcardinal)
|
|
164
175
|
- 2026-06-18 — Quad's NetSuite TOGa Supply sync (`sync_togasupply_quad.php`) hit the bridge ACL gap in prod: 403 EZ-1 on `item-fulfillment-tracking-numbers` (Sentry 7559037554, 46×, since the 2026-06-15 deploy). Confirmed `Client_Quad` perms 380-385 (recs 317-322, role 1) had 0 logic groups; added the chain via `Client_Quad/2026-06-18a - ItemFulfillmentItemReceiptTrackingNumberAclLogicGroups.sql` (all 6 bridges, idempotent, RANDOM_BYTES uuids). Noted the gap surfaces via the per-client sync, not only UI reads. (dfranks)
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Refreshing a Local Dev Database from Beta (dev-sandbox)
|
|
3
|
+
framework: "2.0"
|
|
4
|
+
repo: _underscore
|
|
5
|
+
project: _Underscore
|
|
6
|
+
client: shared
|
|
7
|
+
type: workflow
|
|
8
|
+
status: active
|
|
9
|
+
updated: 2026-07-09
|
|
10
|
+
owners: ["apeterson"]
|
|
11
|
+
files:
|
|
12
|
+
- api2/Config/
|
|
13
|
+
- _underscore/Loader.php
|
|
14
|
+
- _underscore/Model/Client/BundleTranslation.php
|
|
15
|
+
- api2/Component/Api/V2/V2.php
|
|
16
|
+
- toga25-supply/sync_compasscanada_schema.sql
|
|
17
|
+
related:
|
|
18
|
+
- ../features/per-client-database-connections.md
|
|
19
|
+
- ../features/tracking-number-bridges.md
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Summary
|
|
23
|
+
|
|
24
|
+
How to reset a local 2.0 dev database from the **beta / dev-sandbox** environment: dump each
|
|
25
|
+
schema (`Core`, `Client_<Id>`, `Logs_<Id>`, …) from the beta host, drop+recreate the local
|
|
26
|
+
schema, and re-import. This is the "local-DB refresh" the
|
|
27
|
+
[per-client DB connections](../features/per-client-database-connections.md) doc points at. The
|
|
28
|
+
procedure is routine, but the **beta sandbox user is a managed account without `SUPER`/`RELOAD`**,
|
|
29
|
+
so the naive `mysqldump` invocation fails — and a reset pulls Core state that can leave the local
|
|
30
|
+
API broken until two known side-effects are fixed (see Gotchas).
|
|
31
|
+
|
|
32
|
+
Connection endpoints (beta host, port, schema names) live in **api2 `Config/*.ini`** under the
|
|
33
|
+
`[database]` blocks. Read them there — **never record credential values in knowledge or commits.**
|
|
34
|
+
|
|
35
|
+
## Steps
|
|
36
|
+
|
|
37
|
+
Order matters — dump first so a failed dump never wipes a local schema it can't refill.
|
|
38
|
+
|
|
39
|
+
1. **Get on the company VPN.** The beta DB host (`dev.sandbox.database.togahub.com`) is
|
|
40
|
+
firewalled — reachable **only** on the VPN. Off-VPN a direct connect just times out (it is not
|
|
41
|
+
an auth error), which is the usual first red herring.
|
|
42
|
+
2. **Per schema, dump → drop → recreate → import**, looping over the schemas you need
|
|
43
|
+
(`Core`, `Client_<Id>`, and any `Logs_<Id>`/`Archive_<Id>` you run locally):
|
|
44
|
+
```bash
|
|
45
|
+
for DB in Core Client_Compass Client_CompassCanada Client_Quad Client_Nychh; do
|
|
46
|
+
mysqldump -h dev.sandbox.database.togahub.com -u admin -p<pw> \
|
|
47
|
+
--skip-lock-tables --no-tablespaces --set-gtid-purged=OFF \
|
|
48
|
+
--routines --triggers "$DB" > "/tmp/$DB.sql" || break
|
|
49
|
+
mysql -u root -e "DROP DATABASE IF EXISTS \`$DB\`; CREATE DATABASE \`$DB\`;"
|
|
50
|
+
mysql -u root "$DB" < "/tmp/$DB.sql"
|
|
51
|
+
done
|
|
52
|
+
```
|
|
53
|
+
The `|| break` is load-bearing: if the dump fails, stop before the `DROP` so you never destroy
|
|
54
|
+
a local schema you cannot refill.
|
|
55
|
+
3. **Bring the local `_underscore` checkout up to the branch beta was built from** (see the
|
|
56
|
+
missing-model gotcha) and **re-apply local-only client schema fixes** (see the CompassCanada
|
|
57
|
+
drift gotcha).
|
|
58
|
+
4. **Smoke-test** one API request per refreshed client before relying on the reset.
|
|
59
|
+
|
|
60
|
+
## Gotchas / known issues
|
|
61
|
+
|
|
62
|
+
- **Beta `admin` lacks `RELOAD` → `--single-transaction` fails.** The managed sandbox account
|
|
63
|
+
cannot `FLUSH TABLES WITH READ LOCK`, so the default `mysqldump --single-transaction` dies with
|
|
64
|
+
`Couldn't execute 'FLUSH TABLES WITH READ LOCK': Access denied ... (1045)`. **Fix:** drop
|
|
65
|
+
`--single-transaction` and take a **non-locking** dump instead:
|
|
66
|
+
`--skip-lock-tables --no-tablespaces --set-gtid-purged=OFF --routines --triggers`. (Add
|
|
67
|
+
`--column-statistics=0` if your client's mysqldump is newer than the server.)
|
|
68
|
+
- **A reset can 500 *every* request with a missing `_Model_Client_*` autoload.** Beta's `Core`
|
|
69
|
+
registers models in `Core.Records`/`RecordFields`, and `api2/Component/Api/V2/V2.php`
|
|
70
|
+
(`processRoutePairs`, ~line 3454) iterates **every** registered model and dereferences its
|
|
71
|
+
`::TABLE`. If beta registers a model whose PHP class is **newer than your local `_underscore`
|
|
72
|
+
checkout**, the `_underscore/Loader.php` autoloader throws
|
|
73
|
+
`Could not find required file for '_Model_Client_BundleTranslation'` and the whole API 500s.
|
|
74
|
+
Models are **hand-written committed source** (no generator, no cache), so the fix is a **git
|
|
75
|
+
pull of the missing file**, not a cache clear — e.g. bring
|
|
76
|
+
`_underscore/Model/Client/BundleTranslation.php` in from branch `TRUE-80065`
|
|
77
|
+
(commit `ef6ebd80`). General rule: after a beta reset, sync `_underscore` to (at least) the
|
|
78
|
+
branch beta was built from.
|
|
79
|
+
- **Resetting `Client_CompassCanada` reintroduces the 17-table schema drift.** CompassCanada on
|
|
80
|
+
**beta** is missing 17 tables that **prod** has (`AdvanceShippingNoticeItemUnits`, the
|
|
81
|
+
`*_TrackingNumbers` bridges, TransferOrder link tables, `Customers_Catalogs`), so a reset wipes
|
|
82
|
+
the prior local fix and a SalesOrders record load 500s with **1146 "table doesn't exist"** (the
|
|
83
|
+
`_trackingNumbers` computed field joins those tables). **Fix:** re-run
|
|
84
|
+
`toga25-supply/sync_compasscanada_schema.sql` against `Client_CompassCanada` (17 ×
|
|
85
|
+
`CREATE TABLE IF NOT EXISTS`). **Local-only — do NOT replay to beta/prod** (prod already has
|
|
86
|
+
them). **Operator trap:** the file uses **unqualified** table names, so you must have
|
|
87
|
+
`Client_CompassCanada` selected as the active DB in your client — a standalone `USE` line run
|
|
88
|
+
as a separate statement does **not** carry over, and the tables land in the wrong schema. See
|
|
89
|
+
[tracking-number-bridges](../features/tracking-number-bridges.md) for the bridge tables.
|
|
90
|
+
- **The logs-DB write trap still applies.** A reset only refreshes the schemas you loop over; if
|
|
91
|
+
you skip `Logs_<Id>` the first request 500s (`Unknown database 'logs_<id>'`) on the logging
|
|
92
|
+
write. See [per-client DB connections](../features/per-client-database-connections.md).
|
|
93
|
+
- **Committed dbchanges2 seeds usually survive a reset.** Beta already carries the committed
|
|
94
|
+
`Core` change-sets (e.g. the Surface-layer seeds), so a later replay of *committed* changes is
|
|
95
|
+
largely a no-op. Only ad-hoc changes that were never committed to dbchanges2 need re-applying
|
|
96
|
+
after a reset.
|
|
97
|
+
|
|
98
|
+
## Change history
|
|
99
|
+
|
|
100
|
+
- 2026-07-09 — Initial capture: non-locking `mysqldump` recipe (beta `admin` lacks `RELOAD`), the
|
|
101
|
+
VPN-only beta host, and the two recurring post-reset side-effects — a missing `_Model_Client_*`
|
|
102
|
+
autoload 500 (pull the model file, no cache) and the CompassCanada 17-table drift
|
|
103
|
+
(`sync_compasscanada_schema.sql`, local-only). (apeterson)
|
package/knowledge/INDEX.md
CHANGED
|
@@ -17,7 +17,7 @@ _Auto-generated by `knowledge.js index`. Do not hand-edit._
|
|
|
17
17
|
|
|
18
18
|
## 2.0 framework
|
|
19
19
|
|
|
20
|
-
- **_underscore** (_Underscore) _(framework core)_ —
|
|
20
|
+
- **_underscore** (_Underscore) _(framework core)_ — 28 doc(s) → [2.0/apps/_underscore/INDEX.md](2.0/apps/_underscore/INDEX.md)
|
|
21
21
|
- **worker2** (Worker) — 27 doc(s) → [2.0/apps/worker2/INDEX.md](2.0/apps/worker2/INDEX.md)
|
|
22
22
|
- **api2** (API) — 10 doc(s) → [2.0/apps/api2/INDEX.md](2.0/apps/api2/INDEX.md)
|
|
23
23
|
- **dbchanges2** (Database Changes) _(framework core)_ — 3 doc(s) → [2.0/apps/dbchanges2/INDEX.md](2.0/apps/dbchanges2/INDEX.md)
|
|
@@ -5,13 +5,14 @@ apps:
|
|
|
5
5
|
- _underscore
|
|
6
6
|
- api2
|
|
7
7
|
- toga2-supply
|
|
8
|
+
- toga25-supply
|
|
8
9
|
- dbchanges2
|
|
9
10
|
project: _Underscore
|
|
10
11
|
client: nychh
|
|
11
12
|
type: profile
|
|
12
13
|
status: active
|
|
13
|
-
updated: 2026-
|
|
14
|
-
owners: ["jcardinal"]
|
|
14
|
+
updated: 2026-07-09
|
|
15
|
+
owners: ["jcardinal", "apeterson"]
|
|
15
16
|
files: []
|
|
16
17
|
related:
|
|
17
18
|
- ../../2.0/apps/_underscore/features/tracking-number-bridges.md
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: session
|
|
3
|
+
slug: surface-local-db-replay
|
|
4
|
+
title: Reset local DB from beta, then replay Surface-feature DB changes to LOCAL
|
|
5
|
+
author: apeterson
|
|
6
|
+
repos: [toga25-supply, api2, _underscore, dbchanges2]
|
|
7
|
+
framework: "2.0"
|
|
8
|
+
client: shared
|
|
9
|
+
status: active
|
|
10
|
+
created: 2026-07-09
|
|
11
|
+
updated: 2026-07-09
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Session: surface-local-db-replay
|
|
15
|
+
**Date:** 2026-07-09
|
|
16
|
+
**Project/Repo:** toga25-supply (2.0)
|
|
17
|
+
**Task:** Reset the local dev database from beta (dev-sandbox), fix the resulting breakage, then manually replay the Surface UI feature's DB changes to LOCAL one SQL step at a time, logging every command.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## What WORKED
|
|
22
|
+
<!-- Include specific file paths and evidence -->
|
|
23
|
+
- **Local DB refresh from beta.** Per-schema `mysqldump` from `dev.sandbox.database.togahub.com` → local `DROP DATABASE`/`CREATE DATABASE` → re-import. Refreshed `Core`, `Client_Compass`, `Client_CompassCanada`, `Client_Nychh`, `Client_Quad`. Verified: local `Core` = 48 tables matched beta's 48; beta reachability proven via `SELECT @@hostname` = `ip-172-17-3-190`. Local backups taken first to `/tmp/LOCAL_BACKUP_<DB>.sql`.
|
|
24
|
+
- **Non-locking dump flags** for the RELOAD-less sandbox `admin` user: `mysqldump --skip-lock-tables --no-tablespaces --set-gtid-purged=OFF --routines --triggers` (NO `--single-transaction`). Dump completed (`-- Dump completed on …` marker present).
|
|
25
|
+
- **Fixed the whole-API 500** (`_Model_Client_BundleTranslation` not found) by bringing `Model/Client/BundleTranslation.php` into local `_underscore` from feature branch `TRUE-80065` (commit `ef6ebd80`). Login worked afterward. No server restart needed (models autoload per-request).
|
|
26
|
+
- **Fixed CompassCanada 1146** (`advanceshippingnoticeitemunits doesn't exist`) by running `toga25-supply/sync_compasscanada_schema.sql` against `Client_CompassCanada` — but only after selecting the DB in the client UI (see failures). SO record loads now.
|
|
27
|
+
- **Surface Core replay to LOCAL (all done):** `ALTER Core.SurfaceElements ADD iconWeightToken` + set weights on ids 17/18/19/21; `sales-order-listing-actions` BUTTON_BAR seed; slug renames (`sales-order-actions`→`sales-order-record-actions`, `sales-order-row-actions`→`sales-order-listing-row-actions`); `sales-order-record-approvals` gate (Core off + enable Compass/CompassCanada/Quad); `sales-order-record-header` surface.
|
|
28
|
+
- **Per-client data (all done):** F1 client feature tables across all 32 `Client_*`; Gina (user 4273) role fix in Compass; Compass Manager (role 8) hides approval-workflow (surf 8/el 19) + admin-notes (surf 20/el 37); Approvals-filter hides — Compass role 8, CompassCanada role 9, Quad + NYCHH all-users.
|
|
29
|
+
- **Execution log** written to `toga25-supply/db-migrations/DB-CHANGE-LOG.md` (SQL-only, per user preference), one entry per step run.
|
|
30
|
+
|
|
31
|
+
## What did NOT work — DO NOT RETRY THESE
|
|
32
|
+
<!-- Exact failure reasons — do not vague-ify -->
|
|
33
|
+
- `mysqldump --single-transaction …` against beta → `mysqldump: Couldn't execute 'FLUSH TABLES WITH READ LOCK': Access denied for user 'admin'@'%' (using password: YES) (1045)`. The sandbox `admin` lacks RELOAD. `--single-transaction` still issues FTWRL on MySQL 8; adding `--skip-lock-tables` did NOT suppress it. Fix = remove `--single-transaction` entirely.
|
|
34
|
+
- Direct `mysql -h dev.sandbox.database.togahub.com` off-VPN → `ERROR 2003 (HY000): Can't connect … (60)` (timeout). Host is firewalled; requires company VPN.
|
|
35
|
+
- Running `sync_compasscanada_schema.sql` with a standalone `USE Client_CompassCanada;` line executed separately from the `CREATE` block → tables landed in the wrong DB; verify `SELECT` returned 0 rows in `Client_CompassCanada` and the SO record kept 1146-ing (identical error). The `USE` did not carry across separate executions in the client. Fix = select `Client_CompassCanada` as the active DB in the client UI, then run the whole file in one execution.
|
|
36
|
+
- Initial assumption that the "still 500s" CompassCanada error was caching — it was not; the tables genuinely weren't in the DB (0-row verify). Don't assume cache before verifying table existence.
|
|
37
|
+
|
|
38
|
+
## Not tried yet (candidates for next session)
|
|
39
|
+
- **F2 ACL-grant verify** (paused by user). Multi-client read-only check drafted: for Compass/CompassCanada/Quad/NYCHH/Prudential, confirm `AclRecordScripts` has both `surfaces/meta` and `surfaces/meta-group` granted. Expectation: already present (Step 1's Section 2 applied it since Core had `meta-group` from the reset). Full 32-client coverage would need a 32-way UNION or a loop.
|
|
40
|
+
- **In-app UI verification** across Compass, Compass Canada, Quad, NYCHH: status badge, record header, approvals gate visibility, and the role-gated hidden buttons.
|
|
41
|
+
- Cleanup of stray empty tables if `sync_compasscanada_schema.sql` first landed in the wrong DB (identify which DB was selected, drop the 17 empties there).
|
|
42
|
+
- Remove the ~3.4 GB of `/tmp/*_beta.sql` dumps and `/tmp/LOCAL_BACKUP_*.sql` backups once confident.
|
|
43
|
+
|
|
44
|
+
## Current file state
|
|
45
|
+
| File | Status | Notes |
|
|
46
|
+
|------|--------|-------|
|
|
47
|
+
| toga25-supply/db-migrations/DB-CHANGE-LOG.md | created | Full SQL-only execution log of the LOCAL replay (steps 1–8 + L2). |
|
|
48
|
+
| _underscore/Model/Client/BundleTranslation.php | added (from branch TRUE-80065) | Fixes the autoload 500; committed source, brought in via git. |
|
|
49
|
+
| Local MySQL (localhost) | modified | Core + 4 clients reset from beta; Surface changes replayed; CompassCanada drift synced. LOCAL only. |
|
|
50
|
+
| toga25-supply/sync_compasscanada_schema.sql | unchanged | Existing file; run against Client_CompassCanada this session. |
|
|
51
|
+
|
|
52
|
+
## Decisions made
|
|
53
|
+
- **Beta reset target scope = Core + Compass/CompassCanada/NYCHH/Quad only** (not all 32), per user. Rationale: those are the clients in play; other locals left as-is.
|
|
54
|
+
- **Use hardcoded element ids 17/18/19/21 (icon weights) and 8/19, 20/37 (Manager hides)** per user preference, after verifying they matched local Core. Rejected: slug-resolved lookups (user wanted the literal ids); but #7/#8 were converted to `NOT EXISTS`-guarded to be idempotent.
|
|
55
|
+
- **DB-CHANGE-LOG entries are SQL-only, added only after the user confirms a step ran** (two explicit user preferences). Large 16 KB DDL (`sync_compasscanada_schema.sql`) referenced rather than inlined to avoid drift.
|
|
56
|
+
- **CompassCanada drift sync classified LOCAL-ONLY** — do NOT replay to beta/prod (prod already has the 17 tables).
|
|
57
|
+
- **NEVER merge the beta branch into a feature branch** (user rule; distinct from resetting the local DB from beta). Missing code (BundleTranslation.php) pulled from the specific feature branch, not a beta merge.
|
|
58
|
+
|
|
59
|
+
## Blockers
|
|
60
|
+
none
|
|
61
|
+
|
|
62
|
+
## Exact next step
|
|
63
|
+
> Run the paused F2 ACL-grant verify (multi-client `SELECT` over `Client_Compass`/`CompassCanada`/`Quad`/`Nychh`/`Prudential` `AclRecordScripts` joined to `Core.RecordScripts`, checking both `meta` and `meta-group` are granted). If any client is missing `meta-group`, run the guarded grant re-run for that client; otherwise mark F2 done and proceed to in-app UI verification.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
_Saved by /session-save on 2026-07-09_
|
package/package.json
CHANGED