Skip to content

docs(contributing): how to add a typed mobile analytics event - #14530

Merged
Git-on-my-level merged 28 commits into
mainfrom
task/msd-docs-typed-analytics
Sep 18, 2026
Merged

Git-on-my-level merged 28 commits into
mainfrom
task/msd-docs-typed-analytics

Conversation

@Git-on-my-level

Copy link
Copy Markdown
Member

What changed and why

Seven lines in docs/doc/developer/Contribution.mdx telling a contributor how to add a typed
mobile analytics event: register it in contracts/analytics/events.json, run
python3 scripts/check_event_registry.py --write, commit the generated Dart API and tracking
plan, and preserve emitted names and properties while migrating. It also states the scope of the
raw-call check — adopted files are covered, new and existing unadopted files stay unrestricted —
and points at app/lib/utils/analytics/registry/REGISTRY.md for the batch tests.

Why it is its own PR. The paragraph was written as part of the C7 event-registry contract and
had to come off that branch. scripts/check_spine_contracts.py refuses a change set that carries a
spine revision record alongside non-oracle paths, and #14371 carries revisions 009 and 019, so a
docs file could not travel with it. The checker's own instruction is to separate them, which is
what this does.

Why it is stacked on #14371 and not cut from main. It references
scripts/check_event_registry.py and app/lib/utils/analytics/registry/REGISTRY.md, and I checked
both: neither exists on main today — they arrive with #14371. Based on main this PR would
document tooling the reader cannot run. Stacked, its own change set is a single docs file with no
revision record, so the spine rule does not fire, and GitHub retargets it to main once #14371
merges.

Product invariants affected

none

How it was verified

Docs-only, seven added lines, no code or contract touched. The three paths the paragraph names were
each confirmed present on this PR's base with git cat-file -e, and two confirmed absent from
origin/main.

Failure class (fixes)

Failure-Class: none

🤖 Generated with Claude Code

Review in cubic

Git-on-my-level and others added 28 commits September 17, 2026 13:42
Add strict Python/Dart pending contracts and introducing-commit protection.
Reserve the live-session CLI, wire, ownership/attachment seams and failing
builder acceptance tests. Add live attribution before freezing evidence v1.

Verification:
- bash scripts/dev-harness/run-tests.sh: 287 passed, 7 existing skips,
  40 strict xfailed (24 pending V1 markers), Python 3.11.15.
- make preflight: 16 checks passed, using supported PYTHON selection.
- make mobile-verify fast --paths harness/session contract inputs with an
  absolute evidence directory: 20 executed, 20 passed, no failures/skips.
- bash app/test.sh: 2014 passed, 5 skipped, one unchanged UTC+7
  search_rank_grouping_test failure; affected baseline inputs match main.
- Real module CLI refusals exit 2 without traceback; regression covered.
- Dart SDK probe proves ext. prefix required; marker-removal formatter
  probe proves no incidental Dart diff.

Runtime is intentionally unimplemented. App UI must repair current invalid
VM extension names before live acceptance; unsupported journeys block.
Simulator/emulator latency and detached-process acceptance remain V1 work.
make setup installed hooks but full backend wheel sync stalled; isolated
Python 3.11 harness dependencies ran the owner checks without any skip flag.

Failure-Class: none
The check protects files under the spine roots and their registry, so it only
needs to run when those change. A repo-wide trigger would run it, and its
full-history requirement, on every unrelated contributor PR.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
V1 must refuse live journey execution until a shared executable adapter exists;
B1 addressability alone cannot attach Dart integration tests. Pure admission
contracts remain valid with injected supported IDs.

Verification: harness 287 passed, 7 skipped, 40 strict xfailed;
make preflight passed 20 checks.
…lities

Coordinator turn-4 review authorizes the V1 fixture correction. Exact before/after digests pin the revised oracle; immutable revision records do not permit builder assertion edits. Active tests reject missing/tampered records and prove the fake machine response. Verification: full harness 289 passed, 7 skipped, 40 strict xfailed; UTC app 2020 passed; spine 24 pending/7 protected; make preflight 16 passed. No live device acceptance claimed.
Track retained marker occurrences rather than counts so retiring a second test cannot restore the first test's retired marker. The active regression covers this swap and legitimate continued retirement. Verification: full harness 290 passed, 7 skipped, 40 strict xfailed; spine 24 pending/7 protected; make preflight 16 passed. Dart sources unchanged after the earlier UTC app 2020-pass run.
…rges

