Skip to content

fix(setup): accepting registration terms that say so switches usage sharing on (abilityai/trinity-enterprise#1403) - #4810

Merged
vybe merged 5 commits into
devfrom
fix/ent1403-sharing-on-at-registration
Nov 27, 2026
Merged

vybe merged 5 commits into
devfrom
fix/ent1403-sharing-on-at-registration

Conversation

@trinity-ability

@trinity-ability trinity-ability commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • The self-serve registration terms say usage sharing is on by default, and that accepting them switches it on unless the person already switched it off. Setup recorded the acceptance and did nothing else, so sharing stayed off.
  • A registration-terms provider can now mark its terms usage_sharing_on_accept: true. When terms marked that way are accepted at setup, sharing is switched on through the platform's own switch. That only happens if the operator never chose: the kill switch wins, an install that is already sharing is left alone, and a refusal on record (has_opted_out(), abilityai/trinity-enterprise#1397) is never overridden.
  • A self-installed instance doesn't change. Neither does the instance-ID form, an instance with no provider, or terms without the flag.

Stacked on #4786 (ent#1397's has_opted_out()). The base is that branch, so this diff is only ent#1403. Merge #4786 first. The private half is abilityai/trinity-enterprise PR (linked below).

Journey Impact: none: an existing step does not do what its terms say.

Changes

  • services/setup_registration.py: the optional usage_sharing_on_accept field. Only a literal True counts. Any other value reads False and never makes the terms unavailable. accepted_terms[_if_applies]() returns the accepted document, re-read at submit. check_accepted[_if_applies]() is unchanged on top of it.
  • services/telemetry_sharing_service.py: switch_on_with_terms(actor, via=...) turns the Settings switch on. It calls set_consent(True), writes the same telemetry_sharing_consent audit line plus via (never the share id), and schedules the backfill share. It returns whether sharing is on and never raises.
  • routers/setup.py: on the registration-terms path, when the accepted terms carry the flag, setup calls it with via="registration_terms", inside a try block, so setup never fails on it.
  • components/settings/TelemetrySharingPanel.vue: the Usage sharing header said "Off by default … nothing is shared until you turn this on", which is false once accepted terms switched sharing on. It now says sharing is off unless it is turned on there or terms accepted at setup say accepting them switches it on, and that it can be switched off there any time. Pinned by tests/unit/telemetrySharingPanelHeader.mount.spec.js (mounted, on and off; red against the old sentence).
  • docs/memory/requirements/infrastructure.md (PROV-020), tests/registry.json.

Fix round after validation. Which terms say so is decided by the provider, and it now compares the accepted text, not only the version: sharing comes on only when the version and the sha256 of the text are a pair it knows. A known version with any other text leaves sharing off and is logged. That is all in the private half. The seam here still acts only on a literal True.

Acceptance criteria

Criterion Test (tests/unit/test_ent1403_sharing_on_at_registration.py)
Setup with the terms accepted leaves sharing on when the person never chose test_accepting_terms_that_say_so_leaves_sharing_on
Not when switched off, dismissed, or under DO_NOT_TRACK / TELEMETRY_SHARING_ENABLED=false test_a_refusal_on_record_keeps_sharing_off[switched-off, on-then-off, dont-ask-again], test_the_kill_switch_wins
Only when the accepted version says so; no terms or self-installed is unchanged test_terms_that_do_not_say_so_leave_sharing_as_it_was[false, absent, string, int], test_no_provider_leaves_sharing_as_it_was, test_the_instance_id_form_is_unchanged
Settings shows it on straight after setup; switching it off works as today test_accepting_terms_that_say_so_leaves_sharing_on (get_status()), test_switching_it_off_afterwards_works_as_today
The first-run step does not ask again test_the_first_run_step_does_not_ask_again: the telemetry_sharing_enabled flag that firstRunSteps.js gates pending on. No frontend change needed
Audit-logged like any other change to the switch test_the_change_is_audit_logged_naming_the_door
A failure never blocks setup test_a_failing_switch_never_fails_setup, test_a_failing_audit_never_fails_setup_and_sharing_stays_on

Test Plan

  • New file: 19 passed. Red before the change (6 failed, on "sharing off" and the missing flag).
  • Mutations: deleting the setup hand-off turns 4 tests red. Deleting the has_opted_out guard turns the 3 refusal cases red. Both were restored.
  • Every unit file that imports routers.setup, setup_registration or telemetry_sharing_service (25 files): 668 passed, 2 skipped.
  • Fix round: the header spec plus the raw-color, loading-gate and source-text ratchets, 30 passed. test_ent1403 + test_ent1329, 60 passed.
  • Full unit suite: left to CI.
  • Not run on a live stack.

Related to abilityai/trinity-enterprise#1403 (closed manually at release).

🤖 Generated with Claude Code

Fixes abilityai/trinity-enterprise#1403

dolho and others added 2 commits November 26, 2026 11:48
…refused" (Abilityai/trinity-enterprise#1397)

The consent flag is off both for an install that was never asked and for
one whose admin switched sharing off. A caller that turns sharing on for
the operator had no way to tell them apart.

`telemetry_sharing_service.has_opted_out()` answers it from the rows the
service already writes: the consent row stored as off, a consent time left
from when sharing was on, or the "Don't ask again" mark. Deleting the rows
(the reset path) returns the install to never asked. An unreadable store
counts as a refusal.

No behaviour changes in this repository: the caller is in the private
module.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…haring on (abilityai/trinity-enterprise#1403)

The self-serve registration terms say usage sharing is on by default and
that accepting them switches it on, unless the person already switched it
off. Setup recorded the acceptance and nothing else, so sharing stayed off.

- setup_registration: a provider's terms may carry
  usage_sharing_on_accept (only a literal True counts; anything else
  reads False and never makes the terms unavailable).
  accepted_terms[_if_applies] return the accepted document, so setup acts
  on the version actually accepted, read fresh at submit.
- telemetry_sharing_service.switch_on_with_terms(actor, via=...): the
  Settings switch turned on (set_consent, the telemetry_sharing_consent
  audit line plus via, the backfill share), only for an operator who
  never chose: the kill switch wins, an install already sharing is left
  alone, and a refusal on record (has_opted_out, ent#1397) is never
  overridden. Never raises.
- routers/setup: on the registration-terms path, when the accepted terms
  say so, calls it with via="registration_terms". Never fails setup.

No provider, terms without the flag, and the instance-ID form are
unchanged. Mutation: removing the setup hand-off turns 4 tests red;
removing the has_opted_out guard turns the 3 refusal cases red.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@trinity-ability

Copy link
Copy Markdown
Contributor Author

Private half: abilityai/trinity-enterprise PR for #1403 (provider marks which registration versions switch sharing on).

@trinity-ability trinity-ability added the status-needs-fix PR has an unaddressed review/validation finding; cleared by the author's next push (#2815) label Nov 27, 2026
@trinity-ability

Copy link
Copy Markdown
Contributor Author

/validate-pr (run self-serve-instances, head 40fd27b2): REQUEST CHANGES, one line in the body.

This PR requires the following changes before merge:

  • scripts/ci/check_journey_impact.py rejects the body: REJECTED — '** none: an existing step does not do what its terms say.'. Write the line without bold around the label, e.g. Journey Impact: none: an existing step does not do what its terms say. The check doesn't run while this PR is stacked, but it will go red once the PR is retargeted to dev.

Done by this run: added Fixes abilityai/trinity-enterprise#1403 to the body (cross-tracker, so set status-in-dev on the issue by hand after merge).

The code passed every check this run made:

  • 19/19 new tests pass, and 229 across the 8 setup and telemetry files.
  • 7 mutations, each turned tests red: the has_opted_out guard (3 red), the kill switch, the already-on guard, is True changed to bool(), the router flag check (4 red), the audit call, and the never-raise fences.
  • The trial-terms and Settings routes are untouched.
  • The public text is generic: the enterprise-docs grep finds nothing.

Tier 1 hasn't run yet because the PR is stacked. Merge #4786 first, then retarget.

…switched sharing on (abilityai/trinity-enterprise#1403)

The header said "Off by default ... nothing is shared until you turn this
on". Once accepting terms at setup that say so switches sharing on, the
panel opens with sharing on and that sentence is false. It now names both
ways sharing comes on and that it can be switched off here any time.

telemetrySharingPanelHeader.mount.spec.js mounts the panel, on and off;
both cases were red against the old sentence.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@trinity-ability

Copy link
Copy Markdown
Contributor Author

/validate-pr second validation (run self-serve-instances, head a0839cc5, this PR's two commits only; private half ent#1405 at 190000af): APPROVE. Merge after #4786, retarget to dev, and merge only once Tier 1 is green there.

The one change requested last round is fixed:

  • scripts/ci/check_journey_impact.py now passes (PASSED, exit 0).

The delta checks:

  • Live terms. I fetched GET https://gateway-dev.abilityai.dev/v1/terms/registration myself. It serves version 2026-11-24-registration-v2, and the sha256 of its text is 6315f960…4b82, the pinned value. The ent fixture is byte-identical to what it serves. The prod gateway answers 404 today.
  • The 2026-11-25 text is refused. I rebuilt it from gateway fabed4f terms/registration.md, rendered at 25 messages per 24 hours. Its sha256 is 1c497654…9673. Fed through the real current_terms(), it gives usage_sharing_on_accept: False. Today's e97e572 text gives True.
  • Header sentence. The mounted spec passes, and it goes red (2/2) when "Off by default" is put back. It passes 30/30 together with the raw-color, loading-gate and source-text ratchets.

Earlier checks re-run on this head:

  • 80 passed in ent1403, ent1329 and ent1397. 166 passed in ent12, ent437, 2381, 3004, setup_operator_profile and ent1312.
  • Mutations still go red: removing the router hand-off (4 red), removing the has_opted_out guard (3 red), and is True changed to bool() (3 red).
  • The backend code is unchanged since 40fd27b2.
  • No secrets, emails, IPs or host paths. The enterprise-docs grep is clean, and there's no gated write handler (§4.11 ➖).

Merge gate: Tier 1 pytest / regression diff haven't run, because the base is the #4786 branch. They have to be green after the retarget.

Cross-tracker reference: set status-in-dev on abilityai/trinity-enterprise#1403 by hand after merge.

@trinity-ability trinity-ability removed the status-needs-fix PR has an unaddressed review/validation finding; cleared by the author's next push (#2815) label Nov 27, 2026
@vybe
vybe changed the base branch from fix/ent1397-usage-sharing-opt-out to dev November 27, 2026 16:07
Trinity Agent (trinity) and others added 2 commits November 27, 2026 11:10
#4786 landed on dev as d6629b8 (content-identical to 2d2c17d on this
branch). Only conflict: tests/registry.json, both entries kept.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ff the loop (abilityai/trinity-enterprise#1403)

The #4674 ratchet (test_the_ratchet) went red at 253b089: the hand-off added
three sync db calls inside async defs. `switch_on_with_terms` now makes the
kill-switch / already-on / refusal decision and the `set_consent` write in one
worker thread (`_switch_on_with_terms_sync`), and setup's admin lookup for that
hand-off goes through `asyncio.to_thread`. Still never raises into setup.

Red before (at 253b089): setup.py 10 > baseline 9, telemetry_sharing_service.py
13 > baseline 11. Green after, baseline untouched.

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

Approved by the product agent acting on the operator's standing word of 2026-11-27: independent validation APPROVE at this head (third pass, delta checked, mutations red) and Tier 1 green including the regression diff.

@github-actions

Copy link
Copy Markdown

⚠️ Nightly unit-suite found regressions when this PR is merged into dev (2 of 3 seeds).

Regression details (head_sha: `253b089e57b72cb50a1bb418adf9c1f250197984`)

Seed 12345

Backend unit-suite regression diff

Per-XML totals

Side Path Total Pass Fail Error Skip
base junit-base-pr4810-12345.xml 44346 44243 0 0 103
head junit-head-pr4810-12345.xml 44365 44262 1 0 102

❌ New failures introduced by HEAD (1)

Tests failing under HEAD that did not fail under BASE in any seed:

  • [F] test_4674_sync_on_loop_ratchet.TestTheLiveTree::test_the_ratchet

Legend: [F] = assertion failure, [E] = collection or fixture error.
Identity = (classname, name, kind); union taken across all input XMLs.


Seed 67890

Backend unit-suite regression diff

Per-XML totals

Side Path Total Pass Fail Error Skip
base junit-base-pr4810-67890.xml 44346 44244 0 0 102
head junit-head-pr4810-67890.xml 44365 44262 1 0 102

❌ New failures introduced by HEAD (1)

Tests failing under HEAD that did not fail under BASE in any seed:

  • [F] test_4674_sync_on_loop_ratchet.TestTheLiveTree::test_the_ratchet

Legend: [F] = assertion failure, [E] = collection or fixture error.
Identity = (classname, name, kind); union taken across all input XMLs.

Reproduce locally: git merge dev && ( cd tests && python -m pytest unit/ -m "not slow" -p randomly --randomly-seed=12345 )

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.

3 participants