Skip to content

Remove the AI analysis feature - #3801

Merged
MaxGhenis merged 3 commits into
masterfrom
remove-ai-analysis
Aug 23, 2026
Merged

Remove the AI analysis feature#3801
MaxGhenis merged 3 commits into
masterfrom
remove-ai-analysis

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

Closes #3800.

Removes the AI analysis feature from API v1 rather than patching it. Nothing live calls it — policyengine-app-v2 has no references to /simulation-analysis, /tracer-analysis or /ai-prompts (only the archived v1 app did) — and the model it pinned (claude-sonnet-4-20250514) is retired (Models API returns 404). The feature will be rebuilt properly during the Axiom migration.

Removed

  • Routes: simulation_analysis_routes, tracer_analysis_routes, ai_prompt_routes and their registrations in api.py; the matching OpenAPI paths/schemas and migration-contract entries (migration_registry.py, docs/generated/migration_contracts.json).
  • Services: ai_analysis_service, ai_prompt_service, simulation_analysis_service, tracer_analysis_service; the ai_prompts/ and ai_templates/ packages; the ai-analysis runtime-cache family; the tracer-analysis payload validator.
  • The anthropic dependency (pyproject + lock) and every ANTHROPIC_API_KEY deployment hook: Cloud Run env/secret mapping, secret sync, App Engine app.yaml/export, the deploy-env validators, and the PR/Push workflow env. The GCP secret itself is untouched (manual cleanup whenever).
  • The tests, fixtures and snapshots that only covered the deleted code (including the SDK contract test from Pin anthropic below 1.0 and guard the SDK call contract #3799, which has nothing left to guard).

66 files, +26 / −2,840 (includes removing services/run_sync_utils.py, orphaned since May's Stage 7 refactors — no importers, no tests).

Deliberately kept (separate follow-ups)

  • The analysis table and its Analysis ORM model — dropping it is a schema change and the repo's rule is autogenerated Alembic revisions against a live MySQL, so it gets its own migration PR.
  • /calculate's household-trace storage (runtime_cache/household_traces.py, household_calculation_service.py) — its only consumer was tracer-analysis, so it's now dead weight per calculation, but it touches the most important endpoint and deserves its own review.

Verification

  • CI: all checks green; codecov project 85.16% → 85.48% (+0.32%), patch 100%.
  • tests/unit: 1,040 passed (only the pre-existing local-only test_gcp_logging.py collection artifact excluded); tests/contract: 36 passed; migration-artifact tests pass; import policyengine_api.asgi_factory, policyengine_api.migration_registry ok; ruff format/check clean.
  • git grep -i anthropic now hits only CHANGELOG.md, docs/migration/history/ and the changelog fragment.
  • Built by Sol from a written spec; reviewed and lock regenerated by Claude. Draft pending the maintainer's decision — merging deploys production.

🤖 Generated with Claude Code

MaxGhenis and others added 2 commits August 23, 2026 12:46
Nothing live calls the simulation-analysis, tracer-analysis or ai-prompts endpoints (policyengine-app-v2 has no references; only the archived v1 app did), and the model they pinned is retired. Remove the routes, services, prompts, cache family, validators, the Anthropic dependency and its deployment secret plumbing, and the migration-contract entries. The analysis table and the /calculate household-trace storage are left for separate follow-ups.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@codecov

codecov Bot commented Aug 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.48%. Comparing base (a2880ef) to head (e117906).
⚠️ Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3801      +/-   ##
==========================================
+ Coverage   85.16%   85.48%   +0.32%     
==========================================
  Files         110       95      -15     
  Lines        6309     5897     -412     
  Branches     1096     1030      -66     
==========================================
- Hits         5373     5041     -332     
+ Misses        630      559      -71     
+ Partials      306      297       -9     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Nothing has imported policyengine_api/services/run_sync_utils.py since
the report services stopped sharing it; it carried 44 uncovered
statements and no tests.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@MaxGhenis
MaxGhenis marked this pull request as ready for review August 23, 2026 13:13
@MaxGhenis
MaxGhenis merged commit 5bd3297 into master Aug 23, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AI analysis calls a retired model (claude-sonnet-4-20250514 → 404 not_found_error)

1 participant