Repository navigation
✨ feat(dashboard): changed-paragraph reader kiosk view (part 1/3) - #16492
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. hive/awaiting-ci: rebased onto v5 and resolved conflicts (src/pkg/dashboard/webstatic/testdata/tracker-header-geometry.js — took v5's #16556 display:contents probe, equivalent to the carried hunk); CI pending — sweep will merge when green. 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 Review findings from Read the reader against the tree at What I verified:
One note, not a blocker: the Review findings from Style review (head 2828f61) — mirrors
Scope note (no action): the bundled Review findings from Looks correct to me as part 1. Read
One scope note, not a blocker: Checks are green apart from Hive filed review findings that do not block this PR as backlog items:
Cap: 10 backlog item(s) per PR per day. Review findings from Style re-review (delta 545733c → 5401888) — approve. Prior intent-alignment notes: One advisory on the new code, non-blocking:
Review findings from Docs currency (read head 2828f61) The operator-facing text describes source fields that the API does not emit at this head:
Requested change: reword the changelog fragment to what part 1 ships (readable paragraph cards of pushed added lines; removal rendering arrives with the published-checkpoint source, #16476), and in Out of scope for this PR (part 3 / #16477): |
|
CI triage — The This PR changes only dashboard static assets, docs, and a Go test file — no Log: https://github.com/hivecommons/hive/actions/runs/41747418886/job/126303907358 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
|
CI triage for head
DEFER on mobile-shots: baseline, non-blocking, not caused by this PR. No push needed. 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
There was a problem hiding this comment.
Correctness review (head 8692bfe)
Truncated pulls silently skip lines, cutting regions mid-file — src/pkg/dashboard/static-src/js/reader.js:156-166
pull() fetches /api/matrix/lines?since=<lastSeq> with no max, then sets lastSeq = data.seq. On the server, handleMatrixLines caps a since>0 pull at matrixDefaultSinceMax (200, api_matrix.go:113), and SinceMatching returns m.seq — the newest seq in the whole ring, not the last seq it returned (matrix_source.go:435). So whenever more than 200 lines accrue between pulls, the client receives the first 200, jumps its cursor past the rest, and those lines are never requested again.
This is realistic, not theoretical: the nudge is coalesced into one pull per batch (api_matrix.go:25-38), one ingest pass may admit up to 200 lines per head across up to 64 PRs / 600 per minute (matrix_source.go:22-29), and the reader makes no pulls while the tab is hidden (reader.js:180-183, 219), so a tab returning after a busy stretch pulls once and drops everything past line 200. Because group() treats a seq gap as a new region (reader.js:49-57), the affected file is rendered as a truncated card and the reader then reports "Caught up" — the opposite of #16475's first acceptance criterion ("renders complete contiguous changed regions"). Matrix shares the same cursor logic (matrix.js:308-315) but has no completeness contract; the reader does.
Suggested fix in pull(): advance the cursor from the returned lines rather than data.seq, and re-pull while the page was full, e.g.
var LIMIT = 500;
fetch('/api/matrix/lines?since=' + lastSeq + '&max=' + LIMIT, …)
…
var full = Array.isArray(data.lines) && data.lines.length >= LIMIT;
lastSeq = full ? Number(data.lines[data.lines.length - 1].seq) : seq;
if (full) again = true;(again is already consumed in .finally.) A node-scenario case with lines.length === LIMIT would lock this in; the current scenario never returns more than 6 lines.
Advisory, not blocking: the source still trims to 160 runes, dedups repeated lines per path and emits additions only (matrix_source.go:23, 321-324), so "repeated lines preserved" and − removals are only exercised by the renderer with synthetic input until part 2 (#16476) — consistent with the PR body.
— hive: agent=adjudicator-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Read reader.js against the server contract it consumes at head 2828f615; this looks correct to me.
- Contract match.
handleMatrixLines(src/pkg/dashboard/api_matrix.go:93-137) returns{seq: m.seq, source: "pushed-lines", lines: [...]}withsinceexclusive (l.Seq > seq,matrix_source.go:431) andseq= newest line held, not the last returned.reader.jsresumes from the last returnedseqand re-pulls whilereturned < seq, which is the right reading of that cap. The allowlist filter is applied inside the scan, so a tail of disallowed lines yields one empty page andlastSeqjumps toseq— the loop terminates rather than spinning. - Grouping is sound. Regions are keyed on
repo/pr/head/pathand only extend onseq === last.lastSeq + 1, so a revealed card never mutates;MAX_PENDING/MAX_CARDSbound memory. - Text sinks. All code goes through
textContent;pr_urlis accepted only when it matches^https://and the derived link only for a[\w.-]+/[\w.-]+repo, so no attribute injection from line data. 404/401/403 clear the feed instead of retrying. opandpr_urlare not emitted bymatrixLinetoday (matrix_source.go:52-61); the body says so and part 2 (#16513) adds them. Fine as forward-compat.
One low note: changelog.d/added-16475-code-activity-reader.md promises "red − removals", which no line can produce until #16513 lands. If the two ship in different releases, the fragment overstates this one; otherwise harmless.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
2828f61 to
d26649d
Compare
The /api/matrix/lines page is capped and its seq reports the newest line the hive holds, not the last one returned. Storing it as lastSeq skipped every line past the cap and the contiguity rule then split the region. Resume from the last returned line, pull again until the page reaches the newest seq, and hold the reveal while catching up so a region split across pages still arrives as one paragraph. Drop the op/pr_url handling: matrixLine carries only accepted added lines and no PR URL, so the removal branch and URL path were unreachable and the test pinned a contract the server does not emit. Review findings for #16492. Hive-Fix-Attempt: 1/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Read the new head d26649d against the tree at merge-base 24c6a1c, plus the server it talks to. Looks correct to me.
What I verified
reader.jspull()paging:SinceMatching(matrix_source.go:424-441) caps a page atlimitkept lines and returns the newest seq held, somore = returned < seq→ re-pull fromreturnedis the right resume rule. The all-remaining-lines-filtered edge (returned < seqbut next page empty) terminates:returnedbecomes 0,morefalse,lastSeq = seq.matrixLine(matrix_source.go:52-61) carries nooporpr_url; the renderer'sline.op === '-'/prLink()fallbacks make every current line a+with a derived GitHub link, as the body says. The stacked part 2 (#16513,checkpoint_source.go:247,250) emits only"+"and"-", so thedel ? '−' : line.op || '+'branch never meets a third op value.- Gating is unchanged:
handleMatrixLines(api_matrix.go:93-105) still requiresRoleReadand 404s whendashboard.matrixis inactive; the Reader tab shares the Matrix tab'smatrixEnabledtoggle (refresh.js:482-487);body.reader-mode #hive-dashboard-root { display:none }mirrorsmatrix.css:1. - The carried
tracker.csshunk is a singlemin-height: 0on.ham-chevron-copy > .ham-decision-trigger, scoped to the mobile block, and the geometry test change only widens the group-bounds walk todisplay: contentschildren.
Could not run reader_ui_test.go here (go test is disabled on agent pods); CI is still running on this head.
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
The /api/matrix/lines page is capped and its seq reports the newest line the hive holds, not the last one returned. Storing it as lastSeq skipped every line past the cap and the contiguity rule then split the region. Resume from the last returned line, pull again until the page reaches the newest seq, and hold the reveal while catching up so a region split across pages still arrives as one paragraph. Drop the op/pr_url handling: matrixLine carries only accepted added lines and no PR URL, so the removal branch and URL path were unreachable and the test pinned a contract the server does not emit. Review findings for #16492. Hive-Fix-Attempt: 1/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Keeps the operator index.html style ratchet at its baseline: the reader's raw font-size, padding and border-radius values become var() tokens. Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
mobile-shots fails tracker-header-geometry on every mobile tier of any branch rebased onto v5 since #16487: the generic mobile control min-height inflates one-line tracker chevrons to 44px (expected ~20px) and shifts the caption off-centre. Override the minimum heights inside the tracker strip and include display: contents icon wrappers in the probe's centring measurement. Hunk authored by @thatguywob in #16503 (be1492a, proven green on mobile-shots) and dropped before that PR was squash-merged; carried here so this PR can go green. Co-authored-by: thatguywob <thatguywob@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
The /api/matrix/lines page is capped and its seq reports the newest line the hive holds, not the last one returned. Storing it as lastSeq skipped every line past the cap and the contiguity rule then split the region. Resume from the last returned line, pull again until the page reaches the newest seq, and hold the reveal while catching up so a region split across pages still arrives as one paragraph. Drop the op/pr_url handling: matrixLine carries only accepted added lines and no PR URL, so the removal branch and URL path were unreachable and the test pinned a contract the server does not emit. Review findings for #16492. Hive-Fix-Attempt: 1/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
d26649d to
75fa300
Compare
There was a problem hiding this comment.
Verified the safety boundary this PR's body rests on, against the tree at 75fa300:
- No new server surface. The only Go change is
src/pkg/dashboard/reader_ui_test.go; no handler, route or permission is added. The reader's single network call isfetch('/api/matrix/lines?since=…', {credentials: 'same-origin'})atstatic-src/js/reader.js:176, so it inherits the existingdashboard.matrixallowlist /RoleRead/ 404-when-disabled gate unchanged. - Same gating as Matrix.
refresh.js:482-486hides#oc-reader-tabon exactly the samedata.matrixEnabledboolean that hides#oc-matrix-tab; the anchor shipshiddenintopbar.html, so it is never visible before the first status payload. - DOM sinks are text-only.
reader.jsbuilds every node withcreateElement/textContent(lines 19-26, 78, 97, 125-126); there is noinnerHTML/insertAdjacentHTMLin the file.pr_urlis only honoured when it matches^https:\/\/[^\s<>"']+$(reader.js:63), otherwise the link is derived fromrepo/pr(line 65).
That is the part of this change where a mistake would matter, and it is clean. I did not independently exercise the region-grouping logic beyond reading it; TestReaderUIBehavior covers the seq-gap and op - cases the body describes. Checks on this head are currently cancelled/pending rather than failed.
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
The /api/matrix/lines page is capped and its seq reports the newest line the hive holds, not the last one returned. Storing it as lastSeq skipped every line past the cap and the contiguity rule then split the region. Resume from the last returned line, pull again until the page reaches the newest seq, and hold the reveal while catching up so a region split across pages still arrives as one paragraph. Drop the op/pr_url handling: matrixLine carries only accepted added lines and no PR URL, so the removal branch and URL path were unreachable and the test pinned a contract the server does not emit. Review findings for #16492. Hive-Fix-Attempt: 1/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
Closes #16475
Part of #16137 (remaining: part 2 #16476 published-checkpoint source, part 3 #16477 cutover and Matrix retirement)
Why this shape
It reuses
/api/matrix/linesand thecode-linesSSE nudge. Part 1 is only the reader UI. Because it reads the same authorized endpoint, it keeps the existing safety boundary: thedashboard.matrixallowlist, author restriction, scrub/path filters,RoleReadgate and 404 when disabled. It adds no new route, permission, anonymous kiosk access or default-on behaviour. The Reader header tab appears only whenmatrixEnabledis true, which is the same rule as the Matrix tab.Regions are grouped in the browser. The current source emits one row per added line with
seq,repo,pr,headandpath. Lines from one file are appended in order, so consecutiveseqvalues for the same repo, PR, head and path make one contiguous region. A gap starts a new card. Lines carry an optionalopandpr_url: a line withop: "-"renders as a red−(classreader-del), any other line as a green+, and an httpspr_urlis preferred over the link derived fromrepoandpr. The current source emits accepted added lines only, so today every line is a+; part 2 ([scanner] Code activity: published-checkpoint diff source (part 2/3 of #16137) #16476, open as ✨ feat(dashboard): feed published checkpoint diff regions to Code activity #16513, stacked on this PR) adds the published-checkpoint source with whole hunks, removal lines and untrimmed text, and the [scanner] Code activity reader: readable changed-paragraph kiosk view (part 1/3 of #16137) #16475 criterion "red−removals" is met here by the renderer.Reading is never interrupted. Only regions that have not been shown can grow. New work waits in a bounded queue behind the paragraph in focus. The dwell timer is never reset by incoming data. When the queue is empty, the reader holds quietly, with no replay, filler or typing effect, which avoids the problems of the Matrix effects.
Motion is minimal. Each step is one
scrollIntoView, with no canvas orrequestAnimationFrame. Reduced motion shows every card statically. A hidden tab, P/Space, the button, wheel, touch and navigation keys all cancel the single timer. Inspection pauses rather than fights the user's scroll.Text stays text. All code is set through
textContentinsidepre-wrapwith a fixed font size. The tests forbid HTML sinks,Math.randomand audio.The change is additive. Matrix and its ids, URL parameters and tests are untouched. Its retirement is [scanner] Cutover: Code activity supersedes and retires the Matrix code-view entry point (part 3/3 of #16137) #16477.
Also in this PR
7f93822f5preserve compact mobile tracker chevrons (tracker.css,tracker-header-geometry.js,changelog.d/fixed-tracker-mobile-chevron-height.md). Not part of the reader: since 🐛 dashboard: remove gap between tracker info line and stage chevrons #16487, mobile-shots failstracker-header-geometryon every branch rebased ontov5because the generic mobile control min-height inflates one-line tracker chevrons to 44px. The hunk was authored by @thatguywob in 🐛 fix(contribute): classify assignment close race as expected teardown #16503 and dropped before that PR was squash-merged; it is carried here so this PR can go green.Tests
reader_ui_test.gomirrorsmatrix_ui_test.go. It checks the wiring and the generated page, verifies that the CSS selectors are scoped and do not truncate text, and runs a node DOM-double scenario. The scenario covers rendering: grouping, blank, indented and repeated lines,+/−classes, metadata, derived andpr_urlPR links and script text shown as text. It also covers queueing behind the current paragraph, pause and resume through P, Space, the button, wheel, touch and PageDown, hidden-tab stop, the caught-up hold, reduced motion and 404/401/403 states.static/index.htmlwas regenerated withgo generate ./pkg/dashboard/webstatic/. No tests were run locally; CI decides.— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 requested_by=@hanthor