Repository navigation
test(cli-core): keep one owner per CLI, account and output contract - #208
Merged
Merged
Conversation
Tests in scope: 293 -> 158 (unit 206 -> 105, e2e 87 -> 53); non-blank test lines 4094 -> 2937. multi-account.e2e runs about half as many CLI processes (~110 -> ~55). Product code is unchanged. Owners kept: - Account selection through the CLI (multi-account.e2e): one --account snapshot (@beta_test) and one without --account cover every cache command; the snapshot now includes messages get. The only account, NO_ACTIVE_ACCOUNT, AUTH_REQUIRED, unknown ID, switch persistence (#61), activeAccount applied at start (also under -q). Selector forms (ID, @username in any case, label) belong to account-selector.test. - keepActiveAccountInConfig edge cases (no file, no key, same value, unwritable) belong to auth.test, once; each login keeps its own activation and failure test. - Output: format.e2e owns -f/--format pretty and quiet; output.test owns the JSON snapshot, retryable codes, the documented exit code table (one test over every ErrorCode), quiet errors, info and verbose. The error schema and exit wiring are owned by accounts, multi-account, media and credentials e2e tests. - access.test keeps the COMMAND_ACCESS completeness, the start guard, isReadMethod and the two checks access.e2e does not reach. Removed: - types.test.ts (constants equal themselves, types compile), csv.test.ts (dead stringifyTable; includeHeader owned by sql.test), exit-codes.e2e.test.ts (every test duplicated accounts, media, credentials or help e2e). - Duplicates of e2e owners in account-selector (resolveAccount), access, output and services/telegram tests; help and format e2e tests that re-ran the same citty help or the default JSON. - auth.test's phone merge test, which used a hand-written accounts DB: on the real table (phone UNIQUE) that merge fails with "UNIQUE constraint failed: accounts.phone" and leaves a stray account. The bug is reported, not fixed here. - A vacuous QR test (toBeDefined() on null) and implied assertions. Repaired: the background telemetry e2e test no longer sleeps 2 s in its server, polls with sleeps or compares durations. The server holds every response on a deferred, the test awaits the fourth event; that commands hand events off instead of flushing is owned by telemetry.test. Proofs: 61 product mutations failed their retained owners, each then restored. Two stayed green, and the tests they exposed were put back: quiet errors (config.e2e's check is skipped as root) and allowedChats leaving auth login/logout alone (access.e2e never reaches the check for them). Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
What and why
Part of the test cleanup campaign: each contract keeps one strong owner, and tests that repeat it, restate the code or prove nothing go. Tests only; no product code changed.
Tests in scope: 293 -> 158 (unit 206 -> 105, e2e 87 -> 53); non-blank
test lines 4094 -> 2937. multi-account.e2e runs about half as many CLI
processes (~110 -> ~55). Product code is unchanged.
Owners kept:
snapshot (@beta_test) and one without --account cover every cache
command; the snapshot now includes messages get. The only account,
NO_ACTIVE_ACCOUNT, AUTH_REQUIRED, unknown ID, switch persistence (tg accounts switch is undone by activeAccount in config.json #61),
activeAccount applied at start (also under -q). Selector forms (ID,
@username in any case, label) belong to account-selector.test.
unwritable) belong to auth.test, once; each login keeps its own
activation and failure test.
the JSON snapshot, retryable codes, the documented exit code table (one
test over every ErrorCode), quiet errors, info and verbose. The error
schema and exit wiring are owned by accounts, multi-account, media and
credentials e2e tests.
isReadMethod and the two checks access.e2e does not reach.
Removed:
csv.test.ts (dead stringifyTable; includeHeader owned by sql.test),
exit-codes.e2e.test.ts (every test duplicated accounts, media,
credentials or help e2e).
output and services/telegram tests; help and format e2e tests that
re-ran the same citty help or the default JSON.
on the real table (phone UNIQUE) that merge fails with "UNIQUE
constraint failed: accounts.phone" and leaves a stray account. The bug
is reported, not fixed here.
Repaired: the background telemetry e2e test no longer sleeps 2 s in its
server, polls with sleeps or compares durations. The server holds every
response on a deferred, the test awaits the fourth event; that commands
hand events off instead of flushing is owned by telemetry.test.
Proofs: 61 product mutations failed their retained owners, each then
restored. Two stayed green, and the tests they exposed were put back: quiet errors
(config.e2e's check is skipped as root) and allowedChats leaving auth
login/logout alone (access.e2e never reaches the check for them).
How I checked it
Every removal was checked by breaking the product behaviour on purpose: the retained owner failed, then the code was restored.
The files in scope pass with
bun test --parallel. Typecheck, lint, format and Knip are clean.Tests pass locally and use made-up data only
README, docs and affected demos follow the product content standard
Title follows the repo's commit style: Conventional Commits (
feat: …,fix: …) unlessAGENTS.mdsays otherwise🤖 Generated with Claude Code