Skip to content

Check endpoints: script rewrite + CI workflow#15

Closed
nstillman-te wants to merge 29 commits intomasterfrom
feature/check-endpoints-ci
Closed

Check endpoints: script rewrite + CI workflow#15
nstillman-te wants to merge 29 commits intomasterfrom
feature/check-endpoints-ci

Conversation

@nstillman-te
Copy link
Copy Markdown

@nstillman-te nstillman-te commented Feb 26, 2026

Summary

Refactors the existing check-endpoints.py script into a CI-friendly spec-vs-implementation checker, and adds a workflow that keeps a single auto-updated issue listing missing API endpoints and query params (tied to issue 6 / rolling CI). Also adds a small dev-only test suite for the checker.


check-endpoints.py

  • The original script compared only paths, so different HTTP methods on the same path in the spec were treated as one, which could miss real gaps (e.g. GET vs POST on the same URL).
  • The refactored script:
    • Uses AST to discover implemented (path, method) pairs and their query params from berserk/clients.
    • Compares those to the Lichess OpenAPI spec on a (path, method) basis.
    • Produces either a human-readable list or, with --json, a JSON report with:
      • missing_endpoints (spec (path, method) pairs not implemented by the client),
      • missing_params (query params present in the spec but not passed by the client, including the client method location).
    • Skips certain spec paths via FALSE_POSITIVES: /oauth (intentionally not implemented in the client), and variant/tablebase-style paths like /standard, /atomic, /antichess that are effectively covered but don’t map cleanly in the checker’s spec-vs-AST logic.

CI workflow (.github/workflows/check-endpoints.yml)

  • Runs weekly and on demand.
  • Fetches the latest OpenAPI spec from lichess.org, runs check-endpoints.py, and:
    • Updates a single issue titled Spec vs implementation: missing endpoints or params (auto-updated) with a rendered list of missing endpoints/params, or
    • Replaces the body with a “nothing missing” message and closes the issue when everything is implemented.
  • Logs the full issue body to the Actions log on each run.

Dev tests (dev_tests/)

  • Adds dev_tests/test_check_endpoints.py plus fixtures under dev_tests/fixtures/ (not run by make test; run manually with uv run pytest dev_tests/test_check_endpoints.py -v).
  • Tests the helper functions, JSON shape, and the main discovery paths by running the script against small fixture specs and fake client modules (including f-strings, request(...), path= keyword, params via a params variable, and false-positive paths).

@nstillman-te nstillman-te deleted the feature/check-endpoints-ci branch February 27, 2026 19:48
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