Skip to content

fix(ui-feedback): list the run's notes after a reload, with hover and click to show each box - #17863

Merged
kyle-sexton merged 7 commits into
mainfrom
fix/ui-feedback-note-history
Nov 21, 2026
Merged

kyle-sexton merged 7 commits into
mainfrom
fix/ui-feedback-note-history

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

Closes #17801

Summary

A reload of the notes host used to empty its Notes list, though every sent note was still in the run's actions.json. The host now lists the run's sent notes and its unsent drafts again, oldest first, numbered as their markers are. Hovering a row draws its note's box on the mockup, and moving off clears it. Clicking a row restores the note's variant, screen state and content set, scrolls to it, and keeps its box drawn until a click elsewhere (on the mockup or the host page) or on another row. Clicking a marker selects its row, the same as clicking the row (the scope added in this comment).

Fix

  • lib/ui-feedback/notes_bridge.py: new GET /api/notes. It needs the page token in X-Notes-Token (the existing token_ok check), and do_GET's Host/Origin check still applies. It reads only the server's own data dir (hub.read_log()), and no part of the request picks the directory. It returns each event's seq, at and note fields, without deliveredAt.
  • lib/ui-feedback/host.html: on load, after the token, it fetches /api/notes and keeps each note only if note.schema.json admits it. Rows get hover/focus (draw the box) and click/Enter (select). Every note text, label and reply still reaches the screen through textContent. The frame gets contract keys, an anchor path and a box, never note text. Selection marks rows in place, so the selecting click is not undone by the document listener.
  • lib/ui-feedback/proto-pin.js: new show (hover) and select messages. A note's box is its element's live box while the anchor path still finds a visible element in the note's scope, else the stored rect. select restores the view through the switcher's vs:show, scrolls, and posts shown with whether a box was found. The data log is not replayed, because data-control presses are not idempotent on a live page. A click anywhere but a marker clears the selection and still reaches the page.
  • Drafts: lib/ui-feedback/note-model.mjs gains draftStore(storage, run, schema), and the host keeps this run's drafts in the tab's sessionStorage. Nothing goes to the server. It writes one entry, {run, drafts}, keyed by the run's page token, so another run's drafts read back as none and the next save overwrites them. The host saves the draft list on every render, so a draft drops out of the store once it is sent or deleted. What storage returns is treated as untrusted. A malformed entry reads as no drafts, and a draft note.schema.json refuses is dropped. A restored draft's text renders through textContent, like every other row. This follows feat(ui-feedback): toggle that shows or hides every note marker #17847, which already keeps the marker toggle in sessionStorage. A bridge restart issues a new token, so drafts from before the restart are not listed.
  • Marker clicks: the marker layer keeps pointer-events: none. The frame hit-tests a trusted pointer click against each marker's own box, only outside a pick mode and a held pick, and only for a host that sends markers with clicks: true. Only the notes host sends it, so the planning shared page's markers still take no click. A script's el.click() and a key-made click (no pointer position) are never marker clicks, so data-log replays reach the page.
  • lib/ui-feedback/relocate-note.mjs: its fresh host page now lists the run's notes with their markers, so the screenshot style also hides [data-ui-feedback-layer]. That keeps the relocate pixel checks' "all green" shot clean.
  • notes-markers-browser-take.js: after its reload, the run's earlier note 1 is now listed and drawn, so the expected markers are 1,2 instead of 2.
  • Copies regenerated with scripts/sync-shared-copies.sh. The only planning file touched is the synced plugins/planning/shared/web/proto-pin.js.

Verification