A squash can introduce a corrected contract and its review records in the same commit. Absorb only the revision prefix ending at that introducing file's exact digest, preserving immutable records and later marker-only edits. Active temp-repo regression covers multiple corrections in one squash and rejects restoring old or altered assertions. Verification: harness 291 passed, 7 skipped, 40 strict xfailed; B1 make preflight 20 passed; final B1 journeys 20/20. Dart unchanged after UTC app 41 opt-in and 2051 ordinary passed.
C7 keeps legacy wire names and queue behavior, requires executable consumers, and constrains raw calls only after adoption or in new files. Four example events remain behind a pending dispatch skeleton. Verified UTC app 2067, harness 306 passed/7 skipped/44 xfailed, spine 31 pending/9 protected, preflight 19 checks, and 20 hermetic journeys.
Preserve wire property spelling independently from Dart identifiers and restrict raw-call enforcement to adopted files and the one typed bridge. Revise the protected payload oracle after a Flutter matcher probe exposed map identity inside records.

Verified: TZ=UTC bash app/test.sh (2069 passed); full harness (308 passed, 7 skipped, 44 strict xfailed); spine (31 pending, 10 protected); make preflight (19 passed); fast journeys (20/20); three historical commits passed scanner replay.
Use the actual PR base and immutable exact scaffolding snapshots to reject mixed revision/implementation diffs. Exercise a real squash and child merge. Correct local_dev wire spelling from the simulator RPC and add adversarial V1 conformance oracles after reviewing the first broker.

Verification: UTC app 2064 passed; full harness 303 passed, 7 skipped, 55 strict xfailed; spine 37 pending/9 protected; preflight 16 checks passed. Isolated reviewed-broker probes failed 9/9 as documented in the conformance report. No real app/device launch.
# Conflicts:
#	.github/checks-manifest.yaml
#	contracts/spine/files.json
…ge orders

Keep exact oracle digests and immutable revision records. Traverse full reachable history and match revision payloads by digest. Shared runner metadata requires direct fail-fast suite invocation instead of pinning shared file bytes. Both new regressions fail on the old checker. UTC app 2064 passed; final harness 306 passed, 7 skipped, 59 strict xfailed; spine 39 pending/10 protected; preflight 16 passed. No protected oracle bytes or legacy scope pins changed.
Add strict pending C7 oracles for initialized and pre-init queue payloads. Legacy event privacy remains C8 scope. Verification: UTC app 2071 passed; harness 320 passed, 7 skipped, 59 strict xfailed; spine 43 pending / 13 protected; preflight 19 passed.
Preserve C7 oracles and main's analytics privacy and mechanism fixes. UTC app suite: 2119 passed. Harness: 342 passed, 7 skipped, 59 strict xfailed.
C7's unchanged export plus main's accepted analytics privacy fix no longer matches the old whole-file scaffold pin. Declare the exact existing prefix and require all remaining bytes to equal the accepted target. Oracle and owned skeleton pins stay unchanged; no filename exception or implementation edits are permitted.

Verified: 15 mechanism tests, including both merge orders and rejection of proposed shared-body edits, weakened assertions, and declaration changes/removal. Full harness/preflight passes on the final oracle correction tree; original scope policy and analyzer baseline unchanged.
Restrict AnalyticsManager imports so existing TypedEvents.emit assertions resolve through typed_events.dart itself. Removing that direct import now fails analysis. Exact revision019 pins preserve every pending marker and runtime assertion; no analyzer baseline change.

Verified: analyzer ratchet passed; positive import probe exit 0, negative probe exit 3. UTC app owner rerun 2119 passed after an unchanged WAL test timed out under host load. Final preflight 19 checks passed; registry 4 events current; full harness 343 passed, 7 skipped, 59 strict xfailed.
Main advanced to 83f5428 during verification. Preserve both the accepted revision-payload correction and the shared-prefix scope correction. Resolve the sole conflict as a union of mechanism regression functions; every function from both parents is AST-identical. No Dart or app implementation change.
Pin the reviewed shared prefix directly rather than requiring a superseded whole-file payload to remain reachable. Add a real squash regression alongside both parent orders and negative oracle/body/declaration checks. Mechanism suite: 16 passed; before-correction reproduction fails with frozen scaffold payload missing.
Three conflicts, all genuine unions rather than a side to pick:

