fix: report circular includes as errors instead of orphaned files (#251)#257
Merged
raifdmueller merged 1 commit intodocToolchain:mainfrom Feb 7, 2026
Conversation
raifdmueller
commented
Feb 7, 2026
Collaborator
Author
raifdmueller
left a comment
There was a problem hiding this comment.
Code Review
Overall: Good, one minor note
Cycle Detection
DFS algorithm with visited/in_stack sets is correct. Properly detects both mutual (A↔B) and self-referencing cycles.
Architecture
- Circular errors stored on
StructureIndex._circular_include_errors- initialized in__init__, cleared inclear() - Validation service excludes circular files from orphaned detection - prevents the confusing "orphaned file" message
- Also catches
CircularIncludeErrorduring parsing as fallback
Minor Note
index._circular_include_errors is set externally from mcp_app.py (breaking encapsulation). Consider adding a setter or passing it through build_from_documents() in a future refactor. Not blocking.
Tests
5 tests covering circular A↔B, self-reference, CLI, error format, and not-orphaned check.
Version Conflict
All 3 PRs bump to 0.4.25. Will need rebase after earlier merges.
Reviewed-by: R{AI}f D. Müller (AI-assisted review)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
f508f7e to
4479c09
Compare
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
circular_includeerrors in validation instead of misleadingorphaned_filewarningsChanges
src/dacli/mcp_app.py: Added cycle detection using DFS in_build_index(). Also catchesCircularIncludeErrorduring parsing as fallback.src/dacli/services/validation_service.py: Reports stored circular include errors as"circular_include"type errors and excludes involved files from orphaned file detection.src/dacli/structure_index.py: Added_circular_include_errorslist to store detected cycles.tests/test_circular_include_validation_251.py: 5 new tests covering mutual circular includes, self-includes, CLI output, and non-orphan assertion.Test plan
circular_includeerrors, notorphaned_filewarningscircular_includeerrorsvalidatecommand showscircular_includewith exit code 4Fixes #251
🤖 Generated with Claude Code