test: add failing tests for circular include detection in non-recursive mode (#553)#554
Open
Serhan-Asad wants to merge 2 commits intopromptdriven:mainfrom
Open
test: add failing tests for circular include detection in non-recursive mode (#553)#554Serhan-Asad wants to merge 2 commits intopromptdriven:mainfrom
Serhan-Asad wants to merge 2 commits intopromptdriven:mainfrom
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>
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