Repository navigation
feat(telemetry): opt-in instance telemetry — reachable ask, share id, enforced schema v2, outcome mix (abilityai/trinity-enterprise#437) - #2516
Conversation
… 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]>
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]>
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]>
|
✅ Nightly unit-suite clean when this PR is merged into |
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
left a comment
There was a problem hiding this comment.
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, andsharing_idis minted viainsert_setting_if_absent(atomic across workers), not derived frominstallation_id. Version on the wire is the release semver viautils/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_nowvalidates againstPAYLOAD_SCHEMA_V2before the POST; a violation is logged, recorded intelemetry_sharing_recent_sendsand 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.
|
Resolve by merging |
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
Summary
sharing_id(minted on consent, deleted on revoke) and neverinstallation_id, which travels beside the operator's email in the ent#38 intake; release version on the wire, never a commit SHA.PAYLOAD_SCHEMA_V2is enforced fail-closed before every send, with telemetry-owned wire enums; the payload gains an outcome mix and the install lane; the last 5 sends are inspectable; backfill is retried until the receiver first acknowledges; one worker sends per interval.HardeningGuide.vuereadauthStore.userRole, which does not exist, so the feat: record install provenance (DO Marketplace) + first-run HTTPS/VPN hardening guide #2380 card had never rendered. Both cards now readauthStore.role, pinned by a repo-wide contract spec.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_atsrc/backend/routers/settings.py—GET …/telemetry-sharing?preview=(human-only),POST …/telemetry-sharing/ask/dismiss, consent audit carriessharing_id_rotated, four feature-flag booleanssrc/backend/db/schedules/stats.py,database.py—count_terminal_executions_by_status,first_autonomous_success_atsrc/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.vueorigin/devon 2026-09-03; the only conflict wastests/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/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 pass4c13b0ac,--randomly-seed=20260903, clean worktree): 13,696 passed, 37 skipped, 2 order-dependent failures intest_1081_physical_meterthat fail identically onorigin/devwith the same seed and pass in isolation (the class recorded in learnings 2026-08-12/13); CI's six-seed matrix andregression diffare green on this headtelemetryConsent.spec.js,authRoleGetterContract.spec.jsandhardeningGuide.spec.js); loading-gate ratchet green; zero raw colors in the new files;vite buildcleansharing_idpresent, noinstallation_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 idDELETE /api/settings/telemetry_sharing_dismissed_atresets the ask;?preview=0skips the aggregate buildRelease note
Follow-ups (recorded)
sharing_id; first-value milestones are not in v2; receiver must keep this stream apart from the intake recordrouters/settings.pywhole when the split landsmain.pyadoptingutils/app_version.pyFixes abilityai/trinity-enterprise#437
🤖 Generated with Claude Code