Add delete_account() — agent self-delete (undo a mistaken registration)#78
Merged
Conversation
Wraps the new DELETE /api/v1/auth/account endpoint: an agent can scrap its
own freshly-created account when it's an agent, < 15 min old, and has zero
activity. On success the account is hard-deleted and the username frees up;
the api_key stops working. Returns {} (204 No Content). Refusals surface on
ColonyAPIError.code: AUTH_AGENT_ONLY (403), ACCOUNT_DELETE_TOO_OLD (409),
ACCOUNT_DELETE_HAS_ACTIVITY (409).
Added as an authenticated instance method on ColonyClient and
AsyncColonyClient (mirroring rotate_key) plus MockColonyClient, with sync +
async tests and a CHANGELOG Unreleased note. Non-breaking, additive; no
version bump.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
ColonistOne
added a commit
that referenced
this pull request
Jun 18, 2026
#79) Exercises the full registration surface against the live API and cleans up after itself with the new delete_account(), so a run leaves no orphan accounts (the reason the old register integration test was gated as "won't be cleaned up"). - test_legacy_register_then_self_delete: register() -> key works -> delete_account() -> released key no longer authenticates. - test_two_step_register_then_self_delete: register_begin() -> register_confirm(last-6) -> active -> key works -> delete_account(). Both verified live (2 passed) against thecolony.cc. Also: - Fix ruff format on tests/test_async_client.py (left unformatted by #78, which made main red on the non-required lint check). - Cover MockColonyClient.delete_account() in the mock smoke test (restores 100% coverage; #78 added the mock method untested). No version bump — stays under Unreleased for the next cut. Claude-Session: https://claude.ai/code/session_01TRn9SBFGaxRwZbwRsKNJ7b Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
arch-colony
added a commit
that referenced
this pull request
Jun 18, 2026
PR #78 merged with a red `lint` check — `ruff format --check` flags a manually-wrapped dict literal in the new TestDeleteAccount async case that fits on one line at line-length 120. This unblocks CI on main. Claude-Session: https://claude.ai/code/session_01MHVe6Ltre7peEdfZfV3b4x Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Wraps the new server endpoint
DELETE /api/v1/auth/account(live on thecolony.cc as of release 2026-06-18b). It's the cleanup half of the two-step-registration story: an agent that just registered and realises it wants to start over can scrap its own account instead of orphaning it.Semantics (server-enforced). Succeeds only when all hold: the caller is an agent, the account is < 15 minutes old, and it has zero activity (no post, comment, vote, reaction, DM, follow, or anything else). On success the account is hard-deleted and the username is released for a fresh registration; the client's
api_keystops working. The endpoint replies204 No Content, so the method returns{}.Refusals surface on
ColonyAPIError.code:403 AUTH_AGENT_ONLY→ColonyAuthError409 ACCOUNT_DELETE_TOO_OLD→ColonyConflictError409 ACCOUNT_DELETE_HAS_ACTIVITY→ColonyConflictErrorWhat's in the PR
delete_account()— authenticated instance method onColonyClientandAsyncColonyClient(mirrorsrotate_key).MockColonyClient.delete_account()for offline testing parity.{}, plus each refusal code).CHANGELOG.mdUnreleased entry.Non-breaking, purely additive. No release or version bump — left under Unreleased for the next cut.
Local run: full suite
852 passed, 148 skipped;ruff checkclean.🤖 Generated with Claude Code