Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
docs(mobile): final thermo review of the phone redesign branch
aashu149e94ad777a
diff --git a/.ai/reviews/2026-10-08-phone-redesign-final-thermo-review.md b/.ai/reviews/2026-10-08-phone-redesign-final-thermo-review.mdnew file mode 100644index 0000000000..2bfa704354--- /dev/null+++ b/.ai/reviews/2026-10-08-phone-redesign-final-thermo-review.md@@ -0,0 +1,193 @@+# Final thermo-nuclear review: the whole feat/mobile-redesign branch++## TL;DR++- **Verdict:** not ready to merge. 80 findings, 23 of them MAJOR.+- **Rebase first (O1):** main is 59 commits ahead and has already rewritten 5 document headers that this branch also rewrites.+- **Desktop changes:** S1 (Escape), S9 (dialog clicks), M6 (MES operation screen), O7 (badge order) and R5/R6 (header order, wrapper div) break "desktop must not change".+- **Fixed after the review:** P1, the quote line Subtotal that included tax and the missing Tax row.+- **MES flashes the desktop layout (S2, M1):** MES never mounts `ViewportProvider`, so phones get the desktop layout first and swap after hydration.+- **Mounted twice (M2, M5):** MES bottom bars and the operation context row render twice and hide one copy with CSS.+- **Copy-paste (R1, R4, P2, O3):** the same step code in 4 report trees, 5 near-identical item headers, and 6 line summaries built two ways.+- **Hand-built twice (R2, S3):** app-bar actions are built by hand 7 times, and the account and create menus are rebuilt for the tab bar.+- **Scattered phone patches (S5, O4):** 76 one-off `max-md:opacity-100` classes, and `isPhone` checked 10 times in one file.+- **File size:** no file goes from under 1000 lines to over 1000 because of this branch.++Scope: `git diff origin/main...HEAD` (merge base `3070451ffb`): 9 commits, 720 files, +33k / −13k. Five reviewers worked in parallel, read-only. No typecheck, build or tests ran during the review. Every finding cites the file and line its reviewer read.++## Summary++| Area | MAJOR | Total |+|---|---|---|+| S: shared parts and the phone chrome | 7 | 22 |+| P: sales, purchasing, invoicing | 2 | 11 |+| O: inventory, production, quality | 4 | 15 |+| R: items, accounting, the other modules, routes | 4 | 18 |+| M: MES, printing, documents | 6 | 14 |+| **All** | **23** | **80** |++No file goes from under 1000 lines to over 1000 because of this branch.++Fix first:+- **Desktop behaviour changes (break "desktop must not change"):**+ - S1: `useEscape` now skips an Escape that a menu or popover already handled, so on desktop it takes a second Escape to leave a Table or Grid edit.+ - S9: Table ignores clicks inside any dialog.+ - M6: the operation screen's starting work type, caption, tablet layout and sheet title changed on md and up.+ - O7: in 4 desktop headers the status and version badges moved after the ⋯ menu.+ - R5, R6: the header order changed, and `MakeMethodTools` has an extra wrapper div.+ - P1: the quote line breakdown lost its Tax row and its Subtotal included tax. Fixed after the review: `getQuoteLineSubtotal`, `getQuoteLineTax` and `getQuoteLineTotal` in `QuoteLinePricingOptions.tsx`.+- **Main has moved (O1):** `origin/main` is 59 commits ahead. It moved 5 document headers onto `DocumentPageHeader`, and this branch rewrites those same files. Rebase before any more work.+- **MES has no viewport hint (S2, M1):** MES never mounts `ViewportProvider`, so every `isPhone` gate renders the desktop layout first and swaps after hydration.++## Thermo-nuclear review 2: shared parts and the phone chrome (feat/mobile-redesign)++Scope: `git diff origin/main...HEAD` for `packages/react/src`, `packages/form/src`, `packages/utils/src`, `packages/config/tailwind`, `apps/erp/app/components`, `apps/erp/app/root.tsx`, `apps/erp/app/styles`, `apps/erp/app/stores`, `apps/erp/app/utils`, `apps/starter`. The working tree is clean, so all of it is committed. The review was read-only: no typecheck, build or tests ran.++No file in scope goes past 1000 lines because of this branch. The largest are `Table/Table.tsx` (1663 → 1726, already over 1000 on main) and `Gantt/Gantt.tsx` (1376 → 1402, also already over).++| # | Sev | Where (file:line) | Problem | Simpler alternative |+|---|---|---|---|---|+| S1 | MAJOR (desktop change) | `packages/react/src/hooks/useEscape.tsx:14`; callers `apps/erp/app/components/Table/Table.tsx:606`, `apps/erp/app/components/Grid/Grid.tsx:137`, `packages/react/src/Date/components/Popover.tsx:12` | `useEscape` now skips any Escape with `defaultPrevented`. Radix's dismissable layer listens in the capture phase and calls `preventDefault()` when it closes (`@radix-ui/react-dismissable-layer` dist `index.mjs:59-66`, capture listener in `react-use-escape-keydown` `index.mjs:12`). So on desktop, Escape in an open cell-editor combobox or popover no longer ends the Table/Grid edit or closes the date popover. It now takes a second Escape. This shipped in the phone-chrome commit (39389b335b), and phones have no Escape key. | Revert the guard. If it fixes a real desktop double-handling bug, ship it as its own desktop change with its own reasoning. Otherwise scope it to the layers that need it, e.g. ignore events whose target is inside `[role=dialog]` of a sheet. |+| S2 | MAJOR | `apps/erp/app/root.tsx:336` (the only `ViewportProvider`), `packages/react/src/Viewport.tsx:71-75`; MES call sites e.g. `apps/mes/app/components/MesAppBar.tsx:55`, `apps/mes/app/components/JobOperation/components/Materials.tsx:254` | `ViewportProvider` and `getViewportHint` are wired only into ERP. MES calls `useViewport()` in 11 files but has no provider. Its server snapshot is therefore always `"desktop"` (`Viewport.tsx:74`), so phones get the desktop tree on SSR and swap after hydration. MES also never writes the hint cookie. This is the exact problem the viewport API exists to solve (see the docstring at `Viewport.tsx:39-41`). | Add `viewport: getViewportHint(request)` to the MES root loader and wrap MES in `<ViewportProvider>`, like `apps/erp/app/root.tsx:173/336`. Or make `useViewport` warn in dev when it has no provider. |+| S3 | MAJOR (code judo) | `apps/erp/app/components/Layout/Mobile/ProfileSheet.tsx` (370 new lines; screen stack at :54-58 and :88-95); `apps/erp/app/components/AvatarMenu.tsx` (315 → 483 lines; `AccountMenuItem` and `useAccountMenu` at :58-84); `apps/erp/app/components/Layout/Mobile/CreateSheet.tsx` vs `apps/erp/app/components/Layout/Topbar/CreateMenu.tsx:125-145` | On phones this branch already turns every `DropdownMenu` into a bottom sheet with drill-in sub-pages (`Dropdown.tsx:264-342` → `MenuSheet.tsx`). The tab bar does not use that. It re-renders the two desktop dropdowns by hand. AvatarMenu was split into a data layer and a desktop renderer so that ProfileSheet could add a second renderer with its own `renderItem` switch, `groupItems`, and a `Screen` stack with Back. CreateSheet copies CreateMenu's item loop. | Render the existing `<AvatarMenu>` and `<CreateMenu trigger={…}>` from the tab bar (`TabBarItem` needs a `forwardRef` to be an `asChild` trigger). MenuSheet already gives the sheet, the sub-pages and Back. Add Notifications and Switch company as phone-only `DropdownMenuSub` or items in AvatarMenu. This deletes ProfileSheet's renderer and stack, CreateSheet, and most of the `useAccountMenu` data layer. |+| S4 | MAJOR (SSOT, already drifting) | Row classes: `packages/react/src/MenuSheet.tsx:198-199`, `packages/react/src/SelectSheet.tsx:256`, `apps/erp/app/components/Layout/Mobile/SheetRow.tsx:60-61`, `apps/erp/app/components/Table/components/Compact/FilterSortSheet.tsx:34-35`, `apps/erp/app/components/Layout/Navigation/SidebarPresentation.tsx:46`. Overline: `MenuSheet.tsx:351`, `SelectSheet.tsx:302`, `FilterSortSheet.tsx:39`, `SidebarPresentation.tsx:73`, `ProfileSheet.tsx:319`. Drill-in: `MenuSheet.tsx:85-99`, `ProfileSheet.tsx:88-95`, `FilterSortSheet.tsx:170-174` | The 48pt sheet row exists five times and has already drifted. Corners differ (`rounded-sm` vs `rounded-lg`), hover differs (`hover:bg-accent` vs none), and focus differs (`focus-visible:bg-accent` vs a 3px ring vs none). The section label is copied five times. Three separate drill-in page stacks each have their own Back and their own "reset on close". MenuSheet resets inside `setOpen`; ProfileSheet and FilterSortSheet use an effect. | Export one `sheetRowClassName` / `SheetRow`, one `SheetSectionLabel` and one small `useSheetPages()` (push, pop, reset on close, reusing MenuSheet's) from `@carbon/react` `BottomSheet.tsx`. Make MenuSheet, SelectSheet, SheetRow, FilterSortSheet and SidebarPresentation use them. |+| S5 | MAJOR (spaghetti growth) | 76 added `max-md:opacity-100` across the branch, 25 in scope, e.g. `packages/react/src/NavRail.tsx:373,463,490`, `apps/erp/app/components/Layout/Topbar/Search.tsx:343,397,450`, `apps/erp/app/components/DocumentTemplateEditor/BlockList.tsx:373,401,490`, `apps/erp/app/components/Layout/Navigation/SortableNavItem.tsx:49,66,78`, `apps/erp/app/components/Table/Table.tsx:1398` | Every `opacity-0 group-hover:opacity-100` control is patched one at a time to stay visible on phones. The theme already redefines `hover` for touch (`packages/config/tailwind/theme.css:10-23`), but the "reveal on hover" rule lives in 76 class strings. The next hover-revealed control will be invisible on phones. | Add one utility in `theme.css`, e.g. `@utility hover-reveal`: opacity 0 only under `@media (hover:hover) and (width>=48rem)`, and 1 on `.group:hover`, `:focus-visible` and `[data-state=open]`. Replace the patched pairs with it. |+| S6 | MAJOR | `packages/react/src/SplitButton.tsx:57-96` vs `packages/react/src/Button.tsx:206-245` | SplitButton wraps itself in `ActionPresentationBoundary` and then rebuilds Button's presentation mapping by hand. That covers the variant (`bar` → emphasis, `row` → ghost), `size="lg"`, the row classes copied verbatim (`h-12 … justify-start rounded-sm px-3 text-[15px] font-normal text-foreground shadow-none`) and `setTimeout(presentation.onSelect, 0)`. The two copies can drift: Button adds `text-destructive` for rows (`Button.tsx:245`), SplitButton does not. | Keep the main Button outside the boundary so it reads the presentation itself. Put only the chevron trigger and its `DropdownMenu` inside the boundary. Delete `mainVariant`, the `onClick` wrapper and the copied row classes. |+| S7 | MAJOR | `apps/erp/app/components/Layout/Navigation/ContentSidebar.tsx:23-28, 39-41, 53-54`; `apps/erp/app/components/Layout/Navigation/GroupedContentSidebar.tsx:98-108, 120-127, 169-175`; `apps/erp/app/components/Layout/Mobile/MobileAppBar.tsx:41-57` | `SidebarPresentation` turns every module sidebar into three renderers (`panel`, `sheet`, `title`). The active-route rule is copied into each branch: 3× in ContentSidebar and 3× in GroupedContentSidebar. To get the title, the app bar mounts the whole Sidebar a second time and picks between it and the breadcrumb with a `peer`/`:empty` CSS trick. | Hoist one `isActive(route)` per sidebar, or better one `useActiveSection(links)` that returns the active route. The `title` presentation then becomes `active?.name`, and the sheet and panel share the predicate. |+| S8 | minor (type hole + inconsistency) | `packages/react/src/MenuSheet.tsx:440-453` (`compactPart`, `Phone: ElementType`); popper-prop discard copied at `MenuSheet.tsx:156-167`, `SelectSheet.tsx:172-183`, `PopupSheet.tsx:56-66`; hand-written switches at `Popover.tsx:32,57,71,88,155`, `HoverCard.tsx:28,53,84`, `Dropdown.tsx:267,285,293`, `Context.tsx:252,270,278` | `compactPart` types `Phone` as `ElementType`, so the phone part never type-checks against the desktop props. That is why each sheet content swallows 11 popper props through `_`-prefixed destructuring and `unknown` types. The helper lives in MenuSheet but Select uses it too. Popover, HoverCard and the Root/Portal/Sub parts hand-write the same switch instead. | Move it to `Viewport.tsx` as `phonePart(Desktop, Phone: ComponentType<ComponentPropsWithoutRef<Desktop>>)`, add one `omitPopperProps()` helper, and use the helper for the hand-written Popover/HoverCard/Root/Portal/Sub switches. |+| S9 | minor (desktop change) | `apps/erp/app/components/Table/Table.tsx:621` | The outside-click handler now ignores clicks inside any `[role=dialog]` on every viewport. On desktop, a selected cell or edit is no longer cleared by a click inside a modal or drawer that opens over the table. The comment says this is for the phone bottom sheet. | Add `[role=dialog]` only when `isPhone`, or match the sheet's own marker instead of every dialog. |+| S10 | minor | `packages/react/src/Combobox.tsx:86/183`, `MultiSelect.tsx:73`, `CreateableCombobox.tsx:76`, `CreateableMultiSelect.tsx:84` | Each picker builds `usePhoneOpenAutoFocus()` and passes it to `PopoverContent`. On phones that content is `PopupSheetContent` → `BottomSheetContent`, which already applies `usePhoneOpenAutoFocus` (`BottomSheet.tsx:63`). On desktop the handler does nothing. | Delete the four hook calls and the `onOpenAutoFocus` props. |+| S11 | minor | `packages/react/src/Tooltip.tsx:76-85` | `TapToggleRoot` adds its own `document` `pointerdown` listener to close on an outside tap. Base UI's tooltip already runs `useDismiss` (`@base-ui/react` `tooltip/root/TooltipRoot.js:131`) with `outsidePress` on by default (`floating-ui-react/hooks/useDismiss.js:44`), and that path reaches the existing `onOpenChange(false)`. I did not check this at runtime. | Remove the effect and rely on `onOpenChange(false)` with reason `outsidePress`. |+| S12 | minor | 83 hits for `compactPart`, `compactFooterClassName` (`Modal.tsx:242`), `stackOnCompact`/`compactFocus`/`data-compact-focus` (`Resizable.tsx:15-80`), `useCompactCssVar` (`ChromeSlots.tsx:45`), `useCompactModuleSidebar` (`CollapsibleSidebar.tsx:184`), `handle.compactSidebar` (`utils/handle.ts:25`), and comments that say "on compact" | Commit 5c51803534 replaced `compact` with `phone`/`max-md:` in the API but left the old word in names and comments. There are now two words for one idea. | Rename to `phone*` (`phonePart`, `phoneFooterClassName`, `stackOnPhone`/`phoneFocus`, `usePhoneCssVar`, `handle.phoneSidebar`) and fix the comments. |+| S13 | minor | `packages/react/src/FunnelChart.tsx:80`, `packages/react/src/Sidebar.tsx:84`, `apps/starter/app/components/Breadcrumbs.tsx:133` | `const { isPhone: isMobile } = useViewport()` keeps the old name alive through an alias. | Use `isPhone` directly. |+| S14 | minor (speculative option) | `apps/erp/app/components/Layout/Mobile/appBar.ts:39-44, 58`; the only caller is `useAppBar.ts:31` | `deriveAppBar` takes `moduleCrumbIndex`, and every caller and test passes `0`. | Drop the option and use index 0. |+| S15 | minor | `apps/erp/app/components/Layout/Mobile/MobileAppBar.tsx:27`, `MobileTabBar.tsx:27` | `useAppBar()` runs twice per render: matches, breadcrumbs, sidebar lookup and merge. The tab bar only reads `kind`. | Call it once in `_layout` (or a tiny context) and pass `kind` to the tab bar. |+| S16 | minor | `apps/erp/app/components/Layout/Navigation/DetailsTopbar.tsx:75-96`; `apps/erp/app/components/Layout/Mobile/slots.tsx:76-91` | DetailsTopbar builds an `itemsKey` string and a `biome-ignore` memo. Without them, `createValueSlot` would re-provide a new array on every render and loop. The active rule is computed twice to do this. Every `useProvide` caller must remember to memoize. | Make the slot's `put` skip when the value is shallow-equal to the stored one. Then delete `itemsKey`, the ignore and the call-site `useMemo`s. |+| S17 | minor (SSOT) | `apps/erp/app/components/Table/components/Compact/FilterSortSheet.tsx:201-204` vs `apps/erp/app/hooks/useSavedViews.tsx:37-39` | The saved-view URL (`?view=…&filter=…&sort=…`) is built twice, and the table filter and sort order are copied too. | Expose a `savedViewHref(view, pathname)` from `useSavedViews` and use it in both places. |+| S18 | minor (brittle CSS) | `packages/react/src/Card.tsx:222` | `CardContent` changes its corners when the previous sibling has the literal class string `max-md:hidden` (`[class~='max-md:hidden']+*`). Renaming that class on any header breaks the style without any error. | Do not render the hidden header on phones (so `:first-child` applies), or mark it with a `data-` attribute. |+| S19 | minor (duplicate mount) | `apps/erp/app/components/Layout/RecordHeader.tsx:316-320, 357` | On phones `status` is mounted twice: in the hero and in the desktop row hidden by `max-md:hidden`. Any status control with its own state or modal exists twice. | In the desktop row render `{isPhone ? null : status}`, as the title already does (`:338`). |+| S20 | minor (dead classes) | `apps/erp/app/components/Layout/Navigation/GroupedContentSidebar.tsx:343, 352`; `Topbar.tsx` `hidden md:block`; `MobileAppBar.tsx:61`, `TabBar.tsx:21`, `ChromeSlots.tsx:76` `md:hidden` | The panel never renders on phones (`CollapsibleSidebar.tsx` returns a 0-width div), and the phone chrome mounts only when `isPhone` (`routes/x+/_layout.tsx:540,550`). These responsive classes can never apply. | Delete them. |+| S21 | minor (comment noise) | `apps/erp/app/components/Table/components/Compact/CompactToolbar.tsx:64-76` | The toolbar's JSDoc now sits above `listMenuHiddenSlot`, stacked on another doc block, and the function at `:77` has none. | Move the block back above `CompactToolbar`. |+| S22 | minor | `packages/react/src/Select.tsx:151` | The alias `const position = positionProp;` does nothing. | Destructure `position = "popper"` as before. |++Earlier review items I re-checked and still see, but did not escalate: A6 (`Panels.tsx`, three signals for one fact), A9 (hand-written controlled `open`, now also in `MenuSheet.tsx:82-91` and `SelectSheet.tsx:72-86`), and A4/A2 (`useHideListAppBarMenu`, `mobileMenuItems`). The earlier review gave reasons for skipping them.++## Thermo-nuclear review 2 — sales / purchasing / invoicing++Scope: `git diff origin/main...HEAD -- apps/erp/app/modules/{sales,purchasing,invoicing}` (101 files). Working tree = HEAD for these paths. Desktop comparisons use the merge-base (`3070451ffb`), not the origin/main tip. No file in scope crosses 1000 lines because of this branch (QuoteSummary is now 571; the four >1000 line forms were already >1000 at the merge-base and did not grow). Read-only; nothing was built or type-checked.++| # | Sev | Where (file:line) | Problem | Simpler alternative |+|---|---|---|---|---|+| P1 | MAJOR (desktop regression) | `sales/ui/Quotes/QuoteLinePricingOptions.tsx:418-429`, `:431-446`; merge-base `QuoteSummary.tsx:612-647` | Moving `LinePricingOptions` out of QuoteSummary was not a pure move. A diff of the merge-base body against the new file shows the **Subtotal** row now shows `getQuoteLineTotal(selectedLine)`, which includes tax. The **Tax** row (`Tax (x%)`, merge-base :630-647) is gone. Subtotal now equals Total on desktop and phone. The Total row (:431-446) still inlines the same formula as `getQuoteLineTotal` (:69-80). The helper went into the wrong row. | Put back the pre-tax Subtotal row and the Tax row. Split the helper into `getQuoteLineSubtotal` and `getQuoteLineTax`, with `getQuoteLineTotal = subtotal + tax`. Use them in all three rows and in the `subtotal`/`tax` reduces at `QuoteSummary.tsx:428-451`. |+| P2 | MAJOR | Uses `SummaryLineRow`: `SalesOrderSummary.tsx:406`, `PurchaseOrderSummary.tsx:138`, `QuoteSummary.tsx:170`. Dead classes: `PurchaseOrderSummary.tsx:168-216`, `SalesOrderSummary.tsx:465-515,562`, `QuoteSummary.tsx:223-237`. Restyles the desktop card instead: `SalesInvoiceSummary.tsx:119-124`, `PurchaseInvoiceSummary.tsx:117-122`, `SupplierQuoteSummary.tsx:123-128` | The six sibling line summaries use two phone approaches. SO, PO and Quote return a `SummaryLineRow` on phones, yet their desktop-only branches still carry `max-md:size-14`, `max-md:flex-wrap`, `max-md:basis-full` and `max-md:hit-area`. Those classes can never apply. **(Open from earlier review B2, "delete the dead classes".)** SI, PI and SupplierQuote shrink the desktop card instead, with a different thumbnail size (`size-16` vs `size-14`). The list wrappers also differ. PO caps phones at 3 lines plus "See all" (`PurchaseOrderSummary.tsx:92-93,453`). SO and Quote show every line. Only SO gets a phone Shipping row (`SalesOrderSummary.tsx:269`). | Use `SummaryLineRow` in all six summaries. Add one `SummaryLineList` beside it (the `divide-y` wrapper, plus an optional limit and "See all") and one shipping row. Delete every thumbnail and row `max-md:` class from the desktop branches. |+| P3 | minor | `purchasing/ui/Planning/PurchasingPlanningTable.tsx:683-727` vs `production/ui/Planning/ProductionPlanningTable.tsx:594-637` | The same phone MRP code is in both tables: a `max-md:hidden` form, an `md:hidden` hint ("use ⋯ › Recalculate") and a `mobileMenuItems` copy of the submit. **(Open from earlier review B12.)** | Add one `useMrpRecalculate(locationId)` (or `<MrpRecalculate>`) that returns the desktop button, the menu item and the hint. |+| P4 | minor | `sales/ui/Quotes/QuotesTable.tsx:103-118`, `:141-153`; `PurchasingPlanningTable.tsx:449-462`; `Table/components/Compact/resolveSlots.ts:66` | A compact row allows only one P3 column (`byPriority("P3").find`). So tables put phone-only content inside desktop cells: the expiry in the customer cell, "x of y lines" in the status cell, "on hand" in the supplier cell. This uses `contents max-md:flex` wrappers and `md:hidden` spans, so phone markup is mounted (hidden) on desktop and the desktop cell DOM changes. | Let `resolveSlots` return several P3 columns and have `CompactRow` join them with " · ". Or add a `meta.mobileCell` renderer that only `CompactRow` reads. Desktop cells stay as they were. |+| P5 | minor | `CustomerTaxForm.tsx:162`, `CustomerPaymentForm.tsx:82`, `CustomerShippingForm.tsx:109`, `SupplierTaxForm.tsx:162`, `SupplierPaymentForm.tsx:82`, `SupplierShippingForm.tsx:109` | The same `max-md:[&>*]:flex-1 max-md:[&>div>*]:flex-1 max-md:[&_button]:h-11` string is in 6 files. It rebuilds part of `compactFooterClassName` (`packages/react/src/Modal.tsx:241-242`), which `CardFooter sticky` already applies (`packages/react/src/Card.tsx:249`). | Give `CardFooter` a non-sticky full-width-actions option, for example by splitting `sticky` into `phoneActions` and `sticky`. Delete the 6 copies. |+| P6 | minor | `invoicing/ui/Workbench/ARAPWorkbench.tsx:280-281,324-325`; `components/Table/components/Cell.tsx:84` | A hidden contract with one consumer. Cell widens any `td` that has a `[data-key-cell]` child to `45dvw`. The workbench sets that attribute and repeats the width as `calc(45dvw-32px)`, where 32px is the cell's padding. | Add a column `meta.keyColumn`. Cell then sizes both the `td` and its content, so the width lives in one place. |+| P7 | minor | `sales/ui/Quotes/QuotePaymentForm.tsx:70-76`, `QuoteShipmentForm.tsx:110-116` | The same phone-only "Locked while the quote is {quoteStatus}. Reopen it to edit." note is in two files (the earlier review's "also noted"). It puts the raw status enum into a translated sentence. `PurchaseOrderHeader.tsx:183-185` has a comment warning against exactly this. | One `<QuoteLockedNote status>` that shows the translated status (or a `QuoteStatus` badge), used by both forms. |+| P8 | minor | `sales/ui/Customer/CustomerHeader.tsx:120-122`, `purchasing/ui/Supplier/SupplierHeader.tsx:176-178` | Two stacked comments say the same thing. An empty `<RecordHero />` is mounted only for its `--header-height` side effect, and this is copied into both company headers. | Let `RecordPhoneChrome`, which is mounted on the next line, reset `--header-height`, or give it a `hero={false}` option. Keep one comment. |+| P9 | minor | `sales/ui/Quotes/QuoteHeader.tsx:117,338-354` vs `:148-151` | This is the only ad-hoc `isPhone` in a commercial header. It adds a phone-only Reopen to the bar that repeats the ⋯ menu's Reopen. The guard is only needed because `RecordAction` renders its children in place on desktop. | Give `RecordAction` a `phoneOnly` flag, or a way for `RecordHeader` to promote a menu item to the bar. Then the header has no `isPhone`. |+| P10 | minor | `invoicing/ui/SalesInvoice/SalesInvoiceHeader.tsx:218,422-427`; `PurchaseInvoiceHeader.tsx:224,403-408`; `.ai/research/2026-10-07-record-header-catalogue.md` ("Slot and variant duplicate each other: 9 files") | Each header computes `isDraft` for the slot, then restates `status === "Draft"` for the Button `variant`. Across SO, PO, Quote and both RFQs, every promoted action writes its condition twice (slot and variant). The catalogue flagged this, and it is still unsolved. | Use the boolean once. Give `RecordAction` a `lead` boolean that picks primary or overflow, and pass the same boolean to `variant`. At the least, reuse `isDraft`. |+| P11 | minor | 14 copies in scope (23 in ERP) of `opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100 max-md:opacity-100` (e.g. `SalesOrderExplorer.tsx`, `PurchaseReturnOrderExplorer.tsx`); the line-form header pair `max-md:flex-col max-md:items-stretch max-md:space-x-0` + `max-md:scroll-fade-x max-md:px-4 max-md:pb-2 max-md:empty:hidden` ×4 (`SalesOrderLineForm.tsx:506,580`, `PurchaseInvoiceLineForm.tsx:470,530`, …) | The phone change was made by appending to copied class strings, one file at a time. | One shared hover-reveal class or constant. One `LineFormHeader` (or the classes moved into `ModalCardHeader`) for the line-type tabs row. |++Checked and fine: the RecordHeader conversions keep the desktop conditions, variants and disabled rules (SO, PO and Quote compared line by line with the merge-base). `getSalesOrderLineTotal` matches the inline formula it replaced (`packages/documents/src/utils/sales-order.ts:47-86`). `RichTextView` keeps desktop blank when notes are empty (`packages/react/src/HTML.tsx:86-108`). No new casts or suppressions; the ones in the diff were moved, not added.++## Thermo-nuclear review: ops modules (inventory, production, quality)++Scope: `git diff origin/main...HEAD` limited to `apps/erp/app/modules/{inventory,production,quality}`. That is 111 files, +3462/−2229. Merge base: `3070451ffb`. `origin/main` is 59 commits ahead of it. The working tree in this scope is clean. Read-only review: no typecheck, build or tests were run.++No file goes from under 1000 lines to over 1000. This was checked against the merge base for every changed file. The largest increase is `InventoryStorageUnits.tsx`, from 698 to 856 lines.++| # | Sev | Where (file:line) | Problem | Simpler alternative |+|---|---|---|---|---|+| O1 | MAJOR | `PickingListHeader.tsx`, `StockTransferHeader.tsx`, `ReceiptForm.tsx:178`, `ShipmentForm.tsx:193`, `WarehouseTransferForm.tsx:164`; main: `origin/main:apps/erp/app/components/DocumentPage/DocumentPageHeader.tsx:20-43` | Since the merge base, main added a third header component, `DocumentPageHeader`. Its props are title, status, menuItems, actions and meta. Main moved the Picking List, Stock Transfer, Receipt, Shipment and Warehouse Transfer headers onto it. Main also cut 396, 514 and 454 lines from ReceiptForm, ShipmentForm and WarehouseTransferForm. This branch's rewrites of those 5 files are about 1,380 diff lines. They target code that main has since replaced. 43 files in this scope changed on both sides. After a naive merge there would be 3 overlapping headers: `DocumentHeader`, `RecordHeader` and `DocumentPageHeader`. | Rebase first. Give `DocumentPageHeader` the phone parts the way `DocumentHeader.tsx:54-57` does (`recordHeroSlot.Fill` + `RecordHero`, and `RecordPhoneChrome`), then wrap each caller's actions in `RecordAction`. Drop the branch's rewrites of these 5 files; do not port `RecordHeader` into them. |+| O2 | MAJOR | `inventory/ui/StorageUnits/StorageUnitForm.tsx:75-76,99,113,137,146,156-180,186,216,226` | One form has 9 `isPhoneEdit` branches: sheet height, header layout, Save moved into the header, a hand-built read-only Location input (lock icon and `useLocations` lookup), two `termId` suppressions, a different footer, and the one-caller `PrintButton label` (A12). The height class repeats Drawer's own `size="full"` phone class (`packages/react/src/Drawer.tsx:113`). The comment says the New sheet is left as it is on phones. | Use the New sheet's layout for edit too. `<Location isReadOnly={isEditing}>` already exists, so keep it. Keep the `termId`s and the footer. If full height is needed, pass `size={isPhone ? "full" : undefined}` to `ModalDrawerContent`. That deletes every `isPhoneEdit` branch. |+| O3 | MAJOR (open from earlier review B2/B10) | `inventory/ui/Inventory/InventoryStorageUnits.tsx:337,376-494,576,623-634` | B2 is marked Done, but this file still hand-rolls its phone rows (`phoneRowClassName`, 383). The group-header row (451-485) types out the member row's two-line markup again (397-430). The new `storageUnitLabel` helper (376) is not used by the desktop rows, which still inline the same lookup at 337 and 576. The phone `BottomBar` (623-634) re-types RecordPhoneChrome's bar (`RecordHeader.tsx:248`). | Build one phone row with quantity and meta passed in, and use it for both the group row and the member rows. Use `storageUnitLabel` at 337 and 576. For the bar, wrap the `CardAction` button in `<RecordAction slot="primary">` and add `<RecordPhoneChrome/>`, kept behind the existing `isQuantity` gate. |+| O4 | MAJOR | `inventory/ui/PickingLists/PickingListLines.tsx:205-208,284,420-506,558,627,639-641` | `isPhone` appears 10 times. `phoneButton` (`size` + `flex-1`) is spread into 7 Buttons by hand. `phoneButtonRow` is applied twice. The same `actions` node is placed in two positions (`isPhone ? null : actions`, then `isPhone && actions`). | Render `actions` once, in a container with `max-md:basis-full max-md:order-last max-md:[&_button]:flex-1 max-md:[&_button]:h-11`. Delete `phoneButton`, `phoneButtonRow` and the second placement. |+| O5 | minor | `quality/ui/RiskRegister/RiskRegistersTable.tsx:72,156-161,259` | The `isPhone` branch in the Source cell (a P3 column) re-implements what CompactRow already does: P3 renders inside `<EnumerableAsText value>` as muted 13px text (`CompactRow.tsx:118-123`), and `Enumerable` then renders as plain text (`Enumerable.tsx:28-29`). It also makes the column memo depend on `isPhone`. | Delete the branch and the `isPhone` dependency. Keep `<Enumerable>`. |+| O6 | minor | `inventory/ui/PickingLists/PickingListHeader.tsx:72,117-120,176-189,261-272`; `components/Assignee.tsx:46-48,71-75`; `StockTransferHeader.tsx:159` | On phones, PickingListHeader renders its own "Assign" Button and a second, hidden `<Assignee>`. To support this, Assignee gained controlled `open`/`onOpenChange` props, which have this one caller. The sibling StockTransferHeader does something else: it puts `<Assignee>` straight into the overflow slot. Assignee's trigger is a raw `<button>` (`Assignee.tsx:131-150`), so it does not render as a menu row there. `assigneeName` (117-120) also repeats the `optimisticAssignment` fallback already applied at 100. | Make Assignee's trigger a `Button`, so it follows ActionPresentation, and wrap it in `RecordAction slot="overflow"` in both headers. Then delete the hidden mount, the `isPhone` branch and the controlled props. Look up the name from the existing `assignee`. Not verified: whether the picker popover behaves well when opened from the ⋯ menu. |+| O7 | minor (desktop change) | `RecordHeader.tsx:338-357`; merge base `IssueHeader.tsx:68`, `QualityDocumentHeader.tsx:128-133`, `ProcedureHeader.tsx:73-78`, `AssemblyInstructionHeader.tsx` | RecordHeader always puts `status` after Copy and ⋯. In 4 desktop headers, the status and version badges used to sit before them: Issue (status before Copy), Quality Document and Procedure (version and status inside the Heading), and Assembly Instruction (status right after the name). | Treat this as a deliberate cleanup and say so in the PR, or put the badges back where they were on desktop. Any desktop change needs sign-off. |+| O8 | minor | `production/ui/Jobs/JobHeader.tsx:404-412` | A rule for phones only, in this header only: Pause is hidden unless it can act. Release, Complete and Cancel still appear as disabled overflow rows (460-510), and no other header follows this rule. | Drop the special case. Or, if hiding disabled actions is wanted, make `RecordAction` hide disabled bar actions on phones for every header. |+| O9 | minor (phone bug) | `inventory/ui/InventoryCount/InventoryCount.tsx:117-124` | An `IconButton` inside `RecordAction slot="overflow"` becomes a ⋯ menu row with only the info icon and no visible label. In row mode, Button renders only its children (`Button.tsx:273-279`), and IconButton passes only the icon (`IconButton.tsx:69-77`). | Use `<Button leftIcon={<LuInfo/>}>Notes</Button>` in the slot. Or make Button's row mode show `aria-label` as text when `isIcon`; that fixes it everywhere. |+| O10 | minor | `PickingListsTable.tsx:228`, `ReceiptsTable.tsx:54`, `ShipmentsTable.tsx:54`, `StockTransfersTable.tsx:281`, `StorageRulesGroups.tsx:133` | Each `NewAction` caller writes its action twice: a label, `to` or `onClick` for the phone "+", and the same things again on the desktop child. In `ReceiptsTable` the submit is written twice. The two copies can drift apart. | Have `NewAction` give its child an icon-only ActionPresentation inside the app bar, so the child Button becomes the "+" (Button already supports `iconOnly`). Then drop the `label`, `to` and `onClick` props. |+| O11 | minor | `AssemblyBomTree.tsx:1164,1177,1667,1754,1771`, `BatchItemCard.tsx`, `JobBillOfMaterial.tsx` and others: 17 in scope, 75 across 53 files repo-wide | Every hover-revealed control gets `opacity-0 … max-md:opacity-100` added by hand. | Write `md:opacity-0` in place of `opacity-0` so no new token is needed. Or add one utility next to the branch's global `hover` variant (`packages/config/tailwind/theme.css:12-23`). |+| O12 | minor | `ReceiptLines.tsx:465-605`, `ShipmentLines.tsx` (same hunks), `StockTransferLines.tsx:99-160`, `WarehouseTransferLines.tsx:144-183`, `PickingListLines.tsx:516` | Five sibling line rows get the same pasted class cluster for stacking the two halves on phones: `max-md:p-4 gap-4`, `w-1/2 max-md:w-full`, `max-md:flex-col max-md:items-stretch`, `pl-4 max-md:pl-0`. This doubles duplication that was already there. | Add one `LineItemRow` layout with left and right halves that owns the responsive classes. At the least, use it for Receipt and Shipment, whose rows were already near-copies. |+| O13 | minor | `Schedule/Kanban/context/KanbanContext.tsx:21,33`; `ItemCard.tsx:262`, `JobCard.tsx:317`, `BatchItemCard.tsx:242` | `moveTo` is optional, but both providers always pass it (`Kanban.tsx:584`, `DateKanban.tsx:477`). The three cards each repeat the same `{moveTo && <MoveToSubmenu getTargets=… onMove=…/>}` block. | Make `moveTo` required. Add a `<CardMoveTo itemId={item.id}/>` that reads the context. |+| O14 | minor | `production/ui/Jobs/JobMakeMethodTools.tsx:337,348,363,380` | `className="rounded-md"` repeats MenubarItem's own default (`packages/react/src/Menubar.tsx:33`). It is noise, and the same was done in `MakeMethodTools.tsx`. | Delete it. |+| O15 | minor | `inventory/ui/Inventory/InventoryDetails.tsx:65,94,133` | The usage-window `DateSelect` is mounted twice: once `md:hidden` above the tiles and once `max-md:hidden` in the card. This follows from the skipped B7 `variant`, but it is a separate problem. | Mount it once and move it with flex `order`, or use `isPhone` to pick where it renders. |++## Checked and fine++- **Kanban "Move to" (`Kanban.tsx`, `DateKanban.tsx`):** extracting `resolveColumnCommit`, `submitCommit` and `submitPlacement` is good restructuring. The drop and the phone menu now share one path, and the old guards are kept.+- **`MoveToSubmenu` / `MoveToMenu`:** gated to phones, so desktop does not change.+- **The 5 `RecordHeader` conversions** (Job, Issue, Quality Document, Procedure, Assembly Instruction): consistent and slot-correct. The only exceptions are O7 and O8.+- **`RichTextView` in the notes components:** on desktop the empty state is `hidden`, so there is no visible change.+- **The viewport-API rename commit (`5c51803534`), in scope:** mechanical. No `useIsMobile` or `compact:` is left.+- **No new `any` or casts were added.** The `!` assertions in the diff are moved code.++## Not re-reported++These are earlier minor findings that are still open but not important enough to repeat:++- **B12:** MRP recalculate is copied in `ProductionPlanningTable.tsx:594-639` and in `PurchasingPlanningTable`.+- **A4:** `useHideListAppBarMenu` in `InventoryItemHeader`.+- **A5:** `ReviewersList`.++## Thermo-nuclear review: ERP modules (items, accounting, workflows, resources, people, settings, account, documents, users, agent) and apps/erp/app/routes++Diff: `git diff origin/main...HEAD` over these paths (249 files). Most of them only rename classes or add `meta.mobile` slots; I skimmed those. Read-only review: no typecheck, build or test ran.++No in-scope file grew from under 1000 lines to over 1000. The largest growth was `BillOfMaterial.tsx`, 1392 → 1418. `BillOfProcess.tsx`, `IntegrationForm.tsx`, `priority+/operations.tsx` and `settings+/backups.tsx` were already over 1000 lines on main.++| # | Sev | Where (file:line) | Problem | Simpler alternative |+|---|---|---|---|---|+| R1 | MAJOR | `accounting/ui/Reports/TrialBalanceTree.tsx:64-76,115,124,127-162`, `MultiPeriodStatementTree.tsx:90-97,144-165`, `ExecutivePnlSummary.tsx:48-56,105-123`, `PivotTree.tsx:86-87,133-141,203,263-283,535-566` | **(Partly open from earlier review: B8 and B11.)** The phone "one column at a time" mode is copied into 4 sibling trees. Each one repeats `useViewport`, `useColumnStep`, `<ColumnStepper>`, `estimatedRowHeight: isPhone ? 44 : 36`, `rowWidth = isPhone ? undefined : …` and the wrapper class `max-md:h-auto max-md:min-h-0 max-md:flex-1`. MultiPeriod and Executive also share the same `visiblePeriods`/`currentPeriod`/`getPeriodColumnLabel`/"To Date" block, line for line. The siblings also disagree on approach. TrialBalance and MultiPeriod do not mount the desktop header on phones (`isPhone ?`). Executive (`:121-123`) and Pivot (`:281-283`, `:564-566`) keep it mounted and hide it with `max-md:hidden`, so on phones the Pivot header and footer still render their virtualized column cells, hidden. TrialBalance writes its column labels twice: `columnLabels` at `:66-76`, then the hand-written desktop header at `:137-162`. That desktop-only header also carries dead `max-md:` classes (`:137-138`). | Add one `useReportColumnStep(...)` (or a `ReportTreeFrame`) next to `ColumnStepper.tsx`. It returns `{ isPhone, rowHeight, frameClassName, visible, stepper }`, and every tree renders `stepper` in place of its header. Add `usePeriodStep(periods, columns)` for the two period trees. Use one rule for the desktop header and footer: `isPhone ? null : header`. Build the TrialBalance header from `columnLabels` and delete the dead `max-md:` classes. |+| R2 | MAJOR | `Reports/ReportFilters.tsx:185-203`, `Reports/PivotControlBar.tsx:506-526`, `Reports/PurchasesControlBar.tsx:326-344`, `routes/x+/people+/departments.tsx:157-183`, `ChartOfAccounts/ChartOfAccountsTableFilters.tsx:104-132`, `routes/x+/accounting+/fixed-assets.tsx:84-97`, `routes/x+/accounting+/asset-classes.tsx:83-…` | **(Download part open from earlier review: B11.)** Each site builds "desktop button in place, phone icon in the app bar" by hand. It is done two ways: a `max-md:hidden` desktop copy plus an `<AppBarActions>` copy, or an `isPhone ? <AppBarActions>… : …` ternary. The control is written twice each time. `PivotControlBar` mounts `viewMenu` twice on phones (`:515` and `:525`). `NewAction` (`components/New.tsx:54-91`) already does exactly this: render `children` in place, or an icon in the app bar on phones. Accounting siblings are now inconsistent. `journals.tsx` wraps its button in `NewAction`, but `fixed-assets.tsx:87` and `asset-classes.tsx:83` swap to `<New>` on phones with `isPhone ? … : …`. Two comments are also stale: `PivotControlBar.tsx:290-291` and `PurchasesControlBar.tsx:159-160` say Download "sits on the line below", but it is in the app bar. | Generalize `NewAction` into `AppBarAction({ icon, label, onClick \| to, children })`. Desktop renders `children`; phones render the icon in the app bar. Write each Download, ⋮ and + once inside it. `fixed-assets` and `asset-classes` can wrap their existing Button in `NewAction` as `journals.tsx` does. That deletes the `isPhone` ternaries and the `useViewport` imports. Fix the two comments. |+| R3 | MAJOR | `JournalEntries/JournalEntriesTable.tsx:105,243`, `Locations/LocationsTable.tsx:72-80,151`, `Timecards/TimecardsTable.tsx:125-136,227`, `Shifts/ShiftsTable.tsx:129-137,194` (the same pattern exists outside this scope in `KanbansTable`, `StorageUnitsTable`, `RiskRegistersTable`, `DemandProjectionTable`, `JobsTable`) | Desktop column definitions now branch on `isPhone` inside `cell`, and `isPhone` is in the column `useMemo` deps. Every list that needs a different phone cell adds a viewport fork to the desktop cell renderer, and the columns rebuild when the viewport changes. The compact list already renders a column through its own path (`renderCell` in `Table/components/Compact/CompactRow.tsx:13-28`). | Add `meta.mobileCell?: (row) => ReactNode` to `Table/types.ts:45-54`, and have `CompactRow.renderCell` prefer it. The columns then have no `isPhone`, no extra memo dep and no `useViewport`. |+| R4 | MAJOR | `items/ui/Parts/PartHeader.tsx`, `Tools/ToolHeader.tsx`, `Materials/MaterialHeader.tsx`, `Consumables/ConsumableHeader.tsx`, `Services/ServiceHeader.tsx` | A missed code-judo step: this branch rewrote all 5 headers into the same `RecordHeader` body (about 650 diff lines). `diff MaterialHeader ConsumableHeader` shows only the type, nav hook, path and label differ. Tool and Part add one "Create Change Notice" item, and Part adds a lifecycle pill. | One `ItemRecordHeader({ summary, links, detailsTo, deleteLabel, canChangeNotice, status })`. Each file shrinks to a few lines, or goes away. |+| R5 | minor (desktop change) | `components/Layout/RecordHeader.tsx:343-357` vs main `ChangeNoticeHeader.tsx:85-88`, `MaintenanceDispatchHeader.tsx:61-63`, `TrainingHeader.tsx:82-85`, `PartHeader.tsx:83-89` | The desktop order of the header row changed. `RecordHeader` always renders Copy, ⋯, status. On main, Change Notice, Maintenance Dispatch and Training put the status before Copy, and Part put it between Copy and ⋯. | Accept it as a deliberate desktop change and say so in the PR, or keep each header's old order. |+| R6 | minor | `items/ui/Item/MakeMethodTools.tsx:369-372,418-422,377,392,406`; `routes/x+/part+/$itemId.details.tsx:340` | With `versionInSlot`, `versionMenu` mounts twice on phones: the slot `Fill`, plus a `<div className="max-md:hidden">` copy. That wrapper sits inside a `Menubar` that is already `max-md:hidden` (`:372`), so it is redundant and only adds a desktop DOM node. The route restyles the trigger through `[&_button]:…` descendant selectors. `className="rounded-md"` on 3 `MenubarItem`s repeats the default from `packages/react/src/Menubar.tsx:33`. | `{versionInSlot && isPhone ? <methodVersionSlot.Fill>{versionMenu}</methodVersionSlot.Fill> : versionMenu}` in one place. Pass the trigger styling as a prop. Delete the 3 `rounded-md`. |+| R7 | minor | `Reports/ColumnStepper.tsx:16-27` | `useColumnStep` resets state in an effect when `count` changes (with a `biome-ignore`). That is an effect copying a prop into state: one render uses the stale index, then the component renders again. | Reset during render: keep `{ count, index }` in state and reset when `count !== state.count`. Or key the tree by the column count. |+| R8 | minor | `Reports/PivotTree.tsx:87,535-563,616` | **(Open from earlier review: B8.)** `const rowColumnWidth = ROW_COLUMN_WIDTH` is an alias that does nothing, threaded through about 10 sites. The phone footer's nested ternary repeats the desktop footer's percent/measure total formatting. | Delete the alias. Add one `formatColumnTotal(columnKey \| null)` used by both footers. |+| R9 | minor | `documents/ui/Documents/DocumentsTable.tsx:516`, `items/ui/Item/ItemManufacturingForm.tsx:106-122`, `people/ui/Person/PersonPreview.tsx:83-84` | Phone-only versions of rules that are not about phones. Upload is hidden in Starred/Trash on phones only. Save stays disabled until a field is touched on phones only, and for this one form; that half-copies `DefaultDisabledSubmit` (`packages/form/src/components/Submit.tsx:42-58`). An empty manager shows "—" on phones only. | Apply each rule on every viewport (this is a desktop change, so it needs sign-off), or drop it. Use `DefaultDisabledSubmit` (or its touched logic) instead of a new `ManufacturingSubmit`. |+| R10 | minor | `workflows/ui/Builder/WorkflowBuilder.tsx:214-220` vs `TestRun/TestRunPanel.tsx:35-38`; `Builder/BuilderHeader.tsx:67-120,224-236` | The phone result sheet repeats `TestRunPanel.close()`, the pair of resets that the panel's comment says must stay together. `BuilderHeader` builds its own `RecordHero` + `RecordPhoneChrome` + desktop header, an `inHero` variant and a `!isPhone` render-once rule. That copies `RecordHeader`'s `titleInHero` (`RecordHeader.tsx:262-266,338`). | Add a `clearTestRun()` store action and use it in both places. Let `WorkflowTitle` read `isPhone` itself and drop the `inHero` prop. |+| R11 | minor | `routes/x+/reimbursements+/$reimbursementId._index.tsx:189-191` (the same in `CustomerHeader.tsx:122`, `SupplierHeader.tsx:178`) | An empty `<RecordHero />` is mounted only to zero `--header-height` (the comment says so). `RecordHero` and `RecordPhoneChrome` always have to be mounted together. | Let `RecordPhoneChrome` take `title/subtitle/status` and own the hero, so one component is enough and no hero is mounted just to zero the variable. |+| R12 | minor | `routes/x+/issue-workflow+/new.tsx:76-92`, `routes/x+/inventory+/quantities+/$itemId.tsx:101-122` | `issue-workflow/new` writes its own pushed app-bar override instead of using `NewRecordPage` (`components/NewRecordPage.tsx:16-25`), only because the route has no breadcrumb. Both routes gate the override on `isPhone`. The only reader, `MobileAppBar`, mounts only on phones (`routes/x+/_layout.tsx`, `isPhone && <MobileAppBar />`), and `NewRecordPage` does not gate. | Give `NewRecordPage` a `backTo` prop. Drop the `isPhone` gate and `useViewport` from both overrides. |+| R13 | minor | `routes/x+/workflows+/runs.$runId.tsx:83-96` | Dead code. `DrawerContent` already skips autofocus on phones through `usePhoneOpenAutoFocus` (`packages/react/src/Drawer.tsx:210`, `Viewport.tsx:99-104`). | Delete the `onOpenAutoFocus` handler and `useViewport`. |+| R14 | minor | `Reports/ReportFilters.tsx:110`, `PivotControlBar.tsx:293`, `PurchasesControlBar.tsx:162`, `ChartOfAccountsTableFilters.tsx:57`; `account/ui/UserAttributes/UserAttributesForm.tsx` (the same row class 16×); dashboards `routes/x+/{sales,purchasing,resources,quality,production}+/_index.tsx` | The 8-token phone chip-row class is copied 4×. The same suffix is appended to 16 identical row strings in `UserAttributesForm`. The KPI-grid suffix appears in 5 dashboards, and `max-md:h-[150px]` 7×. | A `ChipRow` component (or one const) for the scroll row. One `rowClassName` const in `UserAttributesForm`. A shared KPI-grid/chart-height const for the dashboards. |+| R15 | minor | `routes/x+/resources+/_index.tsx:682-711` | `DispatchTable` builds its phone list row (`ul` / `Link` / 3 lines) by hand, next to the shared `SummaryLineRow` (`components/SummaryLineRow.tsx`). | Make `SummaryLineRow`'s `value` optional and use it with `title`, `description`, `meta` and `to`. |+| R16 | minor | `routes/x+/templates+/_index.tsx:20-28` | `SettingsSections` is defined inline in a route. Its siblings `InventorySections` and `ProductionSections` are exported next to their submodule hooks (`inventory/ui/useInventorySubmodules.tsx:172-177`). | Export `SettingsSections` from `settings/ui/useSettingsSubmodules.tsx`. |+| R17 | minor | `routes/x+/priority+/dates.tsx:581-589`, `priority+/operations.tsx:590-598` | The phone-keyed display settings (`${KEY}-compact`, no thumbnail) are copied in both priority routes. | One `usePriorityDisplaySettings()`. |+| R18 | minor | `routes/x+/part+/$itemId.tsx:67` vs `tool+/$itemId.tsx:61-67` (and material, consumable, service) | Only Part sets `appBarSubtitle`. Its 4 item siblings fall back to the list crumb, so phone app bars disagree across item types. | Set `appBarSubtitle` on all 5 item routes. That falls out of R4 if the headers merge. |++Earlier-review items checked in this scope: B5 (method tools now use `RecordAction slot="overflow"`) is fixed. B6 (`appBarSubtitle` on the route handle) is fixed for the routes it covers. B8 and B11 are still open: see R1, R2 and R8.++## Thermo-nuclear review 2 — MES, printing, documents (`origin/main...HEAD`)++Scope: `apps/mes/**`, `packages/printing/src`, `packages/documents/src` (54 files, +4936 / −2980). Read-only; nothing was built or type-checked.++Line counts: no file crossed 1000 lines on this branch. Already-oversized files grew: `InspectionView.tsx` 1384 → 1517, `AssemblyView.tsx` 3713 → 3804. `JobOperation.tsx` shrank 3432 → 3001.++| # | Sev | Where (file:line) | Problem | Simpler alternative |+|---|---|---|---|---|+| M1 | MAJOR | `apps/mes/app/root.tsx:109` (loader), `:256` (no provider); `JobDag/JobDag.tsx:164-168` | MES never mounts `ViewportProvider`, so `useViewport()` uses the `"desktop"` server snapshot (`packages/react/src/Viewport.tsx:74`). Every `isPhone` gate (MesAppBar:76, Materials:256, jobs list, timecard list, Assembly/Inspection headers) renders the desktop tree on the server and during hydration, then swaps on phones. The `max-md:hidden` on every desktop header hides this, and `JobDag.tsx:164` adds an effect to work around it ("MES has no server viewport hint, so the first render is desktop"). The ERP already solved this: `apps/erp/app/root.tsx:173` `getViewportHint(request)` + `:336` `<ViewportProvider initialViewport=…>`. | Copy those two lines into the MES root loader and `Document`. Then delete the JobDag effect: derive `direction ?? (isPhone ? "TB" : "LR")`. |+| M2 | MAJOR | `MesBottomBar.tsx:15-41` (hook only); 5 hand-rolled bars: `AssemblyView.tsx:2604`, `InspectionView.tsx:936`, `timecard.tsx:660`, `picking.$pickingListId.tsx:211`, `Controls.tsx:63`; `tailwind.css:168-180` | C2 asked for one `MesBottomBar`. The branch shipped a hook instead, and each caller repeats `ref` + `data-mes-bottom-bar` + safe-area padding + `md:hidden`. The bars are hidden with CSS, not gated, so on desktop their contents still mount twice next to the header copies. These copies hold state: `PickingListControls` (own `useFetcher`, effect, acknowledge-modal state; `picking.$pickingListId.tsx:189` and `:220`), `CompletePassedButton` (own fetcher; `InspectionView.tsx:703` and `:945`, with a `variant` fork at `:1228-1252`), and the timecard clock form (`timecard.tsx:340` and `:666`). The hook also copies the ERP's `useCompactCssVar` (`apps/erp/app/components/Layout/Mobile/ChromeSlots.tsx:45-66`). The ERP already has `BottomBar` / `MobileBottomChrome` slots for this (`ChromeSlots.tsx:38`, `:73-82`). | Move `createPortalSlot`, `BottomBar`, `MobileBottomChrome` and `useCompactCssVar` into `@carbon/react`. Wrap `MesTabBar` in `MobileBottomChrome` in `_layout`. Pages render `<BottomBar>` (phone-only, one mount). The tab bar's slot replaces the header control, so delete the `md:hidden` copies. This removes `--mes-bottom-bar-h`, `data-mes-bottom-bar`, the `:has()` toast rules and the `variant="bar"` fork. |+| M3 | MAJOR | `tailwind.css:173`, `MesTabBar.tsx:94`, `ConsolePill.tsx:39`, `timecard.tsx:664`, `assigned.tsx:299`, `operations.tsx:657`, `_layout.tsx:544` | The tab bar height `54px + env(safe-area-inset-bottom)` is still hard-coded 7× (C2 is marked done, but this part was not fixed). `assigned`/`operations` size the page with `100dvh-54px-…`. | Measure it once as a CSS var (the `--content-inset` of M2), or at least one `--mes-tab-bar-h` in `tailwind.css` used by all 7. |+| M4 | MAJOR | `MesAppBar.tsx:18-36`, `:58-76`; callers `AssemblyView.tsx:1855-1866` + `!isPhone && <header … max-md:hidden>`, `InspectionView.tsx:625-650` (same), `job.$jobId.tsx:74-81`, `picking.$pickingListId.tsx:172-178`, `dispatch.$dispatchId.tsx:270-277` | `desktop?: ReactNode` has three states (undefined = default header, null = none, node = custom), but no caller passes a node: 7 callers pass `null`, then each mounts its own md+ header next to it. Two gate it with `!isPhone`, three only hide it with CSS. `kind` repeats `back` (every `"pushed"` caller passes `back`, no `"root"` caller does). `desktopTitle`/`desktopClassName` exist for 2 callers. | Make `MesAppBar` phone-only (it returns `null` unless `isPhone`). Derive "pushed" from `back`. Add a 10-line `MesQueueHeader({ title })` for the root pages' md+ header. Pages that own a header render it behind `!isPhone`. Delete `kind`, `desktop`, `desktopTitle` and `desktopClassName`. |+| M5 | MAJOR (open from earlier review, C8, now a rule breach) | `JobOperation.tsx:1180-1196` (context row ×2, meters ×2), `:2711-2717` (Times); rule `.claude/rules/mes-job-operation-ui.md:293-296` | The operation rule says the context bar "scrolls sideways … instead of hiding, so there is no mobile-only duplicate". The branch renders `renderContextRow` twice (grid area + inside the Details pane, `md:hidden`) and `meters` twice (Details pane + `Times`, `max-md:hidden`). The context row includes the batch scope `DropdownMenu`, so it mounts twice. The context row now wraps on phones (`:1002` `max-md:flex-wrap`) instead of scrolling, which also breaks the rule. | Render each once and move it with the grid: on phones with Details active, put `context` and `status` inside the `main` track (template-areas switch under `max-md:` + `data-tab`), or gate the second copy on `isPhone` once M1 lands. Otherwise update the rule. |+| M6 | MAJOR (desktop change) | `hooks/useOperation.tsx:93-107`; `JobOperation.tsx:498-503`; `JobOperation.tsx:2586-2608`, `:2650`, `:2666`; `Controls.tsx:215`, `:219`, `:231` | The operation screen changes on md+. (a) The initial work type now opens on the running timer (Setup → Machine → Labor), not the first planned type. (b) The running caption now follows the selected type, and the fallback order changed from setup/labor/machine to setup/machine/labor. (c) Tablets (md–lg) get a new caption row (`md:max-lg:order-first …`), "Log completed"/"More" labels under the icons, and larger `max-lg:` dots and text in `WorkTypeToggle`. (d) The actions sheet gets a "More actions" title (`:2730`). | Scope (b)–(d) to `max-md:`. Ship (a) on its own, as a desktop behaviour change with its own note, or limit it to phones. |+| M7 | minor (desktop change) | `JobOperation.tsx:1145-1152` (Back now `navigate(origin.to)` / `origin.label`, was Schedule); `complete.tsx:240`, `:315`, `:387`; `finish.tsx:52`; `inspection-lot.$id.disposition.tsx:397`, `:406` | Origin threading changes desktop navigation. Back and finishing an operation now return to the opening queue, not Schedule. It is probably intended, but it is not phone-scoped and no note says so. | Keep it, and record it as a deliberate cross-viewport change (PR description / rule). |+| M8 | minor (desktop change) | `_layout.tsx:539-545`; rule `mes-job-operation-ui.md:277-281` | `lg:max-h-[calc(100dvh-1rem)]` on an `overflow-hidden` frame stops the page area at the screen from lg. The rule still says the frame is "only `min-h-svh` bounded because other screens page-scroll". Any route without its own scroller now clips at lg (`job.$jobId.tsx`, `picking.tsx` have no `overflow-y-auto`; I did not check how they render at lg). | Check those routes at lg and update the rule's "Height" bullet. |+| M9 | minor | `OperationCardParts.tsx:19-27`, `:50-62`; `OperationsList.tsx:119` + `:142`, `:214` + `:224`; `ItemCard.tsx:137` + `:232`, `:338` + `:344`; `AssemblyView.tsx:1912-1913` + `:2181`; `InspectionMeasurementMatrix.tsx:625` + `:642` | Several places render a phone copy and a desktop copy and hide one with CSS. On each card the thumbnail `<img>`, `AssigneeTags` and the duration exist twice, for every card on the board. `OperationCardParts` is mostly helpers for this. The Assembly steps bar (with its filter `DropdownMenu`) mounts 2–3×. The gauge picker (Popover + state) mounts twice per measurement row. | Read `isPhone` once in the list or row and render one copy (after M1 there is no flash). Or place the single element and move it with CSS `order` / grid areas. |+| M10 | minor (open from earlier review, C9) | `operations.tsx:599-650`, `assigned.tsx:238-293` | `displayPopoverContent` is still copied (about 50 lines, with `key as keyof DisplaySettings` casts). Within each page it is reached from two triggers. | Use one `<DisplaySettingsPopover settings onChange>` in `components/Kanban`, typed with `keyof DisplaySettings` arrays. |+| M11 | minor (open from earlier review, C11) | `MoreSheet.tsx:205-207`; `Kanban/Kanban.tsx:67-76`; `JobDag.tsx:166-168` | Effects copy props into state: reset the screen when the sheet closes, add new columns to the order, switch direction on phones. The Kanban effect also changes desktop (columns that come back after a filter clear now show; a bug fix, unannounced). | MoreSheet: reset in `onOpenChange`. Kanban: derive `[...order.filter(inColumns), ...missing]` at render. JobDag: see M1. |+| M12 | minor | `dispatch.$dispatchId.tsx:455`, `:684-697`; `:350-361`, `:618-630` | The phone Complete builds its FormData by hand and repeats the hidden fields of the desktop `ValidatedForm` (`dispatchId`/`eventId`/`action`), skipping the validator. Wrapping both rich-text blocks in `ClientOnly` changes desktop: the description no longer renders on the server and pops in after hydration. | Give the existing `ValidatedForm` an `id`, and make the confirm modal's Complete a `type="submit" form={id}` button. Fix the `generateHTML` server output (or use the shared rich-text view) instead of `ClientOnly`. |+| M13 | minor | `MesTabBar.tsx:58-78`, `:91-96`; `_layout.tsx:551` | The keyboard-hide logic adds document `focusin`/`focusout` listeners on every viewport (the tab bar is always mounted, `md:hidden`). It uses `isEditableTarget`, which also matches `role=menu`/`listbox` (`packages/react/src/utils/keyboard.ts:16-18`), so opening any dropdown hides the tab bar. Then it subtracts checkbox/radio types by hand. Visibility is stored twice (`hidden` class + `data-visible`). | Gate on `isPhone`. Use `isTextEntryTarget` (`keyboard.ts:27`) with one type check, and drive both CSS and toasts from `data-visible` only. |+| M14 | minor (open from earlier review, C12) | `UserNav.tsx:160`, `:196`; `AppSidebar.tsx:119-140` | `UserNav` only renders when `!isMobile` (phones get `MoreSheet`), so `side={isMobile ? "bottom" : "right"}` is dead. | Use `side="right"`; drop `useSidebar` from `UserNav`. |++Checked and found clean:+- `packages/documents/src/utils/index.ts` only re-exports `getSalesOrderLineTotal`.+- `PrintButton` `label` has one caller (ERP; A12, open).+- `Materials.tsx` row model matches the old desktop table: the primary/secondary variant, the direct rule `=== false` and the batch totals (only when batched, `JobOperation.tsx:1813`) are the same.+- `utils/origin.tsx` owns the origin logic, as C5 asked, and its `readOrigin` `/x/` guard blocks open redirects.+- `ToolSurface` / `useToolSurface` (C3) are fine.