- contracts/spine/files.json: main added 17 C1 oracle entries via #14327, this
  branch adds 3 C7 entries, and neither side's are on the other. Unioned to 30;
  both belong, since the C1 oracles are live on main and the C7 ones are this
  contract's own.
- .github/checks-manifest.yaml: unioned to 226 unique ids — this branch's
  mobile-event-registry plus main's capture-ownership-boundaries and
  mobile-boundary-check-tests.
- app/AGENTS.md: each side deliberately deleted one base line and added a
  pointer row. Honoured both deletions and both additions, which also happens to
  be the smallest result: 11271 of the 11411 budget.

Worth recording because it nearly went wrong: my resolver appended the two
main-only manifest blocks at end-of-file, which put them inside the trailing
'exempt:' key instead of 'checks:'. The ids were present as text and absent from
the parsed checks list, so two checks would have been silently dropped. Moved
them into the list and verified by parsing: 226 unique ids, all three named
checks present, 'exempt' intact.

Co-Authored-By: Claude Opus 5 <[email protected]>
scripts/check_spine_contracts.py refuses a change set that carries a spine
revision record alongside non-oracle paths, and after merging main forward it
named exactly one offender: docs/doc/developer/Contribution.mdx. This branch
carries revisions 009 and 019, so the seven-line contributor paragraph about
adding typed events had to come off it.

Aligned the file with origin/main. Spine checker then exits 0 at 82 pending
markers and 30 protected files, with no mixed-path error.

The paragraph is not lost: it is preserved verbatim and goes out as its own
docs-only PR, which is where the rule wants it. Nothing about the contract, the
oracles, or the generator changed here.

Co-Authored-By: Claude Opus 5 <[email protected]>
My first resolution of this file preserved main-only check IDs but not main's
EDITS to shared IDs, and that silently reverted #14465. One shared id differed:

  product-invariants
    ours: --changed-files {changed_files} --pr-body-file {pr_body_file}
    main: --base {base} --head {head} --pr-body-file {pr_body_file}

Main's is #14465's fix — compute the change set as a three-dot diff from the live
base instead of consuming a changed-files list. Keeping ours would have undone a
gate fix that merged tonight, and #14465's own invariance test caught it:
test_product_invariants_diffs_three_dot_from_base_not_a_changed_files_list failed
in check-manifest-contract.

Rebuilt from main's text and re-inserted this branch's single addition
(mobile-event-registry), so no edit of main's can be lost by construction.
Verified: 226 unique ids, all of mobile-event-registry,
capture-ownership-boundaries and mobile-boundary-check-tests present,
product-invariants carrying main's command, and the trailing 'exempt' key intact.

Co-Authored-By: Claude Opus 5 <[email protected]>
This paragraph was written as part of the C7 event-registry contract and had to
come off that branch: check_spine_contracts.py refuses a change set that carries
a spine revision record alongside non-oracle paths, and #14371 carries revisions
009 and 019.

Stacked on #14371 rather than cut from main on purpose. It references
scripts/check_event_registry.py and app/lib/utils/analytics/registry/REGISTRY.md,
neither of which exists on main yet — both arrive with #14371. Based on main this
would document tooling a reader cannot run.

Co-Authored-By: Claude Opus 5 <[email protected]>
@mintlify

mintlify Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
omi 🟢 Ready View Preview Sep 18, 2026, 8:30 AM

💡 Tip: Enable Automations to automatically generate PRs for you.

@Git-on-my-level
Git-on-my-level merged commit 89abd51 into main Sep 18, 2026
41 checks passed
@Git-on-my-level
Git-on-my-level deleted the task/msd-docs-typed-analytics branch September 18, 2026 08:37

This branch was successfully deployed

1 active deployment
staging - docs — 3f00609b Deployed Sep 18, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant