tenseleyflow/loader / 89ffea4

Browse files

Tighten format study evidence

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
89ffea40939841efaf4d46297ad122084dc42382
Parents
c84cfd5
Tree
811977b

2 changed files

StatusFile+-
M src/loader/runtime/workflow.py 6 0
M tests/test_workflow.py 51 2
src/loader/runtime/workflow.pymodified
@@ -189,6 +189,7 @@ _ARTIFACT_SET_COMPLETION_HINTS = (
189189
 )
190190
 _CONTENT_EVIDENCE_HINTS = (
191191
     "content",
192
+    "format",
192193
     "cadence",
193194
     "depth",
194195
     "writing style",
@@ -1341,6 +1342,11 @@ def _todo_progress_score(item: str, tool_call: ToolCall) -> int:
13411342
     elif name in {"glob", "grep"}:
13421343
         if _todo_requires_content_level_evidence(text):
13431344
             return 0
1345
+        if _contains_any(text, _PARSE_STEP_HINTS) and not (
1346
+            _contains_any(text, _SEARCH_STEP_HINTS)
1347
+            or _contains_any(text, _READ_STEP_HINTS)
1348
+        ):
1349
+            return 0
13441350
         if not (
13451351
             _contains_any(text, _SEARCH_STEP_HINTS)
13461352
             or _contains_any(text, _READ_STEP_HINTS)
tests/test_workflow.pymodified
@@ -828,7 +828,7 @@ def test_advance_todos_from_tool_call_tracks_plan_progress() -> None:
828828
         in dod.completed_items
829829
     )
830830
 
831
-    assert advance_todos_from_tool_call(
831
+    assert not advance_todos_from_tool_call(
832832
         dod,
833833
         ToolCall(
834834
             id="glob-chapters",
@@ -838,7 +838,7 @@ def test_advance_todos_from_tool_call_tracks_plan_progress() -> None:
838838
     )
839839
     assert (
840840
         "List and read all HTML files in the chapters directory to extract chapter information"
841
-        in dod.completed_items
841
+        in dod.pending_items
842842
     )
843843
 
844844
     assert advance_todos_from_tool_call(
@@ -849,6 +849,19 @@ def test_advance_todos_from_tool_call_tracks_plan_progress() -> None:
849849
             arguments={"file_path": "/tmp/fortran/chapters/01-introduction.html"},
850850
         ),
851851
     )
852
+    assert (
853
+        "List and read all HTML files in the chapters directory to extract chapter information"
854
+        in dod.completed_items
855
+    )
856
+
857
+    assert advance_todos_from_tool_call(
858
+        dod,
859
+        ToolCall(
860
+            id="read-second-chapter",
861
+            name="read",
862
+            arguments={"file_path": "/tmp/fortran/chapters/02-setup.html"},
863
+        ),
864
+    )
852865
     assert "Parse chapter titles from each HTML file" in dod.completed_items
853866
 
854867
     assert advance_todos_from_tool_call(
@@ -1077,6 +1090,42 @@ def test_advance_todos_from_tool_call_does_not_complete_content_examination_from
10771090
     assert "Develop the main index.html file for the nginx guide" in dod.pending_items
10781091
 
10791092
 
1093
+def test_advance_todos_from_tool_call_does_not_complete_format_study_from_shallow_glob() -> None:
1094
+    dod = create_definition_of_done("Create a multi-file nginx guide.")
1095
+    sync_todos_to_definition_of_done(
1096
+        dod,
1097
+        [
1098
+            {
1099
+                "content": "First, examine the existing fortran guide structure to understand the format",
1100
+                "active_form": "Working on: First, examine the existing fortran guide structure to understand the format",
1101
+                "status": "pending",
1102
+            },
1103
+            {
1104
+                "content": "Create the main index.html file for nginx guide",
1105
+                "active_form": "Working on: Create the main index.html file for nginx guide",
1106
+                "status": "pending",
1107
+            },
1108
+        ],
1109
+    )
1110
+
1111
+    assert (
1112
+        advance_todos_from_tool_call(
1113
+            dod,
1114
+            ToolCall(
1115
+                id="glob-reference-root",
1116
+                name="glob",
1117
+                arguments={"path": "~/Loader/guides/fortran", "pattern": "**"},
1118
+            ),
1119
+        )
1120
+        is False
1121
+    )
1122
+    assert (
1123
+        "First, examine the existing fortran guide structure to understand the format"
1124
+        in dod.pending_items
1125
+    )
1126
+    assert "Create the main index.html file for nginx guide" in dod.pending_items
1127
+
1128
+
10801129
 def test_advance_todos_from_tool_call_does_not_complete_deep_guide_study_from_root_index_read() -> None:
10811130
     dod = create_definition_of_done("Create a multi-file nginx guide.")
10821131
     sync_todos_to_definition_of_done(