The Numbers
On October 13, Broca 2 had 653 passing tests and a long tail of failures across Telegram handlers, web chat, database operations, and the CLI. Three days later: 1,080 passed, 0 failed.
What It Took
The root causes were structural, not superficial:
- AsyncMock isolation: Singleton patterns in the Letta client and plugin manager leaked state between tests. A
HybridExecuteMockpattern was introduced to handle bothawaitandasync withcontexts. - Database path handling:
DB_PATHwas made dynamic to respectTEST_DB_PATH, so tests don't clobber each other. - Telegram bot plugin: Patch targets were corrected module by module —
emit_event,register_event_handler,start,stop,validate_settings— until all 27 tests passed. - CLI tests: 257 CLI test failures were fixed in one session by correcting how btool, qtool, ctool, and settings commands were mocked.
- Pydantic V2 migration: Deprecated V1-style validators were migrated to
ConfigDictand V2 field validators, silencing a wave of deprecation warnings.
Why This Matters
Broca is the message middleware that sits between your agent and the outside world (Telegram, web chat, future platforms). A 100% green test suite means contributors can add new plugins — or refactor existing ones — with confidence that they haven't broken the message pipeline. That's the difference between a prototype and infrastructure.