feat: add FDv2 protocol foundation types and state machine#253
Open
kinyoklion wants to merge 10 commits intomainfrom
Open
feat: add FDv2 protocol foundation types and state machine#253kinyoklion wants to merge 10 commits intomainfrom
kinyoklion wants to merge 10 commits intomainfrom
Conversation
Introduces the core FDv2 wire protocol types, protocol handler state machine, source result types, flag eval mapper, async queue, and selector. Pure library code with no SDK integration — existing behavior is unchanged. New files in packages/common_client/lib/src/data_sources/fdv2/: - fdv2_protocol_types.dart: wire protocol event types and deserialization - fdv2_protocol_handler.dart: protocol state machine - fdv2_payload.dart: Payload and Update data types - fdv2_source_result.dart: sealed ChangeSetResult/StatusResult types - fdv2_flag_eval_mapper.dart: FDv2 updates to ItemDescriptor conversion - async_queue.dart: async producer/consumer queue - selector.dart: opaque selector value type
Member
Author
|
bugbot review |
put-object and delete-object with unrecognized kinds were silently accumulated into payloads instead of being ignored. Fix the processor lookup to return early when no processor is registered, and add a kind check to delete-object. Update tests to verify updates are excluded from emitted payloads, not just that the method returns ActionNone. Remove unused dart:async import.
Member
Author
|
bugbot review |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit cec5ebb. Configure here.
AsyncQueue is a JavaScript pattern. Dart's StreamController/Stream is the idiomatic equivalent and is already used by the existing FDv1 data sources in this codebase. Future FDv2 data sources will use StreamController<FDv2SourceResult> instead.
A selector represents both the opaque state string (sent as the basis query parameter) and the payload version. The version is not currently used but is part of the protocol and needed for future features.
Selector is now non-nullable on Payload, defaulting to Selector.empty. An empty selector (empty state string) means no known state, removing the need for null checks. The factory constructor is replaced with a plain const constructor since there is no null-coalescing logic needed.
Avoid abbreviations in Dart enum values. The wire values ('xfer-full',
'xfer-changes') are unchanged.
Files inside the fdv2/ directory don't need the fdv2_ prefix. Renames: fdv2_payload.dart → payload.dart, fdv2_protocol_handler.dart → protocol_handler.dart, fdv2_protocol_types.dart → protocol_types.dart, fdv2_source_result.dart → source_result.dart, fdv2_flag_eval_mapper.dart → flag_eval_mapper.dart. Test files follow the same pattern.
Nothing imports fdv2.dart. Dart consumers import specific files directly.
The null (unknown) intentCode branch in _processServerIntent did not clear _tempUpdates, allowing accumulated updates from a prior transfer to leak into the next emitted payload. Now clears _tempUpdates to match the behavior of all recognized intent code branches.
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.

Adds the base FDv2 protocol types and the protocol handler.