tree: b30c2b370fed99ef312e0f97fe49678e238b74c3 [path history] [tgz]
  1. app_list_specifics.proto
  2. app_notification_specifics.proto
  3. app_setting_specifics.proto
  4. app_specifics.proto
  5. arc_package_specifics.proto
  6. autofill_offer_specifics.proto
  7. autofill_specifics.proto
  8. autofill_wallet_usage_specifics.proto
  9. bookmark_model_metadata.proto
  10. bookmark_specifics.proto
  11. BUILD.gn
  12. client_commands.proto
  13. client_debug_info.proto
  14. contact_info_specifics.proto
  15. data_type_progress_marker.proto
  16. DEPS
  17. device_info_specifics.proto
  18. dictionary_specifics.proto
  19. encryption.proto
  20. entity_data.cc
  21. entity_data.h
  22. entity_data_unittest.cc
  23. entity_metadata.proto
  24. entity_specifics.proto
  25. experiment_status.proto
  26. experiments_specifics.proto
  27. extension_setting_specifics.proto
  28. extension_specifics.proto
  29. favicon_image_specifics.proto
  30. favicon_tracking_specifics.proto
  31. gaia_password_reuse.proto
  32. get_updates_caller_info.proto
  33. history_delete_directive_specifics.proto
  34. history_specifics.proto
  35. history_status.proto
  36. local_trusted_vault.proto
  37. loopback_server.proto
  38. managed_user_setting_specifics.proto
  39. managed_user_shared_setting_specifics.proto
  40. managed_user_specifics.proto
  41. model_type_state.proto
  42. model_type_state_helper.cc
  43. model_type_state_helper.h
  44. model_type_state_helper_unittest.cc
  45. model_type_store_schema_descriptor.proto
  46. nigori_local_data.proto
  47. nigori_specifics.proto
  48. note_entity.proto
  49. os_preference_specifics.proto
  50. os_priority_preference_specifics.proto
  51. password_specifics.proto
  52. persisted_entity_data.proto
  53. power_bookmark_specifics.proto
  54. preference_specifics.proto
  55. printer_specifics.proto
  56. printers_authorization_server_specifics.proto
  57. priority_preference_specifics.proto
  58. proto_enum_conversions.cc
  59. proto_enum_conversions.h
  60. proto_enum_conversions_unittest.cc
  61. proto_memory_estimations.cc
  62. proto_memory_estimations.h
  63. proto_value_conversions.cc
  64. proto_value_conversions.h
  65. proto_value_conversions_unittest.cc
  66. proto_visitors.h
  67. protocol_sources.gni
  68. reading_list_specifics.proto
  69. README.md
  70. saved_tab_group_specifics.proto
  71. search_engine_specifics.proto
  72. security_event_specifics.proto
  73. segmentation_specifics.proto
  74. send_tab_to_self_specifics.proto
  75. session_specifics.proto
  76. sharing_message_specifics.proto
  77. sync.proto
  78. sync_entity.proto
  79. sync_enums.proto
  80. sync_invalidations_payload.proto
  81. sync_protocol_error.cc
  82. sync_protocol_error.h
  83. synced_notification_app_info_specifics.proto
  84. synced_notification_specifics.proto
  85. test.proto
  86. theme_specifics.proto
  87. typed_url_specifics.proto
  88. unique_position.proto
  89. user_consent_specifics.proto
  90. user_consent_types.proto
  91. user_event_specifics.proto
  92. vault.proto
  93. web_apk_specifics.proto
  94. web_app_specifics.proto
  95. webauthn_credential_specifics.proto
  96. wifi_configuration_specifics.proto
  97. workspace_desk_specifics.proto
components/sync/protocol/README.md

Sync Protocol Style

General guidelines:

Some specific guidelines on top of the general ones above, or just things that often come up:

  • Enum entries should be in ALL_CAPS (different from C++!), and for new code, the first entry should be a FOO_UNSPECIFIED = 0 one.

  • Timestamp fields must specify their epoch and unit in a suffix, in this format: _[unix|windows]_epoch_[seconds|millis|micros|nanos], e.g creation_time_unix_epoch_millis.

    • Many existing fields do not follow this format, and specify epoch/unit in a comment instead. Follow the format for all new fields, though!
  • Similarly, duration fields must specify their unit as _[minutes|seconds|millis|...].

  • Proto changes also require corresponding changes in proto_visitors.h and (where appropriate) in proto_enum_conversions.h/cc.

  • Backwards compatibility: In general, all changes must be fully backwards-compatible - consider that a single user might be running different versions of the browser simultaneously! Also note that Sync supports clients up to a few years old, so deprecating/removing an existing field is typically a multi-year process.

    • As one special case, renaming a field within a specifics message is generally safe (unless there are special server-side integrations that depend on the name). However, never rename fields anywhere outside of specifics.
  • Deprecating fields:

    • If the field is still accessed: Mark it as [deprecated = true]. This is the common case, since the browser typically needs to continue supporting the old field for backwards compatibility reasons.
    • If the field is not accessed anymore (i.e. no non-ancient clients depend on the field being populated anymore, all migration code has been retired, etc): Remove the field, and add reserved entries for both its name and its tag number.
    • Note: If your data type is using the Protection against data override by old Sync clients, then even fields that aren't accessed anymore should not be removed from the proto definition, since they should still be treated as supported for the purpose of trimming. (Otherwise, the removed fields would forever be carried forward in the data.)
  • Deprecating enum values: This is particularly tricky, especially if the default value is not a FOO_UNSPECIFIED one (see above). A common pattern is prepending DEPRECATED_ to the entry name.

For reviewers:

  • Be extra careful with protocol changes, especially consider backward and forward compatibility.
  • In doubt, loop in a second reviewer from the Sync team.