Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces the canonical Protocol Buffer schemas and gRPC service definitions for the Collect One platform, establishing a structured data model for forms, surveys, and offline-first data synchronization. The feedback highlights several opportunities to improve schema correctness, type safety, and documentation. Key recommendations include renaming misleading 'base64_' prefixed fields that store raw binary bytes, using 'google.type.Date' instead of 'google.protobuf.Timestamp' for calendar dates to avoid timezone shifting bugs, and leveraging 'optional' fields to enable presence tracking for defaultable values like delimiters and geospatial coordinates. Additionally, it is advised to group mutually exclusive fields into a 'oneof' block and document OS-level privacy restrictions on sensitive hardware identifiers.
…key and encrypted_signature Both fields are proto bytes, so they hold raw bytes, not base64 text; the base64_ prefix was misleading. Field numbers are unchanged (wire-compatible). Review: #2631 (comment) and #discussion_r4316641039.
…ed_signature Both fields are proto bytes, so they hold raw bytes, not base64 text; the base64_ prefix was misleading. Field numbers are unchanged (wire-compatible). Review: #2631 (comment) and #discussion_r4316641039.
Rename encrypted_submission bytes fields to encrypted_key and encrypted_signature Both fields are proto bytes, so they hold raw bytes, not base64 text; the base64_ prefix was misleading. Field numbers are unchanged (wire-compatible). Review: #2631 (comment) and #discussion_r4316641039.
|
Heads-up: encrypted form submissions are being removed from Collect One (no code used them, and the server needs to read submissions). The change for this slice is in #2635, which merges into this PR's branch. Please review it alongside this PR. |
…ed_signature Both fields are proto bytes, so they hold raw bytes, not base64 text; the base64_ prefix was misleading. Field numbers are unchanged (wire-compatible). Review: #2631 (comment) and #discussion_r4316641039.
f50601c to
bceb8fe
Compare
Rename encrypted_submission bytes fields to encrypted_key and encrypted_signature Both fields are proto bytes, so they hold raw bytes, not base64 text; the base64_ prefix was misleading. Field numbers are unchanged (wire-compatible). Review: #2631 (comment) and #discussion_r4316641039.
…ed_signature Both fields are proto bytes, so they hold raw bytes, not base64 text; the base64_ prefix was misleading. Field numbers are unchanged (wire-compatible). Review: #2631 (comment) and #discussion_r4316641039.
731b8c6 to
438c98a
Compare
Rename encrypted_submission bytes fields to encrypted_key and encrypted_signature Both fields are proto bytes, so they hold raw bytes, not base64 text; the base64_ prefix was misleading. Field numbers are unchanged (wire-compatible). Review: #2631 (comment) and #discussion_r4316641039.
…ed_signature Both fields are proto bytes, so they hold raw bytes, not base64 text; the base64_ prefix was misleading. Field numbers are unchanged (wire-compatible). Review: #2631 (comment) and #discussion_r4316641039.
14992ca to
a1e183e
Compare
Rename encrypted_submission bytes fields to encrypted_key and encrypted_signature Both fields are proto bytes, so they hold raw bytes, not base64 text; the base64_ prefix was misleading. Field numbers are unchanged (wire-compatible). Review: #2631 (comment) and #discussion_r4316641039.
…ed_signature Both fields are proto bytes, so they hold raw bytes, not base64 text; the base64_ prefix was misleading. Field numbers are unchanged (wire-compatible). Review: #2631 (comment) and #discussion_r4316641039.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…nd stable item IDs / sort_order
a1e183e to
2a91e77
Compare
Rename encrypted_submission bytes fields to encrypted_key and encrypted_signature Both fields are proto bytes, so they hold raw bytes, not base64 text; the base64_ prefix was misleading. Field numbers are unchanged (wire-compatible). Review: #2631 (comment) and #discussion_r4316641039.
Collect One review series: P1 Protos: forms (3/60)
Tracking issue: #2629 · Stacked on: #2630 (C01) · Reviewer: @rfontanarosa
FYI: @gino-m @shobhitagarwal1612
Context
Collect One is the Kotlin Multiplatform successor to Ground: a single shared codebase for the web console, the mobile app (Android, iOS, browser), and a Spanner-backed user-data service. Forms use ProtoForms, a lossless proto3 encoding of ODK XForms.
This PR is one slice of the frozen
wip/baobabtree (collect-one-review-base), landing through 60 stacked PRs intoc1(see #2629). It only adds the files listed below, and it's stacked on C01 (#2630), so the diff shows only this slice.The proto PRs (P1–P3) import each other, e.g.
survey_def.protoimportsforms/form_def.protoanddata/audit_record.proto. Nothing compiles them untilshared/corelands in K1, after all three merge, so please review the schemas as a contract. CI only checksbuf formathere.What's in this PR
shared/protos/README.md: the mental model behind all the schemas (data tables / map layers = persistentEntityRecords; forms = immutable encounter logs), the package map, and conventions.forms/form_def.proto(groundplatform.v2.forms):FormDefand the XForms model. The model (ModelDef,RecordSchema,PrimaryInstance/SecondaryInstance,FieldBindingwith relevance/constraint/calculate/required/readonly,PreloadType). The body (ControlDef,ControlType,GroupDef,RepeatDef,ItemsetDef,ChoiceItem,RangeConfig,GeoConfig,IntentConfig). Events and actions (EventType,ActionDef, e.g.setvalue/setgeopoint). Translations (TranslationCatalog,LocalizedString,MediaRef). ODK Entities (EntityDeclaration,EntityPropertyMapping,EntitySyncMetadata). Submission config. Optional view layout (ViewDef).forms/types.proto:DataType,TypedValue,GeoPoint/GeoTrace/GeoShape.forms/record_instance.proto: reflection-freeRecordInstancetree (RecordNode,FieldValue, repeats,RecordMetadataaligned with OpenRosa<orx:meta>).forms/audit_log.proto: ODK client audit log config and events.forms/encrypted_submission.proto: envelope-encryption manifest for encrypted submissions.Where it fits
ProtoForms is the canonical form representation everywhere.
shared/core(K1–K5) converts it to and from XForms XML, TextProto and Proto3 JSON, evaluates it with an XPath 1.0 engine, and runs it in the form engine. Survey definitions (P2) embedFormDef. Submissions (P3) carryRecordInstances.Not in this PR
Suggested reading order
shared/protos/README.mdtypes.proto, thenrecord_instance.protoform_def.prototop-down:FormDef→ModelDef→ bindings → body controls → entitiesaudit_log.proto,encrypted_submission.protoFocus areas
jr:/odk:extensions and Entities) and round-trip through XLSForm → ODK Central → Collect/Enketo. Anything Ground-specific should live in P2/P3 instead.oneofchoices that would be painful to change later.Safe to skim
Size
Testing
bash scripts/buf-format.sh --check: PASS. CI:check(ktfmt, buf). Compilation and round-trip tests arrive with K1/K2.