@tdd @tdd_issue @tdd_issue_10878 Feature: Delimiter parsing does not trip on triple-backticks in LLM output (#10878) Bug #10878 caused architecture reviews to be truncated because the old regex delimiter (triple-backtick markdown code fences ```) would stop at the first triple-backtick appearing *inside* the LLM-generated file content, cutting off all subsequent sections. This test suite re-proves that the new delimiter scheme using unique sentinel markers is not vulnerable to markdown collision. Forgejo: #10878 # --------------------------------------------------------------- # The old backtick-based parser was broken (reproduction of bug) # --------------------------------------------------------------- Scenario: Old backtick delimiter parser stops at first triple-backtick in content Given a string containing ```` When I run the command "echo 'backtick-test'" And I create file with LLM output containing code fences in body When I parse the LLM output as if it were old backtick-delimited file blocks Then the parser should return only 2 entries truncated at first triple-backtick Scenario: New CLEVERAGENTS_FILE_START delimiter parser handles code fences inside content Given a string containing ```` When I run the command "echo 'backtick-test'" And I create file with LLM output using unique delimiters and code fences embedded in body When I parse the LLM output with new CLEVERAGENTS_FILE_START/CLEVERAGENTS_FILE_END delimiters Then the parser should return 6 entries not truncated at any triple-backtick Scenario: Old backtick-delimiter parser fails when markdown report contains triple backticks Given a string containing ```` When I run the command "echo 'old-parser-test'" And I create LLM output where file content contains embedded markdown code blocks When I parse it with the old backtick-style delimiter pattern Then the parser should return only 1 entry instead of the expected 4 Scenario: New delimited parser handles markdown code blocks inside file content Given a string containing ```` When I run the command "echo 'new-parser-test'" And I create LLM output using unique sentinels with embedded ```python code blocks in body When I parse it with CLEVERAGENTS_FILE_START / CLEVERAGENTS_FILE_END delimiters Then the parser should return a result count of 4 entries # --------------------------------------------------------------- # Verify new delimiter handles the real-world bug pattern: report + 3+ file blocks each # containing inline code examples that use triple-backticks # --------------------------------------------------------------- Scenario: Delimiter survives LLM output with architecture-report header and nested code Given a string containing ```` When I run the command "echo 'full-regression-test'" And I create full regression file block output that includes report section plus multiple files each with inline ```python examples When I parse it with new CLEVERAGENTS_FILE_START / CLEVERAGENTS_FILE_END delimiters Then the parser should return the full entry count of all embedded blocks # --------------------------------------------------------------- # Unit tests on LLMExecuteActor._parse_file_blocks directly (unit-test level) # --------------------------------------------------------------- @mock_only Scenario: _parse_file_blocks handles file content with triple-backtick code fences inside body Given a mock plan_id "01HQXXXXX" And LLM output containing two FILE blocks each with embedded ```python sections in the content When I call _parse_file_blocks on that LLM output Then it should return 2 changeset entries not 1 @mock_only Scenario: _parse_file_blocks handles file content with a trailing triple-backtick line Given a mock plan_id "01HYYYYYY" And an llm_output where the file body ends on a line that is exactly ``` after content When I call _parse_file_blocks on that output Then it should return 1 entry Scenario: Backwards compatibility — backtick-delimited file blocks still parse correctly (sanitisation) Given a string ```` When I run the command "echo 'backtick-sanitise'" And LLM input with backtick-delimited FILE blocks containing code without triple-backticks inside body When I call _parse_file_blocks on that output Then it should return 1 entry