Skip to content

Client contract test; 1.x clients in the 2.0 plan (#277) - #309

Merged
antiv merged 1 commit into
mainfrom
client-contract-test
Oct 31, 2026
Merged

antiv merged 1 commit into
mainfrom
client-contract-test

Conversation

@antiv

@antiv antiv commented Oct 31, 2026

Copy link
Copy Markdown
Owner

Groundwork for 2.0 (#277). Before phase 1 lands, this pins down what 2.0 must not change for clients that already use a 1.x installation.

What changes

  • shared/test/test_client_contract.py (12 tests) runs the real auth server on an in-memory database, with a fake agent server. It makes the calls a live client makes and checks the status, the shape of the answer and what reaches the agent server:
    • OpenAI API with a personal access token:
      • GET /v1/models;
      • POST /v1/chat/completions, streamed and not streamed;
      • the conversation id header keeps the session;
      • an unknown token gets 401.
    • Widget public key:
      • /widget/api/chat streams the session event, then the reply;
      • the agent runs as widget_<key>_<user>;
      • an existing session is continued;
      • an unknown key gets 401.
    • The proxy with admin credentials:
      • creating a session and /run_sse on any user id, with Basic auth and with the /auth/token bearer;
      • /list-apps;
      • wrong credentials get 401, and nothing reaches the agent server.
  • documents/design/2.0-plan.md:
    • New section "1.x clients": with one workspace, none of these entry points changes for the client.
    • The upgrade path:
      • deploy from a release tag while 2.0 lands on main;
      • set MATE_SECRET_KEY on 1.6;
      • run 2.0 on a copy of the production database before 2.0.0.
    • "Done when" for phases 1 and 2 now includes this test passing unchanged.

Notes

  • The test resets the rate-limit and token-usage service singletons, which otherwise keep the database client of the first test. It passes with RATE_LIMIT_ENABLED on and off.
  • Docs: gen_docs.py --check OK, no guide drift.

Testing

python -m unittest discover -s shared/test -p "test_*.py": 1733 tests OK (1 skipped).

shared/test/test_client_contract.py makes the calls a live client makes, against
the real app: the OpenAI API with a personal access token, the widget, and
/run_sse through the proxy with admin credentials. Phases 1 and 2 of 2.0 are done
only when it passes unchanged.

The 2.0 plan says what 2.0 changes for those clients with one workspace (nothing
they have to change) and how to upgrade an installation that serves them: deploy
from a release tag while 2.0 lands on main, set MATE_SECRET_KEY on 1.6, and run
2.0 on a copy of the production database first.
@antiv antiv mentioned this pull request Oct 31, 2026
22 tasks done
@antiv
antiv merged commit 6d9fbff into main Oct 31, 2026
2 checks passed
@antiv
antiv deleted the client-contract-test branch October 31, 2026 10:26
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