Karyo
Documentation/ Decision records

ADR 0067: The floor view shows what Karyo knows now, and draws nothing it cannot back with a row

Karyo 2.1.1rendered at build time
On this page

Status: Accepted

Context

ADR 0066 drew the floor from the layout. The approved design also shows what is happening on it: people, trucks at the doors and the temperature of a cold room against its set point. Karyo stores some of this and not the rest:

  • Each operator has one row (operator_positions): where they last confirmed a task or scanned, and when. It is kept only while the Facility's dispatch orders work by position, and the one read of it returned the caller's own row.
  • A goods receipt names the dock it is at (dock_location_id), and a dock door may name the location it serves. A receipt has a carrier name and no supplier.
  • A zone had a set point and no reading. A shipment has no departure time.

Showing named people at work is a workforce view, so it is not a side effect of reading the layout.

Decision

  • People are a read of their own. The action work.positions.read (the 34th) returns every operator whose position was recorded in the last 12 hours, by name, with the location and how Karyo learned it (GET /api/v1/work/positions). Only the Manager profile holds it. An Administrator does not, as it does not hold operations.supervise. A migration adds it to the Manager profile and to no other, and an installation adds it to another profile by hand. Without the action the floor view asks for nothing and shows no people and no people figure.
  • A person is where they last stood, with its age, and is never animated. The drawing puts a figure at the location's floor point and writes the age on its card ("4 min ago", "last confirmed task"). Nothing moves between two confirmations, because Karyo does not know that anyone did. The card says "Not a live track".
  • Room temperature is the latest reading, with its time. PUT /api/v1/zones/{id}/temperature stores one value for the zone (zone_temperature_readings, one row for each zone, an older reading never replaces a newer one) and the floor plan serves it. Any sensor feed, or a person, may post it with the layout write action. The floor view judges a reading against the set point only while it is under 30 minutes old: inside the range the room's label shows the number quietly, outside it the label turns amber and the strip counts the room. An older or missing reading is never judged, and the room shows its set point alone: its card says "No recent reading, last 45 min ago" and carries no value.
  • A truck is drawn only where a row puts it. An open goods receipt (created or started) that names a dock puts one truck at an inbound door whose location is that dock. Doors have no unique location, so when several inbound doors serve one dock the truck stands at the one with the lowest id and its card lists the other inbound doors; the figure counts docks with a truck, never doors. An outbound door never shows a truck, because a goods receipt is inbound. A door with no location, and a dock no inbound door serves, show nothing. The card names the receipt and the carrier; no supplier, departure time or route is shown, because Karyo has none to back it.
  • Polling, not pushing. The page asks for people and open receipts every 30 seconds and for the floor every minute, and only while the tab is shown. A failed live read leaves the floor standing and says so under the drawing.
  • Amber means look, red means stopped. An out-of-range room is amber. Red is still only a lock.

Consequences

A Facility that does not dispatch by position has no positions, so its floor view shows no people even to a holder of the action. The page says what a person is and where the figure comes from.

The catalogue of actions grew for the first time since ADR 0048, in four places that must stay equal: Actions, config/action-catalogue.json, the two front ends' ACTIONS, and the auth migration. A guard test keeps them equal. The delegation rule applies as for any action: only a holder of work.positions.read can grant a profile that holds it.

The demo warehouse seeds one reading for its chilled room, dated when the demo was seeded, so the room shows its age like a real one. It seeds no truck and no position: both come from the demo's own receiving and dispatch.

Not built, and recorded here so it is not read as forgotten: a lane's stock by shipment status, a departure time and the decision overlay. A lane is still a tile with its stock, as ADR 0066 drew it.

Alternatives considered

  • Reuse operations.supervise. It adds no action, but the Administrator does not hold it, and it gates wave planning and overrides, not seeing people by name. No reason is recorded for the shipped split; a separate action states what is being protected.
  • Return positions in the floor plan. One request, but anyone who may read the layout would then see named operators.
  • Animate people between confirmations. It looks alive and invents movement that no row records.
  • Keep a temperature history. Not needed to show a room now; a feed that wants a history keeps its own.

Evidence

  • frontend/web/src/pages/floor/floor-live.ts
  • frontend/web/src/pages/floor/use-floor-live.ts
  • frontend/web/src/pages/floor/__tests__/floor-live.test.ts
  • frontend/web/src/pages/floor/__tests__/floor-page.test.tsx
  • services/karyo-app/src/test/kotlin/com/karyo/app/FloorPositionsTest.kt
  • services/karyo-app/src/test/kotlin/com/karyo/layout/api/v1/ZoneTemperatureResourceTest.kt
  • services/karyo-app/src/main/resources/db/migration/auth/V1618__work_positions_read_action.sql
  • services/karyo-app/src/main/resources/db/migration/layout/V1619__zone_temperature_readings.sql