Skip to content

feat(prototype): edit and withdraw a sent note on the notes host - #18042

Merged
kyle-sexton merged 11 commits into
mainfrom
fix/17956-edit-withdraw-sent-note
Nov 21, 2026
Merged

kyle-sexton merged 11 commits into
mainfrom
fix/17956-edit-withdraw-sent-note

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Summary

A sent note on the notes host page could only be edited or deleted while it was a draft. A sent note's row now has Edit and Withdraw. An edit reaches the session as a change to the same note (same seq). A withdraw marks the note withdrawn in the list and tells the session, and a withdrawn note is not shown as pending.

Fix

  • Wire shape. Two new message types sit beside $defs/change in note.schema.json (x-version 8):
    • POST /api/note/edit takes {"edit": <seq>, "text": ...} ($defs/edit). The text replaces the note's own in the log, under the same seq.
    • POST /api/note/withdraw takes {"withdraw": <seq>} ($defs/withdraw).
    • Each is logged as an event of its own naming the note, so the watcher wakes and the session reads it as that note edited or withdrawn, not as a new note.
    • The note text limit moved to $defs/text, so the note and the edit share one definition.
  • Backward compatible. The withdrawn state is never stored on the note record. It comes only from the withdraw event. Old logs have no such event, so they load unchanged.
  • Server (notes_bridge.py):
    • One is_note predicate replaces the "change" not in e checks.
    • record_change, record_edit and record_withdraw share record_naming. It validates the message against its schema definition and refuses a missing note, an event in place of a note, or a withdrawn note.
    • read_state reports withdrawn: true.
    • status and the watcher's unhandled set leave out a withdrawn note and the events that change it. They keep the withdraw event itself.
  • Host page:
    • Edit opens the editor on the sent note with Save draft and the editor's own Move or resize hidden; Send posts the edit.
    • Withdraw lists the note as Withdrawn, with no actions and no marker, and leaves it out of Copy all notes.
    • The withdrawn state survives a reload.
  • Docs. docs/contracts/ui-feedback/README.md, the explore-directions reference/feedback.md (what the session does with an edit or withdraw event), the host page header and the changelog fragment.

