Skip to content
Draft
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
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.

1 change: 1 addition & 0 deletions .github/scripts/modal-deploy-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Deploy simulation API to Modal
# Usage: ./modal-deploy-app.sh <modal-environment>
# Required env vars: 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
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