MCP: move_document, create_folder, list_changes, and make_pdf replacing a document #107

Merged
jfro merged 2 commits from feat-103-move-folders-changes into main 2026-11-27 19:32:45 +00:00
Owner

What changed

PR #107 at c6d71a6 fixes F1 (out-of-range list_changes cursors are clamped, with a test for huge and negative values as numbers and strings); the end-to-end loop test (C7) still passes, the full suite (1601) passes locally, CI is green, and the PR merges cleanly with main now that #101 is in.

Fixes #103

Red, then green

  • The plan review loop test drives the whole #103 flow: an agent polls list_changes and sees the plan moved into Back to Claude with new pages and ink, moves it into Reviewed with move_document, makes a folder with create_folder, and sends v2 with make_pdf replaces_document_id (v1 to the trash), with every move and folder kept inside the key's folders.: bash -c 'source ~/.rmenv && mix test test/rm_analyzer/plan_review_loop_test.exs'
    • fails on the base (9c293f5): exit 1
    • passes on the branch (25b8d8e): exit 0

Checks

  • CI on PR #107's head passed (deps.unlock check, compile with warnings as errors, format, full mix test), and mix precommit passed locally with 1600 tests. (Upper Wolfjaw): bash -c 's=$(curl -s -H "Authorization: token $FORGEJO_TOKEN" https://git.knope.dev/api/v1/repos/jfro/rm-analyzer/commits/$(git rev-parse HEAD)/status | jq -r .state); echo "CI: $s"; [ "$s" = success ]', exit 0
  • At head c6d71a6 the F1 cursor crash is fixed (huge number and string cursors return ok), out-of-scope and folder replace/move probes return tool errors, and the full suite passes (1601); untried: a real tablet sync. (Prover): bash -c 'source ~/.rmenv && eval "$(mise activate bash --shims)" && cd ~/scratch/prv-wt && mix test test/rm_analyzer/plan_review_loop_test.exs', exit 0

Found and fixed

  • F1 bug: list_changes with a cursor above the 64-bit range (e.g. since 99999999999999999999999, as number or string) raises Postgrex DBConnection.EncodeError out of Changes.list; nothing in AgentTools/NotesMCP rescues, so an agent's bad cursor crashes the MCP request instead of returning a tool error. (fixed)

Shipping it

  • Goes live when it merges: no. Merging to main only runs CI; images are built from v* tags by Jeremy's own release run.
  • Undo: a revert puts it back.
  • Not tried on the real thing: A real tablet sync: moves, new folders and make_pdf v2-replaces-v1 were run against the stubbed cloud, not Jeremy's reMarkable.
  • For later: Change events start recording on the first sync after deploy (not backfilled). The changes table grows without pruning.

Prover

Passed (Sonnet): At head c6d71a6 the F1 cursor crash is fixed (huge number and string cursors return ok), out-of-scope and folder replace/move probes return tool errors, and the full suite passes (1601); untried: a real tablet sync.

Every command above was run by Fortysix's Basecamp itself, on the branch named.

## What changed PR #107 at c6d71a6 fixes F1 (out-of-range list_changes cursors are clamped, with a test for huge and negative values as numbers and strings); the end-to-end loop test (C7) still passes, the full suite (1601) passes locally, CI is green, and the PR merges cleanly with main now that #101 is in. Fixes #103 ## Red, then green - The plan review loop test drives the whole #103 flow: an agent polls list_changes and sees the plan moved into Back to Claude with new pages and ink, moves it into Reviewed with move_document, makes a folder with create_folder, and sends v2 with make_pdf replaces_document_id (v1 to the trash), with every move and folder kept inside the key's folders.: `bash -c 'source ~/.rmenv && mix test test/rm_analyzer/plan_review_loop_test.exs'` - fails on the base (9c293f5): exit 1 - passes on the branch (25b8d8e): exit 0 ## Checks - CI on PR #107's head passed (deps.unlock check, compile with warnings as errors, format, full mix test), and mix precommit passed locally with 1600 tests. (Upper Wolfjaw): `bash -c 's=$(curl -s -H "Authorization: token $FORGEJO_TOKEN" https://git.knope.dev/api/v1/repos/jfro/rm-analyzer/commits/$(git rev-parse HEAD)/status | jq -r .state); echo "CI: $s"; [ "$s" = success ]'`, exit 0 - At head c6d71a6 the F1 cursor crash is fixed (huge number and string cursors return ok), out-of-scope and folder replace/move probes return tool errors, and the full suite passes (1601); untried: a real tablet sync. (Prover): `bash -c 'source ~/.rmenv && eval "$(mise activate bash --shims)" && cd ~/scratch/prv-wt && mix test test/rm_analyzer/plan_review_loop_test.exs'`, exit 0 ## Found and fixed - F1 bug: list_changes with a cursor above the 64-bit range (e.g. since 99999999999999999999999, as number or string) raises Postgrex DBConnection.EncodeError out of Changes.list; nothing in AgentTools/NotesMCP rescues, so an agent's bad cursor crashes the MCP request instead of returning a tool error. (fixed) ## Shipping it - Goes live when it merges: no. Merging to main only runs CI; images are built from v* tags by Jeremy's own release run. - Undo: a revert puts it back. - Not tried on the real thing: A real tablet sync: moves, new folders and make_pdf v2-replaces-v1 were run against the stubbed cloud, not Jeremy's reMarkable. - For later: Change events start recording on the first sync after deploy (not backfilled). The changes table grows without pruning. ## Prover Passed (Sonnet): At head c6d71a6 the F1 cursor crash is fixed (huge number and string cursors return ok), out-of-scope and folder replace/move probes return tool errors, and the full suite passes (1601); untried: a real tablet sync. Every command above was run by Fortysix's Basecamp itself, on the branch named.
feat(mcp): move_document, create_folder and list_changes, and make_pdf replacing a document
All checks were successful
CI / test (pull_request) Successful in 1m54s
25b8d8ee0b
Sync records what changed in each item past an account's first sync
(moved, renamed, added, removed, new pages, new ink) in
remarkable_changes; list_changes reads them by cursor within the key's
scope. move_document and create_folder write straight to the cloud,
gated like make_pdf and only inside the folders the key reaches.
make_pdf's replaces_document_id puts v2 in v1's folder and v1 in the
trash in the same commit.

Closes #103
Author
Owner

Settings → API & MCP after this PR (example data: a fresh dev user with no keys yet). It adds a "Changes" tool label and a new description on the write checkbox.

Desktop:
settings desktop

Mobile (390px):
settings mobile

Settings → API & MCP after this PR (example data: a fresh dev user with no keys yet). It adds a "Changes" tool label and a new description on the write checkbox. Desktop: ![settings desktop](https://git.knope.dev/attachments/6e61c851-ccb5-4188-9ea4-3877e6a055ca) Mobile (390px): ![settings mobile](https://git.knope.dev/attachments/f03917cb-cff3-4172-871f-c3f8fc8ad7ff)
list_changes: clamp an out-of-range cursor instead of crashing the query
All checks were successful
CI / test (pull_request) Successful in 1m51s
c6d71a6f82
jfro merged commit 09e0b2e81b into main 2026-11-27 19:32:45 +00:00
jfro deleted branch feat-103-move-folders-changes 2026-11-27 19:32:45 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jfro/rm-analyzer!107
No description provided.