[no-impl] Pass a closure to visitDataBlobs - #262
Draft
JayChung0258 wants to merge 2 commits into
Draft
Conversation
visitDataBlobs, translateDataBlobs and translateOneDataBlob took a stringMatcher and a visitor function and passed both down to the events inside the blob. They now take one blobVisitor closure, and the two callers wrap their existing call in it. No behaviour change, and no test needed updating. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
bv was too short to read. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
JayChung0258
marked this pull request as draft
August 25, 2026 02:38
Contributor
Author
|
Parking this. It is a no-op that only pays off in a later PR, which makes it hard to review on its own merits, and we may not need it: a wider parameter on the shared visitor type would also work, and Leaving the branch up so the closure version is here to compare against when we get to the PR that actually needs it. The decision belongs there, next to its motive. One thing worth remembering either way: if we go the parameter route, the shared signature should not carry both a |
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.
The main idea
The functions that open a history blob need to hand the events inside to someone. Today that someone only needs one thing, the matcher, so passing the matcher as a parameter works fine.
That is about to stop being true. The next change needs to also pass in the namespace id, and the namespace id is only known at the call site, read off the message just before the blob is opened. If we keep passing things as parameters, all three functions in the chain grow a parameter now, and another one next time.
So instead of the helpers being told what to pass along, the caller hands them a closure and they just call it. The caller decides what to carry in.
What was changed
visitDataBlobs,translateDataBlobsandtranslateOneDataBlobtook astringMatcherplus avisitorfunction. They now take oneblobVisitorclosure. The two callers wrap their existing call in it.Before:
After:
And this is the call that needs it, in a later PR. Note that
matchalone is no longer enough:One file, no behaviour change. Split out on its own so the change that follows is easier to read.
Checklist
First step toward CGSCE-639.
How was this tested:
make generate-test-certs go test -race -timeout=12m -tags test_dep -count=1 ./... make lintBoth clean. No test file changed, which is the main thing I wanted to be true here.
One spot worth a second look. The
matchedandchangedreturn values are handled exactly as before. Those two together decide whether a blob is written back, and no test tells them apart, so a mistake there would be quiet.No.
🤖 Generated with Claude Code