feat: bot↔backend version handshake + CI contract test (#93) #165
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/93-version-handshake"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The bot↔backend API contract was kept in sync purely by discipline — nothing verified at runtime or in CI that the two components actually match. A self-hoster upgrading one image but not the other got undefined behaviour (404s, silently missing fields) with no startup signal. This adds a version handshake and contract tests. Cross-component change, both sides in one PR.
Changes
Backend
webapp/backend/app/version.py— single source of truth:APP_VERSION = "3.4.0",BOT_CONTRACT_VERSION = 1, with the bump-on-breaking-change contract documented.main.pynow usesAPP_VERSION(was a stale hardcoded"0.10.0").GET /api/bot/meta(guarded byrequire_bot_auth) →{"app_version", "bot_contract_version"}.Bot
api_client.py:BotMetamodel +get_meta(), plus module-levelBOT_CONTRACT_VERSION/BOT_EXPECTED_APP_VERSION.main.py:run_version_handshake()runs once insetup_hookbefore cogs load:SystemExit(1)(refuses to start);Docs: contract-version bump rule documented in root
CLAUDE.mdandbot/CLAUDE.md.Tests (contract, no live services)
webapp/backend/tests/test_bot_meta.py— shape +bot_contract_version == 1.bot/tests/test_version_handshake.py— all five branches incl.SystemExitcode 1 on mismatch, + a constant-value guard.bot/tests/test_api_client.py—get_metasuccess/error.Verification
Full suites green on the test DB: backend 362 passed, bot 167 passed. Backend changes are ruff-clean.
Note:
BOT_EXPECTED_APP_VERSIONis a second place carrying the version string, but it only ever drives a non-fatal warning — drift there is low-risk by design.Closes #93
🤖 Generated with Claude Code