Skip to content

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

Open
kyle-sexton wants to merge 10 commits into
mainfrom
fix/17956-edit-withdraw-sent-note
Open

kyle-sexton wants to merge 10 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 cd5413e217de9549e14104b443e2ef0767ad5af8: read 1 of 1 changed file(s); 0 finding(s), 0 as inline comments.

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

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

One file changed: lib/ui-feedback/test_notes_edit.py. I read the whole change in the incremental diff. It adds three # test-scope: comment lines at the top of the test file. These lines declare which files the test reads through its imports. They:

  • change no code that runs,
  • touch no trust control, workflow, manifest or standing instruction,
  • add no input path.

The file matches no trusted-path glob. The change has no security-relevant surface, so skip gate 2 applies.

Prior findings and settled threads

  • This lane's earlier reviews reported no findings, so nothing carries forward.
  • The earlier review's checks of the token-gated /api/note/edit and /api/note/withdraw endpoints still hold. None of those files 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 cd5413e217de9549e14104b443e2ef0767ad5af8: read 1 of 1 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 one file that changed since 0fd7fbe4f1, lib/ui-feedback/test_notes_edit.py, and I read its whole change.

No blocking findings.

What changed since the last review

  • test_notes_edit.py now starts with three # test-scope: lines. They name the files the suite reads through from test_notes_bridge import …: test_notes_bridge.py, session_bridge.py, view_bridge.py, the controls and notes fixtures and schemas, controls.js and proto-pin.js.
    • Placement is valid. The lines sit in the leading comment block, before the docstring. That is where the R8 reader in scripts/affected-tests.sh looks for them: scope_declarations stops reading at the first line that is neither a comment nor blank. A comment above the docstring does not stop it from being the module docstring.
    • Every glob matches a file. All nine paths exist in the tree, so the stale-glob check (error: … declares test-scope globs that match no file of the tree) will not fail.
    • The header can only add tests to a run. It makes more suites get selected and removes none.
  • The changed lines are header comments. The tests themselves did not change, so the closing-issue assessment from the last review still applies.

Not verified by me

This run had no shell, so I did not run scripts/affected-tests.sh or the Python suites. Any results for them are the author's claims and unverified.

Earlier threads

Both settled threads, on host.mjs and on notes-edit-browser.test.sh:10, cover files this push did not touch. They stay settled.

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 3 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>
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.

ui-feedback: a sent note cannot be edited or withdrawn

1 participant