tenseleyflow/loader / 77e1893

Browse files

Trim early retry clutter

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
77e1893fde8e0daef6df15d69d6c5eeef768e686
Parents
024377f
Tree
e69fa9f

2 changed files

StatusFile+-
M src/loader/runtime/repair.py 24 1
M tests/test_repair.py 2 0
src/loader/runtime/repair.pymodified
@@ -257,7 +257,7 @@ class ResponseRepairer:
257257
     ) -> str:
258258
         if dod is not None and self._should_compact_empty_retry_message(dod):
259259
             compact_lines: list[str] = []
260
-            compact_lines.extend(self._planned_artifact_progress_lines(dod)[:2])
260
+            compact_lines.extend(self._compact_planned_artifact_lines(dod))
261261
             compact_lines.extend(self._payload_retry_lines(dod))
262262
             compact_lines.extend(
263263
                 self._next_step_resume_lines(
@@ -659,6 +659,29 @@ class ResponseRepairer:
659659
             lines.append("Remaining planned artifacts: " + preview)
660660
         return lines
661661
 
662
+    def _compact_planned_artifact_lines(self, dod: DefinitionOfDone) -> list[str]:
663
+        lines = self._planned_artifact_progress_lines(dod)
664
+        if self._confirmed_output_file_count(dod) < 2:
665
+            return lines[:1]
666
+        return lines[:2]
667
+
668
+    def _confirmed_output_file_count(self, dod: DefinitionOfDone) -> int:
669
+        return sum(
670
+            1
671
+            for target, expect_directory in collect_planned_artifact_targets(
672
+                dod,
673
+                project_root=self.context.project_root,
674
+                max_paths=12,
675
+            )
676
+            if not expect_directory
677
+            and planned_artifact_target_satisfied(
678
+                dod,
679
+                target=target,
680
+                expect_directory=False,
681
+                project_root=self.context.project_root,
682
+            )
683
+        )
684
+
662685
     def _next_step_resume_lines(
663686
         self,
664687
         dod: DefinitionOfDone,
tests/test_repair.pymodified
@@ -947,6 +947,7 @@ def test_empty_response_retry_prefers_pending_index_over_broad_directory_headlin
947947
         in decision.retry_message
948948
     )
949949
     assert "Next missing planned artifact: `chapters/`" not in decision.retry_message
950
+    assert "Remaining planned artifacts:" not in decision.retry_message
950951
     assert (
951952
         "Next observed output pattern under `chapters/`: `01-introduction.html`"
952953
         not in decision.retry_message
@@ -1018,6 +1019,7 @@ def test_empty_response_retry_uses_concrete_file_language_for_aggregate_chapter_
10181019
         "It is the next concrete output needed to continue `Create chapter files with content and structure`."
10191020
         in decision.retry_message
10201021
     )
1022
+    assert "Remaining planned artifacts:" not in decision.retry_message
10211023
     assert (
10221024
         "continue `Create chapter files with content and structure` by creating `01-introduction.html`."
10231025
         not in decision.retry_message