Repository navigation
feat(kit): tags as Marfa tags, delete and archive holds, request pacer and thumbnails - #486
Merged
Merged
Conversation
preflight gains context.holdDeletes, which holds a batch deleting more than 20 and a quarter of a whole, cascades counted, until <connector>_confirm_deletes names it. A kind with holdArchives keeps its archives until the run has read the vendor and holds more than 20 and a quarter of its active rows until <connector>_confirm_archives names them. A confirmation is spent in kit state before any write, so it releases one batch. Closes #470, closes #471.
…to kit/connector-kit # Conflicts: # kit/src/define.ts
…imits A held thumbnail is kept only when Marfa takes it and the caller's maxBytes and the 16 KiB cap allow it. The pixel limit falls to 12 million so the worst decode peaks near 0.5 GB resident.
Count the archives that settle inbound retries and gather in delivery runs only the rows a delivery named. A held batch keeps no keys; a released batch is kept as key hashes and finished first at the next run's start, since Marfa has no atomic set archive. The delete value covers every whole and what each cascade takes, and both conditions lead with the value.
The export, Reader list and Reader write requests take their 429 wait, the Retry-After parsing and the budget from the kit's Pacer, one per token and limit. A missing or malformed Retry-After waits the pacer's default instead of failing the run, and one 429 holds the token's later requests to its deadline. The copies of the Retry-After logic in the HTTP client and the Reader write client are gone.
…r-kit # Conflicts: # kit/src/store.ts
4 tasks done
4 tasks done
A remake now carries the row's tags and favorite, and the agreement after it is what the vendor answered, or what was sent, so the next read keeps them in Marfa. Rows a cascade took come back offered to remake after the rows above them, handed every connection, and are only returned where the vendor still has them.
aicayzer
commented
Dec 3, 2026
aicayzer
left a comment
Contributor
Author
There was a problem hiding this comment.
Review: ready to merge
Summary. Kit support for tags and favorites as Marfa tags, confirmable delete and archive holds, a request pacer, thumbnails and remakes with their tags and children; safe to merge after five review rounds fixed every blocking finding.
First draft: 1/5. The first round found fifteen blocking problems, including ways to lose tags and to archive or delete past the holds, and a regression in Readwise Reader's writes; all were fixed, and later rounds found and fixed six, one, two and two more.
Checked.
- Keep what people made: tag agreement only when both sides hold a tag; smaller agreement saved before a removal; mapping-choice changes start a union; waiting rows retried; a remake carries its tags and favorite.
- Every path: inbound retries and delivery-scoped runs count toward the archive hold;
inkinds never send tags; children remade only after their parent's remake is settled. - Check and write are one step: confirmation values bind the exact set, its operation and cascades; a trash value never releases a purge.
- Real conditions: state under 512 KiB at 14,000 to 16,000 held keys; quadratic scans removed; thumbnail decode memory bounded; CMYK JPEGs refused above 16 million pixels before a heap-bound decode.
- Done: proof groups
holds,tags,readwise,readwise-with-reader,parent-of,todoistagainst marfa 0.0.123.
Found.
- Reader lost its preflight approval.
preflightgot a copy of the context. Fixed in 87f22bd.Every path - Tags agreed from a service answer alone, then deleted at the service. Fixed in e953ff8.
Keep what people made - A mapping change resurrected or removed tags. Fixed in e953ff8 and c312a74.
Keep what people made - Crash recovery undid a fresh tag edit. Fixed in e953ff8.
Check and write are one step - Tag work lost behind a checkpoint or a failed write. Fixed in e953ff8.
Keep what people made - Archive hold bypassed by a retry or a delivery, and confirmations not binding the set. Fixed in 7463229 and 63d42a3.
Every path - Held or gathered archives lost after a failed run. Fixed in 4751408.
Real conditions - Hold state and messages past Marfa's limits. Fixed in 7463229.
Real conditions Retry-Afterlost to a reset header; cached thumbnails skipping the cap. Fixed in 0bce5b8 and 91bc678.Done- A trash confirmation released purges. Fixed in 2e6080a.
Check and write are one step - mozjpeg refused CMYK and harmless-warning JPEGs. Fixed in 4dee7eb and 5f9c118.
Real conditions - A waiting create lost after a cascade restore; a child remade under its parent's deleted link. Fixed in f5073d2 and 595f7bd.
Every path - A confirmed archive batch can be half written by a stop. Declined as specified: Marfa has no atomic archive of a set, so the batch is saved and finished first by the next run; #471 amended.
Done
Quick fixes. 6 applied by reviewers.
Reviewed by withmarfa-reviewer on gpt-6.2-astra (round 1) and claude-opus-5-5 and claude-sonnet-5-5 (rounds 2 to 5). This review may contain mistakes.
aicayzer
marked this pull request as ready for review
December 3, 2026 21:32
aicayzer
enabled auto-merge (squash)
December 3, 2026 21:33
| describe("when the vendor's clock differs from this one", () => { | ||
| const ahead = 10 * 60_000; | ||
| const vendorDate = (): string => | ||
| new Date(start + ahead).toUTCString().replace(/ GMT$/, " GMT"); |
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Connector kit work that every connector can use, needed first by the Raindrop connector:
tagsandfavorite; its entries carry the service's tags and favorite beside their fields, and the kit keeps them as Marfa tags and thefavoritetag both ways, merging tag by tag against what both sides last held. A tag is agreed only when both sides hold it, a change of the kind's tag choice starts from a union, and the smaller agreement is saved before either side loses a tag, so a stop at any point can at worst re-add a tag, never remove one. It follows the mapping'stags("marfa","none"or{ field }) andfavoritechoices.preflight. The confirmation value binds the exact deletes, their operation (a trash never releases a purge) and what each cascade takes. Google Calendar now uses it.429waits (Retry-Afterfirst) through the durable wait. Every Readwise request goes through it.thumbnailfield holds, with no native code: JPEG through mozjpeg in WebAssembly, CMYK JPEG throughjpeg-jsup to 16 million pixels, PNG, GIF and WebP, 25 million pixels at most.Generated plugins now need
marfa0.0.123.Closes #470, closes #471, closes #472, closes #473, closes #474.
Changes
kit/src/tags.ts,kit/src/run.ts,kit/src/agreement.ts,kit/src/store.ts,kit/src/define.ts;scripts/connector-plugins.tswritestagsandfavoriteon a kind.kit/src/holds.ts:context.holdDeletes(...)inpreflight;holdArchives: trueon a kind; settings<connector>_confirm_deletesand<connector>_confirm_archives. A used value is recorded as spent, since a connector key cannot clear a setting.kit/src/pacer.ts(@withmarfa/connector/pacer); Readwise's own limiter andRetry-Afterparsing removed.kit/src/thumbnails.ts(@withmarfa/connector/thumbnails),kit/src/codec-wasm.ts;scripts/bundle-connectors.tscarries the codecs' WebAssembly inline.kit/src/connections.ts:Connections.above();preflight,onChangeandremakeshare one context.holdDeletes, keepinggoogle_calendar_confirm_deletesand its limit of 10.tagsandholds;kit/README.mdfor each piece.Testing
connectors:check: pass.scripts/monorepo.sh(marfa-server 0.0.123): 4,039 of 4,043; the four failures are the macOS sandbox tests, which cannot start Homebrew's Node on the machine used, and run in CI on the pinned Node.holds5,tags8 (including a real process crash mid-merge with both sides changing),readwise9,readwise-with-reader13,parent-of4,todoist34 statements.Notes for reviewers
kit/src/mapping.tsreadstagsandfavoriteas optional because the 0.0.123 client types them as required (The TypeScript client requires tags and favorite on every connector mapping kind marfa#3836); that reading can go once the client is fixed.Checklist