Phase 5: iteration & polish (visualizations, goal history, smart tagging)

Final roadmap phase. No DB migration — it reads data already captured.

- Goal-evolution history: GET /discovery/profile/me/goal-history derives a
  per-goal timeline from the profile_revision snapshots (pure aggregator in
  app/services/profile_history.py).
- Smart tagging: POST /discovery/integration/suggest-foundation suggests which
  foundation a task builds toward + rationale/confidence (FoundationTagger,
  app/services/tagging.py). Suggestion only; the person confirms by posting the
  task mapping.
- Deeper goal-refinement: the reflect loop accepts an optional focus ("goals")
  that steers the coach toward sharpening goals — still mirror, not compass.
- Visualizations: visuals.html renders an Ikigai Venn and an Enneagram diagram
  (plain-language callouts, not the raw type number) plus the goal-evolution
  timeline; linked from profile.html.

Tests: 99 passing (added pure goal-history tests, goal-history + suggest
endpoint tests, reflect-focus passthrough; run in-container). README updated.

This completes the ImpactFlow Vision roadmap (Phases 1-5) on the Discovery side.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Joel Salmon
2026-06-16 21:37:33 -05:00
parent c4fc1cccd7
commit b9d7b0e22b
14 changed files with 798 additions and 9 deletions
+15 -2
View File
@@ -55,8 +55,10 @@ class FakeCoach:
def __init__(self, api_key=None, model=None):
pass
async def reflect(self, profile, history):
FakeCoach.calls.append({"profile": profile, "history": list(history)})
async def reflect(self, profile, history, focus=""):
FakeCoach.calls.append(
{"profile": profile, "history": list(history), "focus": focus}
)
return dict(FakeCoach.response)
@@ -180,6 +182,17 @@ async def test_empty_message_after_opener_returns_400(app_client):
assert r.status_code == 400
async def test_reflect_passes_focus_to_coach(app_client):
"""Phase 5: a goal-refinement focus reaches the coach."""
await _seed_profile()
await app_client.post(
"/discovery/profile/me/reflect",
headers=API_KEY,
json={"message": "let's sharpen my goals", "focus": "goals"},
)
assert FakeCoach.calls[-1]["focus"] == "goals"
async def test_reflect_requires_auth(app_client):
r = await app_client.post("/discovery/profile/me/reflect", json={})
assert r.status_code == 401