Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
01d5cd3
chore: upgrade simulation runtime to PolicyEngine v4.10
anth-volk May 21, 2026
36d3be0
feat: adapt simulation worker to PolicyEngine v4 outputs
anth-volk May 20, 2026
ba38c21
fix: align simulation API with PolicyEngine v4 outputs
anth-volk May 21, 2026
3b145e9
docs: add API v2 AI guidance harness
anth-volk May 21, 2026
7fdecce
docs: switch to model-agnostic AI harness
anth-volk May 21, 2026
c0d57b9
refactor: schematize simulation macro outputs
anth-volk May 21, 2026
6b0d0fd
fix: derive simulation versions from policyengine bundle
anth-volk May 21, 2026
f1b2d08
chore: update policyengine bundle as single stream
anth-volk May 21, 2026
94d7f5c
chore: rename policyengine update workflow file
anth-volk May 21, 2026
9b067a5
refactor: use typed macro output modules
anth-volk May 22, 2026
59437e6
refactor: centralize simulation output building
anth-volk May 22, 2026
06b8bdf
refactor: move simulation output builder module
anth-volk May 22, 2026
dcf865a
refactor: fold output adapter into builder
anth-volk May 22, 2026
c84ea3b
fix: preserve simulation API contracts
anth-volk May 22, 2026
10af713
fix: package simulation runtime for integration
anth-volk May 28, 2026
e665b62
feat: enable sim API cliff impacts
anth-volk May 28, 2026
a2c997b
chore: type version registry metadata
anth-volk May 28, 2026
cd6cf1a
chore: remove simulation compatibility shims
anth-volk May 28, 2026
ee0e8a5
chore: remove stale console exporter comment
anth-volk May 28, 2026
24bc2c3
chore: restore console exporter comment
anth-volk May 28, 2026
915b3e3
refactor: split simulation output segments
anth-volk May 28, 2026
c8fef31
chore: restore simulation package license file reference
anth-volk May 28, 2026
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
66 changes: 66 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Contributing to policyengine-api-v2

See the shared PolicyEngine contribution guide for cross-repo conventions. This
file covers policyengine-api-v2 specifics.

## Commands

```bash
make format # format Python source with Ruff
make check # Ruff check + Pyright over source directories
make test # service unit tests in Docker
make test-complete # unit tests + local integration tests
make push-pr-branch # push current branch to origin with tracking
./scripts/generate-clients.sh
```

For simulation-service-only checks:

```bash
cd projects/policyengine-api-simulation
uv sync --extra test
uv run pytest tests/ -v
```

## Test Organisation

- Service unit tests live under each service's `tests/` directory, for example
`projects/policyengine-api-simulation/tests/`.
- Generated-client integration tests live under
`projects/policyengine-apis-integ/tests/`.
- Unit tests should mock Modal, GCP, Hugging Face, and other network seams.
- Integration tests should use generated clients and clearly state any required
service, GCP, Modal, or staging dependency.

## Opening PRs

Always create branches on the canonical repository, not a fork. The convenience
target:

```bash
make push-pr-branch
```

pushes the current branch to `origin` with the correct tracking so
`gh pr create` works. Then create and verify the PR explicitly:

```bash
gh pr create --draft --repo PolicyEngine/policyengine-api-v2 --head "$(git branch --show-current)" --base main
gh pr view <PR> --repo PolicyEngine/policyengine-api-v2 --json isDraft,headRepositoryOwner,headRepository
```

Before opening the PR, open or identify a GitHub issue for the work. The first
line of the PR description must be `Fixes #ISSUE_NUMBER`.

The PR is valid only if it is a draft and the head repository is
`PolicyEngine/policyengine-api-v2`. If you cannot push to that repository, ask
for access instead of opening a fork PR.

## Repo-Specific Anti-Patterns

- Do not open PRs from personal forks.
- Do not add `[codex]`, `[claude]`, `[copilot]`, or other agent labels to PR
titles.
- Do not hand-edit generated clients without documenting why regeneration is
not appropriate.
- Do not skip integration/client checks when changing public API schemas.
11 changes: 11 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copilot Instructions

Follow the repository's canonical engineering skills under
`docs/engineering/skills/`.

For tests, read `docs/engineering/skills/testing.md` before adding, moving, or
reviewing test files. Do not duplicate or override that testing guidance here.

