Repository navigation
docs(reporting): write the migration guide and extend the error reference #1778
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a48b868
docs(reporting): write the migration guide and extend the error refer…
bokelley 0a0f3e5
Merge branch issue-1695-reference-seller into issue-1695-guides
bokelley 9465e85
docs(reporting): bind the migration example and scope the error refer…
bokelley d7464a5
Merge branch issue-1695-reference-seller into issue-1695-guides
bokelley 4c43fbd
Merge branch issue-1695-reference-seller into issue-1695-guides
bokelley f6e6125
Merge branch issue-1695-reference-seller into issue-1695-guides
bokelley e7ee95a
Merge next into claude/issue-1695-guides
bokelley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,33 @@ | ||
| # Migrating from account-level `reporting_delivery_configs` | ||
|
|
||
| A subscription registers reporting once on the principal, so it follows the caller's grants across every account. Account-level `reporting_delivery_configs`, written through `sync_accounts`, register reporting once per account. The two coexist: during a migration, both can be live on the same account. | ||
|
|
||
| ```python | ||
| # 1. Subscribe, scoped to the accounts already served at account level. | ||
| subscription = { | ||
| "subscription_id": "analytics-daily", # never equal to a delivery_config_id | ||
| "scope": {"account_ids": ["acc_a", "acc_b"]}, | ||
| "selector": {"feed_purpose": "analytics", "period_duration": "P1D", "required_finality": "official"}, | ||
| "reconciliation_mode": "delivery_only", | ||
| } | ||
| await client.reporting.subscribe(subscription) | ||
| # 2. Check what the subscription would own: your account-level configs still take precedence. | ||
| report = await client.reporting.reconcile(include_not_owed=True) # overridden periods read excluded:overridden | ||
| # 3. Hand over: end the account-level configs where the subscription resolves an offering. | ||
| await client.reporting.subscribe({**subscription, "replace_account_configs": True}) | ||
| # 4. Widen the scope once every account is handed over. | ||
| await client.reporting.subscribe({**subscription, "scope": {"all_authorized_accounts": True}, | ||
| "operator_domains": ["agency.example"]}) | ||
| ``` | ||
|
|
||
| ## Precedence | ||
|
|
||
| A caller's own active `sync_accounts` `reporting_delivery_configs` entry for a `feed_purpose` takes precedence over its subscriptions on that account. The subscription records an `overridden` exception, and the two never owe the same period. On the managed path, supply `SubscriptionOptions.account_delivery_configs` so the engine sees those configurations. | ||
| A caller's own active `sync_accounts` `reporting_delivery_configs` entry for a `feed_purpose` takes precedence over its subscriptions on that account. The subscription records an `overridden` exception, and the two never owe the same period: `reconcile()` and `explain()` read those periods as `excluded:overridden`. On the managed path, supply `SubscriptionOptions.account_delivery_configs` so the engine sees those configurations. | ||
|
|
||
| ## Overrides | ||
|
|
||
| Give each configuration its `active_from`, so the exception opens at that instant. A `subscription_id` never equals a `delivery_config_id` the caller uses: they share one namespace. `reporting.principals.reporting_subscription_ids(...)` lets `sync_accounts` refuse a clash. | ||
| Give each configuration its `active_from`, so the exception opens at that instant. A `subscription_id` never equals a `delivery_config_id` the caller uses: they share one namespace. `client.reporting.subscribe` refuses a clash before dispatch (`SUBSCRIPTION_ID_CLASH`). On the seller side, `reporting.principals.reporting_subscription_ids(...)` lets `sync_accounts` refuse the reverse clash. | ||
|
|
||
| ## `replace_account_configs` | ||
|
|
||
| A subscription with `replace_account_configs: true` ends the caller's own account-level configurations with the same `feed_purpose` on in-scope accounts where it resolves an offering. It applies once per `subscription_version`, or when the flag changes to true. Supply `SubscriptionOptions.end_account_configs(principal, account_id, ids, *, at)` together with `account_delivery_configs`; without them the flag is refused with `UNSUPPORTED_FEATURE`. | ||
| A subscription with `replace_account_configs: true` ends the caller's own account-level configurations with the same `feed_purpose` on in-scope accounts where it resolves an offering. It applies once per `subscription_version`, or when the flag changes to true; resending the same version does nothing more. Supply `SubscriptionOptions.end_account_configs(principal, account_id, ids, *, at)` together with `account_delivery_configs`; without them the flag is refused with `UNSUPPORTED_FEATURE`. Periods that started before the handover stay owed by the account-level configuration, and the subscription owes the rest: run `kit.assert_agreement` in the [test kit](reporting-subscriptions-testing.md#testing-today) across a handover before you ship it. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.