refactor(src): Phase 10.2 batch 3 - project_manager + orchestrator_pm Result migration

project_manager.py (3 sites):
- get_all_tracks returns list[dict[str, Any]] where each dict now
  has an 'errors' field (list[ErrorInfo]) capturing per-track
  metadata recovery. The 3 SILENT_SWALLOW sites (state.from_dict,
  metadata.json, plan.md) now append to this list instead of
  silently passing.

orchestrator_pm.py (2 sites):
- get_track_history_summary returns Result[str]. The 2 SILENT_SWALLOW
  sites (metadata.json + spec.md reads) append to a scan_errors list
  that's threaded through the Result.

Tests updated to check result.ok and use result.data.
This commit is contained in:
ed
2026-06-17 22:33:57 -04:00
parent a7d8e2adfd
commit 89ce7ad770
3 changed files with 38 additions and 25 deletions
+13 -9
View File
@@ -37,12 +37,14 @@ class TestOrchestratorPMHistory(unittest.TestCase):
self.create_track(self.archive_dir, "track_001", "Initial Setup", "completed", "Setting up the project structure.")
self.create_track(self.tracks_dir, "track_002", "Feature A", "in_progress", "Implementing Feature A.")
summary = orchestrator_pm.get_track_history_summary()
self.assertIn("Initial Setup", summary)
self.assertIn("completed", summary)
self.assertIn("Setting up the project structure.", summary)
self.assertIn("Feature A", summary)
self.assertIn("in_progress", summary)
self.assertIn("Implementing Feature A.", summary)
self.assertTrue(summary.ok, f"get_track_history_summary failed: {summary.errors}")
body = summary.data
self.assertIn("Initial Setup", body)
self.assertIn("completed", body)
self.assertIn("Setting up the project structure.", body)
self.assertIn("Feature A", body)
self.assertIn("in_progress", body)
self.assertIn("Implementing Feature A.", body)
@patch('src.paths.get_archive_dir')
@patch('src.paths.get_tracks_dir')
@@ -54,9 +56,11 @@ class TestOrchestratorPMHistory(unittest.TestCase):
with open(track_path / "metadata.json", "w") as f:
json.dump({"title": "Missing Spec", "status": "pending"}, f)
summary = orchestrator_pm.get_track_history_summary()
self.assertIn("Missing Spec", summary)
self.assertIn("pending", summary)
self.assertIn("No overview available", summary)
self.assertTrue(summary.ok, f"get_track_history_summary failed: {summary.errors}")
body = summary.data
self.assertIn("Missing Spec", body)
self.assertIn("pending", body)
self.assertIn("No overview available", body)
@patch('src.orchestrator_pm.summarize.build_summary_markdown')
@patch('src.ai_client.send')