feat(qa): rule-based consistency checker for MVP-β #14#40
Merged
Conversation
- M1: add project existence check (404) in QA endpoint - M2: batch-fetch KGNode IDs in possession check (eliminate N+1) - M3/M4: lower confidence to 0.6 when death/resolved location absent - L1: rename _loads to _safe_loads for codebase consistency - L2: move func import to module top level - Add timeline conflict tests (2 tests) - Add plot_thread conflict tests (2 tests) - Fix line length and input validation (Pydantic Field) All 16 tests passing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
683d841 to
a38cb3a
Compare
DankerMu
commented
Feb 21, 2026
Owner
Author
DankerMu
left a comment
There was a problem hiding this comment.
Agent Team Review - PASS (96/100)
Previous Findings Verification
| ID | Finding | Status |
|---|---|---|
| M1 | No project existence check | ✅ FIXED |
| M2 | N+1 queries in _check_possession | ✅ FIXED |
| M3 | confidence=1.0 misleading (character_status) | ✅ FIXED |
| M4 | confidence=1.0 misleading (plot_thread) | ✅ FIXED |
| L1 | _loads naming inconsistency | ✅ FIXED |
| L2 | Inline func import | ✅ FIXED |
| CI | Line too long | ✅ FIXED |
| CI | Merge commit | ✅ FIXED |
All 8 previous findings: FIXED.
Highlights
- Batch-fetch pattern cleanly eliminates N+1
- Confidence 1.0 vs 0.6 accurately communicates certainty
- 16 tests covering all 5 check types with positive/negative cases
- Pydantic Field validation prevents nonsensical inputs
Minor (non-blocking)
- Missing 404 test for invalid project_id
- KGProposal imported inside test functions instead of module top
Recommendation: Merge.
Owner
Author
Agent Team Review - PASS (96/100)All 8 previous findings verified as FIXED. 16 tests passing. CI green. |
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
Changes
backend/app/api/qa.py: QA API endpointbackend/app/services/consistency.py: Rule-based consistency checker (427 lines)backend/tests/test_consistency.py: 12 comprehensive tests (318 lines)backend/app/api/schemas.py: ConsistencyResult schemabackend/app/main.py: Register QA routerfrontend/src/lib/types.ts: TypeScript types for consistency resultsTest Plan
Closes #14
🤖 Generated with Claude Code