Repository navigation
refactor(kit): cut comments to what the code cannot say - #494
Merged
Merged
Conversation
aicayzer
commented
Dec 4, 2026
aicayzer
left a comment
Contributor
Author
There was a problem hiding this comment.
Review: ready to merge with open items
Summary. Cuts comments in kit/, shared/ and template/ to what the code cannot say; it is comments only, so it cannot change behavior.
First draft: 4/5. The cut dropped public conditions from verifyHmac and guardHost and many test wait, stub-shape and witness reasons; all restored in 4abc05b. A later condensing pass dropped 10 conditions and made 2 docs untrue; all fixed in 2bae338.
Checked.
- Done: every changed file printed with comments removed matches
main. - True: each condensed public doc read against the old text and the code it documents.
- Comments: kept kinds (ordering, races, outside constraints, test waits and witnesses, public refusals) and internal doc comments.
Found.
- Public conditions lost.
verifyHmaclost that malformed input isfalse;guardHostlost itsRefusedAddressrefusal. Restored in 4abc05b.True - Docs made untrue by condensing.
thumbnailTurnsdescribed an unknown cursor wrongly, and a contract reference in the scripted server was split across lines. Fixed in 2bae338.True
For an issue.
- JPEG decoder claims behind the thumbnail limits. A connector could run out of heap on a large CMYK JPEG if the unmeasured bound is wrong. Filed as #498.
Quick fixes. About 60 internal doc comments turned into // lines or cut, and paragraphs condensed, by the reviewer.
Reviewed by withmarfa-reviewer on Claude Sonnet 5.5. This review may contain mistakes.
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.
Comment cull for
kit/,shared/andtemplate/(piece 1 of 3). Comments only, no behaviour change. The lint-required empty-catch comments inkit/src/telemetry-sdk.tsare kept.Comment lines (whole-line comments in tracked source)
Kept on purpose: public docs of the
kit/package.jsonexports with every refusal, error and condition; ordering, race and security reasons; the scripted server's stub-shape and contract-citation comments; test witnesses and wait reasons. Test helper doc comments were cut; test//comments were kept except where they restated the code.Outside claims checked (Node 26.13.1,
@jsquash/jpeg1.6.0)AbortSignal.timeoutoverflow (fires after 1 ms past 2^31, throws past 2^32); undiciredirect: "error"gives afetch failedTypeError with cause "unexpected redirect" and no code;@jsquash/jpegdefines a globalImageDatawhen none exists; SIGUSR1 is not delivered under--permission;new URL(path, base)drops the base's last segment.jpeg-jskeeping CMYK/YCCK coefficients in the heap (maxInkJpegPixels); mozjpeg as built not converting CMYK to RGB; server-side limits (30-day idempotency replay, bulk caps) are Marfa contract and were not checked against the server.Issues to file (not filed)
maxInkJpegPixelsrests on an unmeasured claim about heap use within 512 MB.@jsquash/jpeg: the refusal of CMYK input depends on it.Code health
kit/src/run.ts: about 6,000 lines, should be split.kit/src/define.ts: public types mixed with the internal outbound-journal types.kit/src/marfa.ts: very large, several concerns.kit/src/rows.ts: theUnreachable,RefusedandDeclineddocs partly repeatonChangeindefine.ts.kit/src/run.ts: thequietset has a vague name.kit/src/holds.tsandkit/src/define.ts: document the same hold rules (deletes-held,archives-held).Tested
pnpm build,pnpm connectors:check,pnpm typecheck,pnpm lint,pnpm format:checkpass.vitest run kit shared template: 1,882 of 1,883 pass;kit/test/archive-handover.test.tsfails withENOENTbecausevendor/marfa-server/marfa-serveris not built in the worktree. Not run: that test with the server binary, and the proof.Review
Two rounds by
withmarfa-reviewer, standard depth: comments only, checked by printing every changed file with comments removed and comparing it againstmain. Round one restored public conditions (verifyHmac,guardHost) and test waits, stub shapes and witnesses in about 30 files, and turned internal doc comments into//lines or cut them. A condensing pass then shortened the long public docs and moved theUnreachable,RefusedandDeclineddetails intoConnector.onChange. Round two restored 10 conditions that pass dropped and corrected 2 docs it made untrue. The table shows the counts after both rounds. Merged without waiting forFull CI: the change cannot affect any job's behavior.