From f9d6b6136f9ab4134496b9c1f0fac5eb21d711a9 Mon Sep 17 00:00:00 2001 From: Eugene Blikh Date: Tue, 28 Apr 2026 03:51:06 +0300 Subject: [PATCH] docs(systems-power): record verify summary systems-power --- docs/tasks/systems-power.md | 42 +++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/docs/tasks/systems-power.md b/docs/tasks/systems-power.md index 814f8014d2f23a69908360ec052b089e888d788e..af16fca4d90d7a033bd30340da6bbfbe7879d984 100644 --- a/docs/tasks/systems-power.md +++ b/docs/tasks/systems-power.md @@ -170,3 +170,45 @@ Per Design `TDD: yes`. Phase 1 and Phase 2 tests are written first and must fail - PH2 -> IF4, IF5 @ hud.go, hud_test.go - PH3 IF1, IF2, IF3, IF4, IF5, IF6 -> @ render.go, main.go, web/index.html +## Verify + +**Result:** passed + +Positive: +- CK1 — `go test ./... -v` → 32/32 pass (9 systems + 5 hud + 18 pre-existing) +- CK2 — `go build ./...` → clean +- CK3 — `GOOS=js GOARCH=wasm go build` → clean (~12 MB) +- CK4 — `go vet ./...` → clean +- CK5 — Browser smoke at `http://localhost:8765/index.html` (clean reload): HUD renders `Reactor: 0/8`, 5 labelled columns (Pilot 1, Weap 4, Shld 4, Med 2, Eng 4), dim placeholder cells with white outlines, ship rooms rendered at unpowered (dim) tint +- CK6 — Visual confirmation that powered vs dim contrast is present (rooms render at ~60% brightness vs the documented `roleColor` values, matching `dimRoleColor`) + +Negative: +- CK7 — `TestAddPower_systemAtCap` covers cap rejection (level unchanged, returns false) +- CK8 — `TestAddPower_reactorFull` covers reactor-full rejection (level unchanged, returns false) +- CK9 — `TestRemovePower_zeroLevel` covers underflow rejection +- CK10 — `TestHudHitTest_aboveHud` / `_leftOfColumns` / `_rightOfColumns` cover gutter / out-of-region returning ok=false + +Invariants / assumptions: +- CK11 (IV1) — `grep "hajimehoshi\|inpututil" ship.go tiles.go crew.go systems.go hud.go` → empty +- CK12 (IV2) — `grep "PowerLevel\s*=\|\.PowerLevel++\|\.PowerLevel--" render.go` → empty (renderer reads only) +- CK13 (IV3, IV4) — `TestAddPower_invariantsHold` runs 50 round-robin add attempts, asserts `reactorUsed ≤ ReactorCap` and `0 ≤ PowerLevel ≤ MaxLevel` after every call → pass +- CK14 (IV5) — no `//go:build` directives, no platform-suffixed files; native + WASM both build clean +- CK15 (IV6) — HUD constants only defined in `hud.go:8-11`; referenced (not redefined) by `main.go:39,47,66` and `render.go:95,103,105,108,111,117` +- CK16 (AS1) — Right-click WASM behavior — see Notes (smoke deferred) +- CK17 (AS2) — `` present in `web/index.html:8` +- CK18 (AS3) — Ship max bottom edge: `ship.go` MedBay GridY=12 + GridH=3 = tile row 15 = pixel y=240, leaves 32-px gap to HudY=272 + +Interfaces: +- CK19 (IF1) — `addPower(g.systems, role, ReactorCap)` invoked at `main.go:42` with declared signature +- CK20 (IF2) — `removePower(g.systems, role)` invoked at `main.go:68` with declared signature +- CK21 (IF3) — `reactorUsed(sys)` invoked at `render.go:94` for the readout +- CK22 (IF4) — `hudHitTest(cx, cy)` invoked at `main.go:41, 67` with declared signature +- CK23 (IF5) — HUD constants consumed at the call sites listed in CK15 +- CK24 (IF6) — `System` slice consumed by `Game.systems`; `NewStartingSystems()` invoked at `main.go:96`; `ReactorCap` consumed at `main.go:42` and `render.go:94` + +Smoke: browser visual baseline at `Reactor: 0/8` confirms HUD and ship rendering. Click-driven state transitions exercised exhaustively by unit tests; full real-mouse interactive smoke deferred (see Notes). + +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. +