Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds comprehensive technical documentation for the Collect One platform, covering backend Spanner schemas, impact aggregation, client architecture, local data stores, module structures, and onboarding guides. The review feedback is highly constructive, pointing out several inconsistencies and inaccuracies across the newly introduced documents. Key corrections include resolving conflicting statements in the Spanner schema document regarding tombstone TTLs, standardizing the 'sharing_role' field name, aligning the 'UsersByEmail' index uniqueness with its status description, updating outdated phrasing about the sync engine, and correcting the test reference for architecture verification.
| - `ROLE_UNSPECIFIED` reads as `DATA_COLLECTOR`, matching today's implicit | ||
| behavior. `SURVEY_ORGANIZER` is rejected with `INVALID_ARGUMENT`, because | ||
| organizers must be named on the ACL. | ||
| - Set through `SurveyMutation.acl_upsert.default_role` and exposed on |
There was a problem hiding this comment.
There is an inconsistency in the naming of the sharing role field. The Decisions table (line 59) and the section heading (line 485) specify SurveyAcl.sharing_role, noting that default_role was considered but rejected because it sounds like it applies to ACL entries too (line 499). However, lines 494 and 907 still refer to default_role (e.g., SurveyOverview.default_role, SurveyAcl.default_role). These should be updated to use sharing_role consistently.
| - Set through `SurveyMutation.acl_upsert.default_role` and exposed on | |
| - Set through SurveyMutation.acl_upsert.sharing_role and exposed on SurveyOverview.sharing_role, so clients can hide collection UI for view-only surveys. |
There was a problem hiding this comment.
✦ Good question; checking with the author and will follow up here. For context: the shipped schema names the field default_role (SurveyAcl.default_role, SurveyOverview.default_role in shared/protos/survey), while this doc records sharing_role as the decided name, so either the doc or the proto has to change.
…hitecture test references Address review comments on #2707: - spanner-schema.md: requirements table says tombstones are permanent, as the decisions and retention sections do - spanner-schema.md: Users DDL matches the shipped schema (nullable email, EmailVerified, non-unique UsersByEmail) - local-data-store.md: describe how the sync engine stores proto bases today - onboarding.md: ModuleGraphTest pins the Gradle module graph; LayerDependencyArchitectureTest is the Konsist test
Collect One review series: D02 Docs: technical 1/2: client, backend (3/90)
Tracking issue: #2629 · Stacked on: #2698 · 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. Product and architecture background:
docs/product/prd.md,docs/technical/client/architecture.md(docs slices have not merged yet, so docsare named by path here).
This PR is one slice of the
wip/baobabtree. It only adds the files listed below. It is stacked on #2698:review only this diff; it merges after #2698.
The technical docs are reviewed in 2 PRs (D02 client and backend, D03 forms, survey, data, library models and
sync).
This slice is documentation only (7 Markdown files). The docs describe the whole
wip/baobabtree, so theyname classes, modules, and tests that arrive in later slices, and their relative links to code and to other
docs resolve as those slices merge.
What's in this PR
docs/technical/onboarding.md: engineering onboarding guide. Goals, the four application surfaces (webconsole, mobile app, Google Earth balloons, mobile workbench), a terminology bridge from Ground 1.0, CEO and
XLSForm terms to proto messages, the entity-first data model, a system diagram, the repository layout, a
local quickstart (Dev Launchpad, ports), essential commands, CI guardrails, and a reading list.
docs/technical/client/architecture.md: Clean Architecture and MVVM rules for the clients. Layers, when aViewModel may call a repository directly versus a use case,
SessionCoordinatorand the client shells,DomainResult/DomainError, Kermit logging and redaction, Koin modules, clocks and dates, mobile and webnavigation, ViewModel lifecycle and
SavedStateHandle, device clients behind data sources, the directorytree, domain text rules, and a code review checklist.
docs/technical/client/modules.md: the Gradle module graphs ofshared/appandshared/web, a table ofeach module's packages and dependencies, why the boundaries are where they are, where tests and fixture
modules live, and what enforces the graph (compiler, Gradle,
ModuleGraphTest,LayerDependencyArchitectureTest).docs/technical/client/local-data-store.md:LocalStoreas the clients' single source of truth.InMemoryLocalStoreandPersistentLocalStore, what is persisted on the device (sync state, signed-inaccount, active survey, offline map areas), SQLDelight drivers per platform, the table schema, the browser
SQLite worker (OPFS, IndexedDB, memory), seed and schema versioning with migrations
1.sqmto4.sqm, andthe handoff to the sync engine.
docs/technical/client/web-console.md: the web console page by page. URL scheme and route guard, Surveyspage, Organizations pages and library tabs, Impact views, the dashboard (details card, data collection and
media capture on web, data tables, exports), the Survey editor (sharing, datasets, close/archive/reopen),
and the Form editor (flow canvas, geometry and media questions, save-to logic, concept links).
docs/technical/backend/spanner-schema.md: design doc (status: draft for review) for backing the user dataRPCs with Cloud Spanner. Decision table,
PROTOcolumns withSTOREDgenerated columns, client-generatedUUID keys, read-timestamp sync tokens, watermark-only replay detection, permanent tombstones, explicit
mobile downloads with FCM topic tickles, access epochs, Firebase Auth, the survey Trash lifecycle, sharing
policies, the GoogleSQL DDL, an RPC to access-pattern map, emulator notes, and an implementation plan with a
Status section listing where the code differs from the design.
docs/technical/backend/impact-aggregation.md: design doc (status: draft for review) for the impactaggregation job and the optional Earth Engine overlay pipeline. Inputs, GeoID deduplication, aggregation
rules per concept, scope rules, the attribution score, S2 cell thresholding and suppression, the
ImpactAggregateoutput message, privacy rules, hosting options, testing, rollout, and open questions.Where it fits
Reference documentation only: nothing here is compiled or executed.
onboarding.mdis the entry point andlinks to the other six files, to the product docs, and to the model and sync docs. The two backend design docs
describe the server and the shared impact aggregation logic.
Not in this PR
docs/product/*,docs/ux/content-guidelines.md) → D01 Docs: product and UXdocs/technical/sync-engine.mdanddocs/technical/model/**→ D03 Docs: technical 2/2: forms, surveyREADME.md,GEMINI.md,shared/README.md, CI workflows → W01 Build system, CI workflows, and toolingshared/protos/data/data_service.proto,impact_aggregate.proto,client_sync_state.proto→ P03 Protos:data, library, sync, Earth Engine, user data
ImpactAggregator→ K05 Core 5/7: impact, forms.engine (FormEngine, ImpactAggregator)server/README.md,server/src/main/resources/spanner/schema.sql→ S01 Server 1/4: server.data, server.geo(SpannerUserDataReader, StagedSeedOverlayUserDataStore)
LocalStore,InMemoryLocalStore→ A07 App data 2/5: data.datasource.local.persistence,data.datasource.local.store (InMemoryLocalStore, LocalStore)
Suggested reading order
docs/technical/onboarding.mddocs/technical/client/architecture.mddocs/technical/client/modules.mddocs/technical/client/local-data-store.mddocs/technical/backend/spanner-schema.mddocs/technical/backend/impact-aggregation.mddocs/technical/client/web-console.mdFocus areas
architecture.md, "The Rule for Use Cases vs. Direct Repository Access": ViewModels call repositoriesdirectly for simple CRUD and need a use case for anything else. This rule shapes most later app slices.
architecture.md, "Communication with Device Services": only a data source talks to a device client, withtwo named exceptions (trivial queries in a repository, foreground UI utilities in presentation).
spanner-schema.md, "Gap-Free Sync Tokens on Spanner" and "Replay Detection Without a Mutation Log": tokensanchored on the read timestamp, and one
client_seqwatermark per client and scope.spanner-schema.md, "Sharing Policies and Access": the survey ID is the share link, with no separate linktoken and no link rotation. The doc states the trade-off.
spanner-schema.mdinternal consistency: the Decisions table calls tombstones permanent, while theRequirements table still says "rows with a TTL"; the Decisions table names
SurveyAcl.sharing_role, whilelater sections use
default_role; the DDL declaresUsersByEmailunique, while Status says it isn't.impact-aggregation.md, "Grid Cells and Thresholding" and "Privacy and Security": publication thresholds(10 features from 2 organizations), suppression, and the organization opt-out. Hosting, licensing, and
thresholds are listed as open questions.
local-data-store.md, "Working Copy": the bullet saying stored models move to proto-aligned records "whenthe sync engine lands" reads as older than the sync sections below it.
onboarding.mdcallsModuleGraphTesta Konsist test;modules.mdsays it reads Gradle dependencies andthat
LayerDependencyArchitectureTestis the Konsist one.Safe to skim
spanner-schema.md.architecture.mdandmodules.md.local-data-store.md, and the per-control UI detail inweb-console.md(dashboard, media capture, Form editor).onboarding.md.Size
Testing
bash scripts/ktfmt.sh --check: PASS.bash scripts/license-check.sh --check: PASS. This slice is Markdown only, so no Gradle tasks ran.CI:
Check(ktfmt, buf, license headers, JVM tests and detekt, server Spanner tests), as far as the modules inthis PR's tree exist. This PR adds only Markdown, so no Gradle task compiles or tests its files.