Verification

  • python lib/ui-feedback/test_notes_bridge.py TestEditAndWithdraw: the 7 new tests fail on main (3 failures, 4 errors) and pass with the change.
  • node --test lib/ui-feedback/*.test.mjs: 288 pass. The new edit and withdraw fixture cases fail on main, where $defs/edit does not exist.
  • python lib/ui-feedback/test_notes_bridge.py with every class except TestLoop: 55 tests OK after merging origin/main.
    • TestLoop fails on this Windows host on main too, because bash gets a backslash-stripped temp path. CI's Linux lane runs it.
  • node --check passes on both copies of host.mjs.
  • New browser suite: plugins/prototype/skills/explore-directions/scripts/notes-edit-browser.test.sh. It covers Edit and Withdraw in the list, both surviving a reload, the logged events, and status. It cannot run on Windows, so it has not been run; CI's Linux lane runs it.
  • scripts/sync-shared-copies.sh regenerated the plugin copies. A changelog fragment was added for prototype.

Related

  • The existing region move or resize (/api/note/change) uses the same "event naming a note" pattern, and this change extends it.

Closes #17956

🤖 Generated with Claude Code

kyle-sexton and others added 2 commits November 21, 2026 15:47
A sent note could only be corrected or taken back by sending a second,
contradicting note. Its row now has Edit and Withdraw.

- POST /api/note/edit takes {"edit": seq, "text"} ($defs/edit): the text
  replaces the note's own in the log under the same seq, and the edit is
  logged as an event of its own naming the note, so the watcher wakes and
  the session reads it as that note edited, not a new note.
- POST /api/note/withdraw takes {"withdraw": seq} ($defs/withdraw): the
  note stays in the log and that event alone marks it withdrawn. Storing a
  withdrawn flag on the note record would fail note.schema.json
  (additionalProperties false), which the host page's reload, relocation and
  import all re-check, and old logs carry no such event, so they load
  unchanged.
- One is_note predicate replaces the "change" not in e checks, so an edit
  or withdraw event is never listed as a note. A withdrawn note, and the
  events changing it, leave status and the watcher's unhandled set; its
  withdraw stays. The bridge refuses an edit, move or second withdraw of a
  withdrawn note. record_change, record_edit and record_withdraw share one
  record_naming.
- The note text limit moves to $defs/text so the note and the edit share
  it; x-version 8.
- Host page: Edit opens the editor on the sent note (no Save draft, no
  composer reshape, which would demote or only reshape the copy), Send
  posts the edit; Withdraw lists the note as Withdrawn with no actions or
  marker and leaves it out of Copy all notes. sendDrafts closes the editor
  only when the entry it edits was in the batch.

Closes #17956

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@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-21T20:51:05.490329Z 1945860 PR opened
ℹ️ 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.

… test-scope

The suite reads plugins/prototype/.claude-plugin/plugin.json through the
browser test helpers, so a change to it must select the suite
(scripts/affected-tests.sh R8).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-refine/fix-docs

Run 44948312492, attempt 1

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

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

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

Security review: PR #18042 at b1310695 (incremental since cd5413e2)

No security issues found. This lane already reviewed an earlier head of this pull request, so this review is blocking only: it reports only CRITICAL and IMPORTANT findings.

What changed since the last review

I read the whole change in both files on the incremental list:

  • lib/ui-feedback/test_notes_edit.py: one # test-scope: comment line now also names lib/ui-feedback/notes_bridge.py. This is test metadata only. It changes no code that runs.
  • plugins/prototype/skills/explore-directions/scripts/notes-copyout-browser-take.js: one added line in a browser test. It waits until the status line shows "Copied the chosen design" before checking it. This is test timing only. It adds no input path, no network call and no credential handling.

Neither file matches a trusted-path glob. Neither touches a trust control, workflow, manifest or standing instruction, so skip gate 2 applies.

Prior findings and settled threads

This lane's earlier reviews reported no findings, so nothing carries forward. The checks from earlier reviews still hold, because none of the code they covered changed in this push.

Spend

None. The change adds no paid resource and no billing setting.

critical-findings: 0

@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 56e3e43d77624f2618c4587a319da6c29cc84d29; the summary is in this lane's pull request comment.

claude-lane: claude-review

Comment thread lib/ui-feedback/host.mjs Resolved
@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

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

Code review: blocking issues only

This lane already reviewed earlier heads of this pull request, so this review reports only blocking findings. It is incremental: it covers the two files that changed since cd5413e217, and I read the whole change in both.

No blocking findings.

What changed since the last review

  • lib/ui-feedback/test_notes_edit.py:1: the first # test-scope: line now also names lib/ui-feedback/notes_bridge.py.
    • The file exists in the tree, so the stale-glob check will not fail on it.
    • The line stays in the leading comment block. A test-scope line can only add suites to a run, never remove any.
  • plugins/prototype/skills/explore-directions/scripts/notes-copyout-browser-take.js:31: the test now waits for the status line to read Copied the chosen design before it asserts that.
    • It uses the same bounded settle helper (lines 7-9) as the other waits in the file: at most 40 polls 50 ms apart, about 2 s in total.
    • If the text never appears, the ok on line 32 still records a FAIL with the status text. The wait cannot hide a real failure.

Not verified by me

This run had no shell, so I did not run the browser test or the Python suites. Any results for them are the author's claims and unverified.

Earlier threads

  • The settled threads on host.mjs and notes-edit-browser.test.sh:10 are about files this push did not touch. They stay settled.
  • None of the earlier findings repeats.

Other checks

  • The incremental diff changes no plugin manifest, so there are no manifest lines.
  • Loosened checks would be marked: fail (default); patterns: 0.
    • The prompt had no loosened_check_verdict: or loosened_check_patterns: line, so I used no consumer patterns.
    • It had no loosened_check_decision_record: line either, so the citation requirement was not checked.
    • Nothing in this change loosens a check.

Verifier dropped 0 of 0 candidates.

kyle-sexton and others added 2 commits November 21, 2026 16:02
…owser suite

A row's actions show only on the selected row (host.html .note:not([aria-current="true"]) .acts
{ display: none }), so the take timed out clicking a hidden Edit. It now clicks the row's text
first, as a person does. The suite's session prefix becomes edx, which typos accepts, and
numberOf's doc comment moves back onto numberOf.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@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 580436c9f75035b08b14acad9d227a39accd6e31; the summary is in this lane's pull request comment.

claude-lane: claude-review

The prefix rename joined edx and playwright-cli into one argument, so
browser_setup took edxplaywright-cli as the session prefix and never
checked for playwright-cli.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 21, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 21, 2026
…aw-sent-note

# Conflicts:
#	lib/ui-feedback/host.mjs
#	plugins/prototype/notes-bridge/host.mjs
@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/resolve-conflicts

Run 44951038552, attempt 1

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

Failed GitHub API calls

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

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

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

Run 44951038552, attempt 1

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

Failed GitHub API calls

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

kyle-sexton and others added 4 commits November 21, 2026 16:36
…wn file

TestEditAndWithdraw pushed test_notes_bridge.py across the 1000-line size
reference. It is one concern, editing and withdrawing a sent note, so it
moves whole to test_notes_edit.py and imports the shared case and fixtures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…import

It imports test_notes_bridge, so it reads the session bridge, the controls and
notes fixtures and schemas, and proto-pin.js; a change to any of them must
select it (scripts/affected-tests.sh R8).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The host writes "Copied the chosen design" only once the clipboard write
resolves, so reading the status right after the copied text appears raced it
and failed on a slower runner. Also declare notes_bridge.py in
test_notes_edit.py's scope (scripts/affected-tests.sh R8).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 21, 2026
Merged via the queue into main with commit e2d9b1f Nov 21, 2026
47 checks passed
@kyle-sexton
kyle-sexton deleted the fix/17956-edit-withdraw-sent-note branch November 21, 2026 22:05
@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 3, timeout 0, no coverage 0, invalid 0, not run 0.
Covered-code score 57%; mutation score 57%.

File Killed Survived Timeout No coverage Invalid Not run
lib/ui-feedback/host.mjs 0 2 0 0 0 0
lib/ui-feedback/notes_bridge.py 4 1 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
lib/ui-feedback/notes_bridge.py:172 other productive input-gap
lib/ui-feedback/host.mjs:238 LCR productive input-gap
lib/ui-feedback/host.mjs:667 other unclassified none

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: a sent note cannot be edited or withdrawn

1 participant