Skip to content

feat(analytics-events): make events.toml writable without Kotlin - #1547

Merged
bmc08gt merged 6 commits into
feat/analytics-events-contractfrom
feat/analytics-catalogue-authoring
Sep 24, 2026
Merged

bmc08gt merged 6 commits into
feat/analytics-events-contractfrom
feat/analytics-catalogue-authoring

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #1538. The base retargets to code/cash once #1538 merges.

In #1538, events.toml could only be written by someone who reads Kotlin. Each entry named its builder, typed each parameter as a Kotlin type, and listed properties by parameter. This PR changes the file so anyone who knows what they want to track can add an event.

The new entry shape

[[event]]
domain = "Transfer"
name = "Grab Bill"
properties = [
  { name = "Grab Time", type = "duration", optional = true },
  { group = "outcome" },
]
  • Types are plain words: text, yes/no, count, decimal, duration (milliseconds, with a …Millis parameter), or the name of a list. optional = true makes the parameter nullable.
  • Names are derived. The builder name is the event name in camelCase, with any Domain: prefix dropped. Each parameter name is its key in camelCase.
  • Overrides: builder, param and order cover the cases where derivation doesn't fit. Of the 44 events, 14 set builder, and 3 properties set param (choice, price, owner). Only grabBill and sendCashLink set order.
  • Value lists are [lists.X] tables, each with a description. The old schema is gone rather than kept alongside.

When an entry is wrong, the build stops with a message that names the event and says what to change. For example, a mistyped type word lists the words that are allowed.

What didn't change

The generated Kotlin is byte-identical to what #1538 generates. The one exception is KDoc on the eight lists that had no description before. The 38 event tests and the SharedCoreKit tests are unedited.

EVENTS.md

libs/analytics-events/EVENTS.md is generated from the catalogue and checked in, so the events can be read on GitHub without reading TOML. It has a table per event (key, type, optional, list), plus the lists, the amount group, drift notes and people counters. Two builders that send one name ("Deeplink: Parse") share a heading, so the name has one anchor to link to.

checkAnalyticsEventsPage is now part of flipcashTestDebug. It fails when the page and events.toml disagree, and the failure message gives the command to regenerate the page.

…d types

An events.toml entry is now an [[event]] with a domain, the event name, and
properties typed as text, yes/no, count, decimal, duration or a list name.
The generator derives the builder name from the event name, each parameter
name from its property key, and the parameter order from where the properties
sit. builder, param and order override what is derived.

Value enums move to [lists.X] with a description. The old domains.*.events,
params and enums shape is gone.

Error messages name the event and say what to change in the file.
Every entry is now an [[event]] with a domain, the event name and typed
properties. builder is set on the 14 entries whose name doesn't give the
builder they had, param on Cash Link Choice, Fiat and Owner Public Key, and
order on Grab Bill and Send Cash Link.

The value lists move to their own section at the top. The outcome group's
comment moves from above [counters] to the group. The header now explains the
format to someone who doesn't write Kotlin, with the engineer steps in their
own paragraph.

The generated sources are byte-identical to the ones the old schema produced.
Eight lists had no description. Each now says which property or event name
carries it. The generated enums gain the same text as KDoc; nothing else in the
generated sources changes.
EVENTS.md lists every event with a table of its properties: the key, the type
in events.toml's own words, whether it's optional, and the list it draws from.
Lists, the amount group, drift notes and people counters get sections of their
own. Two builders that send one name share a heading, so the name has one
anchor to link to.

The page is checked in. writeAnalyticsEventsPage rewrites it, and
checkAnalyticsEventsPage, now part of flipcashTestDebug, fails with the command
to run when the page and events.toml disagree.
The form asks for the event name, when it's sent, its properties with a type
word and an example value, the platforms and why it's needed. Its intro says
it's optional: anyone can edit events.toml in a pull request instead.

It applies an analytics label, which the repo doesn't have yet; GitHub skips
a form label that doesn't exist.
@bmc08gt
bmc08gt requested a review from jeffyanta as a code owner September 24, 2026 00:30
@bmc08gt bmc08gt self-assigned this Sep 24, 2026
@github-actions github-actions Bot added type: feature New functionality area: build-system Gradle, convention plugins, build-logic and removed type: feature New functionality labels Sep 24, 2026
This repo is public, and GitHub can't limit an issue template to org members,
so anyone could have filed requests through it. To add or change an event,
edit events.toml in a pull request; the header says to ask an engineer
otherwise. EVENTS.md and its generator no longer mention the form.
@github-actions github-actions Bot added the type: feature New functionality label Sep 24, 2026
@bmc08gt
bmc08gt merged commit 15413d5 into feat/analytics-events-contract Sep 24, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: build-system Gradle, convention plugins, build-logic type: feature New functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant