Skip to content

feat(telemetry): opt-in instance telemetry — reachable ask, share id, enforced schema v2, outcome mix (abilityai/trinity-enterprise#437) - #2516

Merged
vybe merged 6 commits into
devfrom
feature/437-opt-in-telemetry
Sep 4, 2026
Merged

vybe merged 6 commits into
devfrom
feature/437-opt-in-telemetry

Conversation

@webmixgamer

@webmixgamer webmixgamer commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Changes

  • src/backend/services/telemetry_sharing_service.py — schema v2 + validator, share id, outcome mix, send log, backfill-until-delivered, tick marker, public_flags, mark_ask_dismissed, first_value_at
  • src/backend/routers/settings.py — GET …/telemetry-sharing?preview= (human-only), POST …/telemetry-sharing/ask/dismiss, consent audit carries sharing_id_rotated, four feature-flag booleans
  • src/backend/db/schedules/stats.py, database.py — count_terminal_executions_by_status, first_autonomous_success_at
  • src/backend/utils/app_version.py — release-version resolver (import-safe in the container)
  • src/frontend/.../onboarding/FinishSetupCard.vue + telemetryConsent.js (new), AdminEmailNudge.vue (removed), HardeningGuide.vue, settings/TelemetrySharingPanel.vue, stores/telemetrySharing.js, stores/sessions.js, views/Dashboard.vue
  • Merged origin/dev on 2026-09-03; the only conflict was tests/registry.json, resolved by re-appending the ent#437 entry onto dev's file (the branch's accidental \u-escape reformat of the registry is gone)
  • Docs: docs/memory/requirements/lifecycle-observability.md §45.2, docs/memory/architecture.md, docs/PRODUCT_EVENTS.md, docs/user-docs/operations/telemetry.md, docs/user-docs/faq/security.md, docs/memory/feature-flows/telemetry-sharing.md (new) + index, docs/memory/learnings.md (3 entries), docs/security-reports/cso-diff-2026-09-03-ent437-opt-in-telemetry.{json,md}

Test Plan

  • tests/unit/test_ent437_telemetry_consent.py (35) + test_ent12_telemetry_sharing.py + the two flag suites pass
  • Full unit tier on the merged head (4c13b0ac, --randomly-seed=20260903, clean worktree): 13,696 passed, 37 skipped, 2 order-dependent failures in test_1081_physical_meter that fail identically on origin/dev with the same seed and pass in isolation (the class recorded in learnings 2026-08-12/13); CI's six-seed matrix and regression diff are green on this head
  • Frontend: 1,618 vitest tests on the merged head (52 across telemetryConsent.spec.js, authRoleGetterContract.spec.js and hardeningGuide.spec.js); loading-gate ratchet green; zero raw colors in the new files; vite build clean
  • Manual verification on a local stack with a POST sink: the card renders (warm variant), consent fires one backfill share within seconds — schema v2, sharing_id present, no installation_id, no cost, release version, outcome mix by wire key; revoke discards the id and Recent sends keeps the delivered record; re-consent mints a new id
  • DELETE /api/settings/telemetry_sharing_dismissed_at resets the ask; ?preview=0 skips the aggregate build

Release note

Follow-ups (recorded)

  • PR2: feature-usage / click-through coverage — filed as abilityai/trinity-enterprise#494 (sub-issue of ent#437); R7 warm re-ask iteration abilityai/trinity-enterprise#495; R8 edition-differentiated ask abilityai/trinity-enterprise#496 (blocked on ent#190)
  • ent#190: benchmark keyed on sharing_id; first-value milestones are not in v2; receiver must keep this stream apart from the intake record
  • ent#463: the product-updates opt-in can join the Finish-setup card as section 3
  • refactor: split oversized backend routers & services (settings, public, agent crud, git, agent_client) #1028: move the telemetry-sharing block of routers/settings.py whole when the split lands
  • Debt inbox: main.py adopting utils/app_version.py

Fixes abilityai/trinity-enterprise#437

🤖 Generated with Claude Code

… enforced schema v2, outcome mix (Abilityai/trinity-enterprise#437)

Second cut of the Tier-2 usage-sharing channel (ent#12).

- Ask: consent moves into a post-login "Finish setup" card (one chassis with the
  #2381 sign-in-email nudge). "Not now" is a 14-day per-browser snooze; "Don't ask
  again" and consent write the server marker; a warm re-ask returns once per
  browser after the first autonomous success, derived on read and memoised (no
  dispatch-path hook). Four feature-flag booleans keep a Dashboard load at zero
  telemetry queries; the payload preview loads on expand.
- Identity: the aggregate carries a separate `sharing_id` (minted on consent via
  insert_setting_if_absent, deleted on revoke, re-minted on re-consent) and never
  `installation_id`, which travels beside the operator's email in the ent#38
  intake. Release version on the wire, never a commit SHA.
- Schema: PAYLOAD_SCHEMA_V2 enforced fail-closed before every send; telemetry-
  owned wire enums for trigger buckets and statuses (a new product bucket lands in
  `other`); the funnel schema derives from _FUNNEL_STEPS.
- Payload: outcome mix (by trigger, by status, provider rate_limit/auth counts) +
  the #2380 install lane.
- Delivery: the last 5 send attempts are kept and shown (a default-URL 404 worded
  as "not live yet" — ent#190 does not exist); backfill retried until the first
  2xx; a TTL-held tick marker makes one worker send per interval; the builder runs
  off the event loop; the consent-time task is strong-ref'd.
- Adjacent fix: HardeningGuide.vue read the nonexistent authStore.userRole and had
  never rendered; both cards now read authStore.role, pinned by a repo-wide
  contract spec.

Docs: requirements §45.2, architecture, PRODUCT_EVENTS.md (schema v2), two user
docs, feature flow telemetry-sharing.md, three learnings entries, CSO diff report.
Tests: tests/unit/test_ent437_telemetry_consent.py, frontend
telemetryConsent.spec.js + authRoleGetterContract.spec.js; the ent#12 suite and
two flag suites adjusted for the v2 shape.

Refs Abilityai/trinity-enterprise#437

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Resolves tests/registry.json by taking dev's file and re-appending only the
ent#437 entry (drops the accidental \u-escape reformat the branch carried).

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@webmixgamer webmixgamer added the ui PR touches the frontend UI — triggers Playwright e2e tests label Sep 3, 2026
Resolves docs/memory/feature-flows.md: both sides added a Recent Updates row
(ent#437 and #2358); both kept.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@webmixgamer
webmixgamer marked this pull request as ready for review September 4, 2026 11:38
Resolves docs/memory/feature-flows.md: both sides added a Recent Updates row
(ent#437 and #2515/ent#456/ent#402); both kept.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@webmixgamer
webmixgamer requested a review from vybe September 4, 2026 11:50
@github-actions

github-actions Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

✅ Nightly unit-suite clean when this PR is merged into dev, all 3 seeds (head_sha: 2acdce372e82f0ce111d238932438a0b803d56ad).

webmixgamer and others added 2 commits September 4, 2026 13:21
Resolves tests/registry.json: both sides appended an entry (ent#438 canvas
suite from dev, ent#437 telemetry suite here); both kept.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Resolves docs/memory/feature-flows.md (both sides added a Recent Updates row;
both kept). Also moves this branch's index row below the top rows and its
registry entry off the tail, so the next merge to dev stops colliding with
the two positions every PR writes to.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

@vybe vybe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validated via /validate-pr. Security, packaging and merge gates all pass.

Verified the two load-bearing privacy claims directly, since this PR opens an egress path:

  • Share identity ≠ install identity — BANNED_KEYS = frozenset({"installation_id"}) is enforced in the validator, and sharing_id is minted via insert_setting_if_absent (atomic across workers), not derived from installation_id. Version on the wire is the release semver via utils/app_version.py, not a commit SHA, so version-adoption timing can't re-link the anonymous stream to the identified intake stream.
  • Egress fails closed — share_now validates against PAYLOAD_SCHEMA_V2 before the POST; a violation is logged, recorded in telemetry_sharing_recent_sends and not sent.

Packaging: no new top-level src/backend/ package, so the Dockerfile COPY list is unaffected. The one new env read (VERSION) is pre-existing build provenance already wired into both compose files and read the same way by main.py:1682 — correctly absent from .env.example, since it is set by the build rather than by an operator.

Test adequacy: non-happy-path coverage present on each new surface (consent transitions, schema refusal, worker-tick dedupe, role-getter contract). ui label present and e2e is green.

Checks on head d1f60a6d: all green. pytest (base, seed 12345) is still running, but that is the baseline arm feeding the regression diff — all three head seeds passed.

@vybe
vybe merged commit 553a866 into dev Sep 4, 2026
31 of 32 checks passed
@webmixgamer
webmixgamer deleted the feature/437-opt-in-telemetry branch September 4, 2026 13:02
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

⚠️ Live-instance suite skipped — merge conflict against dev.

Resolve by merging dev locally and pushing the result; the next nightly re-tests.

vybe pushed a commit that referenced this pull request Sep 4, 2026
One conflict: docs/memory/architecture.md, because #2516 (ent#437 opt-in
telemetry) added content to the monolith this branch splits.

Resolved semantically rather than textually. The lean core is kept as-is and
all four of #2516's edits are re-homed into the area files that own them:

  backend.md         `settings.py` catalog entry (Tier-2 sharing routes)
  backend.md         new "Opt-in Instance Telemetry (ent#437)" section
  agent-lifecycle.md the First-Run "Collateral" paragraph (FinishSetupCard)
  api-endpoints.md   the /api/settings/feature-flags row

The telemetry section goes to backend.md rather than beside the neighbours it
had in the monolith (#2380/#2381 in agent-lifecycle.md, or reliability.md,
which owns the section it was inserted before). The deciding rule is that the
PreToolUse hook routes by PATH: `services/telemetry_sharing_service.py` matches
backend.md's `src/backend/services/**` glob, so an engineer sent to backend.md
must find the prose there. Placing it by monolith adjacency would point the
hook at a file that does not describe it.

Verified by the branch's own suite — 22 passed, including
test_no_dangling_anchor_links_across_the_split (which proves the re-homed
cross-references still resolve) and test_core_within_line_budget (core
unchanged at 181 lines).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01HAw7x7VwACVjc58pPPi3Th
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ui PR touches the frontend UI — triggers Playwright e2e tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants