tenseleyflow/loader / e6ba8d6

Browse files

Prioritize unfinished edits on completion

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
e6ba8d662bb6b49d77a92c575008dc829f2d7ad1
Parents
7a4495a
Tree
c6ab7fc

1 changed file

StatusFile+-
M src/loader/runtime/task_completion.py 44 0
src/loader/runtime/task_completion.pymodified
@@ -16,6 +16,22 @@ from .verification_observations import (
1616
 )
1717
 
1818
 _ACTION_VERBS = ("create", "write", "make", "edit", "fix", "add", "delete", "run")
19
+_PENDING_MUTATION_HINTS = (
20
+    "create",
21
+    "develop",
22
+    "populate",
23
+    "build",
24
+    "update",
25
+    "edit",
26
+    "write",
27
+    "fix",
28
+    "modify",
29
+    "change",
30
+    "patch",
31
+    "replace",
32
+    "correct",
33
+)
34
+_PENDING_VERIFICATION_HINTS = ("verify", "validate", "test", "confirm")
1935
 _COMPLEX_INDICATORS = (
2036
     "set up a project",
2137
     "create a project",
@@ -859,6 +875,10 @@ def _build_follow_through_facts(
859875
         or has_planned_verification
860876
         or has_stale_verification
861877
     )
878
+    pending_items = _order_completion_pending_items(
879
+        pending_items,
880
+        has_recorded_work=has_recorded_work,
881
+    )
862882
     for evidence in dod.evidence:
863883
         if not evidence.passed:
864884
             continue
@@ -900,6 +920,30 @@ def _first_verification_command(dod: DefinitionOfDone) -> str | None:
900920
     return None
901921
 
902922
 
923
+def _order_completion_pending_items(
924
+    pending_items: list[str],
925
+    *,
926
+    has_recorded_work: bool,
927
+) -> list[str]:
928
+    """Prefer concrete unfinished work when assessing premature completion."""
929
+
930
+    if not has_recorded_work:
931
+        return pending_items
932
+    for item in pending_items:
933
+        if _pending_item_is_mutation_step(item):
934
+            return [item, *(candidate for candidate in pending_items if candidate != item)]
935
+    return pending_items
936
+
937
+
938
+def _pending_item_is_mutation_step(item: str) -> bool:
939
+    text = item.strip().lower()
940
+    if not text:
941
+        return False
942
+    if any(hint in text for hint in _PENDING_VERIFICATION_HINTS):
943
+        return False
944
+    return any(hint in text for hint in _PENDING_MUTATION_HINTS)
945
+
946
+
903947
 def _looks_like_verification_command(command: str) -> bool:
904948
     command_lower = command.lower()
905949
     return any(