test(core): regression guard for long relation_type values (#721)#770
test(core): regression guard for long relation_type values (#721)#770phernandez merged 2 commits intomainfrom
Conversation
Adds an integration test that exercises the failure mode reported in #721: a markdown bullet with >200 chars of prose preceding an inline `[[wikilink]]` gets parsed as a relation whose `relation_type` is the entire prose. With the historical `MaxLen(200)` constraint on `RelationType`, the response model would reject this on re-index, breaking edit_note for any note matching that pattern. Commit 01cbad1 removed the cap. This test locks the fix in so a future contributor reintroducing `MaxLen` on `RelationType` will see the test fail before shipping. Closes #721 Signed-off-by: phernandez <paul@basicmachines.co>
|
Claude finished @phernandez's task in 1m 23s —— View job Code Review
Summary: Clean, well-scoped regression guard. The module docstring is excellent — it explains the historical bug, the fix commit, and what's explicitly out of scope. The test follows project conventions and will catch any reintroduction of Team Checklist
Minor observations1. Assertion specificity ( assert "Edited note" in edit_result.content[0].textOther tests (e.g., assert "Edited note (append)" in edit_result.content[0].text2. No write_text = write_result.content[0].textOther integration tests first assert 3. No read-back verification (optional, not blocking) The test proves VerdictApprove. The core regression guard is correct and sufficient. Observations 1 and 2 are cosmetic nits — either address them here or leave them; neither affects correctness or the guard's purpose. |
Address review nits on PR #770: - Match the precise edit_note success string ("Edited note (append)") rather than the prefix, mirroring other edit_note integration tests. - Add len(content) == 1 guards before indexing, consistent with surrounding integration tests. Signed-off-by: phernandez <paul@basicmachines.co>
|
Claude finished @phernandez's task in 1m 8s —— View job Code Review
Summary: The fixup commit ( What changed in the fixup commit
Both indexing sites are now guarded, and the edit assertion matches the specificity used in other Schema verification
RelationType = Annotated[str, MinLen(1)]
# No MaxLen - matches DB Text column which has no length restrictionNo Team Checklist
VerdictApprove. All previous nits resolved. The regression guard is correct, the |
Summary
edit_notefailing on notes with >200 chars of prose preceding an inline[[wikilink]]— the parser extracts that prose asrelation_type, which then violated theMaxLen(200)constraint onRelationTypein the response model.main.MaxLenonRelationType, the test fails immediately.Why test-only
The original symptom (validation error → poisoned note) is fixed. The reporter's secondary suggestion — a
parse_relation()heuristic to fall back tolinks_towhen prose-before-link looks like a sentence — is a knowledge-graph quality improvement, not a correctness fix, and is intentionally out of scope here.Test plan
pytest test-int/mcp/test_long_relation_type_integration.py --no-cov— passesRelationType = Annotated[str, MinLen(1)]inschemas/base.py:181(no MaxLen)ruff checkcleanCloses #721
🤖 Generated with Claude Code