For pull requests, read `docs/engineering/skills/github-prs.md` before opening,
replacing, or sharing a PR. This repository only accepts same-repository PRs
from branches in `PolicyEngine/policyengine-api-v2`; never create fork PRs.
14 changes: 14 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Fixes #

## Same-Repository Draft PR Check

- [ ] This PR is a draft.
- [ ] This PR is from a branch in `PolicyEngine/policyengine-api-v2`, not a personal fork.

## Summary

-

## Testing

-
136 changes: 0 additions & 136 deletions .github/scripts/check-country-package-updates.py

This file was deleted.

12 changes: 7 additions & 5 deletions .github/scripts/modal-deploy-app.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
#!/bin/bash
# Deploy simulation API to Modal
# Usage: ./modal-deploy-app.sh <modal-environment>
# Required env vars: POLICYENGINE_US_VERSION, POLICYENGINE_UK_VERSION
# Required env vars: POLICYENGINE_VERSION, POLICYENGINE_US_VERSION, POLICYENGINE_UK_VERSION
# These should come from the bundled policyengine.py release manifest.
#
# Deploys two apps:
# 1. policyengine-simulation-gateway - Stable gateway with fixed URL
# 2. policyengine-simulation-us{X}-uk{Y} - Versioned simulation app
# 2. policyengine-simulation-py{X} - Versioned simulation app

set -euo pipefail

MODAL_ENV="${1:?Modal environment required}"

# Generate versioned simulation app name (dots replaced with dashes for URL safety)
US_VERSION_SAFE="${POLICYENGINE_US_VERSION//./-}"
UK_VERSION_SAFE="${POLICYENGINE_UK_VERSION//./-}"
SIMULATION_APP_NAME="policyengine-simulation-us${US_VERSION_SAFE}-uk${UK_VERSION_SAFE}"
POLICYENGINE_VERSION_SAFE="${POLICYENGINE_VERSION//./-}"
SIMULATION_APP_NAME="policyengine-simulation-py${POLICYENGINE_VERSION_SAFE}"

echo "========================================"
echo "Deploying to Modal environment: $MODAL_ENV"
echo " policyengine.py version: ${POLICYENGINE_VERSION}"
echo " US version: ${POLICYENGINE_US_VERSION}"
echo " UK version: ${POLICYENGINE_UK_VERSION}"
echo "========================================"
Expand All @@ -40,6 +41,7 @@ echo ""
echo "Step 3: Updating version registries..."
uv run python -m src.modal.utils.update_version_registry \
--app-name "$SIMULATION_APP_NAME" \
--policyengine-version "${POLICYENGINE_VERSION}" \
--us-version "${POLICYENGINE_US_VERSION}" \
--uk-version "${POLICYENGINE_UK_VERSION}" \
--environment "$MODAL_ENV"
Expand Down
13 changes: 5 additions & 8 deletions .github/scripts/modal-extract-versions.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
#!/bin/bash
# Extract policyengine-us and policyengine-uk versions from uv.lock
# Extract policyengine-us, policyengine-us-data, policyengine-uk, and
# policyengine-uk-data versions from the bundled policyengine.py manifests.
# Usage: ./modal-extract-versions.sh <project-dir>
# Outputs: Sets us_version and uk_version in GITHUB_OUTPUT
# Outputs: Sets policyengine_version, us_version, us_data_version, uk_version,
# and uk_data_version in GITHUB_OUTPUT

set -euo pipefail

PROJECT_DIR="${1:-.}"

cd "$PROJECT_DIR"

US_VERSION=$(grep -A1 'name = "policyengine-us"' uv.lock | grep version | head -1 | sed 's/.*"\(.*\)".*/\1/')
UK_VERSION=$(grep -A1 'name = "policyengine-uk"' uv.lock | grep version | head -1 | sed 's/.*"\(.*\)".*/\1/')

echo "us_version=$US_VERSION" >> "$GITHUB_OUTPUT"
echo "uk_version=$UK_VERSION" >> "$GITHUB_OUTPUT"
echo "Deploying with policyengine-us=$US_VERSION, policyengine-uk=$UK_VERSION"
uv run python -m src.modal.utils.extract_bundle_versions
Loading
Loading