toga-ai 1.0.547 → 1.0.548

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.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  type: session
3
3
  slug: elite-supply-fe
4
- title: Elite Service Requests (Orders) + Inventory FE in toga2-supply — code complete, blocked on backend Page.php context-setting fatal
4
+ title: Elite Service Requests + Inventory FE in toga2-supply — Service Requests VERIFIED end-to-end; remaining: orphan-modal decision, regression pass, PR
5
5
  author: tcox
6
6
  repos: [toga2-supply]
7
7
  framework: "2.0"
@@ -14,69 +14,60 @@ updated: 2026-08-10
14
14
  # Session: elite-supply-fe
15
15
  **Date:** 2026-08-10
16
16
  **Project/Repo:** toga2-supply (2.0)
17
- **Task:** Elite's full supply2 FE surface — Service Requests page (retitled Orders page on the new `service-requests` backend view) + details modal + the previously built Inventory page — code complete and iteratively debugged against beta; currently blocked by a backend Page.php fatal that the new service-requests context-setting triggers on the inventory page.
17
+ **Task:** Elite's full supply2 FE surface — Service Requests page (retitled Orders page on the backend `service-requests` view) + details modal, plus the previously built Inventory page. Service Requests is now VERIFIED working end-to-end on beta; remaining work is a design decision, the regression pass, and PR mechanics.
18
18
 
19
- > Supersedes session `elite-inventory-fe` (2026-08-06). All Inventory findings there still stand.
19
+ > Supersedes session `elite-inventory-fe` (2026-08-06). KB docs for everything durable were captured 2026-08-10 (`/capture`): see `clients/elite/features/supply2-scope.md`, `2.0/apps/toga2-supply/workflows/client-host-scoping.md`, `2.0/apps/_underscore/features/page-meta-context-field-settings.md`, `clients/elite/features/supply2-tableview-config-drift.md`.
20
20
 
21
21
  ---
22
22
 
23
23
  ## What WORKED
