Fix missing analysis continuity fallback (#491)
Co-authored-by: jmservera <jmservera@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Juan Manuel Servera committed
Jun 15, 2026 at 19:23 UTC
252e9e7dad4543991c18c13c25d34498a7c65ca3
2 files changed
+22
-1
scripts/analyze_fallback.py
+1
-1
@@ -614,7 +614,7 @@ def _resolve_existing_path(configured: str | None, fallback: Path) -> Path:
614
for candidate in candidates:
615
if candidate.exists():
616
return candidate
617
- return candidates[0] if candidates else fallback
617
+ return fallback
618
619
620
def resolve_analysis_context_paths() -> tuple[Path, Path, Path]:
tests/test_analyze_fallback.py
+21
@@ -186,6 +186,27 @@ class AnalyzeFallbackTests(unittest.TestCase):
186
self.assertNotIn("{{SKILLS}}", prompt)
187
self.assertNotIn("{{CONTINUITY}}", prompt)
188
189
+ def test_resolve_analysis_context_paths_prefers_squad_fallback_for_missing_relative_paths(self) -> None:
190
+ tests_root = Path(__file__).resolve().parent
191
+ with tempfile.TemporaryDirectory(dir=tests_root) as tmpdir:
192
+ base = Path(tmpdir)
193
+ (base / "squadscope.topic.yml").write_text(
194
+ "topic:\n"
195
+ " id: ai-ml\n"
196
+ "learning:\n"
197
+ " wisdom_file: topics/ai-ml/wisdom.md\n"
198
+ " skills_dir: topics/ai-ml/skills/\n"
199
+ " continuity_file: topics/ai-ml/continuity.md\n",
200
+ encoding="utf-8",
201
+ )
202
+
203
+ with mock.patch.object(analyze_fallback, "ROOT", base):
204
+ wisdom_path, skills_path, continuity_path = analyze_fallback.resolve_analysis_context_paths()
205
+
206
+ self.assertEqual(wisdom_path, base / ".squad" / "topics" / "ai-ml" / "wisdom.md")
207
+ self.assertEqual(skills_path, base / ".squad" / "topics" / "ai-ml" / "skills")
208
+ self.assertEqual(continuity_path, base / ".squad" / "topics" / "ai-ml" / "continuity.md")
209
+
210
def test_render_prompt_injects_historical_context(self) -> None:
211
tests_root = Path(__file__).resolve().parent
212
with tempfile.TemporaryDirectory(dir=tests_root) as tmpdir: