Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ POLICYENGINE_DB_INSTANCE_CONNECTION_NAME=policyengine-api:us-central1:policyengi
# Github Microdata Token
POLICYENGINE_GITHUB_MICRODATA_AUTH_TOKEN=policyengine_github_token

# API key for Anthropic
ANTHROPIC_API_KEY=policyengine_anthropic_api_key

# API Key for OpenAI
OPENAI_API_KEY=policyengine_openai_api_key

Expand Down
2 changes: 0 additions & 2 deletions .github/scripts/cloud_run_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ cloud_run_set_defaults() {
CLOUD_RUN_STARTUP_PROBE="${CLOUD_RUN_STARTUP_PROBE:-httpGet.path=/readiness-check,httpGet.port=${CLOUD_RUN_PORT},initialDelaySeconds=240,periodSeconds=10,failureThreshold=24,timeoutSeconds=5}"
CLOUD_RUN_POLICYENGINE_DB_PASSWORD_SECRET="${CLOUD_RUN_POLICYENGINE_DB_PASSWORD_SECRET:-policyengine-api-prod-db-password:latest}"
CLOUD_RUN_GITHUB_MICRODATA_TOKEN_SECRET="${CLOUD_RUN_GITHUB_MICRODATA_TOKEN_SECRET:-policyengine-api-prod-github-microdata-token:latest}"
CLOUD_RUN_ANTHROPIC_API_KEY_SECRET="${CLOUD_RUN_ANTHROPIC_API_KEY_SECRET:-policyengine-api-prod-anthropic-api-key:latest}"
CLOUD_RUN_OPENAI_API_KEY_SECRET="${CLOUD_RUN_OPENAI_API_KEY_SECRET:-policyengine-api-prod-openai-api-key:latest}"
CLOUD_RUN_HUGGING_FACE_TOKEN_SECRET="${CLOUD_RUN_HUGGING_FACE_TOKEN_SECRET:-policyengine-api-prod-hugging-face-token:latest}"
CLOUD_RUN_RUNTIME_CACHE_URL_SECRET="${CLOUD_RUN_RUNTIME_CACHE_URL_SECRET:-policyengine-api-prod-runtime-cache-url:latest}"
Expand Down Expand Up @@ -75,7 +74,6 @@ cloud_run_set_defaults() {
export CLOUD_RUN_STARTUP_PROBE
export CLOUD_RUN_POLICYENGINE_DB_PASSWORD_SECRET
export CLOUD_RUN_GITHUB_MICRODATA_TOKEN_SECRET
export CLOUD_RUN_ANTHROPIC_API_KEY_SECRET
export CLOUD_RUN_OPENAI_API_KEY_SECRET
export CLOUD_RUN_HUGGING_FACE_TOKEN_SECRET
export CLOUD_RUN_RUNTIME_CACHE_URL_SECRET
Expand Down
1 change: 0 additions & 1 deletion .github/scripts/deploy_cloud_run_candidate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ fi
secret_vars=(
"POLICYENGINE_DB_PASSWORD=${CLOUD_RUN_POLICYENGINE_DB_PASSWORD_SECRET}"
"POLICYENGINE_GITHUB_MICRODATA_AUTH_TOKEN=${CLOUD_RUN_GITHUB_MICRODATA_TOKEN_SECRET}"
"ANTHROPIC_API_KEY=${CLOUD_RUN_ANTHROPIC_API_KEY_SECRET}"
"OPENAI_API_KEY=${CLOUD_RUN_OPENAI_API_KEY_SECRET}"
"HUGGING_FACE_TOKEN=${CLOUD_RUN_HUGGING_FACE_TOKEN_SECRET}"
"RUNTIME_CACHE_URL=${CLOUD_RUN_RUNTIME_CACHE_URL_SECRET}"
Expand Down
1 change: 0 additions & 1 deletion .github/scripts/sync_cloud_run_secrets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,5 @@ require_env CLOUD_RUN_RUNTIME_SERVICE_ACCOUNT

sync_secret POLICYENGINE_DB_PASSWORD policyengine-api-prod-db-password
sync_secret POLICYENGINE_GITHUB_MICRODATA_AUTH_TOKEN policyengine-api-prod-github-microdata-token
sync_secret ANTHROPIC_API_KEY policyengine-api-prod-anthropic-api-key
sync_secret OPENAI_API_KEY policyengine-api-prod-openai-api-key
sync_secret HUGGING_FACE_TOKEN policyengine-api-prod-hugging-face-token
1 change: 0 additions & 1 deletion .github/scripts/validate_app_engine_deploy_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ required=(
POLICYENGINE_DB_INSTANCE_CONNECTION_NAME
POLICYENGINE_DB_PASSWORD_SECRET_RESOURCE
POLICYENGINE_GITHUB_MICRODATA_AUTH_TOKEN_SECRET_RESOURCE
ANTHROPIC_API_KEY_SECRET_RESOURCE
OPENAI_API_KEY_SECRET_RESOURCE
HUGGING_FACE_TOKEN_SECRET_RESOURCE
SIM_ENTRYPOINT
Expand Down
1 change: 0 additions & 1 deletion .github/scripts/validate_cloud_run_deploy_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ cloud_run_require_env \
POLICYENGINE_DB_INSTANCE_CONNECTION_NAME \
CLOUD_RUN_POLICYENGINE_DB_PASSWORD_SECRET \
CLOUD_RUN_GITHUB_MICRODATA_TOKEN_SECRET \
CLOUD_RUN_ANTHROPIC_API_KEY_SECRET \
CLOUD_RUN_OPENAI_API_KEY_SECRET \
CLOUD_RUN_HUGGING_FACE_TOKEN_SECRET \
CLOUD_RUN_RUNTIME_CACHE_URL_SECRET \
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ jobs:
env:
POLICYENGINE_DB_PASSWORD: ${{ secrets.POLICYENGINE_DB_PASSWORD }}
POLICYENGINE_GITHUB_MICRODATA_AUTH_TOKEN: ${{ secrets.POLICYENGINE_GITHUB_MICRODATA_AUTH_TOKEN }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
HUGGING_FACE_TOKEN: ${{ secrets.HUGGING_FACE_TOKEN }}
- name: Upload coverage to Codecov
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ jobs:
APP_ENGINE_SERVICE_ACCOUNT: policyengine-api-ae-staging@policyengine-api.iam.gserviceaccount.com
POLICYENGINE_DB_PASSWORD_SECRET_RESOURCE: projects/policyengine-api/secrets/policyengine-api-prod-db-password/versions/latest
POLICYENGINE_GITHUB_MICRODATA_AUTH_TOKEN_SECRET_RESOURCE: projects/policyengine-api/secrets/policyengine-api-prod-github-microdata-token/versions/latest
ANTHROPIC_API_KEY_SECRET_RESOURCE: projects/policyengine-api/secrets/policyengine-api-prod-anthropic-api-key/versions/latest
OPENAI_API_KEY_SECRET_RESOURCE: projects/policyengine-api/secrets/policyengine-api-prod-openai-api-key/versions/latest
HUGGING_FACE_TOKEN_SECRET_RESOURCE: projects/policyengine-api/secrets/policyengine-api-prod-hugging-face-token/versions/latest
GATEWAY_AUTH_ISSUER: ${{ secrets.GATEWAY_AUTH_ISSUER }}
Expand Down Expand Up @@ -224,7 +223,6 @@ jobs:
RUNTIME_CACHE_SERVICE: api
POLICYENGINE_DB_PASSWORD: ${{ secrets.POLICYENGINE_DB_PASSWORD }}
POLICYENGINE_GITHUB_MICRODATA_AUTH_TOKEN: ${{ secrets.POLICYENGINE_GITHUB_MICRODATA_AUTH_TOKEN }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
HUGGING_FACE_TOKEN: ${{ secrets.HUGGING_FACE_TOKEN }}
- name: Validate App Engine deployment configuration
Expand Down Expand Up @@ -508,7 +506,6 @@ jobs:
APP_ENGINE_SERVICE_ACCOUNT: policyengine-api-ae-prod@policyengine-api.iam.gserviceaccount.com
POLICYENGINE_DB_PASSWORD_SECRET_RESOURCE: projects/policyengine-api/secrets/policyengine-api-prod-db-password/versions/latest
POLICYENGINE_GITHUB_MICRODATA_AUTH_TOKEN_SECRET_RESOURCE: projects/policyengine-api/secrets/policyengine-api-prod-github-microdata-token/versions/latest
ANTHROPIC_API_KEY_SECRET_RESOURCE: projects/policyengine-api/secrets/policyengine-api-prod-anthropic-api-key/versions/latest
OPENAI_API_KEY_SECRET_RESOURCE: projects/policyengine-api/secrets/policyengine-api-prod-openai-api-key/versions/latest
HUGGING_FACE_TOKEN_SECRET_RESOURCE: projects/policyengine-api/secrets/policyengine-api-prod-hugging-face-token/versions/latest
GATEWAY_AUTH_ISSUER: ${{ secrets.GATEWAY_AUTH_ISSUER }}
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/sync-cloud-run-secrets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ jobs:
CLOUD_RUN_RUNTIME_SERVICE_ACCOUNT: ${{ secrets.GCP_CLOUD_RUN_RUNTIME_SERVICE_ACCOUNT }}
POLICYENGINE_DB_PASSWORD: ${{ secrets.POLICYENGINE_DB_PASSWORD }}
POLICYENGINE_GITHUB_MICRODATA_AUTH_TOKEN: ${{ secrets.POLICYENGINE_GITHUB_MICRODATA_AUTH_TOKEN }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
HUGGING_FACE_TOKEN: ${{ secrets.HUGGING_FACE_TOKEN }}
run: bash .github/scripts/sync_cloud_run_secrets.sh
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ make setup-env
- `POLICYENGINE_DB_PASSWORD`
- `POLICYENGINE_DB_INSTANCE_CONNECTION_NAME`
- `POLICYENGINE_GITHUB_MICRODATA_AUTH_TOKEN`
- `ANTHROPIC_API_KEY`
- `OPENAI_API_KEY`
- `HUGGING_FACE_TOKEN`

Expand Down
1 change: 1 addition & 0 deletions changelog.d/remove-ai-analysis.removed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Removed the AI analysis feature (simulation-analysis, tracer-analysis and ai-prompts endpoints, the Anthropic client and its deployment secrets); nothing live called it and it will be rebuilt during the Axiom migration.
5 changes: 1 addition & 4 deletions docs/engineering/migration-contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Generated from `policyengine_api/migration_registry.py` and `tests/contract/regi

| Metric | Count |
| --- | ---: |
| route group count | 12 |
| route group count | 9 |
| workflow count | 7 |
| request count | 14 |
| db entity count | 6 |
Expand All @@ -25,9 +25,6 @@ Generated from `policyengine_api/migration_registry.py` and `tests/contract/regi
| `simulation` | `simulation`, `simulations` | `simulation` | `economy` |
| `report` | `report` | `report` | `report` |
| `user_profile` | `user-profile` | `user` | `none` |
| `simulation_analysis` | `simulation-analysis` | `none` | `none` |
| `tracer_analysis` | `tracer-analysis` | `none` | `none` |
| `ai` | `ai-prompts` | `none` | `none` |

## App V2 Workflow Contracts

Expand Down
2 changes: 1 addition & 1 deletion docs/engineering/skills/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ lifecycle whenever either Alembic domain changes.
Shared-cache unit behavior and real Redis-compatible integration semantics:

```bash
uv run pytest tests/unit/runtime_cache tests/unit/services/test_household_calculation_service.py tests/unit/services/test_tracer_service.py tests/unit/services/test_ai_analysis_service.py tests/unit/services/test_reform_impacts_service.py tests/unit/services/test_budget_window_cache.py -q
uv run pytest tests/unit/runtime_cache tests/unit/services/test_household_calculation_service.py tests/unit/services/test_reform_impacts_service.py tests/unit/services/test_budget_window_cache.py -q
RUNTIME_CACHE_TEST_URL="redis://127.0.0.1:6379/0" uv run pytest tests/integration/test_runtime_cache_redis.py -q
```

Expand Down
26 changes: 1 addition & 25 deletions docs/generated/migration_contracts.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"metadata": {
"db_entity_count": 6,
"request_count": 14,
"route_group_count": 12,
"route_group_count": 9,
"sim_flow_count": 3,
"workflow_count": 7
},
Expand Down Expand Up @@ -86,30 +86,6 @@
"user-profile"
],
"sim_flow": null
},
{
"db_entity": null,
"name": "simulation_analysis",
"path_segments": [
"simulation-analysis"
],
"sim_flow": null
},
{
"db_entity": null,
"name": "tracer_analysis",
"path_segments": [
"tracer-analysis"
],
"sim_flow": null
},
{
"db_entity": null,
"name": "ai",
"path_segments": [
"ai-prompts"
],
"sim_flow": null
}
],
"version": 1,
Expand Down
6 changes: 3 additions & 3 deletions gcp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ Secret Manager wiring. Required runtime settings are `RUNTIME_CACHE_MODE`,
The App Engine image is environment-neutral. `app.yaml` receives non-secret
configuration and Secret Manager resource names only. Before Gunicorn starts,
`policyengine_api.app_engine_runtime` resolves the database password, GitHub
microdata token, Anthropic key, OpenAI key, and Hugging Face token into the
process environment using the attached App Engine service account. Raw values
and temporary secret files must never enter the build context or image layers.
microdata token, OpenAI key, and Hugging Face token into the process environment
using the attached App Engine service account. Raw values and temporary secret
files must never enter the build context or image layers.

Local development uses an explicitly launched Redis-compatible process and an
explicit durable development database. For example:
Expand Down
3 changes: 0 additions & 3 deletions gcp/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ def _render_app_config() -> str:
".policyengine_github_microdata_auth_token_secret_resource": _required(
"POLICYENGINE_GITHUB_MICRODATA_AUTH_TOKEN_SECRET_RESOURCE"
),
".anthropic_api_key_secret_resource": _required(
"ANTHROPIC_API_KEY_SECRET_RESOURCE"
),
".openai_api_key_secret_resource": _required("OPENAI_API_KEY_SECRET_RESOURCE"),
".hugging_face_token_secret_resource": _required(
"HUGGING_FACE_TOKEN_SECRET_RESOURCE"
Expand Down
1 change: 0 additions & 1 deletion gcp/policyengine_api/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ env_variables:
POLICYENGINE_DB_INSTANCE_CONNECTION_NAME: ".policyengine_db_instance_connection_name"
POLICYENGINE_DB_PASSWORD_SECRET_RESOURCE: ".policyengine_db_password_secret_resource"
POLICYENGINE_GITHUB_MICRODATA_AUTH_TOKEN_SECRET_RESOURCE: ".policyengine_github_microdata_auth_token_secret_resource"
ANTHROPIC_API_KEY_SECRET_RESOURCE: ".anthropic_api_key_secret_resource"
OPENAI_API_KEY_SECRET_RESOURCE: ".openai_api_key_secret_resource"
HUGGING_FACE_TOKEN_SECRET_RESOURCE: ".hugging_face_token_secret_resource"
SIMULATION_ENTRYPOINT_URL: ".simulation_entrypoint_url"
Expand Down
1 change: 0 additions & 1 deletion policyengine_api/ai_prompts/__init__.py

This file was deleted.

116 changes: 0 additions & 116 deletions policyengine_api/ai_prompts/simulation_analysis_prompt.py

This file was deleted.

Loading
Loading