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
45 changes: 34 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,38 @@
name: tests
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
# Pull request runs share one group per PR, so a newer push cancels the superseded run.
# Every other run (pushes to main) gets its own group keyed by run_id, so main runs are never
# queued behind, or cancelled by, another run. run_id is unique per workflow run and is kept
# across re-runs, so a re-run cannot collide with a different run (a sha key would group two
# runs of the same commit). GitHub cancels a pending run when a newer one joins its group even
# with cancel-in-progress false, which is why a shared main group is not used.
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
core:
runs-on: ubuntu-latest
# Observed runs take about 1 minute; the limit leaves room for install retries and slow runners.
timeout-minutes: 20
strategy:
matrix:
python: ['3.11', '3.12', '3.13']
python: ['3.11', '3.12', '3.13', '3.14']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: ${{ matrix.python }}
- run: python -m pip install -e '.[dev]'
- run: python -m pip install -r examples/ai-gateway/requirements.txt
- name: Install package with dev extras
run: |
bash scripts/ci_pip_install.sh python -e '.[dev]'
- name: Install example requirements
run: |
bash scripts/ci_pip_install.sh python -r examples/ai-gateway/requirements.txt
- run: python -m ruff check src tests examples
- run: python -m pytest -q --cov=typewright
- run: python -m typewright demo --out runs/ci-demo
Expand All @@ -27,7 +43,7 @@ jobs:
run: |
temp_dir="$(mktemp -d)"
python -m venv "$temp_dir/venv"
"$temp_dir/venv/bin/python" -m pip install "$GITHUB_WORKSPACE"/dist/typewright-*.whl
bash scripts/ci_pip_install.sh "$temp_dir/venv/bin/python" "$GITHUB_WORKSPACE"/dist/typewright-*.whl
cp -R "$GITHUB_WORKSPACE/examples/hierarchy/support" "$temp_dir/study-inputs"
cd "$temp_dir"
unset PYTHONPATH
Expand All @@ -46,18 +62,25 @@ jobs:
"$temp_dir/venv/bin/typewright-study" report --frozen study-frozen --execution study-execution
optional-contracts:
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
matrix:
# Both ends of the supported range in pyproject.toml (issue #90).
dspy: ['3.3.1', '3.4.0']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: '3.11'
- run: python -m pip install -e '.[all,dev]'
- run: python -m pip install -r examples/ai-gateway/requirements.txt
- run: python -m pip install 'dspy[litellm]==${{ matrix.dspy }}' 'gepa==0.1.4'
- name: Install package with all and dev extras
run: |
bash scripts/ci_pip_install.sh python -e '.[all,dev]'
- name: Install example requirements
run: |
bash scripts/ci_pip_install.sh python -r examples/ai-gateway/requirements.txt
- name: Install pinned DSPy and GEPA
run: |
bash scripts/ci_pip_install.sh python 'dspy[litellm]==${{ matrix.dspy }}' 'gepa==0.1.4'
- run: python -m typewright doctor --check-optional
- run: python -m pytest -q
# This workflow never uses API secrets and does not run paid inference.
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
stale, Windows/CPython 3.13-only historical freeze in `reports/`. Regression tests check the
tables against `pyproject.toml` and require every lock-like file in the tree to be named (#50).
No lock was generated.
- CI hardening (#50): the `push` trigger is limited to `main` (pull requests still run), superseded
pull request runs are cancelled by a per-PR concurrency group (runs on `main` each get their own
group, so none is queued or cancelled), each job has a 20 minute timeout, `actions/checkout` and
`actions/setup-python` are pinned to verified commit SHAs, pip installs retry up to three times
through `scripts/ci_pip_install.sh` before failing, and the core matrix adds Python 3.14.
- Frozen hierarchy artifacts are now checked for lexical scope on load: node origins must match
their export chain, references, `after` edges, and finals may not cross subgraph scopes (except
through the inputs an export passes down), and exports must have descendant nodes (#85).
Expand Down
3 changes: 2 additions & 1 deletion MANIFEST.sha256
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cfbc27a244debce6413733798800282eb90aa96e12c97120bffedc05b6783964 .env.example
b4a064c3a119736216efaca4188b17c9829ba8fef12312ea1c067d3fe638b0e4 .github/workflows/ci.yml
bb4bbaa645f3a3993bff02ab4dca4441ab252225e711b64e01e8d5be7ea3145f .github/workflows/ci.yml
0550ea438f0ef6f2ea54da31c25f93f2e0176d5a271f133b31efffa783955b76 .gitignore
30a02d4b567c1cb152c54ec29668d31a69f069e1b7cfd4aad770e37f45024431 AGENTS.md
2e7d278cb4a2bad1de30725a7d02b20d44e88891396f51ac046711923ba51409 CLAUDE.md
Expand Down Expand Up @@ -42,6 +42,7 @@ aa89862d423e9345e9d2cc643d69c79c93763ea0686f906c02c047156e891112 schemas/hierar
b400d15eb1d0b4729aa16b52efe4db432bf222a805a8e4816eb3be2b9678abb8 schemas/hierarchy-source.schema.json
2bd89ad29a0a0e1b10f2cb0dc20ac79929fe1058cd4a130e31e519907d4057bd schemas/program.schema.json
f52b7d9f7682d4a21a1b9076551e33d86702ca80c1580d1e420d1f96b84c8085 schemas/usecase.schema.json
bd6cf7a8acdb312db66345e5b23ab78c44ba41888ae6d2dd864f3b5fa0a065e0 scripts/ci_pip_install.sh
efb40e872ef8ad4a65a16b561a32a38237f95aeb2791cd082ed29e0df76ec6b1 scripts/setup.ps1
ea58da181cabe222f88aa559d2de331b685e2eb92004bb12e476e3bf14781470 scripts/setup.sh
3d43521e9b072f66f553ecfc4221298031714b8cf50c4f89b7a48980a6628ecd src/s1compiler/__init__.py
Expand Down
2 changes: 1 addition & 1 deletion docs/HIERARCHY_RELEASE_VERIFICATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ This is the software evidence map for epic [#6](https://github.com/CompleteTech-

`tests/test_hierarchy_validation.py` covers cycles, typed references, contract drift, and conditional dominance. `tests/test_hierarchy_artifact.py` covers size limits, path-like definition references, format dispatch, and flat hash compatibility. Runtime, budget, data, evidence, architect, GEPA, compiler, metrics, examples, and study test modules cover malformed responses, model drift, split leakage, small-branch review, cancellation, retries, lost attempt receipts, strict replay, and held-out freeze order. `tests/test_hierarchy_security.py` guards the hierarchy modules against dynamic execution and unsafe serialization/process imports. These are software tests; model prompt-injection resistance is not established by them.

The CI matrix runs pytest, Ruff, wheel build, installed-wheel flat and hierarchy no-key demos, and runtime import isolation on Python 3.11–3.13. Its optional job installs the pinned SDK/DSPy/GEPA extras and runs interface tests with fake providers. No CI job uses a live key. The exact results belong to the PR's check runs; a green configuration file alone proves nothing.
The CI matrix runs pytest, Ruff, wheel build, installed-wheel flat and hierarchy no-key demos, and runtime import isolation on Python 3.11–3.14. Its optional job installs the pinned SDK/DSPy/GEPA extras and runs interface tests with fake providers. No CI job uses a live key. The exact results belong to the PR's check runs; a green configuration file alone proves nothing.

Prior flat-study test-input and normalized-text exclusion lists were generated in the original local checkout under ignored `runs/hierarchy-issues-20260930/`; they are not published because hashes of low-entropy text can be sensitive. A new checkout needs independently verified exclusion lists. Live registration checks both lists against every split; a human must still review semantic and near-duplicate independence. `typewright-study manifest` now writes the complete pre-spend live manifest from a registered live protocol, `typewright-study review` binds a human review of the required attestations to that exact digest, and live selection refuses to start unless the reviewed manifest matches the protocol and current software parameters. The software can therefore produce and enforce a complete manifest, but the live scope retained in issue #74 still needs the human inputs: a new independently human-reviewed four-split dataset, a completed review with verified price quote and externally enforced billing cap, paid and teacher-sharing approvals, and after live selection the frozen graph digests and semantic review. Paid calls and teacher-example sharing each require separate explicit authorization. The owner explicitly approved splitting software and live tracking on 2026-10-03. Issues #20/#21 are closed for their delivered software scope; their original reviewed-live-manifest and empirical all-child requirements remain assigned to #74 and epic #6. Both live trackers stay open until their acceptance criteria are verified. This decision supersedes the earlier conflicting close/reopen comments and does not authorize any live execution. The existing flat benchmark is not the new hierarchy holdout.

Expand Down
24 changes: 24 additions & 0 deletions scripts/ci_pip_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
# CI helper: run `<python> -m pip install <args...>` up to 3 times, 15 s apart.
# Used by .github/workflows/ci.yml so every install step shares one retry policy.
# pip exit codes do not separate network failures from resolver errors, so every
# failure is retried; a deterministic error costs about 30 s before the step fails.
set -euo pipefail
if [ "$#" -lt 2 ]; then
echo "usage: $0 <python> <pip install args...>" >&2
exit 2
fi
python_bin="$1"
shift
attempts=3
for attempt in $(seq 1 "$attempts"); do
if "$python_bin" -m pip install "$@"; then
exit 0
fi
if [ "$attempt" -eq "$attempts" ]; then
echo "::error::pip install failed after $attempts attempts"
exit 1
fi
echo "::warning::pip install attempt $attempt failed; retrying in 15s"
sleep 15
done
Loading