Skip to content

Telemetry: hold sign-in events until the consent question is answered - #367

Merged
GLinnik21 merged 1 commit into
mainfrom
fix/signin-events-before-consent
Oct 1, 2026
Merged

GLinnik21 merged 1 commit into
mainfrom
fix/signin-events-before-consent

Conversation

@GLinnik21

Copy link
Copy Markdown
Collaborator

What changed

The signin.started / signin.completed / signin.failed / signin.cancelled usage events have been dropped on every release since 0.7.0. A sign-in always happens before the consent question is asked, and sign-out resets the decision to unanswered, so the allows_usage() gate in diag::event discarded the whole funnel.

0.6.x fixed this (issue #75) by holding sign-in events while consent is unanswered. That code lived only on release/v0.6 and was not carried over by the 0.7 forward-port (#105). This ports just that deferral onto main:

  • While the consent question is unanswered, sign-in events are held in memory: sign-in family only, at most 8 (four whole attempts), never written to disk, nothing sent or spooled.
  • When a decision is committed (commit_live), the held events are replayed through the ordinary gate with their original timestamp and session id. A "yes" to usage analytics sends them; a "no" drops them.
  • Sign-out and Delete all local data (forget_live) drop them unreplayed, so a held event never crosses to the next account.
  • An already-answered "no" still drops every event, exactly as before.
  • No boot-time replay (0.6 had one): activate_initial publishes the decision before the session adapter can emit a sign-in event.

Files: rust-modules/src/diag/mod.rs, rust-modules/src/app/adapters/consent.rs.

No GitHub issue exists for this regression, so there is no closing link.

Tests (written failing first, now passing)

In diag::tests, watched failing with the hold disabled:

  • a_signin_event_before_the_consent_answer_is_held_and_replayed_with_its_original_stamp
  • clear_deferred_drops_whatever_was_held
  • replay_with_consent_still_unanswered_empties_the_queue_without_redeferring
  • the_deferred_queue_is_capped

Plus: an answered "no" holds nothing, a non-sign-in event is never held, a replayed stamp without a session id is dropped, and at the seam app::adapters::consent::tests::commit_live_replays_held_signin_events_and_forget_live_drops_them.

Gates

On the committed tree of the code change (git status --short empty before and after):

  • make check, exit 0:
    • test result: ok. 5433 passed; 0 failed; 7 ignored; 0 measured; 0 filtered out; finished in 57.13s
    • test result: ok. 102 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.15s
    • test result: ok. 5513 passed; 0 failed; 7 ignored; 0 measured; 0 filtered out; finished in 57.56s
  • CARGO_INCREMENTAL=0 cargo +nightly check --manifest-path rust-modules/Cargo.toml --lib --no-default-features: clean.
  • make (ARM cross-build): exit 0.

A doc-claim audit then corrected two comments this change had added. On that final tree only the targeted run and the feature check were repeated; the full make check was not re-run after the comment-only edit:

  • cargo +nightly test --lib -- diag::: test result: ok. 59 passed; 0 failed; 0 ignored; 0 measured; 5381 filtered out; finished in 0.24s
  • --no-default-features check: clean.

Host-only change; no FFI, UI or device behaviour touched, so no TV verification.

Not proven here

  • That the replayed events reach PostHog. The host build carries no key, so the tests stop at "replayed through the gate with the original stamp". The first confirmation will be signin.* events arriving from a build that ships this.

Known leftovers (out of scope)

  • PRIVACY.md and the in-app Privacy text are unchanged. Nothing in them is made false, but they do not mention that sign-in activity from before the answer is sent after a "yes". Whether to add a sentence is left to the owner.
  • With more than four attempts before the answer, the oldest started is evicted, so a replayed failed can arrive without its started.
  • The new seam test adds a fourth copy of the test-only Redirect guard in consent.rs; a shared helper would touch three existing tests.

🤖 Generated with Claude Code

The signin.started/completed/failed/cancelled usage events have been dropped
on every release since 0.7.0. A sign-in always happens before the consent
question is asked, and sign-out resets the decision to unanswered, so the
allows_usage() gate in diag::event discarded the whole funnel.

0.6.x fixed this (issue #75) by holding a bounded, memory-only, sign-in-only
set of events while consent is unanswered and replaying them with their
original timestamp and session id once the person answers. That code lived
only on release/v0.6 and was not carried over by the 0.7 forward-port (#105).

Port just the diag deferral: Stamp, defer, replay_deferred, clear_deferred,
DEFERRED_CAP = 8. commit_live replays after publishing the decision, so a
"yes" sends the held events and a "no" drops them; forget_live clears, so a
held event never crosses to the next account. An answered "no" stays dropped.
No boot-time replay: activate_initial publishes the decision before the
session adapter can emit a sign-in event.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@GLinnik21
GLinnik21 merged commit 6ee274c into main Oct 1, 2026
13 of 15 checks passed
@GLinnik21
GLinnik21 deleted the fix/signin-events-before-consent branch October 1, 2026 20:49
GLinnik21 added a commit that referenced this pull request Oct 1, 2026
…nt only on a yes (#373)

#367 holds the sign-in usage events from before the consent answer in memory and sends
them only after a yes to product analytics. PRIVACY.md and the in-app Privacy text (en, es,
be) now say so: every attempt before the answer is covered, at most the eight most recent
events, discarded on a no, on sign-out, or when the app closes first.

Text only. POLICY_VERSION and the consent scopes are untouched, so nobody is asked again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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