Run locally (Windows):

  • lib/ui-feedback/test_notes_bridge.py: 49 run, 44 pass. The 5 failures are the known local-only TestLoop ones (/bin/bash path mangling). The new TestNoteHistory (4 tests) passes on three consecutive runs and was red before the route existed. It covers the run's notes coming back oldest first, a missing, wrong or watcher token refused with no note text in the body, another run's notes never returned (a second bridge on a second data dir, ?dir= ignored, and the other run's token refused), and a foreign Host refused. TestGuards threw WinError 10053 on some local runs, as expected on this machine; no test was added there.
  • node --test lib/ui-feedback/note-model.test.mjs: 151 pass, 0 fail. Five draft-store tests failed before draftStore existed: save then restore, sent or discarded drafts leave the store, another run's drafts are ignored, malformed entries and refused notes are dropped, and a throwing storage keeps nothing without breaking the page. Five new frame tests failed before the proto-pin.js change: hover box from the stored rect, element's live box, select restores the view and a page click clears it and still reaches the page, not-found reported, and marker clicks (opt-in only, only on the marker's box, never in a pick mode, never for a script click).
  • lib/ui-feedback/relocate-note.test.sh: 34 pass, 0 fail.
  • plugins/planning/shared/tests/test_server.py TestPrototypePage: 8 OK.
  • scripts/sync-shared-copies.sh --check: all copies match. scripts/check-html-assets.sh: clean.
  • Syntax: node --check on proto-pin.js and host.html's module script, a parse of the new take script, and bash -n on the new test script.

Only CI's Linux Test Bash lane can run (browser tests cannot run on this machine):

  • New notes-history-browser.test.sh: two notes sent on variants A and B and one draft left unsent, then a reload. Both notes are listed, and the draft is listed as D1 with status draft and its marker, with markup shown as text; hover draws note 1's box on its row and clears on leaving; clicking row 2 switches to variant B with its box drawn; a mockup click and a host-page click each clear it; clicking marker 1 selects row 1 and restores variant A.
  • The edited assertion in notes-markers-browser.test.sh, and the relocate pixel checks, which now rely on hiding [data-ui-feedback-layer] in the shot.
  • Residual risk: the notes host now opts in to marker clicks, so a trusted click in an existing browser test that lands on a marker's own box outside a pick would now select that note. I found none in the scripts I read; CI will show any.

Related

🤖 Generated with Claude Code

kyle-sexton and others added 3 commits November 21, 2026 03:01
… click to show each box

The notes host fetches the run's sent notes from a new token-checked
GET /api/notes and lists them again, numbered as their markers. Hovering
a row draws its note's box; clicking a row or its marker restores the
note's variant, state and content set and keeps the box drawn until a
click elsewhere. Marker clicks are opt-in for the host, so the planning
shared page keeps today's behavior.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… box

Selecting a row re-rendered the list, so the click that selected it then
reached the document listener from a detached row and cleared it.
Selection now marks the rows in place, and leaving the list clears the
hover box even when a re-render replaced the hovered row. The history
browser test waits for each held pick to be released.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ssionStorage

Drafts never reach the bridge, so a reload lost them. The host now keeps
them in sessionStorage under one entry naming the run's token, reads them
back as untrusted (malformed entries and notes the schema refuses are
dropped, another run's entry reads as none) and saves the list on every
change, so a sent or deleted draft leaves the store.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 21, 2026 08:19
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-21T08:22:54.013059Z 3a026a1 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3a026a1ad9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/ui-feedback/proto-pin.js Resolved
@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 0dde58e22a414d6204e1248ddec1928e6c8927ea: read 19 of 19 changed file(s); 0 finding(s), 0 as inline comments.

Security review (blocking only): no security issues found

This lane already reviewed an earlier head of this pull request, so this review reports only CRITICAL and IMPORTANT findings. I read every hunk of all 18 files on the to-read list. plugins/prototype/notes-bridge/proto-pin.js is a byte-identical copy of plugins/planning/shared/web/proto-pin.js at a path where it acts the same way, so I read it once.

What I checked

  • New GET /api/notes route (lib/ui-feedback/notes_bridge.py and its prototype copy).
    • The existing origin_ok() check in do_GET still runs first: session_bridge.py#L500-L502.
    • The route then calls token_ok(), which accepts only the page token and only in the request header, never in a URL: session_bridge.py#L492-L494. The watcher token is refused, and the tests cover that.
    • It reads only the hub's own log. No part of the request picks a path, so ?dir= is ignored.
    • The only caller that gets the notes is the page that wrote them with the same token, so the change gives no new party access to note text.
  • The sandboxed framed page stays untrusted.
    • noteTarget() sends it only the note number, kind, cssPath, box and variant, state and content keys. Never the note text.
    • The new marker, unselected and shown messages from the frame can only select or clear a row, or show a fixed status line.
    • The cssPath the frame passes to querySelector runs only inside the frame's own opaque origin.
  • Notes read back from /api/notes and drafts restored from sessionStorage are both treated as untrusted.
    • Each one is checked against note.schema.json (problems() / draftStore().load()).
    • All note text still reaches the screen through textContent. The new browser test checks that markup in a note creates no element.
  • Drafts in sessionStorage. They are stored under the run token in the host's same-origin storage. The frame has an opaque origin and no storage, so it cannot read them. A different bridge port is a different origin.
  • Marker clicks. They are opt-in: only the notes host sends clicks: true. Script clicks (isTrusted === false) and keyboard clicks (detail === 0 with no pointerType) are never treated as marker clicks, and pick mode and a held pick stay in control.

Scope notes

  • This change touches no trust controls, workflows, tokens, plugin manifests or standing instructions. No file matches a trusted-path glob.
  • The settled threads (layer redraw on scroll, and the target / noteTarget name clash) are not re-raised.
  • Nothing in the PR context is aimed at this review lane.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 0dde58e22a414d6204e1248ddec1928e6c8927ea: read 19 of 19 changed file(s); 0 finding(s), 0 as inline comments.

Code review (blocking only): no findings

This lane already reviewed earlier heads of this pull request, so it reports only blocking findings. This head (0dde58e2) merges origin/main into the branch. I read every hunk of all 18 files in the full diff. The synced plugins/prototype/notes-bridge/proto-pin.js matches plugins/planning/shared/web/proto-pin.js, so I read it once.

The earlier blocking finding stays fixed. The target clash in the host's module script is gone:

  • lib/ui-feedback/host.html has noteTarget at lines 260, 272 and 499, and const target is the only top-level target.
  • The prototype copy matches.

Checked against #17801:

  • The bridge serves the run's notes. GET /api/notes requires token_ok() and reads only self.hub.read_log(), so no request input picks the directory. It drops deliveredAt. TestNoteHistory covers:
    • a missing, wrong or watcher token is refused;
    • ?dir= is ignored, and the other run's token is refused;
    • a foreign Host is refused.
  • The host lists the notes again after a reload.
    • It removes seq and at from each logged event and keeps the rest only if note.schema.json admits it.
    • It restores drafts from sessionStorage through draftStore, which treats what storage gives back as untrusted.
    • It numbers rows the same way the pins are numbered (numberOf).
  • Hover, select and clear work in the frame. show and select draw the note's box from its element or from the stored rect. A click that is not on a marker clears the selection and still reaches the page. A marker takes a click only when all of these hold: the host opted in with clicks: true, no pick mode or held pick is active, the click is a trusted pointer click, and it lands on the marker's own box.
  • Tests: the new notes-history-browser.test.sh take covers the "Done when" browser criterion: two notes, a reload, hover, row and marker clicks, and the clears. I did not run any test. The PR's verification results are the author's claim and unverified; the browser take runs only on CI's Linux lane.

The settled scroll-redraw thread on lib/ui-feedback/proto-pin.js lines 469-471 is unchanged since it was resolved, so I have not raised it again.

Loosened checks would be marked: fail. That is the default, because the prompt has no loosened_check_verdict: or loosened_check_patterns: line; patterns: 0. No changed file loosens a check. The prompt has no loosened_check_decision_record: line, so I did not check the citation requirement.

No plugin manifest changed. The changelog fragments use bump: minor for prototype (a new feature) and bump: patch for planning (the synced frame helper).

Verifier dropped 0 of 0 candidates.

kyle-sexton and others added 2 commits November 21, 2026 03:26
The layer redrew on resize only. An outline on a fixed or sticky element
is placed in document coordinates, so a selected note's outline drifted
off its element during the smooth scroll that selecting it starts, and
stayed misplaced afterwards. A scroll now redraws the layer, at most
once per animation frame.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/resolve-conflicts

Run 44887113039, attempt 1

Field Value
Model rung 0
Leg handoff
Run job success
Activity step success
Commits pushed none (read lane)
Run 44887113039

Failed GitHub API calls

No failed call recorded by the run job's scripts.

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/apply-conflict-patch

Run 44887113039, attempt 1

Field Value
Model rung 0
Leg base
Run job success
Activity step skipped
Commits pushed none recorded
Run 44887113039

Failed GitHub API calls

No failed call recorded by the run job's scripts.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-review: 1 inline finding(s) on 891fd93de3ffd0dc4326efce83a09158ef94c919; the summary is in this lane's pull request comment.

claude-lane: claude-review

Comment thread lib/ui-feedback/host.html Resolved
kyle-sexton and others added 2 commits November 21, 2026 03:42
…parses

Merging main brought `const target` (the frame's post origin) into the
host module, where this branch already declared `function target(m)`.
The redeclaration is a SyntaxError, so the host page ran none of its
script. The helper is now noteTarget.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 21, 2026
Merged via the queue into main with commit 17387b1 Nov 21, 2026
56 checks passed
@kyle-sexton
kyle-sexton deleted the fix/ui-feedback-note-history branch November 21, 2026 09:24
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 4, survived 1, timeout 0, no coverage 0, invalid 0, not run 2.
Covered-code score 80%; mutation score 80%.

File Killed Survived Timeout No coverage Invalid Not run
lib/ui-feedback/note-model.mjs 1 1 0 0 0 0
lib/ui-feedback/notes_bridge.py 2 0 0 0 0 0
lib/ui-feedback/proto-pin.js 0 0 0 0 0 2
lib/ui-feedback/relocate-note.mjs 1 0 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
lib/ui-feedback/note-model.mjs:83 SBR productive input-gap

The run's summary has the full report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ui-feedback: list a run's notes after reload, with hover and click to show each note's box

1 participant