[Ops] Bot↔backend version handshake and CI contract test #93
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Context
The API contract between
webapp/backend/app/routers/bot.pyandbot/questboard_bot/api_client.pyis kept in sync purely by discipline (the "same commit" rule in CLAUDE.md). Nothing at runtime or in CI verifies the pair actually match.Current behavior
A self-hoster upgrading one image but not the other gets undefined behavior — 404s on renamed routes, silently missing fields — with no startup warning. CI never exercises the two components against each other, so a one-sided route rename merges green.
Fix / Spec
GET /api/bot/metatowebapp/backend/app/routers/bot.pyreturning{"app_version": "<semver>", "bot_contract_version": <int>}. The contract version is a manually bumped integer constant; document in both the rootCLAUDE.mdand the bot's docs that it must be bumped with any breaking change to the bot API, as part of the existing keep-in-sync rule.api_client:404from an older backend without the endpoint → warning ("backend predates version handshake"), proceed (compat).api_clientand extracts every(HTTP method, path template)it calls (via inspection of its request helpers or a small registry added to the client),.forgejo/workflows/ci.yml.Acceptance criteria
GET /api/bot/metarequires the sameX-Bot-Keyauth as the rest of the bot router (or is explicitly public — decide and document).References
webapp/backend/app/routers/bot.pybot/questboard_bot/api_client.py.forgejo/workflows/ci.ymlFiled from the July 2026 full-project review.