Skip to content

fix(admin): audit and repair historical channel discovery - #10040

Draft
bradseiler wants to merge 1 commit into
mainfrom
harrington/historical-channel-discovery
Draft

bradseiler wants to merge 1 commit into
mainfrom
harrington/historical-channel-discovery

Conversation

@bradseiler

Copy link
Copy Markdown
Contributor

Summary

Add explicit, bounded operator modes for historical relay-signed channel discovery:

  • buzz-admin reconcile-channels --check reports missing metadata, admins and members for an expected relay identity without writing.
  • --repair-missing creates only missing coordinates from canonical state, rechecking behind the existing publisher locks. Healthy coordinates and intentional membership removals are preserved.
  • Before new-mode repair writes, reject an unrecognized signing key when another author has live metadata. An explicit recovery override is documented, repair-only and not a key-rotation mechanism.
  • UUID pagination, whole-command deadlines, JSON reports and a nonzero incomplete result make historical inventories scriptable without a recent-channel cutoff.
  • Existing no-mode backfill and targeted roster-republish behavior remain unchanged.
  • Document incomplete publication, retry boundaries, measured read-only detection and operator verification. No schema migration or automatic production repair/deployment.

Related issue

Related discovery work: #9805.

Testing

Agent runs on the revised patch tree:

  • 29 admin unit tests and 225 database unit tests passed.
  • The actual required Justfile admin selector ran 26 tests including both discovery tests; the exact Cargo fallback discovery step ran both tests.
  • All 14 admin PostgreSQL-lane tests passed with nextest's actual desired-state setup and per-test isolation; the command journey also passed on migration-applied PostgreSQL 16.
  • Wrong-key repair exits nonzero and changes no discovery heads. Removing the preflight turns that no-write assertion red.
  • Journey coverage includes all missing-kind subsets, wrong-signer records, tenant UUID collisions, intentionally removed members, deterministic concurrent operators, legacy compatibility, historical pagination, deletion and bounded-read failure.
  • Fresh local relay, PostgreSQL and Redis: synthetic 30-day-old DM repaired; both participants discover the roster and exchange/read messages; both healthy reopen directions and a second repair leave signed discovery unchanged. Public-key-only inventory also passes with a read-only database session.
  • Admin/database Clippy (--all-targets -- -D warnings), formatting, discovery-convention guard, shell syntax and file-size checks passed.

Full repository just ci, full just test, full fallback unit suite and native-client UX were not run. No production writes/deployments or production-scale performance measurement.

Rollout and operator verification

The new modes require a newly built admin binary, or an updated relay image where operators execute buzz-admin inside that container. There is no automatic repair feature flag.

  1. Measure representative inventory/query-plan cost and choose an appropriate page budget and schedule; presence probes visit monthly partitions.
  2. Run --check --relay-pubkey <verified advertised relay key> across the configured community, following every cursor. Retain reports; exit 6 identifies incomplete pages, while other nonzero exits mean inventory failure.
  3. With the verified signing key, run --repair-missing --channel <id> for approved affected channels. Expect missing_after: [].
  4. Rerun checks expecting exit 0, and have both affected participants verify discovery and messages in each direction.

Repairs are ordinary signed discovery events, committed per coordinate and safe to retry. Reverting the tool does not undo repaired events. An explicitly overridden wrong identity is not repaired by rollback and requires separate investigation/cleanup.

Review and human gate

Independent review cleared the patch. Required GitHub CI and explicit human confirmation remain pending. Human steps are in docs/operator-channel-discovery.md: use a disposable loopback relay/database and run the opt-in synthetic journey. It deliberately deletes discovery records for a fresh synthetic DM; expect its PASS result for historical recovery, bidirectional messages and healthy reopen/repair no writes.

Boundaries

Stored-authorship consistency is not independent proof of relay ownership. Presence checks do not certify tag freshness, signatures or signing-key rotation. Repair never restores absent or removed membership rows. Scheduling, alert routing and production execution remain explicit operator responsibilities.

Co-authored-by: Harrington <91868d0cc0b8144564e350ce0a9e46447f654ad3fe93b23e39fe71314c911781>
Signed-off-by: Brad Seiler <seiler@squareup.com>
@bradseiler
bradseiler force-pushed the harrington/historical-channel-discovery branch from 7f9c393 to 07bf586 Compare December 1, 2026 21:35

This branch has not been deployed

No deployments
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.

1 participant