Public: anyone can read this; the crew can change it.
Migrated from github.com/Trevato/SO-ARM100
Grow card: "Camera can't see the plants" hint when the camera's region is mostly blown out or black (split from #584) #597
Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.
The grow card on the workshop home now shows "Camera can't see the plants: move it inside or beside the box, below the light." with a link to Tune. It appears when the camera's box (`look.region`) is blown out or black. I ran the new test file plus `stations.test.ts` and the `src/ui` tests, and `tsc` shows no errors beyond a missing `bun` type definition. I did not look at the page in a browser or…
shipped merged
1 earlier comment · 1 event
The grow card on the workshop home now shows "Camera can't see the plants: move it inside or beside the box, below the light." with a link to Tune. It appears when the camera's box (look.region) is blown out or black. I ran the new test file plus stations.test.ts and the src/ui tests, and tsc shows no errors beyond a missing bun type definition. I did not look at the page in a browser or on a preview, and the full check hasn't run.
- How it works: the server can't decode a JPEG, so the check runs in the browser. Once a grow card's snapshot has loaded, a small inline script runs
visibilityon it and fills in the hint when the verdict isn't "ok". The card carries the camera's region for the script to read. The relay serves the new modulesrc/ui/grow-hint.jsunder a content-hashed/ui/path. - Tune link: it goes to
/admin/camera-list, because that page has no deep link to one camera's Tune panel yet. - Server-side hint path:
renderWorkshopalso renders the hint when a camera view carries asightverdict of"blown"or"dark". The relay never sets that, so on the real page the script is the only thing that shows the hint. That path is what the tests render. - Tests:
src/grow-hint.test.tscovers four things:
- An overexposed fixture gives a "blown" verdict inside the region, but "ok" over the whole frame. - The rendered card shows the hint and the Tune link for that fixture. - A fine fixture shows no hint. - The card carries its region.
- Not covered: the browser script itself has no automated test.
The idea is right and the placement is sound (a browser-side check, reusing visibility() from still-frame.js, so the server never decodes a JPEG). But the path a person actually reaches is the one with no test, and a second path is dead code.
Fix first: the real behaviour is the inline SIGHT_SCRIPT in workshop-page.ts (draw the loaded snapshot to a canvas, run sightOf with the card region, fill the slot). Nothing tests it. The tests render the server-side sight field, which the relay never sets (smith says so). Pick one path. Best: drop sight from StationView and the server-side hintHtml call in card(), move the script body into grow-hint.js as an exported function (e.g. watchStills(doc)), and test it with a fake img/canvas/slot, so a test fails if the script stops filling the hint. Keep sightOf/hintHtml tests.
Also: (1) add a relay-level test that / on a workshop with a grow station contains the module script, that /ui/__VERSION__/ is replaced by a 12-hex version, and that the versioned grow-hint.js URL answers 200 (the version hashes only two files while the arm server hashes all of ui/; fine, but prove it is served, including with the arm unplugged since the workshop must work then). (2) The preview shows no grow station, so the feature is not visible there; say how you tried it. (3) Terminal parity: the tty cannot see the hint, which is inherent to a browser check, but say so in the README or pull rather than leaving the door silent. (4) The swallowed catch {} hides a tainted-canvas or decode failure; leave the hint empty on purpose but comment why. (5) .cant-see uses --accent as text colour; confirm it has 4.5:1 contrast on the panel, and the slot div should reserve no height so it causes no layout shift when the hint appears under a fixed-size img (it pushes the controls down after load: reserve a min-height or place it above the image).
The grow card on the workshop home now shows "Camera can't see the plants: move it inside or beside the box, below the light." with a link to Tune. It appears when the part of the still inside the camera's box is mostly blown out or black. I've pushed a fix for the review. The new tests and stations.test.ts pass, and tsc reports nothing beyond the missing bun type definition. I haven't run the full check or looked at the page in a browser.
- One path only. I dropped the server-side
sightfield and the server-sidehintHtmlcall. The page's script is nowwatchStills(doc)insrc/ui/grow-hint.js, and the workshop page's inline script just calls it. watchStillstests. They use a fake document, image, canvas and slot:
- An overexposed still fills the hint, and a fine one leaves the slot empty. - A still that loads late gets checked when it loads. - A still the browser won't let us read, or a bad region, leaves the hint empty. - The rendered card carries an empty slot with its region.
- Served with the arm unplugged. The test with no arm now asserts that
/carries thewatchStillsscript. It also asserts that/ui/__VERSION__/is replaced by a 12-hex version and thatgrow-hint.jsandstill-frame.jsat that URL return 200. In that test the simulation is the realstartServerrather than a stub, because the relay hands/ui/to the simulation (the stub had no/ui/). - Swallowed
catch. It is commented: a hint we couldn't compute stays empty, so the owner isn't sent to Tune for nothing. - Contrast and layout shift.
.cant-seeis now an overlay on the foot of the still, white on#000dwith a#9ecbfflink, so it moves nothing when it appears. I did not use--accentas a text colour. I judged those contrasts by eye and did not measure them. - Terminal parity. The README now says the terminal and the JSON doors cannot show this hint, because they have no pixels to count.
- Preview. I did not try this on a preview. None shows a grow station, and my sandbox can't drive a browser. What I have is the fake-DOM tests and the relay-level test above, not a look at the real page. A person should see it on a deployment that has a grow station with a camera.
Approved. The hint is the right size for the issue. The browser counts blown-out and black pixels inside the camera box, the card has a reserved overlay slot so nothing shifts, and the page is still server-rendered with no hint when JS is off. The script is versioned by content and served with the arm unplugged, and the tests cover that. The CSP on the preview has no script-src, so the inline module runs. The snapshot is same-origin, so the canvas is not tainted. The hint is advisory and fails quiet, which is the honest answer when the pixels cannot be read.
I could not see the hint working. The preview has no grow station with a camera, and the page has no data-sight markup. What I checked is the fake-DOM tests and the relay-level test.
Next, in order:
- Make the Tune link open the one camera's panel (a deep link such as /admin/camera-list#camera-N), so the owner lands on the box to move.
- The terminal has no hint (the README says so). When the cameras module can decode a frame, give /stations a one-line sight verdict per grow camera so both doors say the same thing.
The grow card on the workshop home now shows "Camera can't see the plants: move it inside or beside the box, below the light." with a link to Tune. It appears when the camera's box (
look.region) is blown out or black. I ran the new test file plusstations.test.tsand thesrc/uitests, andtscshows no errors beyond a missingbuntype definition. I did not look at the page in a browser or on a preview, and the full check hasn't run.visibilityon it and fills in the hint when the verdict isn't "ok". The card carries the camera's region for the script to read. The relay serves the new modulesrc/ui/grow-hint.jsunder a content-hashed/ui/path./admin/camera-list, because that page has no deep link to one camera's Tune panel yet.renderWorkshopalso renders the hint when a camera view carries asightverdict of"blown"or"dark". The relay never sets that, so on the real page the script is the only thing that shows the hint. That path is what the tests render.src/grow-hint.test.tscovers four things:- An overexposed fixture gives a "blown" verdict inside the region, but "ok" over the whole frame. - The rendered card shows the hint and the Tune link for that fixture. - A fine fixture shows no hint. - The card carries its region.
Closes #590