test: add failing tests for circular include detection in non-recursive mode (#553)#554
Merged
gltanaka merged 3 commits intopromptdriven:mainfrom Feb 24, 2026
Merged
Conversation
…ve mode (promptdriven#553) Add 6 unit tests and 6 E2E tests that detect the bug where circular <include> tags cause an infinite loop in the default (non-recursive) preprocess path. The _seen set is only populated inside `if recursive:` blocks, making cycle detection dead code in non-recursive mode. Unit tests (test_circular_includes.py): - 4 circular tests that fail with timeout (infinite loop) - 2 regression guards that pass (non-circular includes still work) E2E tests (test_e2e_issue_553_circular_includes_non_recursive.py): - 4 subprocess-based CLI tests that fail with timeout - 2 regression guards that pass All circular tests are verified to fail on current code and will pass once the fix is implemented. Refs promptdriven#553
… path (promptdriven#553) Populate _seen tracking in the non-recursive convergence loops of process_include_tags and process_backtick_includes. Previously _seen was only updated inside `if recursive:` blocks, making the cycle check dead code in non-recursive (default) mode and causing infinite loops. Also clean up unused _timeout/signal/contextlib imports in tests and make E2E output file assertion unconditional. Fixes promptdriven#553 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds regression tests for Issue #553 (circular <include> tags causing an infinite loop in the default non-recursive preprocess path) and updates the preprocessor to attempt cycle detection in the non-recursive convergence loops.
Changes:
- Add new unit test coverage for circular includes in non-recursive mode.
- Add new subprocess-based CLI E2E coverage for Issue #553 scenarios (mutual/self/3-file cycles; XML and backtick includes).
- Modify
pdd/preprocess.pyto detect circular includes during non-recursive convergence.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
pdd/preprocess.py |
Adds tracking-based cycle detection in the non-recursive convergence loops for XML and backtick includes. |
tests/test_circular_includes.py |
Adds a new TestCircularIncludesNonRecursive test class for Issue #553 coverage. |
tests/test_e2e_issue_553_circular_includes_non_recursive.py |
Adds subprocess-based CLI tests that assert non-recursive circular includes fail fast instead of hanging. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…eplace pytest-timeout markers with signal-based timeouts - E2E tests now set PYTHONPATH to project root, matching other E2E tests in the repo (prevents ModuleNotFoundError in CI) - Replace @pytest.mark.timeout(10) with @_with_timeout(10) using SIGALRM since pytest-timeout is not a declared dependency Co-Authored-By: Claude Opus 4.6 <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 failing tests that detect the bug reported in #553 — circular
<include>tags cause an infinite loop in the default (non-recursive) preprocess path.Test Files
tests/test_circular_includes.py(6 new tests inTestCircularIncludesNonRecursiveclass)tests/test_e2e_issue_553_circular_includes_non_recursive.py(6 subprocess-based CLI tests)What This PR Contains
Root Cause
_seenset for cycle detection is only populated insideif recursive:blocks atpreprocess.py:272-274andpreprocess.py:179-181. In the default non-recursive path,_seenstays empty, so the cycle check at line 226 is dead code. The convergence loop (while prev_text != current_text) oscillates forever with circular includes.Next Steps
_seentracking into the non-recursive convergence loopFixes #553
Generated by PDD agentic bug workflow