Skip to content

Tests from Main to Develop#29

Closed
jeffmaki wants to merge 21 commits into
developfrom
main
Closed

Tests from Main to Develop#29
jeffmaki wants to merge 21 commits into
developfrom
main

Conversation

@jeffmaki

@jeffmaki jeffmaki commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Merge tests from main to develop

Merged the test suite from main into develop, along with supporting maintenance changes.

Highlights:

  • Added broad unit and integration coverage for config, JWT, security, JSON schema validation, users/teams/workspaces schemas, and repository behavior.
  • Reworked test infrastructure with shared fakes, HTTP mocks, factories, and updated fixtures for real in-process FastAPI integration tests.
  • Added integration coverage for health, proxy, teams, users, and workspaces endpoints.
  • Updated CI and tooling: consolidated workflow jobs, added pyright to CI, refreshed action versions, updated black/isort/pre-commit settings, and documented test/type-check/format workflows in the README.
  • Added repository guidance docs in CLAUDE.md and tests/README.md.
  • Made a few functional hardening changes in app code, including safer client initialization checks, schema fetch caching/refetch logic, workspace/quest validation guards, Sentry release tagging, and enum migration cleanup.
  • Added Pyright suppressions/comments where SQLModel typing caused false positives.

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fd4b45c8-852f-4e84-8f42-d2baf989fb98

📥 Commits

Reviewing files that changed from the base of the PR and between 09d1ed5 and c6600c3.

📒 Files selected for processing (42)
  • .github/workflows/ci.yml
  • .pre-commit-config.yaml
  • .vscode/settings.json
  • CLAUDE.md
  • README.md
  • alembic_osm/versions/9221408912dd_add_user_role_table.py
  • api/core/config.py
  • api/core/json_schema.py
  • api/core/jwt.py
  • api/core/security.py
  • api/main.py
  • api/src/teams/repository.py
  • api/src/teams/routes.py
  • api/src/teams/schemas.py
  • api/src/users/repository.py
  • api/src/users/routes.py
  • api/src/users/schemas.py
  • api/src/workspaces/repository.py
  • api/src/workspaces/routes.py
  • api/src/workspaces/schemas.py
  • pyproject.toml
  • tests/README.md
  • tests/conftest.py
  • tests/integration/test_health.py
  • tests/integration/test_proxy.py
  • tests/integration/test_teams.py
  • tests/integration/test_users.py
  • tests/integration/test_workspaces.py
  • tests/support/__init__.py
  • tests/support/factories.py
  • tests/support/fakes.py
  • tests/support/http.py
  • tests/test_main.py
  • tests/unit/test_config.py
  • tests/unit/test_json_schema.py
  • tests/unit/test_jwt.py
  • tests/unit/test_security.py
  • tests/unit/test_teams_schemas.py
  • tests/unit/test_user_info.py
  • tests/unit/test_users_schemas.py
  • tests/unit/test_workspace_repository.py
  • tests/unit/test_workspaces_schemas.py

📝 Walkthrough

Walkthrough

This PR overhauls CI/tooling configuration, simplifies an Alembic migration to unconditional DDL, adds null-safety guards for shared HTTP/TDEI clients and entity IDs across security, json_schema, main, teams, users, and workspaces modules, and introduces a substantial new test infrastructure (FakeSession, factories, streaming HTTP mocks, rewritten conftest) plus extensive unit/integration test suites and documentation.

Changes

Test infra, null-safety hardening, and tooling updates

Layer / File(s) Summary
CI, pre-commit, editor, and pyproject tooling
.github/workflows/ci.yml, .pre-commit-config.yaml, .vscode/settings.json, pyproject.toml
Consolidates CI into a single job with concurrency control, updated action versions, and a pyright step without Postgres wiring; bumps black hook version; expands VS Code Python formatting; adds pytest/isort config.
Documentation
CLAUDE.md, README.md, tests/README.md
Adds permission/testing/Pyright/Alembic guidance in CLAUDE.md, testing/tooling instructions in README, and the test suite/fixture contract in tests/README.
Alembic migration simplification
alembic_osm/versions/9221408912dd_add_user_role_table.py
Replaces conditional/inspection-based migration logic with unconditional DDL for the user role table and enum.
Client null-safety guards
api/core/json_schema.py, api/core/security.py, api/main.py, api/src/workspaces/repository.py
Adds _require_http_client()/_require_osm_client() raising 503 when clients are uninitialized, refactors schema fetch caching, and tightens _validate_token_uncached and resolve_quest_def client handling.
Entity ID assertions and route/schema hardening
api/src/teams/*, api/src/users/*, api/src/workspaces/*
Adds id-not-None assertions before DTO construction, Pyright suppression comments, @test: documentation, and a JSON quest-definition required-field 400 guard.
Test support infrastructure
tests/support/*, tests/conftest.py
Adds FakeSession/FakeResult, deterministic factories, StreamingMockTransport, and rewrites conftest fixtures (app, client, login, task_session, osm_session).
Integration test suites
tests/integration/*
Adds tests for health, OSM proxy, teams, users, and workspaces routes exercising the new fixture stack.
Unit test suites
tests/unit/*, tests/test_main.py
Adds unit tests for config, jwt, json_schema, security, schemas, and repository behavior; removes the old health test.

Estimated code review effort: 4 (Complex) | ~75 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Route
  participant RequireClientHelper
  participant SharedClient
  Route->>RequireClientHelper: _require_http_client() / _require_osm_client()
  RequireClientHelper->>SharedClient: check initialized
  SharedClient-->>RequireClientHelper: None
  RequireClientHelper-->>Route: raise HTTPException 503
Loading
sequenceDiagram
  participant Test
  participant Client
  participant FastAPIApp
  participant FakeSession
  Test->>Client: HTTP request
  Client->>FastAPIApp: ASGI call
  FastAPIApp->>FakeSession: query via overridden get_task_session/get_osm_session
  FakeSession-->>FastAPIApp: queued FakeResult
  FastAPIApp-->>Client: response
  Client-->>Test: assert status/body
Loading

Possibly related PRs

Poem

A rabbit hopped through tests anew,
FakeSessions queued, and mocks that flew 🐇
No more 503 surprise—
just guarded clients, safe and wise.
CI now runs in one tidy hop,
Pyright checks before we stop! 🥕


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@jeffmaki jeffmaki requested a review from MashB July 7, 2026 20:00
@jeffmaki jeffmaki marked this pull request as ready for review July 7, 2026 20:00
@jeffmaki jeffmaki closed this Jul 7, 2026
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.

2 participants