Skip to content

mac: the header's hairline waits for the transcript to scroll - #295

Merged
stupart merged 1 commit into
mainfrom
feat/header-hairline
Sep 16, 2026
Merged

stupart merged 1 commit into
mainfrom
feat/header-hairline

Conversation

@stupart

@stupart stupart commented Sep 16, 2026

Copy link
Copy Markdown
Owner

§3: "A hairline appears under the header only once the transcript scrolls or a pane opens." It was drawn unconditionally, so a header with nothing above it still carried a rule — a line separating nothing from nothing.

The signal was already being measured

publishPosition() computes fromTop to decide when to ask for the previous page (onReachTop). The hairline asks a different question of the same number — has anything gone under the header yet — so this adds one call beside the existing one rather than measuring twice.

It is deliberately not onUserScroll. That reports isAtBottom, which is a different question: a long transcript resting at its top is not at the bottom and has still scrolled nothing. Using it would have drawn the rule immediately on every session with a scrollable history.

The guarded expression onUserScroll(document.height <= visible.height || distance <= 8) is untouched — it is what keeps a streaming row followed.

Both of §3's reasons

The conversation page waits for the scroll. The deliverable and side-by-side pages keep their rule unconditionally, because there a pane is open — §3's other clause — and a guard asserts that arm never gains the condition.

Mutation battery, including one that got away

mutation result
the hairline is drawn unconditionally again 1 fail
the pane stops listening for the scroll 1 fail
any scrollable transcript counts as scrolled, even at rest 1 fail
it asks about the BOTTOM instead of the top 1 fail
the deliverable page's rule also waits for a scroll 1 fail
the measurement is computed a second time survived at first

The last one is the useful one. My guard counted let fromTop = documentView.isFlipped, and the mutation duplicated the calculation as fromTopCopy — a different name, so the regex correctly didn't match and the guard passed. That is also the realistic drift: someone adds a second top-distance under a new name rather than reusing this one. The guard now pins the expression (documentView.isFlipped ? visible.minY - document.minY) instead of the variable name, and the same mutation fails it.

Gate

bun test 2300/0 exit 0 (2299 on main plus this guard) · tsc --noEmit exit 0 · swift test exit 0 · Mac xcodebuild BUILD SUCCEEDED · iOS xcodebuild BUILD SUCCEEDED — the Mac build matters here: a new closure is threaded through an NSViewRepresentable's Coordinator, and CI builds neither app.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SfEX6bfwCGXtThk1JRNmsE

§3 draws that rule only once the transcript has scrolled or a pane is open.
It was unconditional, so a header with nothing above it still carried a line
separating nothing from nothing.

The signal was already being measured: publishPosition computes fromTop to
decide when to ask for the previous page, and the hairline asks a different
question of the same number -- has anything gone under the header yet. One
call beside the existing one, not a second measurement.

Deliberately NOT onUserScroll, which reports isAtBottom: a long transcript
resting at its top is not at the bottom and has scrolled nothing, so that
signal would draw the rule immediately on any session with history.

The deliverable and side-by-side pages keep their rule unconditionally --
there a pane IS open, §3's other clause -- and a guard asserts that arm never
gains the condition.

One mutation survived first time round and was worth it: the guard counted
`let fromTop = documentView.isFlipped`, while the mutation duplicated the
calculation under a new name, which is the realistic drift. It now pins the
expression rather than the variable name, and that mutation fails.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SfEX6bfwCGXtThk1JRNmsE
@stupart
stupart merged commit 93f717c into main Sep 16, 2026
2 checks passed
@stupart
stupart deleted the feat/header-hairline branch September 16, 2026 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant