Files
museion/docs/devlog/20261104-issue160-cold-turkey-contract-render_log.md
T
AlexKucera e3195d68fd
CI / ci (push) Canceled after 0s
feat(cold-turkey): pure goal engine (#161)
Wayfinder map #158, Build S1: the pure logic slice the writing
lock consumes — no chrome, no clock of its own.

WritingGoal (words | minutes, one goal per block, fixed at arm)
+ WritingGoalRun: update(text:) takes whole-document text and
netNewWords falls out of the delta (deleting costs — net, not
gross; a big paste counts). now is injected into every call, so
the countdown cannot pause by construction; the minutes deadline
is arm+minutes (inclusive), isMet is live truth, unlatched
(delete below target un-mets — complete on the first true tick),
and progress(now:) is the clamped 0…1 the readout hairline rides.
Word counting goes through the new internal DraftStats.words(in:)
— net-words and first-draft stats share one tokenizer and can
never drift.

Finish-audit fanout: the Int() conversion trap in secondsRemaining
fixed at the seam (isFinite + Double(Int.max).nextDown cap — the
naive cap is itself off-by-one at 2^63; flip-verified pin), two
unpinnable > 0 guards in progress deleted, baselineWords narrowed
to let. Equatable and the ?? armedAt fallback kept deliberately
(S2 consumes the former; removing the latter costs formula
duplication). S2 throttle note landed on #162.

Suite 602/602 (xcresult count), swiftformat + swiftlint clean in
app and test targets. Two traps filed to the swift wiki (bare
@Suite stripped by swiftformat; the Double(Int.max) cap).
2026-11-04 12:50:02 +01:00

4.7 KiB

#160: Cold Turkey arm-bar + progress readout — contract render

Date: 2026-11-04 Type: issue Reference: wayfinder map #158 · ticket #160

Goal

Resolve wayfinder ticket #160 (prototype, HITL): render the Cold Turkey surfaces — arm-bar, progress readout, completion note, edge states — as the #154-pattern HTML contract in the editorial two-color chrome, rule the open visual calls with Alexander live, and leave the adjusted file as the contract the build slices (#161, #162) implement.

What Was Done

  • Claimed #160 (assignee = AlexKucera, the map's driving dev) before any work.
  • Studied the pattern sources: ref/prototypes/wf154-mentor-pane-prototype.html (house contract-render shape), Museion/DesignTokens.swift, Museion/FocusChrome.swift (hover zones, overlay panels), Museion/PostEditorView.swift (focusChip save cue, SaveStateDot, focus ground).
  • Built ref/prototypes/wf160-cold-turkey-prototype.html: state tabs (focus · arm · locked-words · locked-near · locked-minutes · complete · save-fail edge), live rulings panel, interactive arm-bar (minutes|words selector, steppers, Start, Esc), readout with near-goal + hairline variants, completion note with fade, top-seat save-fail chip.
  • Ruled six calls with Alexander in two clarify rounds; baked the rulings as the render's defaults and marked them "ruled" in the panel.
  • Verified in ego-browser (Chromium): all seven tabs, selector flip (30 MIN → steppers → 40 MIN), Start → locked, Esc → focus, live ruling flips (hairline, title, presence), dot geometry (20px right / 18px bottom), dot click → arm, presence-aware captions. Screenshots eyeballed via vision for layout glitches — none.
  • Recorded the resolution: comment on #160, closed it, appended the map's Decisions-so-far line, amended the map's superseded "menu-first v1" settles (#8, #11) and the arming-shortcut fog item.

Decisions & Rationale

Decision Rationale
Seat = BARE mono text on the focus ground (no chip box) Alexander overrode the chip recommendation — quietest possible surfaces; Start keeps its accent fill as the only boxed element
Progress = text + 2px hairline under the numerals Alexander chose the hairline over text-only; fill = progress, accent when near
Piece title absent from the readout Numerals only — the open Piece is stable while locked, the title adds noise
Near-goal = terracotta numerals at 80% Recommendation stood, unobjected
Completion note fades after ~6s Quiet return to focus; ● 500 words · 14:02
Presence = persistent dot, bottom-right corner Alexander's lean, confirmed after the dot was actually rendered (first round couldn't test — see gotcha); muted 6px pip, COLD TURKEY label on hover, click arms; menu item stays as second path. Amends charting-settle "menu-first v1"
Save-fail keeps the top-center chip seat The #87 focusChip language is an existing app surface; readout owns bottom-center — no collision

Gotchas & Fixes

Problem Root Cause Fix
"The focus dot does not appear" (Alexander, ruling round 1) The presence ruling's "always" option only changed caption text — no dot element existed in the mock Rendered the real dot (surface 0), wired visibility to the ruling + focus state, click → arm-bar; then re-asked with the artifact visible
Dot landed bottom-center First render put every surface on the center axis Ruled: tucked bottom-right (20px/18px in the corner)
Focus caption said "chrome absent" while the dot showed Static caption string Presence-aware caption built per setState call
page.waitForLoad/page.textContent don't exist in ego-browser Wrong API guess waitForTimeout + evaluate(() => …) equivalents

Files Changed

File Change Summary
ref/prototypes/wf160-cold-turkey-prototype.html NEW — the ruled contract render (baked defaults = the contract)
docs/devlog/INDEX.md + root AGENTS.md window this log registered

Open Items & Next Steps

  • Build S1 (#161, open, unblocked): WritingGoal engine — net-words delta + never-pausing countdown, pure logic + tests.
  • Build S2 (#162, blocked by #160 ✓ + #161 + #159 ✓): integration — WritingLockState, kiosk entry/exit, arm-bar/readout per this contract, typing-continuity hard AC.
  • Calibration gate (#163, blocked by #162): Alexander writes a real block on the pinned corpus.
  • Fog stays fog: preset chips (post-calibration), S5.1 stats tie-in, keyboard arming shortcut (needs #87 probe discipline).

Log written by write-log skill