24
- - **"Service Requests" is NOT a new page.** The mockup source (`TOGa Supply mockup Elite/elite/elite-app.jsx`: `VIEW_META.Orders.title = "Service Requests"`, nav `{label:"Orders", text:"Service Requests"}`) defines it as the Elite Orders view retitled; the "details modal" is a details-only order modal (`elite-modal.jsx`, titles itself "Order INC…"). Implemented as config on the existing OrdersPage — no new route.
25
- - **Sales Orders / Service Requests FE (all tsc-clean, uncommitted on local `_production`):**
26
- - `src/pages/Orders/viewModel/FIELDS/ELITE/BASE.json` (new): `pageTitle: "Service Requests"`, `tableSlug: "service-requests"`, `listingSlug: "sales-orders-listing"`, `hasQuoteFilter: false`, `approvalsButton.isEnabled: false`, `exportButton.isEnabled: true`, NO `approvalActionOptions`.
27
- - `useOrdersPageViewModel.ts`: explicit `ELITE: {base: BASE_ELITE}` + `if (hostName === "ELITE") return hostFields.base;` (PRUDENTIAL precedent). L63 `|| fieldMapping.compass` fallback untouched.
28
- - `OrdersPage.tsx`: all 8 hardcoded `sales-orders` references now `fields?.tableSlug || "sales-orders"` (listing meta, tableDisplayData, setSlug, ResetFilters, both providers); ACL check optional-chained + slug-keyed with a TS cast; `pageTitle` initialized from `fields?.pageTitle || "Orders"`; `isQuote: false` in additionalData is now conditional — omitted when `fields?.hasQuoteFilter === false` (backend confirmed FE-side fix: ServiceRequests has no isQuote column).
29
- - `SlideMenu.tsx` ELITE branch: "Service Requests" (link `/`) + Inventory deep-link.
30
- - `renderModalContent.tsx` untouched — DEFAULT routes ELITE row-clicks to OrderDetailsModal only (verified: no ELITE key, no ApprovalsModal).
31
- - **Review fixes (CodeRabbit) on Inventory work:** `InventoryPage.tsx` re-seeds `selectedGrouping` when the stored uuid isn't in the resolved host's array (corrupt JSON handled); `InventoryRouter.tsx` redirects `/inventory_items` → `/inventory` for hosts whose default view lacks `subTableParent` (data-driven, no host literal). Both no-ops for NYCHH/Compass/Quad.
32
- - **`convertConstructorColumnTitles.ts`** null-guarded — a page slug without backend meta degrades to "" labels instead of crashing the table (was the white-screen when `service-requests-listing` didn't exist).
33
- - **Post-merge diagnostics (2026-08-07 prod→beta refresh rebuilt Client_Elite at 11:55 + beta API redeploy) — root causes found via DB reads:**
34
- 1. Login failure → re-seeded devteam user had an EMPTY password → fixed by hash copy from `Client_Compass.Users` id 127046 (login verified working after).
35
- 2. `service-requests` table view wiped by merge → backend recreated it (ServiceRequests-record view joined to Tickets/Customers/ServiceRequestTypes/SalesOrders with Elite-tailored status CASE).
36
- 3. Service Requests table 500 → OUR `isQuote: false` filter against ServiceRequests → fixed FE-side (above), backend confirmed.
37
- 4. Inventory `/pages/meta?slug=inventory` 500 "Undefined array key 190" → fully diagnosed (see Blockers).
24
+ - **Service Requests verified end-to-end on beta (2026-08-10):** table loads on the `service-requests` view → row click opens the details modal → ServiceRequest→SalesOrder uuid resolution → order details/items/invoices/shipments render. Verified on the one SR with a linked SalesOrder (ticket INC-13982, SR uuid cfc6ea32-dcfa-46c0-bf1b-f40733117a0e).
25
+ - **Modal-not-opening fix:** `renderModalContent.tsx` registry is keyed by **pageTitle** — retitling the page to "Service Requests" silently unhooked the modal (`clientConfig[pageTitle]` → undefined → null). Fixed with an additive `"Service Requests": [{component: OrderDetailsModal}]` key in DEFAULT.
26
+ - **uuid mismatch fix:** rows carry ServiceRequests uuids; detail routes are /sales-orders record routes → `GET /sales-orders/{srUuid}` 404'd. Added `getSalesOrderUuidForServiceRequest()` (OrdersApi.ts: GET /sales-orders + ServiceRequests join + where ServiceRequests.uuid) and threaded `detailsUuid` through `useOrderDetailsViewModel.ts` via a react-query gated `enabled: hostName === "ELITE"` — other hosts bypass entirely.
27
+ - All Service Requests config/slug-threading work from earlier (ELITE BASE.json with pageTitle/tableSlug/listingSlug/hasQuoteFilter/approvals-off; OrdersPage 8-literal slug threading; conditional isQuote; SlideMenu entry) — see superseded session + KB scope doc for detail. tsc clean throughout.
28
+ - Post-merge fixes that held: devteam password restored (hash copy from Client_Compass id 127046); `convertConstructorColumnTitles` null guard; `listingSlug` = `sales-orders-listing` (no service-requests-listing page exists in Core.Pages).
38
29
 
39
30
  ## What did NOT work — DO NOT RETRY THESE
40
- - **`listingSlug: "service-requests-listing"`** — no such page exists: `Core.Pages` has only `sales-orders-listing` (id 2) etc. The null pageMeta then crashed `convertConstructorColumnTitles` (`Cannot read properties of null (reading 'settings')`). Reverted to `sales-orders-listing`; if backend ever creates a service-requests page, it's a one-line JSON change.
41
- - **Assuming the service-requests view is a renamed SalesOrders view** — it's a ServiceRequests-record view (`SalesOrders.serviceRequestId = ServiceRequests.id` 1:1). Consequence: table rows carry ServiceRequests uuids; the details modal fetches by uuid via sales-orders record routes → probable uuid mismatch on row click (untested — see Not tried).
42
- - **Theory: empty `ClientPageSettings` caused the inventory meta 500** — WRONG: NYCHH's is empty too; that table (and `Pages_DefaultTableViewGroups`/`TableViewGroups`) is unused everywhere. The real cause is the context-setting fatal (Blockers).
43
- - **Sending `isQuote` unconditionally in OrdersPage additionalData** — 1054 "Unknown column 'ServiceRequests.isQuote'". It's a SalesOrders-only column.
44
- - (Carried from previous session) `/login` redirect ≠ Domains row exists; devteam lives only in dev-sandbox `Client_Compass` (127046); MCP env `client-beta` exposes no schemas — beta API client DBs are on the **dev-sandbox** cluster.
31
+ - **Retitling a page without adding a matching `renderModalContent` DEFAULT key** — modal silently never opens; registry lookup is `clientConfig[pageTitle]`.
32
+ - **`listingSlug: "service-requests-listing"`** — no such page in `Core.Pages`; null pageMeta crashed the table until the null guard + revert to `sales-orders-listing`.
33
+ - **Fetching order details directly with the row uuid on ELITE** — 404 EV-6; row uuid is the ServiceRequests uuid, not SalesOrders.
34
+ - **Assuming an empty modal means a broken fetch** — 5 of 6 Elite dev-sandbox ServiceRequests have NO linked SalesOrder (only SR id 2 / INC-13982 does); the resolver correctly yields null and the modal is empty by design. Verify against INC-13982 before debugging.
35
+ - **Sending `isQuote` unconditionally** — ServiceRequests has no isQuote column (1054). Config-gated via `hasQuoteFilter: false`.
36
+ - (Carried) `/login` redirect ≠ Domains row; devteam lives in dev-sandbox Client_Compass (127046); MCP env `client-beta` empty — query `dev-sandbox`; beta hand-inserted rows are eaten by prod→beta refreshes.
45
37
 
46
38
  ## Not tried yet (candidates for next session)
47
- - **Row-click details modal on Service Requests** — expect uuid mismatch (ServiceRequests uuid vs sales-orders fetch routes). Fix is either backend (expose linked `SalesOrders.uuid` as the drill identifier) or FE (ELITE detail `apiFields` pointing at service-requests routes in `useOrderDetailsViewModel` — structure already supports per-host apiFields).
48
- - Inventory nested-expand re-validation (blocked again post-merge: prod's stale TableViewJoins were re-imported; the 3-statement fix from the drift doc applies but join ROW IDS may have shifted — match by tableViewId + joinRecordId + joinOnRecordFieldId, not row id).
49
- - Four-client regression pass (NYCHH/ENDEAVORHEALTH/COMPASS/COMPASSCANADA, same browser) before PR.
50
- - Branch + PR (tcox branches personally; bare ticket-ID name; ask first).
51
- - gitignore check: `TOGa Supply mockup Elite/` folder sits untracked in the repo root — must not ride into the PR.
39
+ - **Orphan-SR modal state (design decision, then ~minutes of FE):** options are (1) "No sales order linked" empty-state message wired to the resolver's null, (2) SR-level detail view (needs backend routes + design), (3) non-clickable orderless rows. Waiting on backend/product: is an order-less SR a legitimate lifecycle state?
40
+ - Inventory nested-expand re-validation — still blocked on backend TableViewJoins drift fix (dbchanges2 migration; match rows by tableViewId+joinRecordId+joinOnRecordFieldId, ids shifted in the 08-07 re-import) and the Page.php:824 isset() guard for the inventory /pages/meta 500 (KB: page-meta-context-field-settings.md).
41
+ - Four-client regression pass: NYCHH, ENDEAVORHEALTH, COMPASS, COMPASSCANADA inventory + orders in ONE browser session — release blocker per the host-scoping playbook.
42
+ - gitignore `TOGa Supply mockup Elite/` (untracked in repo root) before branching.
43
+ - Branch + PR: tcox branches personally (bare ticket-ID name, ask tcox first). Work sits uncommitted on local `_production`; beta already runs a deployed copy of it.
52
44
 
53
45
  ## Current file state
54
46
  | File | Status | Notes |
55
47
  |------|--------|-------|
56
- | src/pages/Orders/viewModel/FIELDS/ELITE/BASE.json | new, uncommitted | full ELITE page config (see What WORKED) |
57
- | src/pages/Orders/viewModel/index.ts | modified, uncommitted | BASE_ELITE export |
58
- | src/pages/Orders/viewModel/useOrdersPageViewModel.ts | modified, uncommitted | ELITE fieldMapping entry + base branch |
59
- | src/pages/Orders/OrdersPage.tsx | modified, uncommitted | slug threading, pageTitle from fields, conditional isQuote, null-safe ACL |
48
+ | src/pages/Orders/viewModel/FIELDS/ELITE/BASE.json | new, uncommitted | pageTitle/tableSlug/listingSlug(sales-orders-listing)/hasQuoteFilter:false/approvals off/export on |
49
+ | src/pages/Orders/viewModel/index.ts + useOrdersPageViewModel.ts | modified, uncommitted | BASE_ELITE export + ELITE base entry/branch |
50
+ | src/pages/Orders/OrdersPage.tsx | modified, uncommitted | slug threading, fields-driven pageTitle, conditional isQuote, null-safe ACL |
51
+ | src/pages/Orders/api/OrdersApi.ts | modified, uncommitted | getSalesOrderUuidForServiceRequest() resolver |
52
+ | src/pages/Orders/view/OrderView/viewModel/useOrderDetailsViewModel.ts | modified, uncommitted | ELITE-gated uuid resolution; all detail fetches keyed on detailsUuid |
53
+ | src/components/ui/Tables/PrimaryTable/helperFunctions/renderModalContent.tsx | modified, uncommitted | DEFAULT "Service Requests" → OrderDetailsModal |
60
54
  | src/components/layout/SlideMenu/SlideMenu.tsx | modified, uncommitted | ELITE: Service Requests + Inventory |
61
- | src/utils/convertConstructorColumnTitles.ts | modified, uncommitted | null-guarded pageMeta/settings |
62
- | src/pages/Inventory/** (7 files, from elite-inventory-fe session) | modified/new, uncommitted | host-scoped group options etc. + CodeRabbit fixes (selectedGrouping re-seed, InventoryRouter guard) |
63
- | src/utils/resolveClientHostName.ts | new, uncommitted | store-first + subdomain fallback |
64
- | package.json | modified, uncommitted | `npm run elite` script |
65
- | dev-sandbox Client_Elite.Users | hand-fixed, KEPT | devteam password restored via Compass hash copy |
55
+ | src/utils/convertConstructorColumnTitles.ts | modified, uncommitted | null-safe pageMeta/settings |
56
+ | src/pages/Inventory/** + src/utils/resolveClientHostName.ts (from inventory session) | modified/new, uncommitted | host-scoped statics + CodeRabbit fixes (selectedGrouping re-seed, InventoryRouter subtable guard) |
57
+ | package.json | modified, uncommitted | `npm run elite` |
58
+ | dev-sandbox Client_Elite.Users | hand-fixed, KEPT | devteam password restored 08-10; note: any future prod→beta refresh re-empties it |
66
59
 
67
60
  ## Decisions made
68
- - Service Requests = config on OrdersPage (pageTitle/tableSlug/listingSlug/hasQuoteFilter in FIELDS), NOT a new route — mockup defines it as the Orders view retitled; supply2.0 components render it (2.5 mockup = spec for WHAT, 2.0 = HOW).
69
- - Slug threading via FIELDS with `|| "sales-orders"` fallbacks — other hosts have no tableSlug key, provably unchanged. Rejected: fixing the broken lowercase-`compass` fallback (cross-client risk).
70
- - Reuse `sales-orders-listing` page meta for Elite until a service-requests page exists (headers come from the table-view meta, so only ACL/search-labels are affected).
71
- - Keep devteam seeding + document every hand-fix — the 08-07 merge proved hand-inserted beta rows get eaten; everything must eventually be dbchanges2 migrations.
61
+ - Modal registry fix as an additive DEFAULT pageTitle key (idiomatic to the registry) — rejected refactoring the lookup to a title-independent pageType (shared-code churn).
62
+ - uuid resolution FE-side, host-gated in the detail view model — self-contained, no backend work, other hosts provably bypass (enabled flag + detailsUuid === activeUuid). Rejected: backend exposing SalesOrders.uuid as the drill identifier (still needed an FE change and backend coordination).
63
+ - Orphan-SR modal handling deliberately deferred — mockup doesn't cover the state; it's a product/backend decision first.
72
64
 
73
65
  ## Blockers
74
- - **Backend: `/pages/meta?slug=inventory` fatal "Undefined array key 190"** — `Client_Elite.ClientRecordFieldSettings` row id 1 (field 58 → label "Total" in context of field 190 = ServiceRequests.id, created for the new service-requests view) is fetched for ANY page whose field set includes field 58; `_underscore/Model/Core/Page.php:824` resolves `contextRecordFieldId` against a lookup built only from the current page's fields → key 190 missing on inventory → warning made fatal by the newly deployed strict error handler. Fix: isset()-guard Page.php ~L822-829 (skip context settings whose context field isn't on the page). Deleting the row would un-break inventory but lose the service-requests "Total" label. Reported to backend 2026-08-07.
75
- - Inventory nested-expand still blocked by the re-imported TableViewJoins drift (see drift doc `clients/elite/features/supply2-tableview-config-drift.md`).
76
- - Details-modal uuid mismatch (suspected, untested) — see Not tried.
66
+ - Backend (all reported + documented in KB): Page.php:824 isset() guard; TableViewJoins drift migration; answer on order-less ServiceRequests lifecycle.
67
+ - None on the Service Requests happy path — verified working.
77
68
 
78
69
  ## Exact next step
79
- > Confirm with backend that the Page.php:824 isset() guard (or equivalent) is deployed, then `npm run elite`, log in as devteam, and verify BOTH pages render: Inventory (columns + chevron) and Service Requests (table loads without isQuote error). Then click a Service Request row and capture the modal's network call — the expected failure is the ServiceRequests-uuid-vs-sales-orders-route mismatch.
70
+ > Get the orphan-SR answer from backend/product; implement the chosen modal state (option 1 is a few lines wired to the resolver's null). Then run the four-client regression pass (NYCHH/ENDEAVORHEALTH/COMPASS/COMPASSCANADA, one browser session), gitignore `TOGa Supply mockup Elite/`, and branch for PR (ask tcox for the ticket-ID branch name).
80
71
 
81
72
  ---
82
73
  _Saved by /session-save on 2026-08-10_
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toga-ai",
3
- "version": "1.0.547",
3
+ "version": "1.0.548",
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",