Skip to content

bug(reporting): scope configuration generations and leases by account #1169

Description

@bokelley

Summary

In 8.0.0-beta.15, Reliable Reporting configuration generations are keyed globally by (delivery_config_id, delivery_config_version), even though AdCP defines delivery_config_id as caller-selected and unique only within the authenticated caller and account.

This is a cross-account correctness and isolation bug for any multi-tenant seller using one in-memory or PostgreSQL ledger.

Current behavior

  • ReportingConfiguration.generation_key returns tuple[str, int] without account_id.
  • InMemoryReportingLedgerStore._configurations and _leases use that key.
  • PgReportingLedgerStore selects, conflicts, leases, and releases configurations using only delivery_config_id and delivery_config_version.
  • Status projection also builds configuration maps from the two-part key.

Two authorized accounts may validly publish daily@1. Today the second write either conflicts with the first account's immutable generation or aliases storage/lease/status behavior that should remain account-scoped.

Required behavior

Make the durable generation identity account-qualified everywhere, ideally through one typed SDK value rather than repeated tuples:

@dataclass(frozen=True)
class ReportingConfigurationGenerationKey:
    account_id: str
    delivery_config_id: str
    delivery_config_version: int

All configuration, obligation, lease, lookup, lock, status, and issue joins should use the same identity.

Acceptance criteria

  • Two accounts can each store the same delivery_config_id and version with different valid configuration content.
  • Reads, worker leases, releases, obligation generation, and status projection cannot cross account boundaries.
  • In-memory and PostgreSQL stores have identical key semantics.
  • PostgreSQL primary/unique constraints and every ON CONFLICT, WHERE, lock, and lease path include account_id.
  • A migration path preserves existing reporting ledger rows and constraints for adopters already running beta.15.
  • Tests exercise concurrent same-name generations across two accounts, including worker leasing and status reads.
  • Public helper types discourage future code from reconstructing an incomplete tuple ad hoc.

Adopter impact

Embedded Sales Agent runs many publisher tenants and buyer accounts in one process/database. We cannot safely enable SDK-managed reporting for multiple accounts until this identity matches the protocol's account scope.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions