fix(chronology): respect state.toml status as override + plan-progression heuristic for old archive tracks
This commit is contained in:
@@ -200,7 +200,9 @@ def _parse_state_status(state_path: Path) -> str:
|
||||
if stripped.startswith("status") and "=" in stripped:
|
||||
parts = stripped.split("=", 1)
|
||||
if len(parts) == 2:
|
||||
return parts[1].strip().strip('"').strip("'").split("#")[0].strip()
|
||||
val: str = parts[1].split("#")[0].strip()
|
||||
val = val.strip('"').strip("'").strip()
|
||||
return val
|
||||
return ""
|
||||
|
||||
|
||||
@@ -251,7 +253,7 @@ def classify_status(
|
||||
"""Git-history evidence classifier returning (status, confidence, reason).
|
||||
|
||||
Evidence priority:
|
||||
1. Override signals (highest): TRACK_COMPLETION/TRACK_ABORTED reports, state.toml superseded
|
||||
1. Override signals (highest): state.toml status (human-set), TRACK_COMPLETION/TRACK_ABORTED reports
|
||||
2. Git commit evidence (medium): work-commit count
|
||||
3. Directory location (low): archive/ vs tracks/
|
||||
4. Fallback: Needs Review
|
||||
@@ -260,9 +262,15 @@ def classify_status(
|
||||
return ("Special", "high", "placeholder track")
|
||||
if "contingency" in current.lower():
|
||||
return ("Special", "high", "contingency track")
|
||||
# 1. Override signals
|
||||
# 1. Override signals — state.toml is human-set, trust it
|
||||
if state_status == "superseded":
|
||||
return ("Superseded", "high", "state.toml status=superseded")
|
||||
if state_status in ("completed", "complete", "shipped"):
|
||||
return ("Completed", "high", f"state.toml status={state_status}")
|
||||
if state_status == "abandoned":
|
||||
return ("Abandoned", "high", "state.toml status=abandoned")
|
||||
if state_status == "archived":
|
||||
return ("Completed", "high", "state.toml status=archived (treated as completed)")
|
||||
if has_abort_report or _has_report_matching(reports_dir, track_id, "TRACK_ABORTED_"):
|
||||
return ("Abandoned", "high", "abort report found")
|
||||
if _has_report_matching(reports_dir, track_id, "TRACK_COMPLETION_"):
|
||||
@@ -281,7 +289,18 @@ def classify_status(
|
||||
# 3. Directory location
|
||||
if is_archive:
|
||||
if work_commits == 0:
|
||||
return ("Abandoned", "low", "archived with 0 commits")
|
||||
# Check for plan-progression commits (old tracks: work was in src/, not the track folder)
|
||||
full_log: str = _git_log(folder_link, "--oneline")
|
||||
if folder_link.startswith("conductor/archive/"):
|
||||
original: str = folder_link.replace("conductor/archive/", "conductor/tracks/", 1)
|
||||
full_log = _git_log(original, "--oneline") + full_log
|
||||
plan_progression: int = sum(
|
||||
1 for line in full_log.splitlines()
|
||||
if "conductor(plan): Mark phase" in line or "conductor(plan): Mark task" in line
|
||||
)
|
||||
if plan_progression >= 3:
|
||||
return ("Completed", "low", f"archived with {plan_progression} plan-progression commits (work in src/)")
|
||||
return ("Abandoned", "low", "archived with 0 work commits")
|
||||
return ("Completed", "low", "archived but no completion report")
|
||||
# 4. Fallback
|
||||
return ("Needs Review", "none", "classifier inconclusive")
|
||||
|
||||
Reference in New Issue
Block a user