Skip to content

fix(readwise): send a Marfa edit on the quick run between schedules - #466

Merged
aicayzer merged 2 commits into
mainfrom
fix/readwise-look-run
Dec 2, 2026
Merged

aicayzer merged 2 commits into
mainfrom
fix/readwise-look-run

Conversation

@aicayzer

@aicayzer aicayzer commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Editing a Readwise Reader document in Marfa now reaches Reader on the quick run that follows, instead of failing that run with checkpoint requires an active full vendor read and waiting for the next scheduled one. Closes #460

Changes

  • On a run a change in Marfa started, read each Reader document the kit names and write its row, and nothing else: no listing, no identity walk, no content or picture work, no reconciliation. The kit sends a change only over a row the run read.
  • On that run, save no read progress on any path. The old hint branch ran after eight other checkpoints and saved the hints as pending, which the kit refuses. The pending retries, the listing and the content queue wait for the scheduled run, which lists Reader whole.
  • On that run, keep the identity claims in memory instead of saving them. A scheduled run keeps those still pending.
  • On that run, give the identity cache the export client without preparing or saving anything, so a Reader highlight's note or tags edit resolves its export identity and is sent on the quick run. A highlight with several export aliases still stops at "requires a complete export", which the scheduled run completes, so its edit waits for that run.
  • A Reader rate limit waits inside the run, since the client always holds a wait function, so the run has no separate rate-limit branch.
  • The unit tests' stand-in checkpoint now refuses on a run with hints, as the kit does. Two tests that relied on a run with empty hints behaving as a scheduled one now use a scheduled run, and the test that expected hints to be saved as pending now expects nothing saved.

Testing

  • A new test runs the real connector against the real kit and a Reader stub, on its schedule. It edits a title in Marfa after the first run and waits for the run that look starts. It failed first with checkpoint requires an active full vendor read. It now succeeds, Reader receives PATCH /v3/update/doc-1/ with the new title, the saved state is unchanged, the run lists no page of Reader, and a document new in Reader is not imported until the next scheduled run, which then imports it.
  • A new look test edits a Reader highlight's note and tags in Marfa and expects PATCH /v3/update/hi-1/ with both and the saved state unchanged. It failed first (the look logged Reader export client is unavailable and sent nothing). A new identity test, seen failing without the change, holds a pending claim without saving it on a run with hints.
  • pnpm build, pnpm typecheck, pnpm lint and pnpm format:check pass. The Readwise tests (478) and the kit tests pass.
  • The full pnpm test ran 3,832 tests: 3,828 passed and 4 failed, all in the macOS sandbox and bundle tests (host/test/macos-profile.test.ts, host/test/sandbox-os.test.ts and scripts/test/bundle-connectors.test.ts), where the pinned Node fails with Library not loaded: @rpath/libnode.147.dylib. They also fail on main on this machine, and this change touches none of them.

Notes for reviewers

  • The test passes --every alone. --look-every is refused for Readwise: the kit checks it against the settings' defaults, where Reader is off, so the connector does not look. The host never passes it, so the test imports the kit's defaultLookMs, the interval an owner's run uses. The look tests each hold their own access token, because Reader's request budget is kept per token for the whole process; readwiseVendor takes an optional token.
  • A look edit to a row only the export made starts no run, so the quick run never has a key that is not a Reader document.
  • Not run against a live Readwise account.

Checklist

  • The title is a scoped Conventional Commit.
  • New behavior has a test that was seen failing first, or no test was needed and the reason is above.
  • Docs, comments and the contract still say what is true after this change.

A highlight edit made in Marfa needs the export client to resolve its identity, which only the scheduled run's preparation handed over. A look run now assigns it without saving anything. The hinted rate-limit branch is removed because the Reader client waits inside the run, and a malformed key is contained in the look's try.

@aicayzer aicayzer left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Review: ready to merge

Summary. A run that a change in Marfa starts now reads only the Reader documents the kit names, sends the edit for sources and highlights, and saves nothing, so it no longer fails on the kit's refused checkpoint; safe to merge.

First draft: 3/5. One blocking finding (a highlight edit not sent on the quick run) and four smaller ones, all fixed in 215f3a4.

Checked.

  • Done: connectors/readwise/test/look.test.ts runs the real connector through the kit's start against the Reader stub. It fails on main with checkpoint requires an active full vendor read; after the fix it sends PATCH /v3/update/doc-1/ for a source title and PATCH /v3/update/hi-1/ for a highlight's note and tags, leaves saved state unchanged and lists no page. Breaking the content-queue guard, adding a final checkpoint, removing the identity.ts guard or removing useClient each makes a test fail.
  • Keep what people made: a look whose Reader read fails saves nothing and sends nothing; the next scheduled run sends the edit, because the kit keeps the pending intent. A claim held in memory on a look stays pending until a scheduled run saves it (settle in outbound.ts). Nothing the old hint branch kept is lost, since the kit refused the earlier checkpoint first.
  • Every path: every checkpoint in reader/sync.ts and identity.ts is unreachable on a hinted run; prepare and setLifecycleReady sit behind a check that throws first. Both Reader and export clients are built with waitUntil, so a rate limit waits inside the run and the removed hinted RateLimited branch could never run.
  • True: the refusing checkpoint in the stand-in contexts matches the kit's message and condition. --look-every cannot be passed because the kit validates it against the settings' defaults, where Reader is off; the test uses the kit's defaultLookMs, as an owner's run does.
  • Real conditions: idFromKey now sits inside the per-key try, so one malformed key is contained.

Found.

  • A Reader highlight edit was not sent on the quick run. identities.resolve needed the export client, set only by the saving prepare. Fixed in 215f3a4 with useClient, which only assigns it; a highlight with several export aliases still waits for a complete export, as the PR states. Done
  • Unreachable hinted rate-limit branch, and an untrue PR claim about it. Removed and reworded in 215f3a4. True
  • Dead return check on importDocuments and idFromKey outside the try. Fixed in 215f3a4. Nothing left behind
  • Test copied the kit's look interval. Now imports defaultLookMs. Fixed in 215f3a4. True
  • Stale test counts in the PR body. Corrected. True

Not from this change. host/test/macos-profile.test.ts, host/test/sandbox-os.test.ts and scripts/test/bundle-connectors.test.ts fail on a clean main on the review machine too (Library not loaded: @rpath/libnode.147.dylib, a Homebrew Node without libnode).


Reviewed by withmarfa-reviewer on claude-sonnet-5-5. This review may contain mistakes.

@aicayzer
aicayzer marked this pull request as ready for review December 2, 2026 03:48
@aicayzer
aicayzer enabled auto-merge (squash) December 2, 2026 03:48
@aicayzer
aicayzer merged commit da33ffc into main Dec 2, 2026
29 of 30 checks passed
@aicayzer
aicayzer deleted the fix/readwise-look-run branch December 2, 2026 04:06
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.

Send a Marfa edit to Readwise Reader on the quick run between schedules

1 participant