Repository navigation
refactor: merge duplicate helpers in blobs, store and vault - #235
Merged
Merged
Conversation
blobs.Put and PutWant share one write path; the nested-tag condition of ListNotes and SearchNotes is one constant; backlinks use showText, the same function as valid. No change in behavior.
Contributor
Author
|
Review and integration record for head Cross-review: reviewer Integration runs (host,
CI: all checks are green at the head. |
bketelsen
approved these changes
Nov 14, 2026
This was referenced Nov 15, 2026
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
Merges 3 duplicates that the grooming pass of issue #213 lists. No change in behavior.
internal/blobs/blobs.go:PutandPutWanthad the same steps: temp file, hash, check of the context, chmod, sync, close and publish. Now both call 1 unexportedput(ctx, r, want). OnlyPutWantsetswant; content that hashes to another ID returnsErrCorrupt. The order of the steps stays the same:PutWantchecks the hash before it checks the context. The error texts stay the same.PutWantstill refuses a malformed ID before it reads.internal/store/queries.go,internal/store/search.go:ListNotes(noteConditions) andSearchNotes(searchNotesSQL) each wrote out the same nested-tagEXISTSclause and its 3 arguments. Now they share the constanthasTagand the functionhasTagArgs. Only the whitespace inside the SQL text changes.internal/vault/backlinks.go:validwas the same function asshowTextinwrite.go(strings.ToValidUTF8(..., "\uFFFD")).backlinkContextnow callsshowText, andvalidis removed.Risk tier
Risk tier: 1 — a refactor with no change in behavior. No changed file is in
.github/risk-paths.json.Verification
internal/blobs/putwant_failures_test.go. They pinPutWant's failures (a failing reader, wrong content and its error text, a cancelled context, and wrong content with a cancelled context) and that it leaves no file behind. They also pin that a malformed ID makes no directory, and thatPutandPutWantstore the same bytes with mode 0600. They pass on the base code.make check(host,umask 022) on the basebac5e97with the characterization tests: exit 0, 57 packagesok.make checkon the head: exit 0, 57 packagesok. No existing test changed.TestListNotes-style cases ininternal/store/queries_test.go("tag and nested tags, ignoring case", "tag with #") and byinternal/store/filters_test.go(tag:filters, nested tags).make vault-itandmake sync-sim: see the comment below.Left out on purpose
(*DB).Search,(*DB).GetVaultand(*Client).DownloadAll. Only contract tests call them (T-0016, T-0029, marked "Do not edit"), and those tests also cover live code.retargetTextis the test entry totargetSpan, which the live code uses.ignoredandvaultPathHeldare not exact opposites: both are false when the vault lookup fails. So they stay apart.app/are in files that fix(app): a narrow window offers no splits and follows the keyboard #232 changed.PruneChangeshas its own issue, changes log is never pruned: add a retention step that calls store.PruneChanges #219.