tenseleyflow/loader / 9c5b609

Browse files

Keep broad content steps pending

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
9c5b6091f017b422b6c16c720b19bae2b3effd5d
Parents
7e3369e
Tree
060b985

2 changed files

StatusFile+-
M src/loader/runtime/workflow.py 32 0
M tests/test_workflow.py 35 0
src/loader/runtime/workflow.pymodified
@@ -1476,6 +1476,8 @@ def _todo_progress_score(item: str, tool_call: ToolCall) -> int:
14761476
             if "directory" in text and "mkdir" in command:
14771477
                 score += 2
14781478
     elif name in {"write", "edit", "patch"}:
1479
+        if _todo_describes_broad_content_generation_step(text, basename):
1480
+            return 0
14791481
         if _todo_describes_aggregate_mutation(text) and basename and basename not in text:
14801482
             return 0
14811483
         if _contains_any(text, _MUTATION_STEP_HINTS):
@@ -1509,6 +1511,7 @@ def _is_summary_artifact_name(name: str) -> bool:
15091511
 def _todo_describes_aggregate_mutation(text: str) -> bool:
15101512
     return (
15111513
         _contains_any(text, _AGGREGATE_TODO_HINTS)
1514
+        or _todo_describes_broad_content_generation_step(text, "")
15121515
         or _todo_mentions_plural_output_set(text)
15131516
     ) and _contains_any(
15141517
         text,
@@ -1516,6 +1519,35 @@ def _todo_describes_aggregate_mutation(text: str) -> bool:
15161519
     )
15171520
 
15181521
 
1522
+def _todo_describes_broad_content_generation_step(
1523
+    text: str,
1524
+    basename: str,
1525
+) -> bool:
1526
+    if basename and basename in text:
1527
+        return False
1528
+    if _TODO_FILE_CANDIDATE_PATTERN.search(text):
1529
+        return False
1530
+    if not _contains_any(text, _MUTATION_STEP_HINTS):
1531
+        return False
1532
+    if not _contains_any(text, _CONTENT_EVIDENCE_HINTS):
1533
+        return False
1534
+    return any(
1535
+        token in text
1536
+        for token in (
1537
+            "guide",
1538
+            "tutorial",
1539
+            "documentation",
1540
+            "docs",
1541
+            "manual",
1542
+            "website",
1543
+            "site",
1544
+            "content",
1545
+            "pattern",
1546
+            "structure",
1547
+        )
1548
+    )
1549
+
1550
+
15191551
 def todo_describes_aggregate_mutation(item: str) -> bool:
15201552
     """Return True when a todo describes a broad multi-artifact mutation step."""
15211553
 
tests/test_workflow.pymodified
@@ -1014,6 +1014,41 @@ def test_advance_todos_from_tool_call_keeps_plural_chapter_creation_step_pending
10141014
     assert "Create chapter files following the established pattern" in dod.pending_items
10151015
 
10161016
 
1017
+def test_advance_todos_from_tool_call_keeps_broad_guide_content_step_pending() -> None:
1018
+    dod = create_definition_of_done("Create a multi-file nginx guide.")
1019
+    sync_todos_to_definition_of_done(
1020
+        dod,
1021
+        [
1022
+            {
1023
+                "content": "Develop the nginx guide content following the established pattern",
1024
+                "active_form": "Working on: Develop the nginx guide content following the established pattern",
1025
+                "status": "pending",
1026
+            },
1027
+            {
1028
+                "content": "Ensure consistency in formatting, structure, and content approach",
1029
+                "active_form": "Working on: Ensure consistency in formatting, structure, and content approach",
1030
+                "status": "pending",
1031
+            },
1032
+        ],
1033
+    )
1034
+
1035
+    assert (
1036
+        advance_todos_from_tool_call(
1037
+            dod,
1038
+            ToolCall(
1039
+                id="write-index",
1040
+                name="write",
1041
+                arguments={
1042
+                    "file_path": "/tmp/nginx/index.html",
1043
+                    "content": "<html></html>",
1044
+                },
1045
+            ),
1046
+        )
1047
+        is False
1048
+    )
1049
+    assert "Develop the nginx guide content following the established pattern" in dod.pending_items
1050
+
1051
+
10171052
 def test_advance_todos_from_tool_call_tracks_bash_directory_creation_progress() -> None:
10181053
     dod = create_definition_of_done("Create a multi-file nginx guide.")
10191054
     sync_todos_to_definition_of_done(