Skip to content

fix: live smoke suite, dependency update and the bugs it found - #14

Merged
neoromantic merged 11 commits into
mainfrom
chore/alive-smoke
Oct 21, 2026
Merged

neoromantic merged 11 commits into
mainfrom
chore/alive-smoke

Conversation

@neoromantic

Copy link
Copy Markdown
Owner

A health check of tg against a real account. Offline tests were green, but the live run found several bugs in core commands. This PR fixes the small ones and turns the integration suite into a live smoke suite.

Dependencies

  • mtcute 0.32.5 → 0.32.6, Bun 1.4.3.
  • Biome 2.3.13 → 2.5.15, pinned. 2.6.0 and 2.6.1 shipped without platform binaries, so lint can't start with them. The config is migrated, and the new useOptionalChain and organizeImports fixes are applied.

Fixes

  • tg sql --query "…" failed with "Missing required positional argument" (citty 0.2 makes positionals required by default). The -q alias is removed, because the root command always read it as --quiet.
  • The daemon's dialog bootstrap stopped at the first FLOOD_WAIT on messages.getDialogs, so large accounts got a partial chat list. Daemon clients now wait out flood waits of up to 5 minutes and log each wait. On a test account with about 2,900 dialogs, the bootstrap now completes in 36 s, including one 17 s wait.
  • tg contacts list from the cache read only the first 1000 users. On a real account it showed 436 contacts out of 1060.
  • Messages received in real time were cached with raw_json = '{}'.
  • tg daemon stop printed a progress line to stdout before the JSON.
  • tg send --to me (or self) now sends to Saved Messages. Before, it failed with USERNAME_INVALID.

Live smoke suite (bun run test:integration)

Four tests run the CLI the way a user would:

  • auth status, plus the profile written to and read from the cache
  • chats and contacts fetched from the API, then served from the cache
  • send to Saved Messages, read back through tg api messages.getMessages
  • the daemon from start through real-time updates, the dialog bootstrap and history sync, to tg status and a clean tg daemon stop

Messages go only to Saved Messages and are deleted after each test. The suite stays opt-in and never runs in CI. The old suite called tg user me, which doesn't exist, so it could never pass.

Testing

  • bun run check, bun run test (1119), bun run test:e2e (100) and bun run build pass. New regression tests cover tg sql, contacts behind 1000 cached users, --to me, raw_json and the daemon flood waiter.
  • bun run test:integration passed 4/4 in 56 s against a real account.

The larger problems found during the check go to separate issues.

🤖 Generated with Claude Code

neoromantic and others added 10 commits October 21, 2026 14:45
Biome 2.6.0 and 2.6.1 shipped without platform binaries, so the
lint script can't start with them. Pin 2.5.15 until a fixed 2.6
release is out, migrate the config and apply the new
useOptionalChain and organizeImports fixes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
citty 0.2 treats positionals as required by default, so every
'tg sql --query' call failed with 'Missing required positional
argument: COMMAND'. Mark the subcommand positional optional and add
e2e tests that go through the real argument parser.

Drop the -q alias: the root command always read it as --quiet, so
'tg sql -q ...' printed nothing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The cached path read the first 1000 users by name and only then kept
the contacts, so accounts with more cached users lost contacts and
reported a wrong total. Query contacts directly.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
'tg send --to me' was resolved as a username and failed with
USERNAME_INVALID.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
'tg daemon stop' wrote 'Stopping daemon (PID ...)' to stdout before
the JSON result, so agents couldn't parse it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The live update handler never passed the raw message, so every message
the daemon received in real time was cached with raw_json '{}'. Pass
msg.raw and serialize it with the same BigInt-safe replacer as the
sync worker.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Daemon clients had no flood-waiter middleware beyond mtcute's 10s
default, so the dialog bootstrap stopped at the first FLOOD_WAIT on
messages.getDialogs and large accounts got a partial chat list. Give
connect and reconnect one client factory that waits up to 5 minutes
and logs each wait, keeping mtcute's internal-errors handler.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Four tests run the CLI against the real API: auth and profile cache,
chats and contacts cache, send to Saved Messages read back through
tg api, and the daemon from start through bootstrap and history sync
to a clean stop. Messages go only to Saved Messages and are deleted.

The old suite called 'tg user me', which never existed, and sent to an
optional external recipient. AGENTS.md also had the data dir layout
wrong.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@neoromantic
neoromantic merged commit e858995 into main Oct 21, 2026
5 checks passed
@neoromantic
neoromantic deleted the chore/alive-smoke branch October 21, 2026 11:10
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