From fcffe5a136eb4af0863f4e02a627ff6dd4443538 Mon Sep 17 00:00:00 2001 From: Eugene Blikh Date: Tue, 28 Apr 2026 03:54:53 +0300 Subject: [PATCH] docs(systems-power): record review conclusion systems-power --- docs/tasks/systems-power.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/docs/tasks/systems-power.md b/docs/tasks/systems-power.md index af16fca4d90d7a033bd30340da6bbfbe7879d984..79ccea8b9b9e9651fd0e6cc14021b958b0497a45 100644 --- a/docs/tasks/systems-power.md +++ b/docs/tasks/systems-power.md @@ -212,3 +212,33 @@ Notes: - Interactive click smoke (left-click → addPower, right-click → removePower, browser context-menu suppression) could not be driven via synthesized DOM events: PointerEvent / MouseEvent dispatched on the canvas from `evaluate_script` reach the canvas (verified via capture-phase listener) but do not appear to be picked up by Ebitengine's WASM input layer. The underlying logic is fully covered by 14 unit tests; AS1 and AS2 are deferred to a real-mouse user pass. - UK1 resolved partially: dimming is in effect (factor 0.6 in `dimRoleColor`) but the visual contrast against the powered tint is subtle at 640×360. Reviewer / user may want to increase to 0.4 or add a "POWERED OFF" overlay tag if visibility matters during play. +## Conclusion + +Outcome: systems-power milestone shipped — Reactor + per-system power data, click-driven HUD allocation, dim-on-unpowered ship rooms, WASM right-click suppression — at HEAD `3144cda`. + +Invariants: +- IV1 — `grep "hajimehoshi\|inpututil" ship.go tiles.go crew.go systems.go hud.go` empty. +- IV2 — `grep "PowerLevel\s*=\|\.PowerLevel++\|\.PowerLevel--" render.go` empty; `addPower` / `removePower` are the only mutators. +- IV3, IV4 — `TestAddPower_invariantsHold` runs 50 round-robin add attempts and asserts `reactorUsed ≤ ReactorCap` and `0 ≤ PowerLevel ≤ MaxLevel` after every call → green. +- IV5 — no `//go:build`, no platform-suffixed files; `go build ./...` and `GOOS=js GOARCH=wasm go build` both clean. +- IV6 — `HudY`, `HudX`, `HudColW`, `HudColCount` defined only in `hud.go:8-11`; `main.go` and `render.go` reference, never redefine. + +### Assumptions check +- AS1 — unverifiable in this session: synthetic DOM events did not propagate through Ebitengine's WASM input layer, so right-click → `removePower` could not be exercised end-to-end. The data path is fully unit-tested; deferred to a real-mouse user pass. +- AS2 — held by inspection: `` present at `web/index.html:8`; effect on a real browser context menu deferred to the same real-mouse pass as AS1. +- AS3 — held: `MedBay` extends to tile-row 14, pixel y=240; `HudY=272` leaves a 32-px gap. + +### Unknowns outcome +- UK1 — partially resolved. Dimming is in effect (`dimRoleColor` returns 60% of the powered tint). At 640×360 the contrast between powered and unpowered rooms is subtle in the baseline screenshot. Visible but not strong; flagged for play-time follow-up. + +### Review findings +- Important #1 — reviewer flagged `cellBottom = HudY + (VirtualH - HudY) - cellGap` as loop-invariant inside `drawHud`'s nested loops, framed as a mild IV6 violation. Resolved at `3144cda` by hoisting to a file-scope const and simplifying the algebra. Pushed back on the strict IV6 framing: `cellW`, `cellH`, `cellGap` are also rendering-only HUD-cell visuals living in `render.go`; centralizing every implicit pixel calculation in `hud.go` would over-engineer for a single render-only use-site. IV6 protects the constants consumed by **both** render and input; those (HudY, HudX, HudColW, HudColCount) remain in `hud.go`. + +### Future work +- Increase dim contrast or add a "POWERED OFF" overlay tag if play-testing finds the unpowered/powered distinction too subtle. Justification: UK1 partial — dimming works, perception not. +- Real-mouse interactive smoke for AS1 (right-click → removePower) and AS2 (browser context-menu suppression). Justification: synthetic-event tooling limitation in this verification path; underlying logic exhaustively unit-tested. + +Verified by: +- 32/32 unit tests + native + WASM + vet builds run fresh in this session. +- Browser visual baseline at `Reactor: 0/8` confirms HUD rendering, ship dimming, layout — the next reader should run the real-mouse smoke for AS1/AS2 before merge if interactive behavior matters for the merge gate. +