Handoff — esg-field UI and the NCR capture flow
Session e038f9b9 · Claude Opus 5 (Claude Code) · 2026-08-01
Branch feat/rn-app-parity · State tsc clean, 12 suites / 132 tests pass
Scope apps/esg-field only. Nothing in app/ (the console) was touched.
Read this with docs/WORKLIST.md § C27, which carries the same decisions in worklist form. This file is the narrative; the worklist is the checklist.
1 · What is on the branch now
The shell
- Two destinations. Home and Chat. Four destinations plus the centre mic were built and reverted in this session — the label under the button was clipped by the button. There is no Messages destination: Chat is the messaging surface.
- A tap on the centre control never leaves a flow. It used to mean "open the conversation with the mic listening", which is right on a destination and wrong everywhere else — pressed mid-capture it threw the operator into Chat and left the work behind.
- A flow can BORROW the centre button (
CaptureControlinapp/index.tsx): it registers a glyph, a press and a release. Nothing registered → the button is the microphone it has always been. State, not a ref: the bar has to re-render when the sheet swaps voice for camera.
Home
Two counted tiles (Work = Inbox | Tasks, Activity = In progress | Completed) over four action slabs. No section headings, no "Running now" — a half-finished walk is a row under Activity › In progress. The slabs stretch to fill the screen below the tiles.
The NCR capture flow — re-cut around the capture
It ran Site → Classify → Notes → Photos → Summary → Confirm: four questions before the operator could say what they were looking at. Now:
- Record what you see — a
Voice | Photoswitch, not two steps. - Classify — category → severity → site last.
- Review.
- Push-to-talk on the bar's centre button, with the full-screen listening overlay (
ui/voice.tsx'sListeningOverlay, the same one the shell raises). - Many recordings, each deletable and each playable. The transcript is DERIVED from the list, never stored beside it — held as its own state it drifts the moment one is deleted, and the ticket then says something no recording on the device backs up.
- Photos show, on both steps, and are removable. 96pt thumbs with a ✕.
- Typing works on both tabs. It was bolted to the voice tab.
- Review uses dropdowns, not chips.
2 · Three real bugs, and their root causes
Keep these; they are the kind that come back.
- Sherpa red box — "Audio file is empty or could not be read".
transcribeFileREJECTS on a zero-length wav and the rejection comes back through the TurboModule as a red box, which atryaround the JS call cannot absorb. A push-to-talk control produces exactly that file on a brief press. Fix: a 400ms floor (MIN_RECORD_MS) andengine.cancel()— the recogniser is never handed the file. Also caught one step earlier, for a release that arrives while the engine is still starting. - The responder re-bound mid-press → live mic, model never released, crash. The registered capture control was rebuilt whenever a callback it closed over changed identity — and
pinAnchorchanges identity the moment it pins, which is the FIRST thing a press does. Pressing caused: pin → newpinAnchor→ effect cleanup →setCapture(null)→ re-run →setCapture(new)→ the bar re-renders → the responder is re-bound while the finger is still down. The release then ran on a different closure than the press, andonResponderTerminatefired on the old one. Fix: the object handed to the bar is built ONCE per(step, medium); its callbacks read the current handlers out ofgestureRef. Do not add the callbacks back to that effect's dependency array. - SVG overlays drawing a visible hard-edged rectangle inside every control.
style={StyleSheet.absoluteFill}pluswidth="100%" height="100%"on an<Svg>resolves against two different boxes in react-native-svg. AviewBoxdoes not fix it either — a viewBox scales the CONTENT to the surface, it never tells the surface how big to be. Fix: measure the parent withonLayoutand hand the<Svg>real numbers (seeui/gradient.tsx).
3 · Decided the hard way — do not re-open without new evidence
- Button treatment is a GRADIENT. One vertical gradient over one solid hue. Chosen off a 34-treatment sample sheet.
- Liquid glass — BUILT AND REJECTED. Bevel, raking sheen, rim light, plus a coloured backdrop for the panes to stand in front of. Glass reads well over something colourful; this app's ground is not, and the ground is to stay the app's own near-black. Without transmission it was three gradients of effort for a box with shiny edges.
- Neumorphic chrome — BUILT AND REJECTED. On a near-black surface the light half needs so little white that it reads as a smudge, not a shape.
- Deep fills with white marks — BUILT AND REJECTED. Measured 5.4:1 and looked like mud: yellow will not go dark without becoming olive, nor orange without becoming brown, so the colour code — the only reason the fill exists — was the first casualty.
typeColors()still exposesdeep; do not use it as a slab. - The selected bar destination carries its state TWICE, hollow and accent. Plain ink was tried and reverted: slate-on-slate is too quiet to find.
- Two icon weights, and they are not interchangeable.
ui/icons.tsxis 1.7pt hairline for bars and lists;ui/appIcons.tsxis filled silhouettes with a knockout, for the Home slabs only. At 20pt a filled mark is a blob. - The Five Questions glyphs are compass / waypoint pin / target-and-pin with the gap / dominoes / splash / signpost. Four earlier attempts failed on sight and every one was caught by RASTERISING and looking: intent read as the Mars symbol ♂, consequence was the DOWNLOAD glyph and then the WIFI glyph, cause read as "III". Render icons and look at them. Do not reason about them.
- No video. There is none in the app and the ticket's evidence payload has no slot for one. Photo mode is stills; a hold is another way to press.
4 · Not true, and not done
- Nothing here has been checked against WCAG on the handset. White marks on the bright hues are carried by a SHADOW, which is a real technique and not a measurable contrast ratio. If it fails in daylight the answer is dark ink, not a bigger shadow.
CapturedEvidence.audioUriis the FIRST recording only. The ticket's evidence payload has one audio slot and that is an append-only event vocabulary;recordingstravels beside it. Widening the event shape is its own ticket.NoteCapture.tsxis no longer reachable from the capture flow. The file remains.- TaskFlow has not registered a centre control. Holding works there (it parks a spoken-command handler) but a tap does nothing, because no screen should have a "logical next action" invented for it by the bar.
- A finding saved WITHOUT an NCR still has nowhere durable to go. Unchanged, and the flow says so rather than pretending.
5 · The next task — the site map (WORKLIST C27)
Asked for: on Home, project thumbnails; selecting one displays that project's site map beneath; the four action slabs under that, raising work against the selected project and, where a zone is tapped, that location. Inspection / investigation / audit should open from there too.
Renderer decision — react-native-svg, NOT a native map SDK. It is already a
dependency (every icon is drawn with it), so there is no prebuild and no new
binary for testers. A native SDK buys live tiles and pinch-zoom a corridor
schematic does not need, at the cost of a ten-minute rebuild on every handset.
This requires a deliberate reversal, and the codebase currently argues the
opposite. apps/esg-field/data/sites.ts says:
NO GEOMETRY HERE, DELIBERATELY. The device does not draw a plan.
That reasoning was sound and its premise is what changes. The geometry is in the
console's app/lib/sitePlans.ts, and the location and asset ids already match
across both sides on purpose — so porting it needs no translation table, which
is the thing that would have rotted.
Build order
- Port the corridor geometry into
apps/esg-field/data/as data. ui/siteMap.tsx— alignment, station points, environmental zones, a pin for the current GPS fix, zone tap-to-select. Serves both the thumbnail and the full map at two sizes.- Home: thumbnails → map → the four slabs.
- Wire the selection into capture, so the site and location are answered by where you tapped instead of asked cold on step 2.
Step 4 is the point. sites.ts complains that nothing binds a record to a
location; this is what closes that.
Watch for: Home gets tall with thumbnails + map + slabs. The slabs currently
stretch to fill the screen (flex: 1 rows inside a flexGrow: 1 scroll
container) — they will need a fixed height, and the page scrolls. That was an
explicit request earlier, so change it deliberately, not silently.
6 · How to verify
cd apps/esg-field
npx tsc --noEmit # expect: silence
npx jest # expect: 12 suites, 132 tests
Everything on this branch is TypeScript — no native module was added, so a Metro reload is enough. Do not spend ten minutes on a rebuild.
On the handset: Home → NCR Ticket → hold the centre mic, speak, release. The note appears with a Play control. Then the Photo tab, take two, delete one. Then step 2 reads category → severity → site.
The design sample sheet is docs/design/action-buttons-and-palette.html — 34
button treatments in five passes, the full palette, and a Daylight toggle that
washes the screen out the way a phone goes at arm's length on site. Open it as a
local file; it is self-contained.
7 · Scouted before stopping — read this before porting the geometry
The port in §5 step 1 is not "copy one object". app/lib/sitePlans.ts is 1117
lines and a corridor's geometry is assembled from several constants:
OL_ZONES · OL_ASSETS · OL_PLOTTED · OL_GEO · OL_DIAGRAM (and the EG_* pair)
views: [OL_GEO, OL_DIAGRAM, TABLE_VIEW] — so each corridor carries two
geometries: a planimetric one and a schematic one. The device wants the
planimetric view (*_GEO); the diagram view is the train-car strip and is not
what a site map is for.
The trap, and it is stated in that file because it has already happened once.
There is a shared PLAN_BOX — the box each corridor's planimetric view is
projected into — and it is exported and imported by
scripts/build-corridor-basemap.mts, which pre-projects the street basemaps at
build time. The file's own words:
if these numbers change here and not there, the streets end up drawn in a different coordinate space from the alignment sitting on top of them — and NOTHING ABOUT THE PICTURE SAYS SO. It still looks like a map. It is just quietly in the wrong place.
So: PLAN_BOX travels with the geometry, or the port is wrong in a way that
looks right. If the device is to draw streets under the alignment as well, the
basemaps already exist — public/basemaps/, public/maps/ontario-line-streets.svg,
public/maps/eglinton-crosstown-streets.svg — but note they are SVG files,
and react-native-svg cannot import a file without react-native-svg-transformer,
which is not installed. Either add that (a Metro config change, not a
prebuild), or draw the alignment alone on a plain ground and skip the streets.
Why this session stopped here rather than starting. Porting five constants
plus PLAN_BOX, writing ui/siteMap.tsx, rebuilding Home and rewiring capture is
a four-file change, and it was not going to land whole. A half-applied port of
geometry whose coordinate space has one documented failure mode is worse than an
untouched branch. The branch is green; start fresh with this section open.
8 · The geo-referenced basemap — everything needed to build it
Asked for: the thumbnails and the map should look like the console's planimetric view — streets and rivers under the alignment, not the bare line.
The data is ready and needs NO new dependency. public/basemaps/*.json:
{ id, w, h, attribution, paths: [ { c: "<class>", d: "<svg path>" }, … ] }
ontario-line.json w 1120 · h 1080 · 3803 paths · 308 KB
eglinton-crosstown.json · 338 KB
c is the class the builder assigned (river for waterways, secondary and the
other highway tiers for roads — see scripts/build-corridor-basemap.mts).
React Native require()s JSON natively, so this bundles with no Metro
transformer and no prebuild.
Three things to get right, in order:
siteMap.tsxmust stop projecting to the view. It currently callscorridorProjection(width, height, …)— its own box, sized to the component. The basemap is already projected into the box in its ownw/h. Draw EVERYTHING in that box behind<Svg viewBox={"0 0 " + w + " " + h}>and let the SVG scale it, so basemap and alignment share one space and there is no shared number for the two to drift on.- PROVE the alignment lands on the streets. The basemap was projected by
scripts/build-corridor-basemap.mtsusingPLAN_BOXfromapp/lib/sitePlans.ts; the device must project the route with the SAME margin and the SAME extent list, or the line sits beside the roads. Check one station against a street it is known to be on before believing the picture — this is the documented failure mode and it looks fine when it is wrong. - Filter by class for the thumbnail. 3803
<Path>nodes in a 104pt tile is a scroll that drops frames. Rivers and the top one or two road tiers for the thumbnail; the full set only on the large map.
Layout to match (the console's view, and the reference image): map fills its card edge to edge with the label text OUTSIDE it, station labels beside their points, zone labels above their circles in the category colour.
Status: not started. Home currently draws the alignment, stations and zones on a plain ground — correct, honest, and not what was asked for.