PR Invariant Checklist
Every PR must pass this checklist before requesting review. These are not guidelines, they are contracts.
Pre-PR Checklist
-
make typecheckpasses (mypy --strict with zero errors) -
make lintpasses (ruff check with zero errors) -
make format-checkpasses (code is formatted) -
make testpasses (all tests pass, >=80% coverage) - Pre-commit hooks installed and passing
Code Quality Invariants
I1, Dependency Direction
- No circular imports (checked by CI)
-
rag_axis.coreimports only fromaiprimsand stdlib - No other
rag_axis.*subpackages imported by core
I2, Error Taxonomy
- No bare
Exceptionraises anywhere - Every error type is in the error taxonomy (extends
AiprimsErroror subclasses) - Every error carries
message,context, andrun_id
I3, Return Types
- No pipeline functions return
None - Optional results use typed unions (e.g.,
Result | ErrorType)
I4, Immutability
- All dataclasses crossing stage boundaries are
frozen=True - Every frozen dataclass has a test asserting mutation raises
FrozenInstanceError
I5, Adapter Tests
- Every adapter reference implementation has an integration test
- Integration tests can run against local/mocked providers
I6, Server Resilience
- Server can start with no external services available
-
/healthendpoint returns degraded status (not crashed)
I7, Type Coverage
-
mypy --strictpasses on all files inrag_axis.coreandrag_axis.adapters - No
Anytypes in core or adapters (checked by mypy)
I8, Structured Logging
- All log lines are structured JSON via
aiprims.StructuredLogger - No f-string log lines anywhere (
grep -r 'logging.*f"' rag_axisreturns nothing)
I9, Evaluation Default
-
benchis enabled by default in server config - Disabling bench requires explicit config
- Startup emits
EvaluationNotRunningWarningif bench is disabled
I10, Documentation
- Public functions have docstrings
- ADRs updated if architectural decisions were made
- CHANGELOG.md updated if user-facing changes
Testing Requirements
- New code has unit tests
- Critical paths have integration tests
- Edge cases are tested (empty retrieval, truncation, version mismatch, etc.)
- Error paths are tested (every custom error type raised somewhere)
Before Requesting Review
- Branch is up-to-date with main
- All CI checks are passing
- This checklist is complete
- PR description explains what/why, not just how
Reviewer Checklist
- All invariants verified
- Test coverage is adequate
- No new tech debt introduced
- Documentation is clear