feat: backend API test harness — 36 tests across 6 trust boundaries#141
Open
MichaelCordner wants to merge 1 commit intomainfrom
Open
feat: backend API test harness — 36 tests across 6 trust boundaries#141MichaelCordner wants to merge 1 commit intomainfrom
MichaelCordner wants to merge 1 commit intomainfrom
Conversation
Adds a pytest-based test harness that verifies Jentic Mini's API contracts at the HTTP boundary. Uses a real temp SQLite DB with real Alembic migrations — no mocking of the database or vault. Test files organized by trust boundary: - test_health_and_meta: /health and /version contract shapes - test_auth_boundary: 401/403 perimeter, agent vs human session - test_policy_engine: _check_policy pure function + system safety rules - test_credential_vault: write-only invariant (values never returned) - test_toolkit_lifecycle: CRUD, key management, credential counts (#60) - test_broker_contracts: dot-in-host routing, error responses Infrastructure: - tests/conftest.py: temp DB, minimal test lifespan, auth fixtures - pytest + pytest-asyncio added to requirements.txt - ci-backend.yml: runs on src/tests/alembic changes, path-filtered 36 tests, 0.63 seconds, zero network calls. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the first backend test suite for Jentic Mini — a pytest-based test harness that verifies the API's trust boundaries at the HTTP level.
Testing strategy: harness engineering
This is not a traditional unit test suite. Jentic Mini is a harness — it constrains AI agents by injecting credentials they never see, enforcing policies they can't bypass, and tracing every API call they make. The tests verify that the harness itself is trustworthy.
The approach follows harness engineering principles:
What's covered (36 tests, 6 files)
What's NOT yet covered
This is a starting point. The following trust boundaries need tests in follow-up PRs:
Infrastructure
How to run
36 tests, 0.63 seconds, zero network calls.
Test plan