Add concurrent payload visitor#2140
Open
cconstable wants to merge 6 commits into
Open
Conversation
cconstable
commented
Jun 23, 2026
Comment on lines
+54
to
+60
| - name: Check generated payload visitor is up to date | ||
| run: | | ||
| pnpm run gen:payload-visitor | ||
| if ! git diff --exit-code -- packages/proto/src/payload-visitor.generated.ts; then | ||
| echo "::error::payload-visitor.generated.ts is out of date with the protos. Run 'pnpm run gen:payload-visitor' and commit the result." | ||
| exit 1 | ||
| fi |
Contributor
Author
There was a problem hiding this comment.
safeguard to make sure generated protos stay up to data
cconstable
commented
Jun 24, 2026
| "rebuild": "pnpm run clean && pnpm run build", | ||
| "build": "pnpm --recursive --stream run build", | ||
| "build:watch": "pnpm run build:protos && tsc --build --watch packages/*/tsconfig.json", | ||
| "build:watch": "pnpm run build:protos && pnpm run gen:payload-visitor && tsc --build --watch packages/*/tsconfig.json", |
Contributor
Author
There was a problem hiding this comment.
Building the protos package now builds the payload visitor as well. I can't think of a reason why you wouldn't want to keep them in sync but you can still run build:protos to just build the protos.
cconstable
commented
Jun 24, 2026
| * A counting semaphore. `acquire` resolves once a permit is available; `release` returns one, | ||
| * handing it directly to the longest-waiting acquirer if any. | ||
| */ | ||
| class Semaphore { |
Contributor
Author
There was a problem hiding this comment.
Hand rolling concurrency primitives feels bad but I didn't see any reusable alternatives. I could move this to a different place if folks have opinions.
jmaeagle99
reviewed
Jun 25, 2026
jmaeagle99
left a comment
Contributor
There was a problem hiding this comment.
Haven't read too closely, but I think a few things need to be changed:
- The visitor shouldn't enforce cardinality. If a callback wants to mutate the arity of an array, it should be able to e.g. codecs.
- There needs to be some kind of context that is passed through while walking and a separate visitor that allows updating/replacing the context on a per-message basis. This would allow things like SerializationContext or StorageDriverStoreContext to change as we iterate commands in a WFT completion.
- There should be settings for skipping search attributes and headers.
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.
What was changed
WorkflowActivation/WorkflowActivationCompletionproto trees.proto/scripts/gen-payload-visitor.tsscript that generates the visitors atproto/src/payload-visitor.generated.ts. Runs automatically when new protos are generated. About ~1k lines of checked in code.Why?
Prerequisite for External Storage store/retrieve (and reusable by codecs / payload validation): we need to find and transform every payload in an arbitrary proto message with bounded concurrency.