feat: Add generic entity synchronizer and add SyncWebFeatures#1692
Merged
jcscottiii merged 3 commits intomainfrom Aug 6, 2025
Merged
feat: Add generic entity synchronizer and add SyncWebFeatures#1692jcscottiii merged 3 commits intomainfrom
jcscottiii merged 3 commits intomainfrom
Conversation
This commit introduces a generic `entitySynchronizer` component to reconcile the state of a Spanner table with a desired list of entities. This new component handles inserts, updates, and deletes in a single, auditable operation. To support this, the generic entity mapper interfaces have been refactored from bigger definitions into smaller, single-responsibility interfaces (e.g., `readOneMapper`, `mergeMapper`, `deleteByStructMapper`) that are composed for specific components. This improves the design by ensuring components only depend on the capabilities they require. Key changes include: - A new `entitySynchronizer` that can perform a full sync on any table. - A `syncableEntityMapper` interface composed of the new building blocks. - `SyncWebFeatures` is the first implementation, providing a robust way to manage the `WebFeatures` table. - The `GetKey` method has been renamed to the more explicit `GetKeyFromExternal` across all existing mappers for clarity and consistency. In a future commit, the web feature data [consumer](https://github.com/GoogleChrome/webstatus.dev/tree/main/workflows/steps/services/web_feature_consumer) will be updated to use `SyncWebFeatures`. The existing `UpsertWebFeature` method will then be deprecated and removed in a future change.
jrobbins
approved these changes
Aug 6, 2025
Closed
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.
This commit introduces a generic
entitySynchronizercomponent to reconcile the state of a Spanner table with a desired list of entities. This new component handles inserts, updates, and deletes in a single, auditable operation.To support this, the generic entity mapper interfaces have been refactored from bigger definitions into smaller, single-responsibility interfaces (e.g.,
readOneMapper,mergeMapper,deleteByStructMapper) that are composed for specific components. This improves the design by ensuring components only depend on the capabilities they require.Key changes include:
entitySynchronizerthat can perform a full sync on any table.syncableEntityMapperinterface composed of the new building blocks.SyncWebFeaturesis the first implementation, providing a robust way to manage theWebFeaturestable.GetKeymethod has been renamed to the more explicitGetKeyFromExternalacross all existing mappers for clarity and consistency.In a future commit, the web feature data consumer will be updated to use
SyncWebFeatures. The existingUpsertWebFeaturemethod will then be deprecated and removed in a future change.