Skip to content

testnet: de-list the ephemeral e2e councils after each suite run - #147

Closed
AquiGorka wants to merge 1 commit into
mainfrom
e2e-council-cleanup
Closed

testnet: de-list the ephemeral e2e councils after each suite run#147
AquiGorka wants to merge 1 commit into
mainfrom
e2e-council-cleanup

Conversation

@AquiGorka

Copy link
Copy Markdown
Contributor

Problem

Every run of the testnet suites creates a listed council (Testnet E2E <ts> in testnet/main.ts, Testnet Verify <ts> in lifecycle/testnet-verify.ts) and never removes it. Six such councils have accumulated on the public network dashboard (07-27 to 07-28 alone) alongside the pre-audit demo set, so the demo surface shows a junk network. Worse: runs without MASTER_SECRET use random admin keys, and council deletion is ownership-checked, so those leaked councils are permanently orphaned (only DB surgery can remove them).

Fix

New shared testnet/cleanup-councils.ts: at the end of a passed run each suite re-auths as its admin key and deletes every council that key owns via DELETE /api/v1/council/metadata. Sweeping by owner (not just this run's id) also collects leftovers from earlier crashed runs whenever the suite runs with MASTER_SECRET-deterministic keys. Cleanup is loud but non-fatal: a failed sweep prints a WARNING but does not turn a passed payment/lifecycle flow into a failed suite.

Companion action (not in this diff, needs an ops decision): the deployed-testnet invocation (nightly job) should always set MASTER_SECRET, otherwise a run that dies mid-flow still leaks an undeletable council.

Verified

deno lint and deno fmt --check clean. deno check reports only the 8 pre-existing errors on main (stellar-sdk Keypair type mismatch at the deriveKeypair call sites, identical count and locations on a clean checkout); the new code adds none. Not exercised against deployed testnet from here: running the suite creates real councils, which is what this PR exists to stop; the sweep uses the same walletAuth + endpoints the suites already exercise.

Both suites leave their per-run council listed on council-platform, so every run adds a junk council to the public network dashboard. Each suite now sweeps all councils owned by its admin key at the end of a passed run; the sweep only covers crashed runs too when MASTER_SECRET is set, since random keys are unrecoverable.
@AquiGorka AquiGorka closed this Jul 30, 2026
@AquiGorka
AquiGorka deleted the e2e-council-cleanup branch July 30, 2026 20:19
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