Skip to content

docs: map tg's layers, seams, disk and wire; fix the adapter-test standard - #640

Merged
leemour merged 1 commit into
mainfrom
docs/architecture-and-adapter-standard
Oct 20, 2026
Merged

leemour merged 1 commit into
mainfrom
docs/architecture-and-adapter-standard

Conversation

@leemour

@leemour leemour commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator

What

  • docs/dev/ARCHITECTURE.md rewritten in whatsapp-cli's shape: what cli-core owns, the layers (with the biome.json rules that hold them, and the one direction no rule checks yet), history from Telegram's servers, the adapter (Feature, send/write, flood waits, proxy), connections, logging in, the test seams, what is on disk, what goes on the wire, and the standards it follows. Each fact was read from the code on origin/main (139062d). It no longer points at the untracked HANDOFF.md or at max-cli's architecture; the adapter-method path is written out on the page.
  • No connection lock, by ruling. The page says every process opens its own main connection (owner's ruling NEED-600 A, docs/dev/session-sharing.md), that TELEGRAM does not set connection: "exclusive" and commands do not go through serve, that the only lock is cli-core's serve lock, and that AUTH_KEY_DUPLICATED is the signal that reopens the question. wa's device lock and serve relay are not copied.
  • agent-os/standards/testing/adapter-fake-client.md cited adapter.ts:2027-2040 (the file has 625 lines) and gave no reason. It now describes the adapter tests as they are, by symbol: the real @mtcute/node with only TelegramClient replaced (FakeClient, SeededClient, StatsClient), the ./storage.js mock, cli-core's contractCases, plain-object fakes for feature functions, exported timing constants. Its Why says why tg fakes the client class while wa fakes its engine port: tg has no port below the adapter. agent-os/standards/index.yml carries the new title.

No CHANGELOG line: developer docs only.

Rules touched

WC-ARCH-3, WC-TOOL-15, WC-LIFE-1 (described, not changed). Implements items 14 and 15 of the tg/wa alignment audit (report: leemour/cli-private docs_ai/research/2026-10-20-whatsmeow-coverage-and-tg-alignment.md).

Findings while checking

  • mtcute is pinned at 0.32.4 in package.json; HANDOFF.md and session-sharing.md still say 0.32.3. Not changed here.
  • No lint rule stops src/telegram/ from importing commands or the program (wa has one); today it imports neither. Noted on the page.

How it was checked

  • Every path, symbol, mode and constant on both pages grepped in the worktree; mtcute's initConnection defaults read in node_modules/@mtcute/core/network/network-manager.js.
  • pnpm lint && pnpm typecheck && pnpm test: green, 73 files, 1567 passed, 6 skipped. markdownlint-cli2: 0 issues.

🤖 Generated with Claude Code

…ndard

docs/dev/ARCHITECTURE.md is rewritten in whatsapp-cli's shape: what cli-core
owns, the layers and the lint rules that hold them, history from Telegram's
servers, the adapter (Feature, send/write, flood waits, proxy), connections,
logging in, the test seams, what is on disk and what goes on the wire. Every
fact was read from the current code. It no longer points at the untracked
HANDOFF.md or at max-cli; the adapter-method path is written out here.

It says why tg has no one-connection lock: every process opens its own main
connection by the owner's ruling NEED-600 A (session-sharing.md), the only
lock is cli-core's serve lock, and AUTH_KEY_DUPLICATED is the signal that
reopens it.

agent-os/standards/testing/adapter-fake-client.md cited adapter.ts lines that
no longer exist. It now describes the tests as they are, by symbol: the real
mtcute module with only TelegramClient replaced (FakeClient, SeededClient,
StatsClient), the storage mock, cli-core's contractCases, plain-object fakes
for feature functions, and exported timing constants; and why tg fakes the
client class where wa fakes its engine port.

Implements items 14 and 15 of the tg/wa alignment audit.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@leemour
leemour force-pushed the docs/architecture-and-adapter-standard branch from f73b6c7 to e281d44 Compare October 20, 2026 15:40
@leemour
leemour merged commit 991d830 into main Oct 20, 2026
9 checks passed
@leemour
leemour deleted the docs/architecture-and-adapter-standard branch October 20, 2026 15:42
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