From 2dd7dec4b62a1c1059dbeb01fa70ded56095eba6 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 28 Nov 2026 12:10:25 +0000 Subject: [PATCH 1/3] Release 0.1.0 with a simplified CI and tag-driven release Bump bearshape to 0.1.0 and document the union binding leak as a known limitation instead of a release blocker. Replace the reusable validation, nightly, upstream-proposal and evidence-gated PyPI workflows with one CI workflow summarized by a single `check` job, a beartype prerelease lane (#62), and a tag-push release modeled on beartype's own workflow. Pin actions to major tags, remove ExecPlans, evidence and upstream-proposal tooling, and shorten the contributor, agent and release guides. Carry the README docs link from #59. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01VhCcPq9JDmHrruFMCgcGMa --- .github/workflows/ci.yml | 158 ++- .github/workflows/docs.yml | 14 +- .github/workflows/nightly.yml | 65 - .github/workflows/pypi.yml | 170 +-- .github/workflows/upstream-proposal.yml | 57 - .github/workflows/validate.yml | 251 ---- .pre-commit-config.yaml | 8 +- AGENTS.md | 157 +-- CHANGELOG.md | 63 +- CONTRIBUTING.md | 334 +---- PLANS.md | 178 --- README.md | 30 +- docs/examples/index.md | 5 +- docs/features/composition.md | 24 +- docs/features/index.md | 4 +- docs/getting-started/index.md | 3 +- docs/getting-started/installation.md | 49 +- docs/getting-started/quickstart.md | 8 +- docs/index.md | 4 +- docs/maintainers/production-readiness.md | 569 -------- docs/maintainers/releasing.md | 242 +--- examples/bearshape_tour.ipynb | 4 +- plans/2026-05-28-baseline-audit.md | 424 ------ plans/2026-05-28-hook-ci-hygiene.md | 377 ------ plans/2026-05-29-bearshape-rename.md | 323 ----- plans/2026-09-07-typing-ci-floor.md | 129 -- plans/2026-09-08-action-runtimes.md | 100 -- plans/2026-09-08-agent-workflow.md | 230 ---- plans/2026-09-08-backend-conversion.md | 103 -- plans/2026-09-08-checker-conformance.md | 112 -- plans/2026-09-08-ci-validation.md | 108 -- plans/2026-09-08-claw-caller.md | 103 -- plans/2026-09-08-cupy-runtime.md | 100 -- plans/2026-09-08-distribution-integrity.md | 104 -- plans/2026-09-08-docs-contract.md | 106 -- plans/2026-09-08-framework-validation.md | 112 -- plans/2026-09-08-handoff-evidence.md | 102 -- plans/2026-09-08-installed-consumers.md | 107 -- .../2026-09-08-memo-discovery-performance.md | 129 -- plans/2026-09-08-production-readiness.md | 408 ------ plans/2026-09-08-publication-gate.md | 97 -- plans/2026-09-08-rc0-compat.md | 108 -- plans/2026-09-08-rc0-integration.md | 107 -- plans/2026-09-08-release-candidate.md | 94 -- plans/2026-09-08-static-like-inputs.md | 106 -- plans/2026-09-08-static-tree-containers.md | 108 -- plans/2026-09-08-union-transactions.md | 337 ----- plans/2026-09-08-validation-lifetime.md | 115 -- plans/2026-09-10-ownership-transfer.md | 103 -- plans/2026-10-11-audit-followup.md | 332 ----- plans/2026-10-11-converter-validation.md | 85 -- plans/2026-10-11-dtype-normalization.md | 180 --- plans/2026-10-11-nested-value.md | 85 -- plans/2026-10-11-python311-beartype0231.md | 93 -- plans/2026-10-11-release-integration.md | 235 ---- plans/2026-10-11-release-pipeline.md | 108 -- plans/2026-10-11-release-readiness.md | 186 --- plans/2026-10-11-shape-preparation.md | 175 --- plans/2026-10-11-tree-ellipsis.md | 85 -- .../2026-10-11-union-ordinary-performance.md | 250 ---- plans/2026-10-11-union-scope-correctness.md | 298 ---- plans/2026-10-11-variadic-broadcast.md | 87 -- plans/2026-10-12-dev-toolchain.md | 185 --- plans/2026-10-12-docs-alignment.md | 286 ---- plans/README.md | 81 -- pyproject.toml | 4 +- ruff.toml | 10 - tests/test_release.py | 337 ----- tests/test_runtime_preflight.py | 32 +- tools/README.md | 119 +- tools/check_distribution.py | 148 -- tools/check_docs.py | 1 - tools/check_installed.py | 152 --- tools/check_release.py | 115 -- tools/check_release_evidence.py | 83 -- tools/check_upstream_proposal.py | 161 --- .../2026-10-11-audit-performance/README.md | 77 -- .../benchmark-matched-after311.json | 352 ----- .../benchmark-matched-after314.json | 352 ----- .../benchmark-matched-before311.json | 352 ----- .../benchmark-matched-before314.json | 352 ----- .../benchmark-released-after311.json | 351 ----- .../benchmark-released-after314.json | 351 ----- .../benchmark-released-before311.json | 350 ----- .../benchmark-released-before314.json | 350 ----- .../identity.json | 17 - .../3.11-hook-lookup-alternatives.json | 39 - .../3.11-proposal-combined.json | 430 ------ .../3.11-proposal-dtype.json | 430 ------ .../3.11-proposal-main.json | 430 ------ .../3.11-proposal-ordinary.json | 189 --- .../3.11-proposal-shape.json | 430 ------ .../3.11-released-combined.json | 430 ------ .../3.11-released-dtype.json | 430 ------ .../3.11-released-main.json | 430 ------ .../3.11-released-ordinary.json | 159 --- .../3.11-released-shape.json | 430 ------ .../3.11-root-combined.json | 25 - .../3.11-root-dtype.json | 25 - .../3.11-root-main.json | 25 - .../3.11-root-shape.json | 25 - .../3.14-hook-lookup-alternatives.json | 39 - .../3.14-proposal-combined.json | 430 ------ .../3.14-proposal-dtype.json | 430 ------ .../3.14-proposal-main.json | 430 ------ .../3.14-proposal-ordinary.json | 189 --- .../3.14-proposal-shape.json | 430 ------ .../3.14-released-combined.json | 430 ------ .../3.14-released-dtype.json | 430 ------ .../3.14-released-main.json | 430 ------ .../3.14-released-ordinary.json | 159 --- .../3.14-released-shape.json | 430 ------ .../3.14-root-combined.json | 25 - .../3.14-root-dtype.json | 25 - .../3.14-root-main.json | 25 - .../3.14-root-shape.json | 25 - .../README.md | 164 --- .../cold-dtype-samples.json | 37 - .../experiments.json | 4 - .../identity.json | 154 --- tools/probe_union.py | 31 - tools/smoke_minimal.py | 132 -- tools/upstream/DESIGN_REVIEW.md | 103 -- tools/upstream/README.md | 219 --- tools/upstream/benchmark_transactions.py | 233 ---- .../evidence/2026-10-11-isolation/README.md | 84 -- .../native-stability-314.json | 223 --- .../runtime-correctness-311.json | 194 --- .../runtime-correctness-314.json | 194 --- .../runtime-optimized-311.json | 194 --- .../runtime-optimized-314.json | 194 --- .../runtime-released-311.json | 194 --- .../runtime-released-314.json | 194 --- .../transactions-correctness-311.json | 209 --- .../transactions-correctness-314.json | 208 --- .../transactions-optimized-311.json | 207 --- .../transactions-optimized-314.json | 207 --- .../transactions-released-311.json | 179 --- .../transactions-released-314.json | 179 --- tools/upstream/evidence/2026-10-11/README.md | 67 - .../evidence/2026-10-11/correctness311.json | 193 --- .../evidence/2026-10-11/correctness314.json | 192 --- .../evidence/2026-10-11/optimized311.json | 193 --- .../evidence/2026-10-11/optimized314.json | 193 --- .../evidence/2026-10-11/released311.json | 164 --- .../evidence/2026-10-11/released314.json | 164 --- tools/upstream/patches/0001-state.patch | 1203 ----------------- .../patches/0002-scope-correctness.patch | 638 --------- .../patches/0003-ordinary-performance.patch | 497 ------- tools/upstream/patches/series.json | 17 - tools/upstream/test_audit_composition.py | 58 - tools/upstream/test_scope_isolation.py | 92 -- tools/upstream/test_scope_transactions.py | 227 ---- tools/upstream/test_union_transactions.py | 272 ---- tools/validate_runtime.py | 18 +- uv.lock | 15 +- zensical.toml | 1 - 157 files changed, 424 insertions(+), 28937 deletions(-) delete mode 100644 .github/workflows/nightly.yml delete mode 100644 .github/workflows/upstream-proposal.yml delete mode 100644 .github/workflows/validate.yml delete mode 100644 PLANS.md delete mode 100644 docs/maintainers/production-readiness.md delete mode 100644 plans/2026-05-28-baseline-audit.md delete mode 100644 plans/2026-05-28-hook-ci-hygiene.md delete mode 100644 plans/2026-05-29-bearshape-rename.md delete mode 100644 plans/2026-09-07-typing-ci-floor.md delete mode 100644 plans/2026-09-08-action-runtimes.md delete mode 100644 plans/2026-09-08-agent-workflow.md delete mode 100644 plans/2026-09-08-backend-conversion.md delete mode 100644 plans/2026-09-08-checker-conformance.md delete mode 100644 plans/2026-09-08-ci-validation.md delete mode 100644 plans/2026-09-08-claw-caller.md delete mode 100644 plans/2026-09-08-cupy-runtime.md delete mode 100644 plans/2026-09-08-distribution-integrity.md delete mode 100644 plans/2026-09-08-docs-contract.md delete mode 100644 plans/2026-09-08-framework-validation.md delete mode 100644 plans/2026-09-08-handoff-evidence.md delete mode 100644 plans/2026-09-08-installed-consumers.md delete mode 100644 plans/2026-09-08-memo-discovery-performance.md delete mode 100644 plans/2026-09-08-production-readiness.md delete mode 100644 plans/2026-09-08-publication-gate.md delete mode 100644 plans/2026-09-08-rc0-compat.md delete mode 100644 plans/2026-09-08-rc0-integration.md delete mode 100644 plans/2026-09-08-release-candidate.md delete mode 100644 plans/2026-09-08-static-like-inputs.md delete mode 100644 plans/2026-09-08-static-tree-containers.md delete mode 100644 plans/2026-09-08-union-transactions.md delete mode 100644 plans/2026-09-08-validation-lifetime.md delete mode 100644 plans/2026-09-10-ownership-transfer.md delete mode 100644 plans/2026-10-11-audit-followup.md delete mode 100644 plans/2026-10-11-converter-validation.md delete mode 100644 plans/2026-10-11-dtype-normalization.md delete mode 100644 plans/2026-10-11-nested-value.md delete mode 100644 plans/2026-10-11-python311-beartype0231.md delete mode 100644 plans/2026-10-11-release-integration.md delete mode 100644 plans/2026-10-11-release-pipeline.md delete mode 100644 plans/2026-10-11-release-readiness.md delete mode 100644 plans/2026-10-11-shape-preparation.md delete mode 100644 plans/2026-10-11-tree-ellipsis.md delete mode 100644 plans/2026-10-11-union-ordinary-performance.md delete mode 100644 plans/2026-10-11-union-scope-correctness.md delete mode 100644 plans/2026-10-11-variadic-broadcast.md delete mode 100644 plans/2026-10-12-dev-toolchain.md delete mode 100644 plans/2026-10-12-docs-alignment.md delete mode 100644 plans/README.md delete mode 100644 tests/test_release.py delete mode 100644 tools/check_distribution.py delete mode 100644 tools/check_installed.py delete mode 100644 tools/check_release.py delete mode 100644 tools/check_release_evidence.py delete mode 100644 tools/check_upstream_proposal.py delete mode 100644 tools/evidence/2026-10-11-audit-performance/README.md delete mode 100644 tools/evidence/2026-10-11-audit-performance/benchmark-matched-after311.json delete mode 100644 tools/evidence/2026-10-11-audit-performance/benchmark-matched-after314.json delete mode 100644 tools/evidence/2026-10-11-audit-performance/benchmark-matched-before311.json delete mode 100644 tools/evidence/2026-10-11-audit-performance/benchmark-matched-before314.json delete mode 100644 tools/evidence/2026-10-11-audit-performance/benchmark-released-after311.json delete mode 100644 tools/evidence/2026-10-11-audit-performance/benchmark-released-after314.json delete mode 100644 tools/evidence/2026-10-11-audit-performance/benchmark-released-before311.json delete mode 100644 tools/evidence/2026-10-11-audit-performance/benchmark-released-before314.json delete mode 100644 tools/evidence/2026-10-11-audit-performance/identity.json delete mode 100644 tools/evidence/2026-10-11-remaining-optimization/3.11-hook-lookup-alternatives.json delete mode 100644 tools/evidence/2026-10-11-remaining-optimization/3.11-proposal-combined.json delete mode 100644 tools/evidence/2026-10-11-remaining-optimization/3.11-proposal-dtype.json delete mode 100644 tools/evidence/2026-10-11-remaining-optimization/3.11-proposal-main.json delete mode 100644 tools/evidence/2026-10-11-remaining-optimization/3.11-proposal-ordinary.json delete mode 100644 tools/evidence/2026-10-11-remaining-optimization/3.11-proposal-shape.json delete mode 100644 tools/evidence/2026-10-11-remaining-optimization/3.11-released-combined.json delete mode 100644 tools/evidence/2026-10-11-remaining-optimization/3.11-released-dtype.json delete mode 100644 tools/evidence/2026-10-11-remaining-optimization/3.11-released-main.json delete mode 100644 tools/evidence/2026-10-11-remaining-optimization/3.11-released-ordinary.json delete mode 100644 tools/evidence/2026-10-11-remaining-optimization/3.11-released-shape.json delete mode 100644 tools/evidence/2026-10-11-remaining-optimization/3.11-root-combined.json delete mode 100644 tools/evidence/2026-10-11-remaining-optimization/3.11-root-dtype.json delete mode 100644 tools/evidence/2026-10-11-remaining-optimization/3.11-root-main.json delete mode 100644 tools/evidence/2026-10-11-remaining-optimization/3.11-root-shape.json delete mode 100644 tools/evidence/2026-10-11-remaining-optimization/3.14-hook-lookup-alternatives.json delete mode 100644 tools/evidence/2026-10-11-remaining-optimization/3.14-proposal-combined.json delete mode 100644 tools/evidence/2026-10-11-remaining-optimization/3.14-proposal-dtype.json delete mode 100644 tools/evidence/2026-10-11-remaining-optimization/3.14-proposal-main.json delete mode 100644 tools/evidence/2026-10-11-remaining-optimization/3.14-proposal-ordinary.json delete mode 100644 tools/evidence/2026-10-11-remaining-optimization/3.14-proposal-shape.json delete mode 100644 tools/evidence/2026-10-11-remaining-optimization/3.14-released-combined.json delete mode 100644 tools/evidence/2026-10-11-remaining-optimization/3.14-released-dtype.json delete mode 100644 tools/evidence/2026-10-11-remaining-optimization/3.14-released-main.json delete mode 100644 tools/evidence/2026-10-11-remaining-optimization/3.14-released-ordinary.json delete mode 100644 tools/evidence/2026-10-11-remaining-optimization/3.14-released-shape.json delete mode 100644 tools/evidence/2026-10-11-remaining-optimization/3.14-root-combined.json delete mode 100644 tools/evidence/2026-10-11-remaining-optimization/3.14-root-dtype.json delete mode 100644 tools/evidence/2026-10-11-remaining-optimization/3.14-root-main.json delete mode 100644 tools/evidence/2026-10-11-remaining-optimization/3.14-root-shape.json delete mode 100644 tools/evidence/2026-10-11-remaining-optimization/README.md delete mode 100644 tools/evidence/2026-10-11-remaining-optimization/cold-dtype-samples.json delete mode 100644 tools/evidence/2026-10-11-remaining-optimization/experiments.json delete mode 100644 tools/evidence/2026-10-11-remaining-optimization/identity.json delete mode 100644 tools/probe_union.py delete mode 100644 tools/smoke_minimal.py delete mode 100644 tools/upstream/DESIGN_REVIEW.md delete mode 100644 tools/upstream/README.md delete mode 100644 tools/upstream/benchmark_transactions.py delete mode 100644 tools/upstream/evidence/2026-10-11-isolation/README.md delete mode 100644 tools/upstream/evidence/2026-10-11-isolation/native-stability-314.json delete mode 100644 tools/upstream/evidence/2026-10-11-isolation/runtime-correctness-311.json delete mode 100644 tools/upstream/evidence/2026-10-11-isolation/runtime-correctness-314.json delete mode 100644 tools/upstream/evidence/2026-10-11-isolation/runtime-optimized-311.json delete mode 100644 tools/upstream/evidence/2026-10-11-isolation/runtime-optimized-314.json delete mode 100644 tools/upstream/evidence/2026-10-11-isolation/runtime-released-311.json delete mode 100644 tools/upstream/evidence/2026-10-11-isolation/runtime-released-314.json delete mode 100644 tools/upstream/evidence/2026-10-11-isolation/transactions-correctness-311.json delete mode 100644 tools/upstream/evidence/2026-10-11-isolation/transactions-correctness-314.json delete mode 100644 tools/upstream/evidence/2026-10-11-isolation/transactions-optimized-311.json delete mode 100644 tools/upstream/evidence/2026-10-11-isolation/transactions-optimized-314.json delete mode 100644 tools/upstream/evidence/2026-10-11-isolation/transactions-released-311.json delete mode 100644 tools/upstream/evidence/2026-10-11-isolation/transactions-released-314.json delete mode 100644 tools/upstream/evidence/2026-10-11/README.md delete mode 100644 tools/upstream/evidence/2026-10-11/correctness311.json delete mode 100644 tools/upstream/evidence/2026-10-11/correctness314.json delete mode 100644 tools/upstream/evidence/2026-10-11/optimized311.json delete mode 100644 tools/upstream/evidence/2026-10-11/optimized314.json delete mode 100644 tools/upstream/evidence/2026-10-11/released311.json delete mode 100644 tools/upstream/evidence/2026-10-11/released314.json delete mode 100644 tools/upstream/patches/0001-state.patch delete mode 100644 tools/upstream/patches/0002-scope-correctness.patch delete mode 100644 tools/upstream/patches/0003-ordinary-performance.patch delete mode 100644 tools/upstream/patches/series.json delete mode 100644 tools/upstream/test_audit_composition.py delete mode 100644 tools/upstream/test_scope_isolation.py delete mode 100644 tools/upstream/test_scope_transactions.py delete mode 100644 tools/upstream/test_union_transactions.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 62b96c1..0fef19a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,6 +4,9 @@ on: push: branches: [main] pull_request: + schedule: + # Weekly, so new beartype prereleases are tested even without bearshape pushes. + - cron: "0 4 * * 1" workflow_dispatch: permissions: @@ -13,6 +16,157 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +defaults: + run: + shell: bash + +env: + UV_TORCH_BACKEND: cpu + jobs: - validate: - uses: ./.github/workflows/validate.yml + quality: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + - uses: astral-sh/setup-uv@v10 + with: + version: "0.13.0" + - run: uv run --locked --only-group dev prek run -a + - run: uv run --locked --only-group dev prek run actionlint -a --stage manual + + test: + name: test (${{ matrix.os }}, ${{ matrix.python }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + python: ["3.11", "3.12", "3.13", "3.14"] + include: + - { os: macos-latest, python: "3.11" } + - { os: macos-latest, python: "3.14" } + - { os: windows-latest, python: "3.11" } + - { os: windows-latest, python: "3.14" } + steps: + - uses: actions/checkout@v7 + - uses: astral-sh/setup-uv@v10 + with: + version: "0.13.0" + python-version: ${{ matrix.python }} + enable-cache: true + - run: uv sync --locked --no-default-groups --group optional --group test + - run: uv run --no-sync python tools/validate_runtime.py cpu + - run: >- + uv run --no-sync pytest tests/ --ignore=tests/test_typecheck.py -n 4 + --cov=bearshape --cov-branch --cov-report=term-missing:skip-covered + --cov-fail-under=90 + + beartype-prerelease: + # Plum-style canary for beartype release candidates (#62). It installs the + # newest beartype, prerelease or not, over the locked environment. + name: test (beartype prerelease, 3.14) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + - uses: astral-sh/setup-uv@v10 + with: + version: "0.13.0" + python-version: "3.14" + enable-cache: true + - run: uv sync --locked --no-default-groups --group optional --group test + - run: uv pip install --upgrade --pre beartype + - run: uv run --no-sync python -c "import beartype; print('beartype', beartype.__version__)" + - run: uv run --no-sync pytest tests/ --ignore=tests/test_typecheck.py -n 4 + + checkers: + name: checkers (${{ matrix.python }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python: ["3.11", "3.12", "3.13", "3.14"] + steps: + - uses: actions/checkout@v7 + - uses: astral-sh/setup-uv@v10 + with: + version: "0.13.0" + python-version: ${{ matrix.python }} + enable-cache: true + - run: uv sync --locked --no-default-groups --group optional --group static --group test + - run: uv run --no-sync pytest tests/test_typecheck.py -v + + compatibility: + name: compatibility (${{ matrix.environment }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + environment: + - py311-bt0231-numpy22 + - py311-bt0231-jax05 + - py311-bt0231-torch26 + - py311-bt0231-optree014 + - py313-bt0231-numpy24 + - py313-bt0231-jax09 + - py313-bt0231-torch210 + - py313-bt0231-optree019 + - py313-bt0231-type-pyright1408 + - py313-bt0231-type-mypy119 + - py313-bt0231-type-ty + - py313-bt0231-type-pyrefly + steps: + - uses: actions/checkout@v7 + - uses: astral-sh/setup-uv@v10 + with: + version: "0.13.0" + enable-cache: true + - run: uv run --locked --only-group test tox run -e "${{ matrix.environment }}" + + docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + - uses: astral-sh/setup-uv@v10 + with: + version: "0.13.0" + python-version: "3.14" + - run: uv run --locked --only-group docs zensical build --clean + - run: uv run --locked --only-group docs python tools/check_docs.py + - run: uv sync --locked --no-default-groups --group optional --group notebook + - run: uv run --no-sync python tools/check_notebook.py + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + - uses: astral-sh/setup-uv@v10 + with: + version: "0.13.0" + - run: uv build + - name: Smoke-test the wheel without optional backends + run: | + uv venv --python 3.11 .smoke + uv pip install --python .smoke/bin/python dist/*.whl + .smoke/bin/python -I -c "import bearshape, sys; assert 'numpy' not in sys.modules; print('bearshape', bearshape.__version__)" + + # The one status check to require on main. It succeeds only when every job + # above succeeded, so branch rules never need to list matrix job names. + check: + if: always() + needs: + [quality, test, beartype-prerelease, checkers, compatibility, docs, build] + runs-on: ubuntu-latest + steps: + - name: Require every CI job to succeed + env: + RESULTS: ${{ toJSON(needs) }} + run: | + python - <<'PY' + import json + import os + results = json.loads(os.environ["RESULTS"]) + failed = {name: job["result"] for name, job in results.items() if job["result"] != "success"} + if failed: + raise SystemExit(f"CI jobs did not succeed: {failed}") + print("All CI jobs succeeded") + PY diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 69c23bf..71b7437 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -2,7 +2,8 @@ name: Validate or deploy docs on: push: - branches: [main, docs] + branches: [main] + tags: ["v**"] workflow_dispatch: permissions: @@ -18,18 +19,19 @@ jobs: env: FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0 + - uses: actions/checkout@v7 + - uses: astral-sh/setup-uv@v10 with: version: "0.13.0" - run: uv run --locked --only-group docs zensical build --clean - run: uv run --locked --only-group docs python tools/check_docs.py - - uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 + - uses: actions/upload-pages-artifact@v5 with: path: site deploy: - if: github.event_name == 'workflow_dispatch' + # Deploy on release tags and manual runs; pushes to main only build. + if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/v') needs: build permissions: pages: write @@ -42,4 +44,4 @@ jobs: url: ${{ steps.deployment.outputs.page_url }} steps: - id: deployment - uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1 + uses: actions/deploy-pages@v5 diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml deleted file mode 100644 index bc3521a..0000000 --- a/.github/workflows/nightly.yml +++ /dev/null @@ -1,65 +0,0 @@ -name: Nightly - -on: - schedule: - - cron: "0 4 * * *" - workflow_dispatch: - -permissions: - contents: read - -concurrency: - group: ${{ github.workflow }} - cancel-in-progress: true - -jobs: - validate: - uses: ./.github/workflows/validate.yml - - dependency-canary: - name: Latest compatible dependencies (${{ matrix.python }}) - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python: ["3.11", "3.14"] - defaults: - run: - shell: bash - env: - UV_TORCH_BACKEND: cpu - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - persist-credentials: false - - uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0 - with: - version: "0.13.0" - python-version: ${{ matrix.python }} - - name: Resolve compatible runtime upgrades in this disposable checkout - run: >- - uv lock --upgrade-package beartype --upgrade-package numpy - --upgrade-package jax --upgrade-package jaxlib --upgrade-package torch - --upgrade-package optree --upgrade-package typing-extensions - - name: Install upgraded runtime with the maintained checker toolchain - run: >- - uv sync --locked --no-default-groups --group optional --group test - --group static - - name: Record exact canary inputs and validate the declared dependency range - run: | - git rev-parse HEAD > canary-source.txt - uv pip list --format json > canary-packages.json - uv run --no-sync python tools/validate_runtime.py cpu --latest-compatible > canary-runtime.json - - name: Test runtime and all four consumer checkers - run: uv run --no-sync pytest tests/ -n auto | tee canary-tests.log - - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 - if: always() - with: - name: dependency-canary-${{ matrix.python }} - path: | - uv.lock - canary-source.txt - canary-packages.json - canary-runtime.json - canary-tests.log - if-no-files-found: error diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 61c4e19..aea164f 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -1,155 +1,55 @@ -name: Validate or publish release +name: release + +# Push a "v"-prefixed tag that matches the version in pyproject.toml (for +# example "v0.1.0") to publish a GitHub Release and upload it to PyPI. on: - release: - types: [published] - workflow_dispatch: - inputs: - ref: - description: Ref to validate; publication requires v - required: true - type: string - publish: - description: Publish validated artifacts to PyPI after environment approval - required: true - default: false - type: boolean + push: + tags: + - "v**" permissions: contents: read -defaults: - run: - shell: bash - -concurrency: - group: pypi-${{ github.event_name == 'workflow_dispatch' && inputs.ref || github.event.release.tag_name }} - cancel-in-progress: false - jobs: - resolve: + release: + name: Create tagged release on GitHub runs-on: ubuntu-latest - outputs: - sha: ${{ steps.identity.outputs.sha }} - version: ${{ steps.identity.outputs.version }} - publish: ${{ steps.identity.outputs.publish }} + permissions: + contents: write steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - ref: ${{ github.event_name == 'workflow_dispatch' && inputs.ref || github.event.release.tag_name }} - fetch-depth: 0 - persist-credentials: false - - uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0 + - uses: actions/checkout@v7 + - uses: astral-sh/setup-uv@v10 with: version: "0.13.0" - python-version: "3.14" - - name: Resolve and validate release identity - id: identity + - name: Check that the tag matches the package version env: - RELEASE_REF: ${{ github.event_name == 'workflow_dispatch' && inputs.ref || github.event.release.tag_name }} - PUBLISH: ${{ github.event_name == 'release' || inputs.publish }} + TAG: ${{ github.ref_name }} run: | - PROJECT_VERSION="$(uv version --short)" uv run --locked --only-group dev python tools/check_release.py - - validate: - needs: resolve - uses: ./.github/workflows/validate.yml - with: - ref: ${{ needs.resolve.outputs.sha }} - - contract: - name: Full composition release contract (${{ matrix.python }}) - needs: [resolve, validate] - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python: ["3.11", "3.14"] - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - ref: ${{ needs.resolve.outputs.sha }} - persist-credentials: false - - uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0 - with: - version: "0.13.0" - python-version: ${{ matrix.python }} - - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 - with: - name: candidate-distributions - path: dist/ - - name: Install exact candidate with the locked test dependencies - run: | - uv sync --locked --no-default-groups --group optional --group test - uv pip install --no-deps --reinstall dist/*.whl - - name: Require full native union semantics from the installed wheel - run: | - .venv/bin/python -I -m pytest tools/upstream/ -n 0 - .venv/bin/python -I tools/probe_union.py - - evidence: - needs: [resolve, validate, contract] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - ref: ${{ needs.resolve.outputs.sha }} - persist-credentials: false - - uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0 - with: - version: "0.13.0" - python-version: "3.14" - - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 - with: - name: candidate-distributions - path: dist/ - - name: Record validated artifact identity - env: - SOURCE_SHA: ${{ needs.resolve.outputs.sha }} - PROJECT_VERSION: ${{ needs.resolve.outputs.version }} - RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - run: >- - uv run --locked --only-group dev python tools/check_release_evidence.py - record release-evidence.json dist - --source-sha "$SOURCE_SHA" --version "$PROJECT_VERSION" --run-url "$RUN_URL" - - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 - with: - name: release-evidence - path: release-evidence.json - if-no-files-found: error - - publish: - name: Publish validated artifacts to PyPI - if: needs.resolve.outputs.publish == 'true' - needs: [resolve, validate, contract, evidence] + version="$(uv version --short)" + if [ "$TAG" != "v$version" ]; then + echo "Tag $TAG does not match pyproject.toml version $version" >&2 + exit 1 + fi + - uses: ncipollo/release-action@v1 + with: + name: bearshape ${{ github.ref_name }} + generateReleaseNotes: true + prerelease: ${{ contains(github.ref_name, 'a') || contains(github.ref_name, 'b') || contains(github.ref_name, 'rc') }} + + pypi: + name: Publish tagged release to PyPI + needs: release runs-on: ubuntu-latest environment: name: pypi - url: https://pypi.org/p/bearshape + url: https://pypi.org/project/bearshape/ permissions: - contents: read id-token: write steps: - - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 - with: - name: candidate-distributions - path: dist/ - - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 + - uses: actions/checkout@v7 + - uses: astral-sh/setup-uv@v10 with: - name: release-evidence - path: evidence/ - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - ref: ${{ needs.resolve.outputs.sha }} - path: source/ - persist-credentials: false - - name: Verify approved bytes immediately before upload - env: - SOURCE_SHA: ${{ needs.resolve.outputs.sha }} - PROJECT_VERSION: ${{ needs.resolve.outputs.version }} - RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - run: >- - python source/tools/check_release_evidence.py - verify evidence/release-evidence.json dist - --source-sha "$SOURCE_SHA" --version "$PROJECT_VERSION" --run-url "$RUN_URL" - - uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # release/v1 + version: "0.13.0" + - run: uv build + - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/upstream-proposal.yml b/.github/workflows/upstream-proposal.yml deleted file mode 100644 index bdc5871..0000000 --- a/.github/workflows/upstream-proposal.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Validate local upstream proposal - -on: - pull_request: - paths: - - "src/**" - - "tests/**" - - "tools/**" - - "pyproject.toml" - - "uv.lock" - - ".github/workflows/upstream-proposal.yml" - workflow_dispatch: - -permissions: - contents: read - -defaults: - run: - shell: bash - -jobs: - proposal: - name: Proposal (${{ matrix.python }}) - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python: ["3.11", "3.14"] - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - path: bearshape - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: beartype/beartype - ref: f85b67d8b0b6bd9c910bd97f0d2d417c4550b038 - path: upstream - - uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0 - with: - version: "0.13.0" - python-version: ${{ matrix.python }} - - name: Build and test normally installed proposal wheels - working-directory: bearshape - env: - PROPOSAL_PYTHON: ${{ matrix.python }} - run: | - uv run --locked --only-group dev python tools/check_upstream_proposal.py \ - --upstream-source ../upstream --output ../proposal-evidence \ - --python "$PROPOSAL_PYTHON" - - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 - if: always() - with: - name: local-proposal-${{ matrix.python }} - path: | - proposal-evidence/commands.json - proposal-evidence/evidence.json - proposal-evidence/dist/ diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml deleted file mode 100644 index 66cb58e..0000000 --- a/.github/workflows/validate.yml +++ /dev/null @@ -1,251 +0,0 @@ -name: Validate candidate - -on: - workflow_call: - inputs: - ref: - description: Exact commit to validate; defaults to the caller event SHA - type: string - default: "" - -permissions: - contents: read - -defaults: - run: - shell: bash - -env: - UV_TORCH_BACKEND: cpu - -jobs: - quality: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - ref: ${{ inputs.ref || github.sha }} - - uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0 - with: - version: "0.13.0" - - name: Verify installed hook stages - run: | - uv run --locked --only-group dev prek install - test ! -e "$(git rev-parse --git-path hooks/commit-msg)" - message_file="$(mktemp)" - printf '%s\n' 'Hook stage validation' > "$message_file" - uv run --locked --only-group dev prek run --stage commit-msg --commit-msg-filename "$message_file" - - run: uv run --locked --only-group dev prek run -a - - run: uv run --locked --only-group dev prek run actionlint -a --stage manual - - run: git diff --exit-code - - runtime: - name: Runtime (${{ matrix.os }}, ${{ matrix.python }}) - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - python: ["3.11", "3.12", "3.13", "3.14"] - include: - - { os: macos-latest, python: "3.11" } - - { os: macos-latest, python: "3.14" } - - { os: windows-latest, python: "3.11" } - - { os: windows-latest, python: "3.14" } - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - ref: ${{ inputs.ref || github.sha }} - - uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0 - with: - version: "0.13.0" - python-version: ${{ matrix.python }} - enable-cache: true - - run: uv sync --locked --no-default-groups --group optional --group test - - run: uv run --no-sync python tools/validate_runtime.py cpu - - run: >- - uv run --no-sync pytest tests/ --ignore=tests/test_typecheck.py -n 4 - --cov=bearshape --cov-branch --cov-report=term-missing:skip-covered - --cov-fail-under=90 - - checkers: - name: Four checkers (Python ${{ matrix.python }}) - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python: ["3.11", "3.12", "3.13", "3.14"] - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - ref: ${{ inputs.ref || github.sha }} - - uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0 - with: - version: "0.13.0" - python-version: ${{ matrix.python }} - enable-cache: true - - run: uv sync --locked --no-default-groups --group optional --group static --group test - - run: uv run --no-sync python tools/validate_runtime.py type - - run: uv run --no-sync pytest tests/test_typecheck.py -v - - compatibility: - name: Compatibility (${{ matrix.environment }}) - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - environment: - - py311-bt0231-numpy22 - - py311-bt0231-jax05 - - py311-bt0231-torch26 - - py311-bt0231-optree014 - - py313-bt0231-numpy24 - - py313-bt0231-jax09 - - py313-bt0231-torch210 - - py313-bt0231-optree019 - - py313-bt0231-type-pyright1408 - - py313-bt0231-type-mypy119 - - py313-bt0231-type-ty - - py313-bt0231-type-pyrefly - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - ref: ${{ inputs.ref || github.sha }} - - uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0 - with: - version: "0.13.0" - enable-cache: true - - run: uv run --locked --only-group test tox run -e "${{ matrix.environment }}" - - docs: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - ref: ${{ inputs.ref || github.sha }} - - uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0 - with: - version: "0.13.0" - - run: uv run --locked --only-group docs zensical build --clean - - run: uv run --locked --only-group docs python tools/check_docs.py - - uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 - with: - name: docs-validation-pages - path: site/ - retention-days: 1 - - notebook: - name: Tour notebook (Python ${{ matrix.python }}) - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python: ["3.11", "3.14"] - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - ref: ${{ inputs.ref || github.sha }} - - uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0 - with: - version: "0.13.0" - python-version: ${{ matrix.python }} - enable-cache: true - - run: uv sync --locked --no-default-groups --group optional --group notebook - - run: uv run --no-sync python tools/validate_runtime.py cpu - - run: uv run --no-sync python tools/check_notebook.py - - distributions: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - ref: ${{ inputs.ref || github.sha }} - - uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0 - with: - version: "0.13.0" - - run: uv build --sdist - - run: uv build dist/*.tar.gz --wheel - - run: uv run --locked --only-group dev python tools/check_distribution.py dist/*.whl dist/*.tar.gz - - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 - with: - name: candidate-distributions - path: dist/ - if-no-files-found: error - - minimal: - name: Minimal wheel (Python ${{ matrix.python }}) - needs: distributions - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python: ["3.11", "3.14"] - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - ref: ${{ inputs.ref || github.sha }} - - uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0 - with: - version: "0.13.0" - - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 - with: - name: candidate-distributions - path: dist/ - - run: uv venv --python "${{ matrix.python }}" .minimal - - run: uv pip install --python .minimal/bin/python dist/*.whl "beartype==0.23.1" - - run: .minimal/bin/python -I tools/smoke_minimal.py - - installed: - name: Installed consumers (Python ${{ matrix.python }}) - needs: distributions - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python: ["3.11", "3.14"] - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - ref: ${{ inputs.ref || github.sha }} - - uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0 - with: - version: "0.13.0" - enable-cache: true - - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 - with: - name: candidate-distributions - path: dist/ - - run: >- - uv run --locked --only-group dev python tools/check_installed.py - dist/*.whl dist/*.tar.gz --python "${{ matrix.python }}" - - required: - name: Required validation - if: always() - needs: - [ - quality, - runtime, - checkers, - compatibility, - docs, - notebook, - distributions, - minimal, - installed, - ] - runs-on: ubuntu-latest - steps: - - name: Require every validation job to succeed - env: - RESULTS: ${{ toJSON(needs) }} - run: | - python - <<'PY' - import json - import os - results = json.loads(os.environ["RESULTS"]) - failed = {name: job["result"] for name, job in results.items() if job["result"] != "success"} - if failed: - raise SystemExit(f"Required validation did not succeed: {failed}") - print("All required validation jobs succeeded") - PY diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5954008..de404d0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,8 +21,6 @@ repos: - repo: builtin hooks: - id: trailing-whitespace - # Unified diffs require the leading space on blank context lines. - exclude: ^tools/upstream/patches/.*\.patch$ priority: 20 - id: check-added-large-files priority: 10 @@ -80,15 +78,13 @@ repos: rev: v1.51.1 hooks: - id: typos - # Preserve exact upstream identifiers and the reviewed patch digests. - exclude: ^tools/upstream/patches/.*\.patch$ priority: 40 - repo: https://github.com/executablebooks/mdformat rev: 1.0.0 hooks: - id: mdformat - exclude: ^(AGENTS\.md|PLANS\.md|plans/.*\.md)$ + exclude: ^AGENTS\.md$ language: python # means renovate will also update `additional_dependencies` args: - --wrap @@ -109,7 +105,7 @@ repos: rev: v0.49.1 hooks: - id: markdownlint-fix - exclude: ^(AGENTS\.md|PLANS\.md|plans/.*\.md)$ + exclude: ^AGENTS\.md$ priority: 40 - repo: https://github.com/rbubley/mirrors-prettier diff --git a/AGENTS.md b/AGENTS.md index 9b203a5..923906e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,141 +1,48 @@ # bearshape agents bearshape checks runtime array shapes, dtypes and tree constraints through -beartype. Scientific Python developers and library authors use its annotations -at API boundaries alongside native backend types. Keep the public identity -lowercase `bearshape`. - -This is the shared Codex/Claude instruction file. `CLAUDE.md` points here. -Human setup and commands live in `CONTRIBUTING.md`; tool usage lives in -`tools/README.md`. Read `docs/maintainers/production-readiness.md` and the -task's plan before changing a contract. `plans/README.md` identifies current -guidance and dated evidence; current owner decisions take precedence. +beartype. Keep the public identity lowercase `bearshape`. `CLAUDE.md` points +here. Setup and commands live in `CONTRIBUTING.md`; releasing lives in +`docs/maintainers/releasing.md`. ## Working rules -- State assumptions before changing behavior. Resolve routine implementation - choices within the approved scope; ask when a missing decision changes the - public contract or acceptance criteria. -- Maintenance is now surgical by default. The rename is complete. No speculative - features, duplicate helpers, unused abstractions or broad cleanup unrelated to - the requested work. +- Keep changes small and focused on the request. No speculative features, + unused abstractions or unrelated cleanup. - Preserve public annotation syntax and useful errors. Use explicit names, - simple control flow and the existing 2-space Python indentation. -- Keep runtime behavior and static consumer behavior aligned. Passing syntax - checks, skipped tests and inferred `Any` do not prove support. -- Do not spawn other agents unless the user requests delegation. - -## Current release contract - -- GitHub ownership transferred on 2026-09-10: use `beartype/bearshape` and - `https://beartype.github.io/bearshape/`. Preserve original authorship and - historical plan evidence. The owner reports the PyPI project in a personal - account; no transfer is required. Private trusted-publisher configuration - remains unverified; future publishing must trust owner - `beartype`, repository `bearshape`, workflow `pypi.yml`, environment `pypi`. - -- bearshape is independently versioned; the candidate is `0.1.0rc1`. -- The current dependency and test target is beartype `0.23.1`, with metadata - `>=0.23.1,<0.24`. Full native composite-union rollback is still incorrect. - The tested local `__beartype_state__` proposal and integration suite are - described in `tools/upstream/README.md`; the hook has not shipped upstream. - The owner chose full composition through supported upstream integration and - permits a later candidate. Keep exact 0.23.1 validation until supported - transaction integration is implemented and tested; update metadata, lock, - preflight and CI together. -- Do not replace beartype, monkeypatch upstream internals, infer union boundaries - from bytecode, hide the defect with an xfail, or restrict composition to make - CI pass. `tools/probe_union.py` reproduces the open release blocker. -- pyright, mypy, ty and pyrefly are supported through the consumer harness on - Python 3.11–3.14. New checkers, including zuban, need an explicit plan. -- Native CuPy static typing is explicitly limited, as accepted by the owner. - Its protocol fallback does not prove native ndarray method inference. Actual - GPU runtime evidence is recorded separately in the handoff report. -- Release readiness remains withheld until the union integration and release - prerequisites are satisfied. Merge approval does not authorize publication, - deployment, access changes, ownership transfer or messages to maintainers. + simple control flow and the existing 2-space Python indentation. +- Keep runtime behavior and static checker behavior aligned. Passing syntax + checks, skipped tests and inferred `Any` do not prove support. +- Add positive and negative regressions for changes to memo ownership, frame + discovery, async contexts, decorator metadata, dtype normalization and + static aliases. ## Product boundaries -- Root imports must not load NumPy, JAX, Torch, CuPy or optree. Backend behavior - belongs in its explicit module; do not widen the root API for shorter examples. +- Root imports must not load NumPy, JAX, Torch, CuPy or optree. Backend + behavior belongs in its explicit module. - Preserve named, anonymous, fixed, arithmetic and broadcastable dimensions, - `Scalar`, `Value(...)`, backend aliases, `Like[...]`, scalar-like types and - `Tree[...]`. Dimensions are runtime constraints, not static shape proofs. -- NumPy owns the broadest dtype/scalar/Like surface. Other backends use their - own native arrays and selected converters. Like validation does not replace - the caller's argument or retry failed conversions through a different backend. -- Bare `@check` manages memo scope. Combine it with `@beartype`, or use - `@check(conf=...)`, to perform type checking. -- Keep runtime tree structure syntax distinct from checker-supported containers. - optree uses the default registry; there is no custom namespace API. -- `Value` expressions are trusted developer contracts, not a security sandbox. - -Memo ownership, frame discovery, failed-alternative rollback, async contexts, -decorator metadata, dtype normalization and static aliases need focused positive -and negative regressions. Preserve lifetime/weak-reference evidence when changing -state ownership. Read the feature-to-test map in the handoff report. - -## Major-work workflow - -For features, contract changes, packaging, CI, release work, substantial docs -and refactors: create a feature branch and matching worktree, commit an ExecPlan -following `PLANS.md`, and open a PR before implementation. Keep independent -changes in focused PRs and document any dependency on another PR. Use the -existing task goal when one exists; do not start duplicate goals. - -Keep the plan current and validate each milestone. Present a concrete result -before requesting merge approval. Reuse explicit approval already given in the -conversation for that scope; do not ask again solely because work crossed a -milestone or worktree. After approval and passing checks, merge, verify main and -remove only clean merged branches/worktrees after preserving evidence. - -For stacked PRs, merging a head into its actual base can mark the PR merged. -Before approval, use a separate integration branch to validate combinations. -After approval, preserve every reviewed head in the merged history, including -conflict resolutions; verify reachability before cleanup. Never force main or -delete another contributor's changes. Small, explicitly requested low-risk edits -may skip the major-work workflow. + `Scalar`, `Value(...)`, backend aliases, `Like[...]`, scalar-like types and + `Tree[...]`. Dimensions are runtime constraints, not static shape proofs. +- Bare `@check` manages memo scope only. Combine it with `@beartype`, or use + `@check(conf=...)`, to type-check. +- `Value` expressions are trusted developer contracts, not a sandbox. +- Known limitation: a union alternative that fails after binding a named + dimension can leave that binding behind + (`docs/features/composition.md`). Do not monkeypatch beartype internals or + inspect bytecode to work around it. +- pyright, mypy, ty and pyrefly are the supported checkers on Python 3.11–3.14. + Native CuPy static typing is limited. ## Validation -Use uv 0.13.0 and the committed lock. Start with `uv sync --locked`; install -hooks with `uv run --locked prek install`. Use these routes from the repository root: - -- Runtime changes: `uv run --locked pytest tests/ --ignore=tests/test_typecheck.py -n auto`. -- Typing changes: `uv run --locked pytest tests/test_typecheck.py -q`; this runs - all four engines, source checks and real positive/negative/inference consumers - with interpreter-matched settings. Direct checker commands are debugging aids. -- Normal hooks: `uv run --locked prek run -a`. -- Workflows: `uv run --locked prek run actionlint -a --stage manual`. -- Select relevant tox, docs/notebook, minimal and installed-archive checks from - `CONTRIBUTING.md` and `tools/README.md`; do not invent environment factors. - -Run a failing regression first when practical. Broaden validation when inputs or -unresolved risks justify it, not by repeatedly rerunning unchanged expensive -suites. Do not lower coverage, suppress diagnostics or remove negative fixtures -to obtain green checks. Stage new files before running hooks; review formatting -changes before committing. Git subprocesses targeting a different repository -must clear the names reported by `git rev-parse --local-env-vars`; use the -existing `git_environment` helper for release tooling and its fixtures. Real -hook execution is part of validation when changing lifecycle stages. - -CI, nightly and candidate validation share `.github/workflows/validate.yml`. -Required lanes include CPU backends, four checkers, compatibility floors, docs, -notebook and normal installed-wheel consumers. Minimal environments require an -exact sync or a fresh venv; `uv run --only-group` can retain earlier packages. -CuPy needs real CUDA hardware. CPU skips are not GPU evidence, and historical -GPU results do not validate a changed package automatically. - -## Docs and handoff +Use uv 0.13.x and the committed lock: -Keep README concise and examples test-backed. Distinguish the unpublished -checkout candidate from the PyPI release before presenting install commands. -Build and inspect changed rendered structures; execute changed runnable examples and notebook cells. Document -runtime-only syntax and backend/checker limits explicitly. Update CHANGELOG for -features and major user-visible changes. +- Runtime: `uv run --locked pytest tests/ --ignore=tests/test_typecheck.py -n auto` +- Typing: `uv run --locked pytest tests/test_typecheck.py -q` +- Hooks: `uv run --locked prek run -a` +- Workflows: `uv run --locked prek run actionlint -a --stage manual` -Record source commits, versions, artifact hashes, commands and meaningful -results in the plan or handoff report. Distinguish implementation completion, -merge state and release readiness. Keep public repository/PyPI/Pages identities -unchanged until the corresponding ownership operation has actually happened. +Do not lower coverage, suppress diagnostics or remove negative fixtures to get +green checks. CuPy needs real CUDA hardware; CPU skips are not GPU evidence. +Update `CHANGELOG.md` for user-visible changes. diff --git a/CHANGELOG.md b/CHANGELOG.md index afc1ed9..16d0d4e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,12 +8,12 @@ and this project follows ## [Unreleased] -The next candidate is **0.1.0rc1**, independently versioned from beartype and -not yet published. Python **3.11+** is required; the validated matrix is -**3.11–3.14**, with exact released beartype **0.23.1** as the current baseline -and dependency range `>=0.23.1,<0.24`. Full native composite-union rollback -still requires supported upstream integration before release. Local patches are -proposal evidence only. +## [0.1.0] - 2026-11-28 + +Requires Python **3.11+** (tested on 3.11–3.14) and beartype `>=0.23.1,<0.24`. +Named dimensions bound inside a failed union alternative can still leak into +later checks of the same call; see +[composition and limitations](https://beartype.github.io/bearshape/features/composition/). ### Fixed @@ -34,8 +34,7 @@ proposal evidence only. and foreign protocols. Do not retry failures through another backend. - Release temporary classes from the default Like trust cache with weak keys. - Keep validation state owned by its active invocation, restore failed atomic - checks and diagnostic changes, and avoid retaining checked arrays. The - broader native composite-union boundary remains the upstream release gate. + checks and diagnostic changes, and avoid retaining checked arrays. - Make `bearshape_this_package()` instrument the calling package's parameters and returns. Keep `check(conf=None)` aligned with its public overloads. - Correct normal-install origin checks for symlinked virtual environments and @@ -73,34 +72,15 @@ proposal evidence only. ### CI and release tooling - Upgrade the locked development tools, checkers, documentation and notebook - tooling. Coordinate uv 0.13.0, its build backend, hooks and workflow pins - while retaining Python 3.11 support and the existing compatibility floors. - -- Share locked candidate validation across PRs, pushes, nightly and releases: - CPU backends, four checkers, compatibility floors, coverage, docs, notebook, - installed archives and minimal environments. Use the locked Ruff toolchain. - -- Require the entire native composition/scope suite against the actual installed - candidate and published dependency before releasing. The separate upstream - proposal workflow cannot authorize publication. - -- Add a separate latest-compatible runtime/backend canary with retained lock, - source, versions and test evidence, without changing locked acceptance. - -- Build wheels from source archives, verify licenses/typing markers/package - contents, and test normal consumers outside the checkout. Ship the - regression suite and its configuration in the source archive. - -- Require immutable tag/version/source identity and verified artifact hashes - before OIDC trusted publishing. Support validation-only runs and document - developer preparation, approval, upload and recovery. Final CUDA evidence - must match the exact final wheel. - -- Keep Pages deployment manually authorized while building/packaging docs in CI. - Use reviewed Node 24 actions and preserve rendered tables/admonitions. - -- Scope file hooks to pre-commit, remove the unused commit-message hook, clear - inherited Git repository variables in release tooling, and test hook stages. + tooling, and coordinate uv 0.13.0 across hooks, CI and the build backend. +- Run one CI workflow: hooks, CPU runtime on Linux, macOS and Windows, the four + checkers, compatibility floors, docs, the tour notebook and a wheel smoke + test, summarized by a single `check` status. +- Test against the newest beartype prerelease on every PR and weekly. +- Release by pushing a `v` tag: the workflow creates the GitHub Release + and publishes to PyPI with trusted publishing. Docs deploy on tags. +- Pin GitHub Actions to major-version tags and remove the ExecPlan, evidence and + upstream-proposal tooling. ### Maintenance @@ -108,17 +88,16 @@ proposal evidence only. identities to `beartype/bearshape` and `beartype.github.io/bearshape`. Preserve original authorship and historical evidence; private PyPI trust remains a separate verification. -- Align shared agent guidance, execution plans, contributor commands and - maintainer handoff with current ownership and validation responsibilities. +- Align shared agent guidance and contributor commands with current ownership. - Use the required typing backports on supported interpreters, and build the documentation with Zensical while preserving the established site design. ### Documentation -- Distinguish the unpublished candidate from the PyPI release, document the - union limitation and correct public factory, Like and decorator examples. -- Complete the contributor review workflow, validation recipes and current - handoff while retaining clearly marked historical evidence. +- Document the union limitation and correct public factory, Like and decorator + examples. +- Add a README docs link and CI badge (from #59), and a short contributor guide + and release runbook. ## [0.0.1] - 2026-03-31 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6f1a106..061e3b2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,80 +1,26 @@ # Contributing -The current development candidate is **0.1.0rc1**, with Python **3.11–3.14** and -exact **beartype 0.23.1** in validation. It is unpublished. Normal CI is green, -but the [native-union release blocker](docs/features/composition.md) remains -open. Local upstream patches are proposal evidence, not a supported replacement -dependency. +bearshape supports Python **3.11–3.14** and beartype **>=0.23.1,\<0.24**. The +known limitation with named dimensions inside union alternatives is described in +[composition and limitations](docs/features/composition.md). -## From an idea to a reviewed change +## Workflow -1. For a bug, describe the smallest reproducer, expected/actual behavior and - Python, bearshape, beartype and backend versions in an issue or draft PR. - For a public-contract change, agree on scope before implementing it. Keep - independent fixes and optimizations in separate PRs. -1. Fork the repository if you do not have write access, then clone your fork. - Add `https://github.com/beartype/bearshape.git` as an `upstream` remote. - Contributors with write access can clone that repository directly. Work - from current `main` in a feature branch; do not edit or force-push main. -1. For features, contract changes, CI/release work, substantial docs or - refactors, create a dedicated worktree, commit an ExecPlan under `plans/` - following [PLANS.md](PLANS.md), then open a draft PR before implementation. - Small, low-risk corrections can use a normal feature branch. State - dependencies when stacking PRs. [The plan index](plans/README.md) separates - active guidance from dated implementation records. -1. Reproduce a bug with a failing regression where practical, then make the - smallest fix. Preserve annotation syntax, useful errors and backend import - boundaries. Use the existing two-space Python indentation. Changes to state - ownership need failure, nesting, async and lifetime evidence; typing - changes need positive, negative and native inference consumers in all four - engines. -1. Run the relevant local checks below and update affected guides/examples and - the changelog for user-visible changes. Keep the ExecPlan's progress, - decisions and results current. Distinguish local results, hosted checks, - expected skips and known release blockers. Never hide a defect with an - xfail, a removed negative fixture or a lower coverage threshold. -1. Push to your branch or fork and target `beartype/bearshape:main`. The PR - should explain the user-visible problem and behavior, link its plan/issue, - list dependencies and give the commands/results needed to review it. Mark - it ready when implementation and required checks pass; address review - feedback in focused commits. -1. Maintainers merge only with explicit approval and successful checks on the - reviewed history. Preserve all reviewed heads and integration resolutions, - verify main, then remove only clean merged branches/worktrees after saving - useful evidence. Merge approval never authorizes publication, deployment, - access changes or upstream messages. +1. For a bug, open an issue or draft PR with the smallest reproducer, the + expected and actual behavior, and your Python, bearshape, beartype and + backend versions. Agree on scope before changing public behavior. +1. Work in a feature branch from current `main` (fork first if you lack write + access). Keep independent changes in separate PRs. +1. Add a failing regression first when practical, then make the smallest fix. + Preserve annotation syntax, useful errors and backend import boundaries. + The code uses two-space indentation. +1. Run the checks below, update affected docs and examples, and add a + `CHANGELOG.md` entry for user-visible changes. +1. Open a PR against `main`. It merges by squash once the `check` status passes. -A worktree is a second checkout sharing the same Git history. From a clean, -up-to-date local main, a substantial change can start with: +## Local development -```bash -git worktree add ../bearshape-my-change -b my-change main -cd ../bearshape-my-change -``` - -Run the setup below inside that checkout. Push to your fork's remote when using -one; you do not need release credentials, organization access or CUDA hardware -to contribute CPU changes. Report an unavailable hardware check explicitly. - -## Local Development - -Install Git and uv, and select a supported Python interpreter. The repository -uses uv-managed Python and uv can download a missing interpreter during sync. -For example, `uv sync --locked --python 3.11` selects the oldest supported -version; use `--python 3.14` in a separate environment for endpoint validation. - -The canonical repository is -[beartype/bearshape](https://github.com/beartype/bearshape). Only for an old -checkout whose `origin` still points to the former canonical owner (not a fork), -update that URL: - -```bash -git remote set-url origin https://github.com/beartype/bearshape.git -``` - -Use **uv 0.13.0** (the project accepts uv 0.13.x). To bootstrap it alongside a -different global uv version, run `uv tool install uv==0.13.0` from outside this -checkout, then ensure its executable is first on PATH. +Install Git and [uv](https://docs.astral.sh/uv/) **0.13.x**, then: ```bash uv sync --locked @@ -84,205 +30,40 @@ uv run --locked pytest tests/ --ignore=tests/test_typecheck.py -n auto uv run --locked pytest tests/test_typecheck.py -q ``` -When upgrading an existing checkout from the earlier hook configuration, remove -its unused commit-message shim once with -`uv run --locked prek uninstall --hook-type commit-msg`, then run the install -command above. File checks default to pre-commit. Runtime/checker checks remain -at pre-push, environment sync at checkout/merge/rewrite, and actionlint manual. -CI verifies installation and that commit-message paths do not enter file checks. - -The checker harness runs pyright, mypy, ty and pyrefly against source and real -positive/negative/inference consumers, with interpreter-matched settings. Direct -checker commands are useful for debugging but do not replace that harness. Use -`-n auto` for runtime tests; use `-n0` for narrow serial debugging. - -The default groups include CPU NumPy/JAX/Torch/optree, all four checkers, tests, -docs, notebook and development tools. Use exact -`uv sync --locked --only-group ` or a fresh venv when proving dependency -isolation: `uv run --only-group` can retain packages from earlier runs. CuPy -runtime validation needs real CUDA hardware. The -[handoff report](docs/maintainers/production-readiness.md) records GPU evidence -and the accepted limits of native CuPy static typing. - -Agent instructions are shared by `AGENTS.md` and the `CLAUDE.md` symlink. -`PLANS.md` describes major-work plans; [tools/README.md](tools/README.md) -describes the validation scripts, their inputs and what their results prove. - -## Repository map and choosing checks +The default dependency groups install CPU NumPy, JAX, Torch and optree, the four +static checkers (pyright, mypy, ty, pyrefly), docs and notebook tools. The +typing suite runs all four checkers against positive, negative and inference +consumers in `tests/typing/` and `tests/typing_negative/`. CuPy tests need real +CUDA hardware and skip on CPU machines. -`src/bearshape/` contains the lightweight root API, shared validators and -explicit backend modules. Runtime regressions live in `tests/test_*.py`; -positive/static inference consumers live in `tests/typing/`, with deliberately -invalid callers in `tests/typing_negative/`. `docs/` is the website, and -`examples/bearshape_tour.ipynb` is its executable tour. `tools/` contains -existing validators; `.github/workflows/validate.yml` is the shared acceptance -matrix. Plans and `tools/evidence/` retain dated experiments, not current -install recipes. +## Repository map - +- `src/bearshape/`: the lightweight root API, shared validators and the explicit + backend modules. The root import must not load NumPy or any backend. +- `tests/`: runtime and typing regressions. +- `docs/`: the website; `examples/bearshape_tour.ipynb` is its executable tour. +- `tools/`: small validation scripts, described in + [tools/README.md](tools/README.md). +- `.github/workflows/ci.yml`: everything CI runs. Its final `check` job is the + single required status. -| Changed surface | Relevant checks in addition to normal hooks | -| ---------------------------------- | ---------------------------------------------------------------------------- | -| Runtime / backend / memo | Runtime suite above; affected backend/floor and lifetime cases | -| Static aliases / public signatures | Full `tests/test_typecheck.py` consumer harness | -| User docs / examples | Docs build and rendered/syntax check; execute affected examples and notebook | -| Dependencies / package metadata | Locked sync, relevant tox factors, archive integrity and installed consumers | -| Workflow / release tooling | Manual actionlint, relevant tooling regressions and actual hook stages | +## Compatibility floors - - -Normal hooks run on every change; the actual pre-push hook runs runtime and -four-checker validation. The docs checker parses snippets but does not execute -them. Exercise changed runnable examples as real calls, including their intended -failures; compilation alone is insufficient. The full hosted matrix remains -required even when only a smaller local check is relevant. - -For a fresh minimal consumer, build the archives first, then use a new venv: - -```bash -uv venv build/minimal --python 3.11 -uv pip install --python build/minimal/bin/python \ - dist/bearshape-0.1.0rc1-py3-none-any.whl "beartype==0.23.1" -build/minimal/bin/python -I tools/smoke_minimal.py -``` - -On Windows use `build\minimal\Scripts\python.exe`. Substitute the current -project version and repeat with Python 3.14 when that boundary changes. Do not -reuse a populated development environment to prove optional-dependency -isolation. - -## Tox environments and CI - -Runtime factors use `{python}-{beartype}-{backend}`; checker factors use -`{python}-{beartype}-type-{checker}`. For example: +`tox.toml` tests the oldest and newest supported backend and checker versions. +Environment names follow `{python}-{beartype}-{backend}` or +`{python}-{beartype}-type-{checker}`: ```bash uv run --locked tox list -uv run --locked tox run -e py311-bt0231-cpu -uv run --locked tox run -e py314-bt0231-cpu uv run --locked tox run -e py311-bt0231-numpy22 -uv run --locked tox run -e py313-bt0231-type-pyright1408 uv run --locked tox run -e py313-bt0231-type-mypy119 -uv run --locked tox run -e py313-bt0231-type-ty -uv run --locked tox run -e py313-bt0231-type-pyrefly -``` - -Type environments install all CPU backends. CuPy is not part of those lanes. -`dev` uses the current lock; explicit backend/checker factors exercise the -configured compatibility ranges. Every baseline lane requires exact beartype -0.23.1. Native composite-union rollback remains a release blocker and requires a -supported upstream integration; passing these lanes alone does not close it. - -Pull requests, main pushes, nightly and candidate validation use the same -required matrix in `.github/workflows/validate.yml`. When adding a version, -update `tox.toml`, `tools/validate_tox_env.py`, the runtime preflight, lockfile -and shared workflow as applicable. The dependency range alone does not prove -compatibility with a new version. - -## Check release archives - -Build the source distribution first, then build the wheel from that archive: - -```bash -uv build --sdist -uv build dist/bearshape-.tar.gz --wheel -uv run --locked --only-group dev python tools/check_distribution.py \ - dist/bearshape--py3-none-any.whl dist/bearshape-.tar.gz -``` - -Replace `` with the project version. The check verifies license text, -metadata, inline typing information, matching package contents, and downstream -test inputs. It prints artifact hashes for release evidence. The source archive -includes the tests, lockfile and configuration needed to run `uv sync --locked` -and `uv run --locked pytest`. For the complete contributor workflow, use a Git -checkout: the archive does not include the website sources, plans or GitHub -configuration. CuPy still requires a separate CUDA environment. - -## Candidate validation - -CI and nightly use `.github/workflows/validate.yml`. Current locked CPU backends -run on Python 3.11–3.14 on Linux, with endpoint jobs on macOS and Windows. -Four-checker consumer tests run on every supported Python on Linux. Separate tox -jobs exercise backend and checker floors with exact beartype 0.23.1. -`tools/validate_runtime.py` fails if an expected backend is absent or Torch is a -CUDA/ROCm build in a CPU lane. Optional local skips do not establish support. - -Use `uv run --locked prek run -a` for the normal hooks and -`uv run --locked prek run actionlint -a --stage manual` for workflow checks. -Pre-push checks use the locked four-checker harness and runtime suite. The -required CI gate accepts only successful completion of every required job. CuPy -GPU validation remains a separate hardware-backed requirement. - -To validate the installed artifact after building the sdist and its wheel, run: - -```bash -uv run --locked python tools/check_installed.py \ - dist/*.whl dist/*.tar.gz --python 3.11 ``` -Repeat with `--python 3.14`. The command installs locked dependencies and the -wheel normally in a temporary environment, then runs copied runtime and checker -fixtures with no package source directory. It reports artifact hashes and -installed module origins. `--installed-package` is an explicit pytest mode for -this consumer check; ordinary source validation continues to include `src`. - -The separate read-only `upstream-proposal.yml` workflow applies the reviewed -patch series only in disposable upstream checkouts and validates installed -consumers at both Python endpoints. -[Its reproduction guide](tools/upstream/README.md) is for work on the open -integration boundary. Do not apply those patches to a normal development -environment or treat its green result as published support. +When adding a version, update `tox.toml`, `tools/validate_tox_env.py`, `uv.lock` +and `ci.yml` together. CI also runs the suite against the newest beartype +prerelease, weekly and on every PR, to catch upstream changes early. -## Validate and publish a release - -The [maintainer release runbook](docs/maintainers/releasing.md) describes -preparation, exact-artifact review, external prerequisites, future publication -and failure recovery. Full native-union composition is an additional required -release gate; published beartype 0.23.1 currently fails it. - -Run a validation-only workflow before making a release decision: - -```bash -gh workflow run pypi.yml --repo beartype/bearshape --ref main \ - -f ref= -F publish=false -``` - -This resolves one commit, runs the complete shared matrix, and produces -`candidate-distributions` plus `release-evidence`. The evidence records the -source SHA, version, artifact hashes and run URL. A failed required check -prevents publication. GPU runtime evidence and open contract decisions still -require review; CPU CI does not replace them. - -Publication requires a canonical `v` tag already in `main` -history. Both the workflow and package must come from that exact tag and commit. -Versions use `X.Y.Z` with an optional `aN`, `bN` or `rcN` suffix. A GitHub -release must be marked as a prerelease exactly when its version has such a -suffix. After explicit owner approval, publish that GitHub release, or dispatch -the workflow from the same tag with `publish=true`. Publishing downloads the -same tested distributions and does not rebuild them. Only that job receives OIDC -permission and enters the `pypi` environment. - -Before enabling publication, configure required review for `pypi`, prevent -self-approval and administrator bypass, and limit its deployment policy to -release tags. Protect `main` and release tags, and require the final validation -check on pull requests. Confirm the PyPI trusted publisher identifies the actual -repository owner/name, `pypi.yml`, and environment `pypi`. The workflow does not -create these controls. The 2026-09-08 inspection found unprotected `main`, no -repository rulesets and no `pypi` approval reviewers; PyPI configuration remains -unverified. The GitHub transfer to `beartype/bearshape` was verified on -2026-09-10. - -Before the next release, a PyPI project owner must inspect -[the publishing settings](https://pypi.org/manage/project/bearshape/settings/publishing/) -and ensure the trusted publisher has repository owner `beartype`, repository -name `bearshape`, workflow filename `pypi.yml`, and environment `pypi`. GitHub -repository redirects do not update that external trust configuration. See -[PyPI's publisher setup](https://docs.pypi.org/trusted-publishers/adding-a-publisher/). -Keep OIDC; do not add an upload token. GitHub transfer does not establish PyPI -ownership. Published version `0.0.1` still carries its original URL metadata; -these repository edits update future distributions, not already published files. - -## Documentation validation and deployment +## Documentation ```bash uv run --locked --only-group docs zensical build --clean @@ -290,37 +71,10 @@ uv run --locked --only-group docs python tools/check_docs.py uv run --locked python tools/check_notebook.py ``` -CI validates rendered structures, Python snippet syntax and notebook execution. -Main/docs pushes build Pages artifacts but do not deploy them. After explicit -deployment approval, dispatch `docs.yml` from the reviewed `main` or `docs` -branch. Only its deployment job receives Pages/OIDC write permissions and enters -the `github-pages` environment. Merging code does not authorize deployment. - -The production site is . After approval: - -```bash -gh workflow run docs.yml --repo beartype/bearshape --ref main -``` - -Pages must use GitHub Actions as its build source, with `main` allowed by the -`github-pages` environment. These settings and a successful deployment were -verified after the transfer on 2026-09-10. Check the resulting workflow and open -the home page, a nested guide, and the logo after deployment. GitHub redirects -old repository links, but -[does not redirect transferred Pages sites](https://docs.github.com/en/repositories/creating-and-managing-repositories/transferring-a-repository). -Use the new website address for saved links. Do not recreate the old repository -to add a redirect, because that would replace GitHub's repository redirect. - -## Dependency canary and custom annotations +The site is . `docs.yml` builds it on +every push to `main` and deploys it on release tags or a manual run. -Nightly keeps the locked validation matrix and adds a separate latest-compatible -runtime/backend canary on Python 3.11 and 3.14. Its temporary lock and version -artifacts explain failures before any dependency update is proposed. The -canary's range-based preflight is not release acceptance; normal CI and releases -keep exact beartype 0.23.1 until supported upstream integration is adopted. +## Releasing -Dynamic custom/Structured factory examples must include real positive, negative -and native inference consumers in the four-checker harness. Use the tested -[complete native alias recipe](docs/features/static-typing.md#custom-factories-and-structured-arrays) -and execute its runtime branch as well. Constructor/repr checks and inferred -`Any` are not evidence of native consumer support. +See [docs/maintainers/releasing.md](docs/maintainers/releasing.md). In short: +bump the version, update the changelog, merge, then push a `v` tag. diff --git a/PLANS.md b/PLANS.md deleted file mode 100644 index dd87e7d..0000000 --- a/PLANS.md +++ /dev/null @@ -1,178 +0,0 @@ -# Codex Execution Plans (ExecPlans): - -This document describes the requirements for an execution plan ("ExecPlan"), a design document that a coding agent can follow to deliver a working feature or system change. Treat the reader as a complete beginner to this repository: they have only the current working tree and the single ExecPlan file you provide. There is no memory of prior plans and no external context. - -## Repository execution policy - -The rename is complete; use focused maintenance plans. `AGENTS.md` owns the -current product boundaries, `CONTRIBUTING.md` the command reference, and -`tools/README.md` the existing validators. Read the current handoff report and the task's plan before changing release -acceptance. `plans/README.md` identifies current guidance and dated records. Historical plans retain -dated evidence; record later owner decisions explicitly rather than applying -an old pending-approval statement over current authorization. - -Use one goal for the active program, with dependent feature plans where useful. -Do not create a second goal for every worktree. Record the user's scope and -approval in the Decision Log, and reuse it across milestones. Before merging, -prove the reviewed heads and integration resolutions are preserved and checks -pass. After merging, verify main and remove only clean, merged worktrees and -branches. Keep artifact evidence outside temporary worktrees. - -Separate implementation completion, merge completion and release readiness in -Progress and Outcomes. For an upstream blocker, preserve a runnable reproducer, -name the missing supported integration boundary, and state what evidence closes -it. Do not replace an unresolved defect with a support claim, silent xfail or -repeated validation of unchanged inputs. A later dependency target must be -concrete, normally installable and validated across all affected surfaces. - -Agent guidance is shared through `AGENTS.md` and the `CLAUDE.md` symlink. Update -actual repository-owned tools or skills when their workflow changes; do not -create duplicate skill/configuration files or alter personal agent settings to -satisfy a repository task. - -## How to use ExecPlans and PLANS.md - -When authoring an executable specification (ExecPlan), follow PLANS.md _to the letter_. If it is not in your context, refresh your memory by reading the entire PLANS.md file. Be thorough in reading (and re-reading) source material to produce an accurate specification. When creating a spec, start from the skeleton and flesh it out as you do your research. - -When implementing an executable specification (ExecPlan), do not prompt the user for "next steps"; simply proceed to the next milestone. Keep all sections up to date, add or split entries in the list at every stopping point to affirmatively state the progress made and next steps. Resolve ambiguities autonomously, and commit frequently. - -When discussing an executable specification (ExecPlan), record decisions in a log in the spec for posterity; it should be unambiguously clear why any change to the specification was made. ExecPlans are living documents, and it should always be possible to restart from _only_ the ExecPlan and no other work. - -When researching a design with challenging requirements or significant unknowns, use milestones to implement proof of concepts, "toy implementations", etc., that allow validating whether the user's proposal is feasible. Read the source code of libraries by finding or acquiring them, research deeply, and include prototypes to guide a fuller implementation. - -## Requirements - -NON-NEGOTIABLE REQUIREMENTS: - -* Every ExecPlan must be fully self-contained. Self-contained means that in its current form it contains all knowledge and instructions needed for a novice to succeed. -* Every ExecPlan is a living document. Contributors are required to revise it as progress is made, as discoveries occur, and as design decisions are finalized. Each revision must remain fully self-contained. -* Every ExecPlan must enable a complete novice to implement the feature end-to-end without prior knowledge of this repo. -* Every ExecPlan must produce a demonstrably working behavior, not merely code changes to "meet a definition". -* Every ExecPlan must define every term of art in plain language or do not use it. - -Purpose and intent come first. Begin by explaining, in a few sentences, why the work matters from a user's perspective: what someone can do after this change that they could not do before, and how to see it working. Then guide the reader through the exact steps to achieve that outcome, including what to edit, what to run, and what they should observe. - -The agent executing your plan can list files, read files, search, run the project, and run tests. It does not know any prior context and cannot infer what you meant from earlier milestones. Repeat any assumption you rely on. Do not point to external blogs or docs; if knowledge is required, embed it in the plan itself in your own words. If an ExecPlan builds upon a prior ExecPlan and that file is checked in, incorporate it by reference. If it is not, you must include all relevant context from that plan. - -## Formatting - -Format and envelope are simple and strict. Each ExecPlan must be one single fenced code block labeled as `md` that begins and ends with triple backticks. Do not nest additional triple-backtick code fences inside; when you need to show commands, transcripts, diffs, or code, present them as indented blocks within that single fence. Use indentation for clarity rather than code fences inside an ExecPlan to avoid prematurely closing the ExecPlan's code fence. Use two newlines after every heading, use # and ## and so on, and correct syntax for ordered and unordered lists. - -When writing an ExecPlan to a Markdown (.md) file where the content of the file *is only* the single ExecPlan, you should omit the triple backticks. - -Write in plain prose. Prefer sentences over lists. Avoid checklists, tables, and long enumerations unless brevity would obscure meaning. Checklists are permitted only in the `Progress` section, where they are mandatory. Narrative sections must remain prose-first. - -## Guidelines - -Self-containment and plain language are paramount. If you introduce a phrase that is not ordinary English ("daemon", "middleware", "RPC gateway", "filter graph"), define it immediately and remind the reader how it manifests in this repository (for example, by naming the files or commands where it appears). Do not say "as defined previously" or "according to the architecture doc." Include the needed explanation here, even if you repeat yourself. - -Avoid common failure modes. Do not rely on undefined jargon. Do not describe "the letter of a feature" so narrowly that the resulting code compiles but does nothing meaningful. Do not outsource key decisions to the reader. When ambiguity exists, resolve it in the plan itself and explain why you chose that path. Err on the side of over-explaining user-visible effects and under-specifying incidental implementation details. - -Anchor the plan with observable outcomes. State what the user can do after implementation, the commands to run, and the outputs they should see. Acceptance should be phrased as behavior a human can verify ("after starting the server, navigating to [http://localhost:8080/health](http://localhost:8080/health) returns HTTP 200 with body OK") rather than internal attributes ("added a HealthCheck struct"). If a change is internal, explain how its impact can still be demonstrated (for example, by running tests that fail before and pass after, and by showing a scenario that uses the new behavior). - -Specify repository context explicitly. Name files with full repository-relative paths, name functions and modules precisely, and describe where new files should be created. If touching multiple areas, include a short orientation paragraph that explains how those parts fit together so a novice can navigate confidently. When running commands, show the working directory and exact command line. When outcomes depend on environment, state the assumptions and provide alternatives when reasonable. - -Be idempotent and safe. Write the steps so they can be run multiple times without causing damage or drift. If a step can fail halfway, include how to retry or adapt. If a migration or destructive operation is necessary, spell out backups or safe fallbacks. Prefer additive, testable changes that can be validated as you go. - -Validation is not optional. Include instructions to run tests, to start the system if applicable, and to observe it doing something useful. Describe comprehensive testing for any new features or capabilities. Include expected outputs and error messages so a novice can tell success from failure. Where possible, show how to prove that the change is effective beyond compilation (for example, through a small end-to-end scenario, a CLI invocation, or an HTTP request/response transcript). State the exact test commands appropriate to the project’s toolchain and how to interpret their results. - -Capture evidence. When your steps produce terminal output, short diffs, or logs, include them inside the single fenced block as indented examples. Keep them concise and focused on what proves success. If you need to include a patch, prefer file-scoped diffs or small excerpts that a reader can recreate by following your instructions rather than pasting large blobs. - -## Milestones - -Milestones are narrative, not bureaucracy. If you break the work into milestones, introduce each with a brief paragraph that describes the scope, what will exist at the end of the milestone that did not exist before, the commands to run, and the acceptance you expect to observe. Keep it readable as a story: goal, work, result, proof. Progress and milestones are distinct: milestones tell the story, progress tracks granular work. Both must exist. Never abbreviate a milestone merely for the sake of brevity, do not leave out details that could be crucial to a future implementation. - -Each milestone must be independently verifiable and incrementally implement the overall goal of the execution plan. - -## Living plans and design decisions - -* ExecPlans are living documents. As you make key design decisions, update the plan to record both the decision and the thinking behind it. Record all decisions in the `Decision Log` section. -* ExecPlans must contain and maintain a `Progress` section, a `Surprises & Discoveries` section, a `Decision Log`, and an `Outcomes & Retrospective` section. These are not optional. -* When you discover optimizer behavior, performance tradeoffs, unexpected bugs, or inverse/unapply semantics that shaped your approach, capture those observations in the `Surprises & Discoveries` section with short evidence snippets (test output is ideal). -* If you change course mid-implementation, document why in the `Decision Log` and reflect the implications in `Progress`. Plans are guides for the next contributor as much as checklists for you. -* At completion of a major task or the full plan, write an `Outcomes & Retrospective` entry summarizing what was achieved, what remains, and lessons learned. - -# Prototyping milestones and parallel implementations - -It is acceptable—-and often encouraged—-to include explicit prototyping milestones when they de-risk a larger change. Examples: adding a low-level operator to a dependency to validate feasibility, or exploring two composition orders while measuring optimizer effects. Keep prototypes additive and testable. Clearly label the scope as “prototyping”; describe how to run and observe results; and state the criteria for promoting or discarding the prototype. - -Prefer additive code changes followed by subtractions that keep tests passing. Parallel implementations (e.g., keeping an adapter alongside an older path during migration) are fine when they reduce risk or enable tests to continue passing during a large migration. Describe how to validate both paths and how to retire one safely with tests. When working with multiple new libraries or feature areas, consider creating spikes that evaluate the feasibility of these features _independently_ of one another, proving that the external library performs as expected and implements the features we need in isolation. - -## Skeleton of a Good ExecPlan - - # - - This ExecPlan is a living document. The sections `Progress`, `Surprises & Discoveries`, `Decision Log`, and `Outcomes & Retrospective` must be kept up to date as work proceeds. - - If PLANS.md file is checked into the repo, reference the path to that file here from the repository root and note that this document must be maintained in accordance with PLANS.md. - - ## Purpose / Big Picture - - Explain in a few sentences what someone gains after this change and how they can see it working. State the user-visible behavior you will enable. - - ## Progress - - Use a list with checkboxes to summarize granular steps. Every stopping point must be documented here, even if it requires splitting a partially completed task into two (“done” vs. “remaining”). This section must always reflect the actual current state of the work. - - - [x] (2025-10-01 13:00Z) Example completed step. - - [ ] Example incomplete step. - - [ ] Example partially completed step (completed: X; remaining: Y). - - Use timestamps to measure rates of progress. - - ## Surprises & Discoveries - - Document unexpected behaviors, bugs, optimizations, or insights discovered during implementation. Provide concise evidence. - - - Observation: … - Evidence: … - - ## Decision Log - - Record every decision made while working on the plan in the format: - - - Decision: … - Rationale: … - Date/Author: … - - ## Outcomes & Retrospective - - Summarize outcomes, gaps, and lessons learned at major milestones or at completion. Compare the result against the original purpose. - - ## Context and Orientation - - Describe the current state relevant to this task as if the reader knows nothing. Name the key files and modules by full path. Define any non-obvious term you will use. Do not refer to prior plans. - - ## Plan of Work - - Describe, in prose, the sequence of edits and additions. For each edit, name the file and location (function, module) and what to insert or change. Keep it concrete and minimal. - - ## Concrete Steps - - State the exact commands to run and where to run them (working directory). When a command generates output, show a short expected transcript so the reader can compare. This section must be updated as work proceeds. - - ## Validation and Acceptance - - Describe how to start or exercise the system and what to observe. Phrase acceptance as behavior, with specific inputs and outputs. If tests are involved, say "run and expect passed; the new test fails before the change and passes after>". - - ## Idempotence and Recovery - - If steps can be repeated safely, say so. If a step is risky, provide a safe retry or rollback path. Keep the environment clean after completion. - - ## Artifacts and Notes - - Include the most important transcripts, diffs, or snippets as indented examples. Keep them concise and focused on what proves success. - - ## Interfaces and Dependencies - - Be prescriptive. Name the libraries, modules, and services to use and why. Specify the types, traits/interfaces, and function signatures that must exist at the end of the milestone. Prefer stable names and paths such as `crate::module::function` or `package.submodule.Interface`. E.g.: - - In crates/foo/planner.rs, define: - - pub trait Planner { - fn plan(&self, observed: &Observed) -> Vec; - } - -If you follow the guidance above, a single, stateless agent -- or a human novice -- can read your ExecPlan from top to bottom and produce a working, observable result. That is the bar: SELF-CONTAINED, SELF-SUFFICIENT, NOVICE-GUIDING, OUTCOME-FOCUSED. - -When you revise a plan, you must ensure your changes are comprehensively reflected across all sections, including the living document sections, and you must write a note at the bottom of the plan describing the change and the reason why. ExecPlans must describe not just the what but the why for almost everything. diff --git a/README.md b/README.md index ffbb8ad..efa223b 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,14 @@ [![Python 3.11-3.14](https://raw.githubusercontent.com/beartype/bearshape/main/docs/assets/images/python_versions_badge.svg)](https://www.python.org/) [![Docs](https://img.shields.io/badge/docs-live-526CFE?style=flat-square&logo=readthedocs&logoColor=white&labelColor=1F2937)](https://beartype.github.io/bearshape/) +[![CI](https://github.com/beartype/bearshape/actions/workflows/ci.yml/badge.svg)](https://github.com/beartype/bearshape/actions/workflows/ci.yml) Runtime shape and dtype checking for NumPy, JAX, PyTorch, CuPy, and tree-structured containers, powered by [beartype](https://github.com/beartype/beartype). +[Read the documentation](https://beartype.github.io/bearshape/). + ```python from beartype import beartype from bearshape import N, C @@ -23,28 +26,22 @@ bearshape turns annotations such as `F32[N, C]`, `F32Like[~B, C]`, Named dimensions are shared within a function call, so mismatched shapes fail at the boundary instead of later in array code. -## Installation and candidate status +## Installation -These docs describe the **unpublished 0.1.0rc1 candidate**, requiring Python -**3.11+** (tested on 3.11–3.14) and beartype **0.23.1**. `pip install bearshape` -currently installs the older -[PyPI release](https://pypi.org/project/bearshape/). To try the candidate from a -checkout in a Python 3.11+ virtual environment: +bearshape requires Python **3.11+** (tested on 3.11–3.14) and beartype +**0.23.1** or a later 0.23.x release: ```bash -python -m pip install . numpy "beartype==0.23.1" +python -m pip install bearshape numpy ``` Install your backend explicitly; the root import loads none. See the -[installation guide](https://github.com/beartype/bearshape/blob/main/docs/getting-started/installation.md) -for checkout, uv, JAX, Torch, CuPy and OpTree instructions. +[installation guide](https://beartype.github.io/bearshape/getting-started/installation/) +for uv, JAX, Torch, CuPy and OpTree instructions. -**Release is blocked by native composite-union rollback in beartype 0.23.1.** A -failed union alternative can leave dimension bindings that reject a later valid -alternative. `check` and `check_context` do not fix that boundary. See -[composition and limitations](https://github.com/beartype/bearshape/blob/main/docs/features/composition.md) -for a reproducer and the distinction between normal checks and the unshipped -upstream proposal. +**Known limitation:** named dimensions bound inside a union alternative that +fails can leak into later checks of the same call. See +[composition and limitations](https://beartype.github.io/bearshape/features/composition/). ## What It Checks @@ -83,7 +80,6 @@ uv run --locked pytest tests/test_typecheck.py -q Use uv 0.13.0. See [CONTRIBUTING.md](https://github.com/beartype/bearshape/blob/main/CONTRIBUTING.md) -for setup, focused PRs, regression expectations, review and artifact validation. -CuPy runtime tests require CUDA hardware. The +for setup and the release process. CuPy runtime tests require CUDA hardware. The [static typing guide](https://github.com/beartype/bearshape/blob/main/docs/features/static-typing.md) distinguishes checker-supported annotations from runtime-only shape expressions. diff --git a/docs/examples/index.md b/docs/examples/index.md index 8e338c0..08892bb 100644 --- a/docs/examples/index.md +++ b/docs/examples/index.md @@ -4,9 +4,8 @@ description: Copyable examples covering the main bearshape runtime and typing pa # Examples -These examples target the -[unpublished candidate](../getting-started/installation.md). Calls marked -`Raises` deliberately demonstrate rejection. Read +These examples target the [current release](../getting-started/installation.md). +Calls marked `Raises` deliberately demonstrate rejection. Read [composition and limitations](../features/composition.md) for the open union boundary before combining stateful annotations inside native unions. diff --git a/docs/features/composition.md b/docs/features/composition.md index 10c3da8..cefb81f 100644 --- a/docs/features/composition.md +++ b/docs/features/composition.md @@ -1,13 +1,12 @@ --- -description: Current native-union limitation, container sampling, and release status. +description: Current native-union limitation, container sampling, and checking guarantees. --- # Composition and limitations -The unpublished 0.1.0rc1 candidate is validated with released beartype 0.23.1. -Ordinary array, dtype, dimension, Like and Tree tests pass. Full composition -through native union alternatives still has a known correctness defect, so -release readiness remains withheld. +bearshape 0.1.0 is tested with beartype 0.23.1. Ordinary array, dtype, +dimension, Like and Tree checks compose as expected. Composition through native +union alternatives has one known limitation, described below. ## A failed union alternative can leave bindings behind @@ -36,16 +35,11 @@ aliases and tree constraints. A failed individual array check can restore its own changes; it cannot see a later failure of its enclosing branch. Explicit `@check` and `check_context()` manage memo lifetime; they do not repair -this union boundary. Passing ordinary CI does not establish full composition. -The standalone reproducer is `tools/probe_union.py`; its nonzero exit with the -published baseline is evidence of this open defect, not an expected passing run. - -The repository contains a tested -[upstream proposal](https://github.com/beartype/bearshape/blob/main/tools/upstream/README.md) -for invocation scopes and transaction rollback. It is not installed or applied -by bearshape and has not shipped in the supported dependency. Its local test -results do not make the published dependency correct. Supported upstream -integration and the full release matrix are required before this blocker closes. +this union boundary. beartype gives bearshape no signal when a union alternative +fails, so the binding cannot be undone today. Until that changes, avoid binding +a named dimension inside a union alternative that can fail before another +argument reuses the same name. Unions without named dimensions, and unions whose +alternatives use distinct names, are unaffected. ## Containers and checking frequency diff --git a/docs/features/index.md b/docs/features/index.md index 011911b..9404fcd 100644 --- a/docs/features/index.md +++ b/docs/features/index.md @@ -15,8 +15,8 @@ bearshape layers several pieces together: ## Guides -- **[Composition and limitations](composition.md)** — The native-union release - blocker, container sampling and what the current candidate establishes. +- **[Composition and limitations](composition.md)** — The native-union + limitation, container sampling and checking guarantees. - **[Framework transformations](frameworks.md)** — JAX tracing and Torch compiler boundaries. diff --git a/docs/getting-started/index.md b/docs/getting-started/index.md index 9e37b65..8534152 100644 --- a/docs/getting-started/index.md +++ b/docs/getting-started/index.md @@ -15,8 +15,7 @@ the memo helpers. Backend modules such as `bearshape.numpy`, `bearshape.jax`, `bearshape.torch`, and `bearshape.cupy` add concrete array aliases once you install those dependencies. -These pages describe the unpublished 0.1.0rc1 candidate. Start with the -[installation guide](installation.md) to select the intended revision and read +Start with the [installation guide](installation.md) and read [composition and limitations](../features/composition.md) before relying on native union alternatives. For changes to bearshape itself, use the [contributor guide](https://github.com/beartype/bearshape/blob/main/CONTRIBUTING.md). diff --git a/docs/getting-started/installation.md b/docs/getting-started/installation.md index 8d0345f..fca4e36 100644 --- a/docs/getting-started/installation.md +++ b/docs/getting-started/installation.md @@ -6,37 +6,27 @@ description: Install bearshape with your preferred array backend. # Installation -## Version covered by this guide +## Requirements -This guide describes the **unpublished 0.1.0rc1 development candidate**. As of -12 October 2026, [PyPI provides 0.0.1](https://pypi.org/project/bearshape/), -which has older dependency metadata and behavior. `pip install bearshape` and -`uv add bearshape` select that published release, not this candidate. +bearshape requires **Python >= 3.11** and **beartype >= 0.23.1, < 0.24**. CI +tests Python **3.11–3.14** with beartype **0.23.1**, and also runs against the +newest beartype prerelease. -The candidate requires **Python >= 3.11** and **beartype >= 0.23.1, < 0.24**. -The maintained matrix is Python **3.11–3.14**, tested with exact beartype -**0.23.1**. Full native composite-union rollback is still a -[release blocker](../features/composition.md); a successful install does not -resolve it. +## Install with pip -## Try the candidate with pip - -In an activated Python 3.11+ virtual environment, clone the repository and -install the checkout with the baseline dependency and your chosen backend: +In an activated Python 3.11+ virtual environment, install bearshape and your +chosen backend: ```bash -git clone https://github.com/beartype/bearshape.git -cd bearshape -python -m pip install . numpy "beartype==0.23.1" +python -m pip install bearshape numpy ``` -`main` changes over time. For a reproducible experiment, check out the full -reviewed commit SHA before installing. Contributors should instead follow +Contributors should instead follow [the locked development setup](https://github.com/beartype/bearshape/blob/main/CONTRIBUTING.md). The distribution name and import package are both `bearshape`. There are no backend extras such as `bearshape[numpy]`; install backend packages explicitly -in the same environment after installing the candidate: +in the same environment: === "NumPy" @@ -78,17 +68,13 @@ in the same environment after installing the candidate: Choose GPU-enabled JAX/Torch builds using their own installation instructions; the repository's development environment deliberately uses CPU packages. -## Try the candidate in a uv project - -From your own project, add the source dependency and NumPy: +## Install in a uv project ```bash -uv add "bearshape @ git+https://github.com/beartype/bearshape.git@main" \ - "beartype==0.23.1" numpy +uv add bearshape numpy ``` -Replace `main` with a reviewed full commit SHA to pin an experiment. This is a -consumer setup; development inside bearshape uses `uv sync --locked`. +Development inside bearshape itself uses `uv sync --locked`. ## Optional dependencies @@ -137,10 +123,7 @@ from bearshape import N, C from bearshape.numpy import F32 ``` -## Release readiness +## Known limitations -The [composition guide](../features/composition.md) explains the known union -defect. The [release runbook](../maintainers/releasing.md) records supported -upstream adoption, exact-artifact validation and publishing prerequisites. The -candidate is independently versioned from beartype; it has not been published -merely because its implementation PRs are merged. +The [composition guide](../features/composition.md) explains the one known +limitation with named dimensions inside union alternatives. diff --git a/docs/getting-started/quickstart.md b/docs/getting-started/quickstart.md index 09a9cca..64d62a0 100644 --- a/docs/getting-started/quickstart.md +++ b/docs/getting-started/quickstart.md @@ -9,10 +9,10 @@ description: Write your first shape-checked function and learn the core executio This page uses NumPy for concreteness, but the same shape language works across `bearshape.jax`, `bearshape.torch`, and `bearshape.cupy`. -First follow the [candidate installation instructions](installation.md). -Examples marked `Raises` deliberately fail; run those calls separately to see -the validation error. The [composition guide](../features/composition.md) -explains the known union limitation in the current dependency. +First follow the [installation instructions](installation.md). Examples marked +`Raises` deliberately fail; run those calls separately to see the validation +error. The [composition guide](../features/composition.md) explains the known +union limitation in the current dependency. ## 1. Start with standard `@beartype` diff --git a/docs/index.md b/docs/index.md index 7eafbc9..414422a 100644 --- a/docs/index.md +++ b/docs/index.md @@ -521,8 +521,8 @@ Powered by

-Development candidate 0.1.0rc1 · Python 3.11–3.14 · -Unreleased: union integration pending +bearshape 0.1.0 · Python 3.11–3.14 · +Known limitations

diff --git a/docs/maintainers/production-readiness.md b/docs/maintainers/production-readiness.md deleted file mode 100644 index 9800e44..0000000 --- a/docs/maintainers/production-readiness.md +++ /dev/null @@ -1,569 +0,0 @@ -# Production review and ownership handoff - -## Current status — 12 October 2026 - -Main at `a475c9b5376601eb39c9e0641f16f62d56fed979` includes the complete -reviewed candidate, correctness fixes and optimizations through PRs -[#56](https://github.com/beartype/bearshape/pull/56) and -[#57](https://github.com/beartype/bearshape/pull/57). All reviewed commits and -integration resolutions are preserved. Their three temporary worktrees were -archived after validation; their merged local and remote branches were removed. - -The unpublished candidate is **0.1.0rc1**, for Python **3.11–3.14** and exact -released **beartype 0.23.1** (metadata `>=0.23.1,<0.24`). Post-merge local -checks passed 1,315 runtime tests and eight checker-suite tests; five skips -cover unavailable CuPy and platform precision. The -[main CI run](https://github.com/beartype/bearshape/actions/runs/38216971736) -passed all 34 jobs, the -[proposal run](https://github.com/beartype/bearshape/actions/runs/38217028857) -passed both Python endpoints, and the -[docs run](https://github.com/beartype/bearshape/actions/runs/38216971758) built -successfully with deployment skipped. Proposal success applies to the patched -local dependency, not published beartype. - -The merged wheel matched the reviewed artifact with SHA256 -`313642ed018e897e5f5ea8123c5571da2deae6ff67a1422448bbf28075529db6`. Its source -archive SHA256 was -`1ce95758f82dfc1f6d6f8e6ffaaaa1deea8b7e40e1ddf482eae0859dae9fc9ad`. These -identify that source snapshot; subsequent documentation and metadata changes -require new artifact hashes. The -[performance report](https://github.com/beartype/bearshape/blob/main/tools/evidence/2026-10-11-remaining-optimization/README.md) -records matched installed baseline/proposal results and unfavorable cases too. - -**Release readiness remains withheld.** Published 0.23.1 lacks supported -whole-alternative rollback; see -[composition and limitations](../features/composition.md). The tested proposal -is in -[the upstream integration guide](https://github.com/beartype/bearshape/blob/main/tools/upstream/README.md). -Fresh final-wheel CUDA evidence, verified repository/PyPI release controls and -separate publication approval remain prerequisites in the -[release runbook](releasing.md). Personal PyPI ownership does not require a -transfer. No publication or deployment occurred during the merge. - -Current contributor commands live in -[CONTRIBUTING.md](https://github.com/beartype/bearshape/blob/main/CONTRIBUTING.md); -[the plan index](https://github.com/beartype/bearshape/blob/main/plans/README.md) -separates current work from historical implementation evidence. - -## Historical reports - -Everything below records the stated source, dependency and date. Past pending -reviews, three-checker/Python 3.10 baselines, earlier upstream prototypes and -older CUDA results do not override the current status above. Follow the current -contributor guide and release runbook for commands and acceptance requirements. - -**Remaining optimizations, 11 October 2026 (pre-merge record):** -[#56](https://github.com/beartype/bearshape/pull/56) prepares builtin dtype -names and keeps custom dtype protocols live; -[#57](https://github.com/beartype/bearshape/pull/57) prepares shape traversal -once per annotation. Their combined wheel passes **1,323 installed baseline -tests** and **1,450 installed proposal tests** on Python 3.11 and 3.14, with -**91.23%** source coverage. The -[comparison report](https://github.com/beartype/bearshape/pull/56) contains -source/artifact identities, raw samples, individual and combined results, -startup tradeoffs and the remaining ordinary beartype cost. Main and release -readiness are unchanged until these PRs are reviewed and merged and the existing -external prerequisites are satisfied. - -**Latest audit follow-up, 11 October 2026:** candidate **0.1.0rc1** targets -Python **3.11–3.14** and exact released beartype **0.23.1**. PRs -[#48–#55](https://github.com/beartype/bearshape/pull/55) add the six audit -fixes, measured scope/Tree optimizations, complete release composition gates and -tested native factory aliases. The current -[execution plan](https://github.com/beartype/bearshape/blob/main/plans/2026-10-11-audit-followup.md) -records validation and external prerequisites; the -[performance evidence](https://github.com/beartype/bearshape/tree/a30c11b52b2ac53ebfc79f7ee00fb1f1fb0ecd18/tools/evidence/2026-10-11-audit-performance) -contains matched installed measurements and artifact identities. - -The combined implementation passes **1,300 installed baseline tests** and -**1,427 installed proposal tests** on each Python endpoint, including all four -consumer checkers. All **23 original audit regressions** pass with both -dependencies. Source coverage is **91.10%**; fresh minimal consumers, 95 docs -snippets, 29 notebook cells on each endpoint and both dependency canaries pass. -The plan records exact source/archive hashes and hosted runs. Five local skips -cover unavailable CuPy and platform-specific extended precision, not union -tests. - -**Release readiness remains withheld.** The published dependency still lacks -full composite-union rollback. The local upstream proposal is separate evidence, -not a released integration. Current runtime changes need fresh exact-wheel CUDA -evidence; earlier GPU results below do not cover them. Repository/PyPI controls, -and separately authorized publication remain outstanding. The owner approved -merging the validated stack on 11 October 2026, preserving every reviewed -commit, then verifying main before cleanup. The dated sections below retain -their original evidence. - -This is the 8 September 2026 review record for **bearshape 0.1.0rc0**. The -candidate is independently versioned from beartype and requires -`beartype>=0.23.0rc0,<0.24`. Exact `0.23.0rc0` was the required test target for -that historical review. - -**Release readiness is withheld.** Native composite-union rollback remains -incorrect in one important composition case. The owner selected full composition -through supported upstream integration and permits a later beartype candidate; -explicitly limited native CuPy static support is accepted. The owner approved -merging the reviewed production work on 8 September 2026. PR #31 integrated all -reviewed heads into main at `df81f00e2f62bda956244e680c980f87db1d4671`; its -post-merge CI passed all 36 jobs. Repository/publication protections still -require configuration, and publication requires separate authorization. - -**Ownership update, 10 September 2026:** the GitHub repository is now -[beartype/bearshape](https://github.com/beartype/bearshape), and documentation -is hosted at . The existing Pages -workflow was successfully redeployed after transfer. Repository links in this -report now use the new owner; dated validation results and artifact identities -remain unchanged. PyPI ownership and trusted-publisher configuration remain -unverified. - -**Current program, 11 October 2026 (candidate 0.1.0rc1, unpublished):** the -owner selected Python 3.11+ (supported matrix 3.11–3.14) and released beartype -`>=0.23.1,<0.24`, with exact `0.23.1` in validation. The October execution plan -records the coordinated migration. The historical results below retain their -original versions; they do not validate the changed candidate. Full native-union -rollback is still blocked in released 0.23.1. Publication remains explicitly -unauthorized. - -**Earlier October integration through PR #45:** ordinary validation recorded -1,142 installed consumer cases passed on each Python endpoint, source coverage -was 92.05%, and -[hosted CI](https://github.com/beartype/bearshape/actions/runs/38133983895) -passed the Linux/macOS/Windows, four-checker, compatibility-floor, docs/notebook -and archive matrix. Its exact wheel passed all 95 CuPy tests at both endpoints. - -The -[validation-only release run](https://github.com/beartype/bearshape/actions/runs/38134009706) -passed shared validation, then correctly failed both full-composition gates on -released 0.23.1; upload was skipped. A normally installed local upstream -proposal passed 1,164 cases per endpoint, including all 22 union regressions. -That proposal has not been submitted, accepted or released. The detailed -source/hashes, performance costs and PR dispositions are recorded in integration -PR [#45](https://github.com/beartype/bearshape/pull/45) and its execution plan. - -The owner reports the PyPI project in their personal account; no organization -transfer is required. Private publisher verification and GitHub release controls -remain pending. Follow the [release runbook](releasing.md) for future authorized -publishing. The dated September tables below remain historical evidence. - -## Purpose and intended users - -bearshape checks array shape, dtype and related tree constraints at Python API -boundaries using beartype. Its main users are scientific Python developers, -model and numerical-library authors, and application teams that want useful -runtime failures alongside editor/type-checker support. It complements native -NumPy, JAX, Torch and CuPy types while retaining backend operations. - -Use it around meaningful function and module boundaries. Strict checks inspect -metadata; tree checks visit leaves; Like checks may convert data and allocate or -transfer memory. It is not a static shape prover, a replacement array backend, -or an untrusted-expression sandbox. `Value` expressions are developer-authored -contracts; permitted attribute access can invoke ordinary Python behavior. - -The next evolution should close the integration boundary with beartype and -maintain the tested annotation contract. New syntax, additional checker engines -and speculative caching are not needed for this release. Zuban is outside the -selected support contract. A future addition needs an explicit plan and real -positive, negative and inference fixtures. - -## Observed support - - - -| Surface | Evidence | Boundary | -| --------------- | ----------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -| CPython | Linux 3.10–3.14; macOS/Windows 3.10 and 3.14 CPU jobs | Other interpreter implementations are unverified | -| beartype | Exact 0.23.0rc0 in required lanes and normal installs | Native composite-union rollback blocks full compatibility; the metadata range is not proof for future releases | -| NumPy | Locked current and 2.2 floor; strict/Like/scalar/structured/endian/temporal tests | Extended precision depends on platform | -| JAX | Locked current and 0.5 floor; jit/vmap/grad numerical and violation cases | Checks inside JIT run while tracing; see [frameworks](../features/frameworks.md) | -| Torch | Locked current and 2.6 floor; autograd and compile cases | Compile evidence uses `backend="eager"` with outer Python validation | -| optree | Locked current and 0.14 floor; containers and structure binding | Default registry only; no custom namespace API | -| CuPy | 95 tests with CUDA 12.9, CuPy 14.2.0, Python 3.10.20/3.14.3 | Other GPU/driver combinations and multiple-device behavior are unverified; native static typing is limited | -| Static checkers | pyright, mypy, ty and pyrefly positive/negative/inference batches on Python 3.10–3.14 and configured floors | Dimensions are runtime constraints; advanced syntax and native CuPy limitations are explicit | -| Minimal install | Normally installed wheel with only declared dependencies at Python endpoints | Root import loads none of NumPy/JAX/Torch/CuPy/optree; custom strict arrays work without NumPy | - - - -The locked checker versions are pyright 1.1.411, mypy 2.3.1, ty 0.0.79 and -pyrefly 1.2.0. Separate floors exercise pyright 1.1.408 and mypy 1.19, plus the -selected ty/pyrefly versions. The harness checks exact diagnostic locations and -categories, including deliberate invalid calls; a checker crash or missing tool -fails the run. See [static typing](../features/static-typing.md) for accepted -annotation forms. - -## Implementation map - - - -| Module | Responsibility and maintenance boundary | -| ------------------------------------------- | --------------------------------------------------------------------------------------- | -| `__init__.py`, `_imports.py` | Lightweight public identity, factories/symbols and explicit optional-dependency loading | -| `_dimensions.py`, `_shape.py` | Shape tokens, arithmetic and bounded parsing of permitted expressions | -| `_dtypes.py` | Dtype families, structured equality, byte order and normalization | -| `_runtime_hints.py` | Runtime hint classes and useful instance-check failure reporting | -| `_array_types.py` | Strict and Like validation, selected converters and failed-leaf rollback | -| `_memo.py` | Invocation-owned automatic state, explicit ContextVars and scope lookup | -| `_decorator.py` | Memo-only/combined decorator modes, metadata, async cleanup and explicit contexts | -| `_tree.py`, `optree.py` | Tree leaves and structures with explicit traversal backend | -| `numpy.py`, `jax.py`, `torch.py`, `cupy.py` | Backend aliases, conversion boundaries and static declarations | -| `_typing.py` | Shared static input families; no runtime backend imports | -| `claw.py` | Direct re-export of the caller-sensitive upstream import hook | - - - -Automatic memo discovery recognizes generated beartype frames and stores state -in the live frame's locals. This is an integration assumption on upstream code -generation, covered at exact rc0 across the declared CPython matrix. Explicit -contexts use ContextVars; child tasks inherit live memo references unless they -create their own context. Failed leaf checks restore their own mutations, and -diagnostic formatting restores state without retaining failed user objects. - -A leaf callback cannot observe rejection of an entire surrounding native union -alternative after a later ordinary type check fails. Neither global replay -caches nor bytecode guesses provide that missing boundary. No upstream -monkeypatch or replacement type-checker implementation was introduced. - -## Feature-to-test map - -Paths below are relative to the repository root. Each row identifies existing -positive and negative evidence, not merely annotation declarations. - - - -| Contract | Representative tests | -| ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| Named/fixed/anonymous dimensions and rank | `tests/test_shape.py`: `TestNamedDim`, `TestFixedDim`, `TestAnonymous`; `tests/test_numpy.py`: `TestCrossArgConsistency` | -| Arithmetic, variadics and broadcasting | `tests/test_shape.py`: `TestSymbolicDim`, `TestVariadicDim`, `TestNamedDimEdgeCases`; `tests/test_numpy.py`: `TestBroadcastableDims`, `TestMultipleVariadicRejected` | -| Scalar and invalid token combinations | `tests/test_dimensions.py`: `TestMixedScalarRejection`, `TestScalarArithmeticRejection`, `TestBooleanDimRejection` | -| Value lookup, arithmetic and rejected expressions | `tests/test_shape.py`: `TestValueDim`, `TestSymbolicEdgeCases`; `tests/test_numpy.py`: `TestValueExpressions`; `tests/test_decorator.py`: `TestValueWithCheckDecorator` | -| Dtype families, byte order, structured fields and temporal units | `tests/test_dtypes.py`: `TestDtypeSpecMatches`, `TestByteorderMatching`, `TestShapedVoidAndStructured`, `TestDatetimeTimedelta`; `tests/test_numpy.py`: `TestStructuredDtypeIntegration`, `TestStructuredLikeDtypeEnforcement` | -| Scalar-like range/casting and boolean rejection | `tests/test_numpy.py`: `TestScalarLikeBoundariesExtended`, `TestScalarLikeCastingVariants`, `TestNumericScalarBooleanRejection` | -| Strict versus Like backend conversion | Backend `Test*ConversionContract` classes; NumPy `TestCustomConversionContract`; CuPy `TestCuPyConverterContract` | -| Return checks, nested calls and readable diagnostics | `tests/test_numpy.py`: `TestReturnViolations`, `TestNestedCalls`, `TestDiagnosticMessages`; corresponding backend tests | -| Invocation lifetime, independent checks, memory release and threads | `tests/test_memo.py`: `TestIndependentCheckLifetime`, `TestThreadSafety`, `TestFrameBasedMemo` | -| Decorator metadata, modes, async cancellation and task contexts | `tests/test_decorator.py`: `TestDecoratorEdgeCases`, `TestAsyncCheckDecorator`, `TestMemoIsolation`, `TestCheckRejectsGenerators`, `TestCallBoundaryContracts` | -| Tree leaf dtype/shape, structures and return constraints | `tests/test_tree.py`: `TestBasicTree`, `TestCrossLeafConsistency`, `TestStructureBindingFailures`, `TestMultiLevelFailures`, `TestReturnTypeFailures` | -| Real import-hook caller discovery | `tests/test_claw.py`: `test_instruments_caller_package` imports actual temporary packages/submodules with default/custom configuration | -| Framework transformations and device behavior | `tests/test_jax.py`: `TestJaxTransformations`; `tests/test_torch.py`: `TestTorchTransformations`; `tests/test_cupy.py`: `TestCuPyDeviceBehavior`, `TestCuPyTrees` | -| Optional imports and custom backend operation | `tests/test_coverage_edges.py`: `TestOptionalBackendImports`, `TestVersionExport`; `tools/smoke_minimal.py` from a minimal installed wheel | -| Static consumers and expected failures | `tests/test_typecheck.py`, `tests/typing/check_*consumers.py`, `tests/typing_negative/invalid_*calls.py` | -| Documentation and distributions | `tests/test_examples.py`, `tools/check_docs.py`, `tools/check_notebook.py`, `tools/check_distribution.py`, `tools/check_installed.py` | -| Publication identity and bypass rejection | `tests/test_release.py`: cases using disposable Git histories, events and foreign hook environments | - - - -The endpoint and platform jobs exercise these files with the actual interpreter -and dependencies. Expected missing-CuPy and platform-precision skips are -visible; preflight checks fail if an expected CPU backend is absent. The -native-union case below remains outside the passing contract and blocks release -rather than being hidden behind an expected-failure marker. - -## Audit findings and independent review units - - - -| Finding | Change and closing evidence | Status | -| -------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- | -| A01: exact rc0 installation | [#13](https://github.com/beartype/bearshape/pull/13), [#25](https://github.com/beartype/bearshape/pull/25): normal resolver installs and endpoint artifact consumers | Implemented and validated | -| A02: caller-package import hook | [#14](https://github.com/beartype/bearshape/pull/14): direct alias and real package import violations | Implemented and validated | -| A03: stale state and retained failures | [#15](https://github.com/beartype/bearshape/pull/15): live-frame ownership, independent failures, mutation, weak references and threads | Implemented and validated | -| A04: composite alternative rollback | Exact hosted wheel still rejects the valid example below | **Release blocker; upstream path selected** | -| A05: converter fallback and trust | [#16](https://github.com/beartype/bearshape/pull/16), [#26](https://github.com/beartype/bearshape/pull/26): actual backend converter oracles and GPU cases | Implemented and validated | -| A06: consumer typing | [#17](https://github.com/beartype/bearshape/pull/17), [#19](https://github.com/beartype/bearshape/pull/19), [#20](https://github.com/beartype/bearshape/pull/20): four engines, Like inputs and structural Tree callers | CPU surfaces validated; limited CuPy policy accepted | -| A07: incomplete distributions | [#18](https://github.com/beartype/bearshape/pull/18), [#25](https://github.com/beartype/bearshape/pull/25): license, typing marker, source inputs and installed consumers | Implemented and validated | -| A08: publication without validation | [#28](https://github.com/beartype/bearshape/pull/28): immutable workflow/package identity, full gate and same artifacts | Code validated; administrative controls pending | -| A09: documentation drift | [#24](https://github.com/beartype/bearshape/pull/24): formatter round trip, rendered structures, executed snippets/notebook | Implemented and validated | -| A10: hooks/CI/dependency drift | [#23](https://github.com/beartype/bearshape/pull/23): locked reusable matrix, CPU resolution, four-checker pre-push and strict aggregate gate | Implemented and validated | - - - -[#21](https://github.com/beartype/bearshape/pull/21) supplies framework/minimal -proofs. [#22](https://github.com/beartype/bearshape/pull/22) and -[#27](https://github.com/beartype/bearshape/pull/27) are validation aggregates -that preserve focused PR branches. Merge prerequisites and living decisions are -recorded in each PR's ExecPlan and the roadmap in -[#12](https://github.com/beartype/bearshape/pull/12). - -The approved history is integrated through -[#31](https://github.com/beartype/bearshape/pull/31), preserving every reviewed -head without squashing. GitHub marked main-based PRs merged automatically; -dependent PRs were closed with an integration record after ancestor -verification. Twenty clean worktrees and their local branches were removed after -preserving coverage/build evidence; the corresponding remote branches were -deleted with expected-head checks. The original checkout remains on main. - -Actual hook installation then exposed two defects addressed in -[#33](https://github.com/beartype/bearshape/pull/33): file checks ran at the -commit-message stage and rejected a worktree Git path, and inherited Git -repository variables redirected disposable release-test commands. File hooks now -default to pre-commit, the unused commit-message shim is removed, and Git -commands explicitly targeting another repository clear Git's local environment -variables. CI checks installed stage routing; four new cases cover foreign Git -environments and ensure fixture construction preserves the hook owner's config -and HEAD. Real commits and pre-push runtime/checker checks pass. Hosted run -[34231187384](https://github.com/beartype/bearshape/actions/runs/34231187384) -passed the complete matrix at `0717df2f2194cdcb10bcf37ba291c09117c42238`. - -The main Pages run -[34229683120](https://github.com/beartype/bearshape/actions/runs/34229683120) -built successfully and skipped deployment. Contributor instructions now require -an explicit docs dispatch and explain removal of an old commit-message shim. - -### Accepted native-union integration path - -This valid call is still rejected by the tested wheel with exact rc0: - -```python -import numpy as np -from beartype import beartype -from bearshape import C, N -from bearshape.numpy import F32 - - -@beartype -def choose(pair: tuple[F32[N], str] | tuple[F32[C], int], y: F32[N]) -> None: - pass - - -choose((np.ones(2, dtype=np.float32), 1), np.ones(3, dtype=np.float32)) -``` - -The first alternative binds `N=2`, then fails its `str` check. The second -alternative succeeds and should bind only `C=2`. `y` should then establish -`N=3`, but the failed alternative's binding survives and rejects it. - -The owner selected an upstream-supported whole-alternative integration boundary -and permits a later beartype candidate. Preserve full composition. A warning, -bytecode heuristic, monkeypatch or restricted annotation contract does not close -this defect. On 8 September 2026, PyPI offered only `0.23.0rc0` in the 0.23 -series; the approval is a direction, not evidence of an available fix. An -isolated normal install of upstream development commit -[`a2729e0`](https://github.com/beartype/beartype/commit/a2729e0e358bf963ee6f177e300ae08a622d05d6) -identifies itself as `0.23.0rc1` and still rejects the same valid call. That -unpublished revision is evidence of the remaining defect, not a supported new -compatibility floor. - -Run `uv run --locked python tools/probe_union.py` from the repository root to -reproduce the current failure with version information. Its nonzero exit is -explicit blocker evidence. A later candidate must preserve bindings from earlier -successful parameters, discard a whole failed alternative's shape/tree state, -commit successful alternatives, isolate diagnostic checks and restore state on -exceptions. Cover nested unions, return checks, explicit/automatic scopes, async -paths and object lifetime before changing the compatibility floor and rerunning -the complete normal-install matrix. No upstream message or patch has been -submitted on the owner's behalf. - -### Tested local union fix, pending upstream review - -PR #34 exposes the active `ShapeMemo` through the proposed `__beartype_state__` -hook. The optimized local upstream extension locates each state domain once, -compiles the checking function at decoration, uses compact rollback records and -avoids duplicate root snapshots and stateless-path setup. It preserves -complete-alternative rollback, exception cleanup, diagnostic replay, lazy -references, ordering and sampling. PR #35 independently reduces frame-discovery -work; combined timings must identify both changes. - -The original callback proposal at upstream commit -`4aef992d1cd0a6d09fe5c3784523c44e0874b178`, based on -`a2729e0e358bf963ee6f177e300ae08a622d05d6`, passed 22 integration cases and -1,124 combined tests per Python endpoint. Its strict small-array benchmark -measured about 19 microseconds with rc0 and 31 with that initial patch. Those -results are historical comparison evidence. The owner requested further -optimization before contacting the maintainer through Zulip. The focused plan -records optimized source identities, validation and matched timing evidence; -these must be read separately from the original artifacts. - -The optimized upstream head is `76e27706fb137c6a676ee7b79a66d8b3092b52ad`. The -combined normally installed artifacts passed 1,125 tests per endpoint, including -all four checkers and 22 union cases, with five existing CPU skip records. -Upstream passed 434/447 unit tests and pyright on Python 3.10/3.14. Its 22 -protocol tests include 600 deterministic independent-reference cases and two -copied-context regressions. Completed transactions release their state -references and are ignored by later checks using a copied context. The protocol -tests also passed against normally installed wheels outside the upstream -checkout. Added strict-check overhead fell by 57%/74%, after separating PR #35's -frame filter improvement. Correct fallback-union calls fell from about 51/53 to -33/25 microseconds. Nested ordinary references still add about 0.74/0.42 -microseconds over rc0; this remaining cost is explicit. All measurements include -the final lifetime correction. See the focused plan for matched baselines, -artifact hashes and the complete timing methodology. - -This demonstrates a working local fix, not compatibility provided by published -rc0. The dependency metadata and lock are unchanged, and the new integration -suite under `tools/upstream/` is explicitly invoked rather than silently skipped -or marked xfail. Normal rc0 CI can remain green while that separate suite fails -on rc0. After upstream acceptance and release, adopt the concrete dependency -across metadata, lock, preflight and CI, move the cases into the required suite, -and rerun candidate validation including CUDA. The patch has not been submitted -upstream, and no package has been published or ownership transferred. - -See `tools/upstream/README.md` in the repository for commands. - -### CuPy static boundary - -CuPy 14.2.0 supplies neither `py.typed` nor usable native ndarray stubs. A real -installed-CuPy consumer reveals Unknown/Any for ordinary native operations: -strict pyright/mypy report missing typing information, while ty/pyrefly can -accept the code with Unknown. The protocol fallback proves only its small -structural surface; it does not establish native method inference. - -The owner accepted explicitly limited static CuPy support alongside the verified -GPU runtime behavior. This is no longer an open release-policy decision. Keep -the limitation visible in typing docs and release notes; do not claim native -method inference or parity with NumPy/JAX/Torch. Any future stronger typing -claim needs actual installed-CuPy positive, negative and inference consumers. - -## Validated artifact identity - -The hook follow-up run -[34231187384](https://github.com/beartype/bearshape/actions/runs/34231187384) -validated source `0717df2f2194cdcb10bcf37ba291c09117c42238`. Both Python -endpoint consumers passed **1,105 tests**, with one explicit absent-CuPy skip -each. Its wheel SHA256 remains -`c1806203da013c9eaf2482a309c686a984c0a7031a495efbd100a824536b57d2`, identical to -the GPU-tested artifact. Its updated sdist SHA256 is -`19b7e7252f2c64e4ea014e92a14b7a25a8409db20612205da257c1d04df9e85b`. The earlier -release-specific runs below remain evidence of publication gating; no -publication was triggered by these merges. - -The actual -[validation-only release run](https://github.com/beartype/bearshape/actions/runs/34221337124) -completed with 38 successful jobs and its sole publishing job intentionally -skipped. It ran all -runtime/checker/floor/docs/notebook/archive/minimal/installed checks against -source commit `3ee4c1d8a0c3d22f537a24b447a9d75e025a5b2d`. The `release-evidence` -artifact records: - -```text -version: 0.1.0rc0 -wheel SHA256: -c1806203da013c9eaf2482a309c686a984c0a7031a495efbd100a824536b57d2 -sdist SHA256: -e2454095144fb4bb5a08d3bd998d0f6a8bee4bc5ad81dfab763c339ca91666df -``` - -The wheel was built from the source archive and installed normally outside the -checkout at both Python endpoints. The exact same wheel also passed all 95 CuPy -GPU cases on both endpoints without skips. The consumer driver copies the -archive's own lockfile, tests and tooling, leaves package source absent, and -verifies site-packages origins and exact beartype rc0. The same artifact pair is -what the publisher would download; it does not rebuild distributions. Later -source changes produce their own source-archive hashes and require their -applicable validation before publication. - -The subsequent -[Node 24 validation run](https://github.com/beartype/bearshape/actions/runs/34223582731) -also completed 38 successful jobs and skipped publication. It includes the four -additional call-boundary cases: 1,101 installed-consumer tests pass at each -endpoint with one absent-CuPy skip. Its source is -`6f40e4a484b70535c58e2c86a645a64ab1079143`; its wheel is byte-identical to the -GPU-validated wheel above. Its updated source archive has SHA256: - -```text -38d89d4ce1b351601ff8602a9a27b4e9af46db056be3ac0eaf41a68ac56a3706 -``` - -[#30](https://github.com/beartype/bearshape/pull/30) updates artifact/Pages -actions to reviewed Node 24 releases. Required docs validation successfully -packaged the 46-file Pages archive, including this report and the logo. The -inspected action logs no longer contain the Node 20 deprecation warning. Actual -Pages deployment remains unperformed during this review. The current upstream -download action still emits a `Buffer()` deprecation notice; no suppression was -added. Artifact digest verification and all consumers passed. - -## Performance observations - -A matched comparison uses normally installed baseline/candidate wheels on the -same macOS arm64 host, CPython 3.10.20, beartype 0.23.0rc0, NumPy 2.2.6, optree -0.19.1 and typing_extensions 4.16.0. The baseline is the rc0-floor artifact -before runtime corrections; the candidate is the hosted artifact identified -above. Five repetitions report medians and min/max, without a CI timing gate. - - - -| Workload | Baseline median (µs) | Candidate median (µs) | Candidate min–max (µs) | -| ----------------------- | -------------------- | --------------------- | ---------------------- | -| `native/3` | 0.120 | 0.120 | 0.119–0.124 | -| `strict/3` | 21.827 | 19.818 | 19.702–20.084 | -| `strict/1000000` | 21.732 | 19.730 | 19.668–19.761 | -| `explicit/3` | 14.554 | 14.042 | 13.979–14.076 | -| `like/3` | 11.356 | 10.208 | 10.177–10.223 | -| `value/3` | 16.295 | 15.770 | 15.730–15.795 | -| `nested/3` | 44.192 | 40.943 | 40.873–41.015 | -| `like-sequence/1000000` | 13950.325 | 13596.900 | 13385.142–13735.867 | -| `tree/1` | 34.232 | 32.245 | 32.095–34.930 | -| `tree/100` | 517.754 | 487.143 | 485.315–488.897 | -| `diagnostic/3` | 124.950 | 120.643 | 119.869–122.627 | - - - -Run `uv run --locked python tools/benchmark_runtime.py` to reproduce the -workloads. The script records versions, origins and per-case call counts. -Ordinary cases use 10,000 calls per repetition; expensive sequence conversions, -100-leaf trees and diagnostics use explicit smaller counts recorded in JSON. The -results are local observations, not cross-platform guarantees or a comparison -with another shape library. - -Strict native checks show little dependence on element count. Sequence -conversion scales with data size; tree validation scales with leaf count. -Profiling the strict path identifies scope/frame discovery and repeated -signature inspection as remaining costs. No new cache or optimization was -introduced while the composition boundary is unresolved. Prefer checks at -meaningful API boundaries and revisit scope work after the integration contract -is settled. - -## Migration and administrative handoff - -Users move from the prior beartype generation to the rc0 floor. Backend Like -validation now obeys the selected converter and retains the original argument; -values accepted only through a NumPy fallback may be rejected. Like/Tree static -annotations accept the tested ordinary callers while preserving useful native -types. Bare `@check` remains memo-only; combine it with `@beartype` or use -`@check(conf=...)` for checking. Public identity remains lowercase `bearshape`. - -Read-only GitHub inspection on 2026-09-08 found no protection on `main`, no -repository rulesets, and no required approval reviewers on `pypi`. That -environment currently permits `main` branches and `v*` tags, with administrator -bypass enabled. `github-pages` permits `docs`/`main` branches. These controls -were not changed. PyPI publisher configuration and package ownership have not -been verified through an authenticated package-owner interface. - -The 2026-09-10 transfer check confirmed Actions and all six workflows are -active, Pages uses GitHub Actions, and `github-pages` still permits -`main`/`docs`. The repository has no Actions secrets, Actions variables or -webhooks to migrate. `main` remains unprotected with no repository rulesets; the -`pypi` environment still has no required reviewers and permits `main` and `v*` -tags. These are existing release prerequisites, not new transfer repairs. - -Before publication, the owner and organization should approve and apply the -following concrete settings: - -1. Protect `main` with reviewed pull requests, stale-approval dismissal, blocked - force-push/deletion, and the observed `validate / Required validation` - check from the final CI workflow. Verify the exact check identity after the - PR set is merged; do not require a stale job name. -1. Protect release tags against unreviewed creation, replacement and deletion. - Add named receiving maintainers or a designated release team as the - authorized release actors. -1. Require release-review approval on `pypi`, prevent self-review, disallow - administrator bypass, and restrict deployments to approved version tags. - The publish workflow must itself run from the matching tag and commit. -1. In - [PyPI publishing settings](https://pypi.org/manage/project/bearshape/settings/publishing/), - verify the trusted publisher uses owner `beartype`, repository - `bearshape`, workflow filename `pypi.yml` and environment `pypi`. A - publisher bound to the former owner does not match the new GitHub identity. - Retain OIDC rather than adding an upload token; see - [PyPI's setup instructions](https://docs.pypi.org/trusted-publishers/adding-a-publisher/). -1. GitHub ownership and Pages restoration are confirmed. Separately verify PyPI - ownership and recovery access. Published `0.0.1` retains the old URL - metadata; updated source metadata applies to future distributions. The old - Pages address has no GitHub redirect; readers must use the new address. -1. Complete the selected upstream union integration. Run the final immutable - candidate validation, inspect hashes and GPU evidence, then separately - authorize prerelease publication and any remaining PyPI ownership - operations. - -The repository changes make these steps reviewable; they do not perform them. -See the repository's `CONTRIBUTING.md` for validation-only, tag-based release -and explicitly dispatched Pages deployment procedures. `AGENTS.md` and the -`CLAUDE.md` symlink share current agent guidance; `tools/README.md` documents -the existing validators. PR #31 aligns those files with the accepted decisions. diff --git a/docs/maintainers/releasing.md b/docs/maintainers/releasing.md index fdf21b5..0110e3d 100644 --- a/docs/maintainers/releasing.md +++ b/docs/maintainers/releasing.md @@ -1,217 +1,51 @@ -# Validating and publishing bearshape +# Releasing bearshape -Publication is a separate owner decision after candidate validation. Merging a -PR does not authorize a PyPI upload or a Pages deployment. Use the -validation-only route below while preparing the next release. +Releases are automated by `.github/workflows/pypi.yml`, in the same way as +beartype's own release workflow. Pushing a `v`-prefixed tag creates a GitHub +Release and publishes the same tag to PyPI through trusted publishing. -## Current release blocker +## Steps -Released beartype 0.23.1 does not roll back a failed native composite-union -alternative's bearshape bindings. The original probe and expanded integration -suite are mandatory release gates on Python 3.11 and 3.14. They currently fail -with the published dependency. A tested local upstream proposal is useful -engineering evidence, but cannot substitute for an available supported release. -Do not skip, mark xfail, or remove these gates to publish. +1. In a PR, set `version` in `pyproject.toml` (for example `0.1.1`), run + `uv lock`, and move the `Unreleased` changelog entries under the new + version. Merge it once `check` passes. -Ordinary CI and nightly validate the selected Python/dependency baseline and all -ordinary regression cases. Release validation additionally requires the complete -composition contract from the normally installed candidate wheel. The gate -collects `tools/upstream/` as a directory so union, scope, isolation and audit -composition modules all run. Tests from the optional patched upstream source are -not substituted for this published-dependency gate. Once supported upstream -integration is adopted, promote the transaction cases into the normal source and -installed-archive suites as well. +1. Tag the merged commit on `main` and push the tag: -## Prerequisites owned by maintainers + ```bash + git checkout main && git pull + git tag v0.1.1 + git push origin v0.1.1 + ``` -Before any upload, verify the following settings with the repository and PyPI -owners. Workflow files do not configure these controls: +1. The workflow fails early if the tag does not equal `v` plus the + `pyproject.toml` version. Versions such as `0.2.0rc1` are marked as GitHub + prereleases and published to PyPI as prereleases. -- Protect `main` with pull-request review and the actual **Required validation** - check from the reusable CI workflow. Require checks on the reviewed head; - prohibit force pushes and deletion. -- Protect release tags matching `v*` against update/deletion and restrict their - creation to authorized release maintainers. Do not move a published tag. -- Configure the `pypi` environment with required reviewers, prevent - self-approval, disable administrator bypass, and allow only approved version - tags. Remove its old `main` branch deployment exception. -- A PyPI project owner must verify ownership/recovery access and the trusted - publisher: owner **beartype**, repository **bearshape**, workflow - **pypi.yml**, environment **pypi**. Inspect the private publishing settings - directly. GitHub ownership transfer does not update or prove this external - trust. -- Obtain fresh CUDA/CuPy results for the exact candidate wheel, including source - SHA, wheel hash, interpreter/backend/driver versions and actual device. CPU - skips and older GPU logs do not validate a changed candidate. +1. `docs.yml` also runs on the tag and deploys the website. -The October 2026 audit found the GitHub protections/reviewers incomplete and -PyPI trust unverified. Keep them outstanding until there is actual verification. +If the PyPI upload fails, fix the cause and re-run the failed job. Never reuse a +version number that already reached PyPI. -The project can remain owned by a personal PyPI account. Its owner configures -**Publishing → Trusted Publisher**, separately from the **Collaboration** page -that manages project roles. No PyPI organization transfer is required. The -GitHub `pypi` environment reviewer is a separate approval: preventing -self-approval requires someone other than the person starting the release. -Choose that reviewer before enabling publication; keep the choice pending while -preparing the candidate. +## One-time setup -## Dependency canary +These live in GitHub and PyPI settings, not in the repository: -Nightly also runs a separate latest-compatible dependency canary at both Python -endpoints. It upgrades beartype, NumPy, JAX/jaxlib, Torch, optree and -`typing-extensions` within the declared constraints in a disposable lock, keeps -the maintained checker toolchain and records the resolved inputs. Failures are -visible and must be investigated before proposing a lock update. The canary uses -`validate_runtime.py cpu --latest-compatible`; normal/release acceptance keeps -the exact preflight. A passing canary neither repairs the known union blocker -nor authorizes publishing. +- **PyPI**: the project needs a trusted + publisher with owner `beartype`, repository `bearshape`, workflow `pypi.yml` + and environment `pypi`. See + [PyPI's guide](https://docs.pypi.org/trusted-publishers/adding-a-publisher/). + No upload token is needed. +- **GitHub environment `pypi`**: create it under Settings → Environments. + Required reviewers are optional; if set, each release waits for one of them. +- **GitHub environment `github-pages`**: allow tags matching `v*` as well as + `main`, so tagged releases can deploy the docs. +- **Branch rules for `main`**: require the `check` status from `ci.yml` and + squash merges. -## Prepare a candidate +## Before a release -Use uv 0.13.0 and Python 3.11–3.14. If a global uv version is outside the -project's 0.13 range, bootstrap `uv tool install uv==0.13.0` outside the -checkout and put that executable first on PATH. From the repository root: - -```bash -uv sync --locked -uv run --locked prek install -uv run --locked pytest tests/ --ignore=tests/test_typecheck.py -n auto -uv run --locked pytest tests/test_typecheck.py -q -uv run --locked prek run -a -uv run --locked prek run actionlint -a --stage manual -``` - -Update the independently versioned bearshape version in `pyproject.toml`, -refresh `uv.lock`, and write the changelog and migration notes in a reviewed PR. -Refresh candidate/release notices in README, installation, the tour and the -current handoff at the same time; existing PyPI metadata and the deployed site -do not change when source docs are merged. Versions must be canonical `X.Y.Z`, -optionally followed by `aN`, `bN` or `rcN`. Do not change the version just to -match beartype. Keep exact dependency preflights, tox, CI and the lock -synchronized when adopting an upstream release. - -Build into an empty output directory: a candidate consists of exactly one source -archive and one pure-Python wheel. Build the wheel from the source archive, then -check both archives and normal consumers: - -```bash -uv build --sdist -uv build dist/bearshape-.tar.gz --wheel -uv run --locked python tools/check_distribution.py dist/*.whl dist/*.tar.gz -uv run --locked python tools/check_installed.py \ - dist/*.whl dist/*.tar.gz --python 3.11 -uv run --locked python tools/check_installed.py \ - dist/*.whl dist/*.tar.gz --python 3.14 -``` - -Replace `` with the candidate version. Preserve old evidence in a -separate directory instead of mixing versions in `dist/`. The source archive -includes consumer tests; the installed check runs them without the package -source folder. Minimal consumers must use fresh environments with no optional -backend. The shared hosted matrix also checks platform endpoints, all four -static engines, backend/checker floors, coverage, rendered docs and notebook -execution. - -### Final CUDA evidence - -Use an owner-approved CUDA environment with a fresh virtual environment and a -CuPy distribution compatible with its driver. Install the exact reviewed wheel -normally, plus the copied source archive's test dependencies; do not install the -bearshape checkout in editable mode. Record `pip freeze` (or `uv pip list`), -source SHA and the wheel's SHA256, then run the environment's interpreter: - -```bash -python -I -c "import cupy; assert cupy.cuda.runtime.getDeviceCount() > 0; cupy.show_config()" -python -I -c "import bearshape, pathlib, sys; assert pathlib.Path(bearshape.__file__).resolve().is_relative_to(pathlib.Path(sys.prefix).resolve())" -python -I -m pytest /tests/test_cupy.py \ - --installed-package -n 0 -``` - -Repeat at both supported endpoint interpreters, retain device/driver details and -complete test results, and investigate any skip. CPU-only skips, prior wheels -and historical GPU reports cannot substitute for this evidence. - -## Run validation without publishing - -Dispatch the release workflow from the reviewed branch/tag containing the -pipeline, with an explicit source commit and publication disabled: - -```bash -gh workflow run pypi.yml --repo beartype/bearshape \ - --ref \ - -f ref= -F publish=false -``` - -Use the full 40-character commit SHA for ``; checkout does not -resolve an abbreviated SHA reliably. A branch or tag is appropriate for `--ref`, -which selects the workflow definition. - -The workflow resolves the source once. Shared validation builds and tests -`candidate-distributions`; the additional composition jobs install that wheel -normally and exercise the union contract. Only successful required validation -and composition checks produce `release-evidence`. A blocked union is a failed -release validation, never a successful dry run. The publishing job is skipped -when `publish=false`. - -Review the workflow's source SHA and job results, then download both artifacts: - -```bash -gh run download --repo beartype/bearshape \ - -n candidate-distributions -D candidate/dist -gh run download --repo beartype/bearshape \ - -n release-evidence -D candidate/evidence -python tools/check_release_evidence.py verify \ - candidate/evidence/release-evidence.json candidate/dist \ - --source-sha --version \ - --run-url https://github.com/beartype/bearshape/actions/runs/ -``` - -The manifest binds the version, source, originating run, canonical filenames and -SHA256 hashes. Verification rejects additional files, missing archives, -symlinks, changed bytes or substituted identity. Retain the manifest, full test -results and matching GPU evidence in the release review packet. - -## Publish later, after explicit approval - -This section documents a future authorized action. No publication is part of the -October implementation task. After review, merge the approved source and verify -its final main checks. Create the canonical `v` tag on that exact -commit; it must already belong to `origin/main` history. The publishing workflow -itself must execute from the same tag and commit. - -Choose one trigger: publish the corresponding GitHub release, marking it as a -prerelease exactly when the version has an a/b/rc suffix, **or** explicitly -dispatch from the tag: - -```bash -gh workflow run pypi.yml --repo beartype/bearshape --ref v \ - -f ref=v -F publish=true -``` - -Every publishing run performs full validation. Before approving its `pypi` -environment, review that run's evidence and exact hashes; a previous dry run is -not an approval of different bytes. The upload job downloads those same -artifacts, verifies their manifest again and uses OIDC trusted publishing. It -never rebuilds the package and receives no long-lived upload token. Concurrent -attempts for the same tag are serialized without cancelling an in-progress -publication. - -After success, verify the PyPI version, metadata and downloadable archive hashes -against the manifest, then test a fresh normal install from PyPI. Update release -notes and close the release-request issue only after the release exists. Pages -has its own manually approved deployment procedure in CONTRIBUTING. - -## Failure and recovery - -If any validation or evidence check fails, repair it in a reviewed source change -and run validation again. Do not bypass the failure or replace artifact bytes in -an existing evidence packet. A missing GitHub artifact requires a new complete -validation run, not a local rebuild uploaded without its checks. - -If upload fails, inspect PyPI before retrying. PyPI versions/files are -immutable; never move the tag, overwrite a released version, or enable -skip-existing to hide a partial publication. If nothing was uploaded, retry only -with the same validated artifacts and reviewed identity. If publication was -partial or wrong, coordinate a new version with the PyPI owner and document what -happened. No token fallback is part of the process: fix the trusted-publisher -identity or environment approval instead. +- `CHANGELOG.md` describes user-visible changes. +- CI on `main` is green, including the beartype prerelease job. +- CuPy runs only on CUDA hardware and is not covered by hosted CI. Test it on a + GPU machine when a release changes CuPy behavior. diff --git a/examples/bearshape_tour.ipynb b/examples/bearshape_tour.ipynb index db94697..c3cf8b7 100644 --- a/examples/bearshape_tour.ipynb +++ b/examples/bearshape_tour.ipynb @@ -13,7 +13,7 @@ "\n", "This notebook walks through every major feature.\n", "\n", - "This tour targets the unpublished **0.1.0rc1** candidate: Python **3.11–3.14**, exact beartype **0.23.1**. Use the repository's [locked contributor setup](../CONTRIBUTING.md). PyPI 0.0.1 is an older release. Native composite-union rollback is still a [release blocker](../docs/features/composition.md); the memo helpers do not repair it.\n" + "This tour targets bearshape **0.1.0**: Python **3.11–3.14**, beartype **0.23.1**. Named dimensions inside a failed union alternative are a [known limitation](../docs/features/composition.md); the memo helpers do not repair it.\n" ] }, { @@ -1166,7 +1166,7 @@ "source": [ "## 15. Explicit memo management\n", "\n", - "For explicit memo lifetime, use `@bearshape.check` or `check_context`. Bare `@check` is memo-only; stack it above `@beartype`, or use `@check(conf=BeartypeConf())` for checking. Neither helper repairs the native-union blocker.\n", + "For explicit memo lifetime, use `@bearshape.check` or `check_context`. Bare `@check` is memo-only; stack it above `@beartype`, or use `@check(conf=BeartypeConf())` for checking. Neither helper repairs the native-union limitation.\n", "\n", "`@bearshape.check` works for both sync and async functions; this section shows both forms plus `check_context()` for manual `is_bearable()` checks.\n" ] diff --git a/plans/2026-05-28-baseline-audit.md b/plans/2026-05-28-baseline-audit.md deleted file mode 100644 index a5a5c22..0000000 --- a/plans/2026-05-28-baseline-audit.md +++ /dev/null @@ -1,424 +0,0 @@ -# Baseline audit before bearshape rename - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - -This ExecPlan is a living document. The sections `Progress`, -`Surprises & Discoveries`, `Decision Log`, and `Outcomes & Retrospective` must -be kept up to date as work proceeds. - -This repository contains `PLANS.md` at the repository root. This document must -be maintained in accordance with `PLANS.md`. - -## Purpose / Big Picture - -The project is being renamed to bearshape and prepared for a production-quality -release under the beartype organization. Before changing package names, public -APIs, CI, tox, docs, or implementation internals, this audit records what works -today and what is already broken. The result should let a future contributor -separate pre-existing failures from regressions introduced by the rename and -cleanup work. - -After this plan is complete, a maintainer should be able to read this file and -know the current local baseline: which tests pass, which tests fail, which type -checkers fail, which hooks fail, what coverage is deferred, and which areas -should become separate follow-up plans. - -## Progress - -- [x] (2026-05-28 09:01Z) Created branch `codex/baseline-audit` in worktree - `/Users/ale/Code/bearshape-baseline-audit`. -- [x] (2026-05-28 09:01Z) Added the agent workflow files needed for this audit: - `AGENTS.md`, `CLAUDE.md` as a symlink to `AGENTS.md`, and `PLANS.md`. -- [x] (2026-05-28 09:01Z) Pushed `codex/baseline-audit` to GitHub. GitHub - reported that the repository moved to `acecchini/bearshape`. -- [x] (2026-05-28 09:05Z) Opened draft PR - `https://github.com/acecchini/bearshape/pull/4` against `main`. -- [x] (2026-05-28 09:03Z) Ran `uv sync`; the locked development environment - installed successfully with CPython 3.10.20. -- [x] (2026-05-28 09:08Z) Ran local runtime tests with CuPy deferred because - this machine does not currently have a CUDA-capable GPU. -- [x] (2026-05-28 09:09Z) Ran the current type-checking contract: - `tests/test_typecheck.py`, pyright, mypy, and ty. -- [x] (2026-05-28 09:11Z) Ran local hooks with `uv run prek run -a`; the command - failed and auto-modified files. -- [x] (2026-05-28 09:14Z) Ran `uv run tox run -e dev`; it passed with CuPy - skipped because `cupy` is not installed. -- [x] (2026-05-28 09:17Z) Checked draft PR CI; ruff, typecheck, and - typecheck-compat passed, spelling failed. -- [x] (2026-05-28 09:18Z) Audited packaging, tox, CI, docs, README, CHANGELOG, - and public import names for drift from the bearshape target. -- [x] (2026-05-28 09:20Z) Wrote a current contract map that links runtime - features, typing fixtures, docs, and tests. -- [x] (2026-05-28 09:20Z) Summarized follow-up work as separate candidate - ExecPlans. - -## Surprises & Discoveries - -- Observation: The remote still appears locally as - `https://github.com/acecchini/bearshape.git`, but pushing reports that the - repository moved. Evidence: `git push -u origin codex/baseline-audit` - printed - `This repository moved. Please use the new location: https://github.com/acecchini/bearshape.git`. -- Observation: Automatic PR creation is not available yet in this local session. - Evidence: the GitHub connector timed out during startup twice, and - `gh auth status` reported that the local token for account `acecchini` is - invalid. -- Observation: Rechecking `gh auth status` outside the read-only sandbox found - the keyring login and enabled PR creation. Evidence: `gh auth status` - succeeded when run with escalated permissions, and `gh pr create` opened - `https://github.com/acecchini/bearshape/pull/4`. -- Observation: The core local runtime and typing surfaces are healthier than - expected. Evidence: non-CuPy pytest passed with `1033 passed, 4 skipped`; - typecheck integration passed with `30 passed`; direct pyright, mypy, and ty - all passed. -- Observation: Local `tox run -e dev` passes, but it skips CuPy entirely. - Evidence: tox reported `1063 passed, 5 skipped`, coverage `91.28%`, and - `tests/test_cupy.py:9: could not import 'cupy': No module named 'cupy'`. -- Observation: Local hooks are not currently green for this branch. Evidence: - `uv run prek run -a` failed after `end-of-file-fixer` modified `PLANS.md`, - and `markdownlint-fix` reported MD025, MD040, and MD013 violations in - `PLANS.md` and the audit ExecPlan. -- Observation: Running hooks caused broad formatter churn outside the audit - scope. Evidence: `git status --short` showed modifications to `AGENTS.md`, - `PLANS.md`, `docs/assets/js/tesseract.js`, `docs/stylesheets/extra.css`, - `examples/bearshape_tour.ipynb`, `mkdocs.yml`, and this ExecPlan. -- Observation: CI spelling does not match local `prek` behavior. Evidence: - local `prek` reported `typos` passed, but the PR spelling job ran `typos .` - and failed on `npt.NDArray` occurrences in `examples/bearshape_tour.ipynb`. -- Observation: The bearshape rename had not started in tracked contract - artifacts at audit time. Evidence: the previous identifier still appeared - throughout source, tests, docs, examples, CI, and publishing configuration, - while bearshape references were limited to the new agent and plan files. - -## Decision Log - -- Decision: Start with a baseline audit rather than a rename. - Rationale: Renaming first would mix pre-existing failures with rename - regressions. The audit creates a factual starting point. - Date/Author: 2026-05-28 / Codex -- Decision: Defer CuPy runtime validation locally. - Rationale: CuPy needs a CUDA-capable GPU, and the current machine does not - have one. CuPy coverage must be tracked explicitly instead of implied by CPU - test runs. - Date/Author: 2026-05-28 / Codex -- Decision: Keep this PR mostly non-invasive. - Rationale: The purpose is to observe the current baseline. Fixes discovered - during the audit should become separate, scoped plans unless a small workflow - fix is required to complete the audit itself. - Date/Author: 2026-05-28 / Codex - -## Outcomes & Retrospective - -The local runtime and typing baseline is usable: non-CuPy pytest, the -typechecker integration test, direct pyright, direct mypy, direct ty, and -`tox run -e dev` all pass. The major caveat is that CuPy runtime behavior is not -validated locally because this machine does not have CUDA GPU support and `cupy` -is not installed. - -At audit time, the repo was not ready for rename or release work yet. The public -identity had not been changed across package metadata, source package names, -docs, tests, examples, CI, and publishing configuration. Local hooks and CI -spelling were not green for the branch. The next work should be split into -explicit plans rather than folded into this audit PR. - -## Context and Orientation - -The desired public identity is bearshape. The package metadata lives in -`pyproject.toml`, tox configuration in `tox.toml`, GitHub workflows in -`.github/workflows/`, documentation under `docs/`, and public examples in -`README.md` plus docs pages. - -The runtime product surface is runtime shape and dtype checking powered by -beartype. Runtime behavior includes validators, decorators, shape matching, -dtype matching, backend-specific conversion rules, tree validation, and error -messages. - -The static product surface is the annotation syntax accepted by type checkers. -The current required checkers are pyright, mypy, and ty. Pyrefly is planned for -addition after a separate plan. Zuban is only a possible future consideration -and should not be added in this audit unless the user explicitly expands scope. - -CuPy is a special backend for validation. Unlike NumPy, JAX CPU, Torch CPU, and -optree, CuPy requires CUDA GPU support. This local audit must record CuPy as -deferred instead of treating it as passed. - -## Plan of Work - -First, establish the repository workflow baseline. Confirm the branch and -worktree, record the pushed branch, and open a draft PR if credentials allow it. -If PR creation remains blocked by local authentication or connector -availability, record the blocker and continue the audit without making code -changes. - -Second, install the current development environment with `uv sync`. Record -whether dependency resolution and installation succeed. If installation fails -because of local cache, network, or tool availability, record the exact failure -and retry only when the retry is a clear environment fix rather than a code -change. - -Third, run the runtime test suite that can be exercised on this machine. Run all -non-CuPy tests with pytest and `-n auto`. Do not run `tests/test_cupy.py` as -proof of local support because this machine lacks a CUDA-capable GPU. - -Fourth, run the static typing surface. Execute `tests/test_typecheck.py`, then -run pyright, mypy, and ty directly against `src` and `tests/typing`. - -Fifth, run hooks with `uv run prek run -a`. Record each failure as a current -baseline issue. Do not fix hook output in this audit unless the hook failure -prevents further audit commands from running. - -Sixth, inspect contract artifacts. Read `pyproject.toml`, `tox.toml`, -`.github/workflows/*.yml`, `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, -`docs/`, `src/bearshape/`, `tests/`, and `tests/typing/`. Record obvious drift, -duplicate or stale surfaces, rename requirements, missing test coverage, and -docs that advertise behavior not proven by tests. - -Seventh, update this ExecPlan with the observed results. The final audit should -identify follow-up plans, not implement all fixes in one PR. - -## Concrete Steps - -Run all commands from the repository root of the audit worktree: - - cd /Users/ale/Code/bearshape-baseline-audit - -Confirm branch and status: - - git branch --show-current - git status --short --branch - git remote -v - -Install the current locked development environment: - - uv sync - -Run local runtime tests except CuPy: - - uv run pytest -n auto \ - tests/test_decorator.py tests/test_memo.py tests/test_dimensions.py \ - tests/test_shape.py tests/test_dtypes.py tests/test_numpy.py \ - tests/test_jax.py tests/test_torch.py tests/test_tree.py \ - tests/test_coverage_edges.py - -Run the typing contract: - - uv run pytest -n auto tests/test_typecheck.py - uv run pyright src tests/typing - uv run mypy src tests/typing - uv run ty check src tests/typing - -Run hooks: - - uv run prek run -a - -Inspect repo contract artifacts: - - rg -n "|bearshape" \ - pyproject.toml tox.toml README.md CHANGELOG.md CONTRIBUTING.md \ - docs src tests .github - rg -n "cupy|CuPy|CUDA|gpu|GPU" \ - pyproject.toml tox.toml README.md docs tests .github - rg -n "pyright|mypy|ty|pyrefly|zuban" \ - pyproject.toml tox.toml tests docs .github - -## Validation and Acceptance - -This audit is accepted when this file contains a factual current baseline with -command outcomes. The acceptance is not that the suite passes. The acceptance is -that the current state is known, reproducible, and split into follow-up work. - -Required evidence: - -- `uv sync` result recorded. -- Non-CuPy pytest result recorded. -- CuPy explicitly marked as deferred until CUDA GPU validation exists. -- `tests/test_typecheck.py` result recorded. -- Direct pyright, mypy, and ty results recorded. -- `prek` hook result recorded. -- Public identity drift toward `bearshape` inventoried. -- CI, tox, packaging, docs, and typing fixture issues inventoried. -- Follow-up candidate ExecPlans listed with clear scopes. - -## Current Contract Map - -Runtime array contracts currently live in `src/bearshape/_array_types.py`, -`src/bearshape/_shape.py`, and backend modules under `src/bearshape/`. They are tested -mainly by `tests/test_numpy.py`, `tests/test_jax.py`, `tests/test_torch.py`, -`tests/test_cupy.py`, `tests/test_shape.py`, and `tests/test_coverage_edges.py`. -Local validation covered NumPy, JAX CPU, Torch CPU, shape internals, and edge -tests. CuPy runtime validation is deferred. - -Dimension syntax and `Value(...)` behavior live in `src/bearshape/_dimensions.py` -and `src/bearshape/_shape.py`. They are tested by `tests/test_dimensions.py`, -`tests/test_shape.py`, backend tests, and typing fixtures that import public -dimension symbols. - -Dtype normalization lives in `src/bearshape/_dtypes.py` and is exercised by -`tests/test_dtypes.py` plus backend tests. The local baseline passed with -platform skips for unavailable distinct `float128/longdouble` and -`complex256/clongdouble`. - -Memo and decorator behavior live in `src/bearshape/_memo.py` and -`src/bearshape/_decorator.py`. They are tested by `tests/test_memo.py` and -`tests/test_decorator.py`, including sync and async paths. - -Tree behavior lives in `src/bearshape/_tree.py`, `src/bearshape/optree.py`, and the -JAX backend. It is tested by `tests/test_tree.py` and typing fixture -`tests/typing/check_tree.py`. - -Static typing behavior is represented by `tests/test_typecheck.py` and all files -under `tests/typing/`. The current checked surface passes pyright 1.1.408, mypy -1.19.1, and ty 0.0.29. Pyrefly and zuban are not configured. - -Docs and examples are contract artifacts, but they are not yet lean. `README.md` -is long, `docs/` contains bearshape-specific pages and assets, and -`examples/bearshape_tour.ipynb` is included in CI spelling checks. - -## Follow-up Candidate ExecPlans - -1. bearshape rename: rename package metadata, source package, imports, docs, - examples, CI, publishing URL, coverage source, and public references from the - previous public identity to `bearshape`. -2. Hook and CI hygiene: resolve the `PLANS.md` versus mdformat/markdownlint - conflict, remove formatter churn from generated or vendored assets, and align - local `prek` spelling with the CI `typos .` job. -3. CuPy validation strategy: define when and where CUDA-backed CuPy runtime tests - run, what is locally skipped, and how CI records the gap. -4. CI and tox rebuild: update the matrix for bearshape, uv-based publishing, - pyrefly evaluation, and release confidence without over-testing slow axes on - every PR. -5. Docs and README cleanup: rewrite from actual code behavior, keep README - succinct, keep examples test-backed where practical, and remove aspirational - or stale contract claims. -6. Runtime code review and slop removal: audit internals for duplicate logic, - useless helpers, stale compatibility paths, and unclear failure messages, - while preserving the now-green baseline. -7. Static checker expansion: add pyrefly through a focused plan and decide - whether zuban belongs in the supported contract. - -## Idempotence and Recovery - -The audit commands are read-only except for environment installation, caches, -and generated test artifacts. They can be rerun safely. If `uv sync` or test -commands fail because of missing dependencies, record the exact error first. Do -not delete caches, rewrite lockfiles, or change dependency ranges unless a -separate plan approves that work. - -If local GitHub PR creation remains blocked, use the pushed branch URL as the -recovery path: - - https://github.com/acecchini/bearshape/pull/new/codex/baseline-audit - -## Artifacts and Notes - -Initial branch evidence: - - Worktree: /Users/ale/Code/bearshape-baseline-audit - Branch: codex/baseline-audit - Initial commit: 2c5f93f Add agent workflow instructions - Pushed branch: origin/codex/baseline-audit - Remote move notice: https://github.com/acecchini/bearshape.git - -PR creation evidence: - - gh auth status reported an invalid local token for acecchini. - The GitHub connector timed out during startup twice. - After rechecking gh auth outside the read-only sandbox, gh pr create opened: - https://github.com/acecchini/bearshape/pull/4 - -uv sync evidence: - - uv sync completed successfully. - Python used: CPython 3.10.20 - Project installed: bearshape==0.0.1 from the local checkout. - Notable warning: the MIT license classifier is deprecated under PEP 639. - -Non-CuPy pytest evidence: - - uv run pytest -n auto tests/test_decorator.py tests/test_memo.py ... - 1033 passed, 4 skipped in 16.92s - Skipped: platform float128/longdouble and complex256/clongdouble variants. - -Type-checking evidence: - - uv run pytest -n auto tests/test_typecheck.py - 30 passed in 22.25s - - uv run pyright src tests/typing - 0 errors, 0 warnings, 0 information - - uv run mypy src tests/typing - Success: no issues found in 26 source files - - uv run ty check src tests/typing - All checks passed! - -Tox dev evidence: - - uv run tox run -e dev - 1063 passed, 5 skipped in 55.67s - Coverage: 91.28%, above the 90% threshold. - CuPy skip: tests/test_cupy.py could not import cupy. - -Hook evidence: - - uv run prek run -a - Failed. - end-of-file-fixer modified PLANS.md. - markdownlint-fix failed on PLANS.md and plans/2026-05-28-baseline-audit.md. - Hook run also modified AGENTS.md, docs assets, the notebook, and mkdocs.yml. - -Draft PR CI evidence: - - gh pr checks 4 --repo acecchini/bearshape - ruff: pass - typecheck: pass - typecheck-compat: pass - Spell Check with Typos: fail - - The spelling job runs typos . and fails on npt.NDArray in - examples/bearshape_tour.ipynb. - -Rename inventory evidence: - - rg -o "|bearshape" ... | wc -l - 1102 - - No target-identity matches were found in the checked contract artifacts. - Explicit stale identity locations include pyproject.toml, mkdocs.yml, - README.md, CHANGELOG.md, docs, examples, tests, src/bearshape, and - .github/workflows/pypi.yml. - -## Interfaces and Dependencies - -The audit should not add runtime dependencies. It uses the existing project -toolchain declared in `pyproject.toml`: uv for environment management, pytest -for tests, pyright, mypy, and ty for static typing, prek for hooks, and tox for -CI-oriented matrix validation. Pyrefly and zuban are out of scope for this audit -except as future work items. - -The main files and directories under inspection are: - -- `pyproject.toml` for package metadata, dependency groups, checker settings, - and uv build settings. -- `tox.toml` for version and backend matrix validation. -- `.github/workflows/` for CI, docs, nightly, and PyPI publishing workflows. -- `src/bearshape/` for the current runtime package. -- `tests/` for runtime behavior. -- `tests/typing/` for static typing fixtures. -- `README.md`, `docs/`, `CONTRIBUTING.md`, and `CHANGELOG.md` for public - contract artifacts. - -## Revision Notes - -- 2026-05-28: Created the initial baseline audit ExecPlan after setting up the - branch and worktree. This version records the intended audit process, known - PR creation blocker, and CuPy deferral. -- 2026-05-28: Updated the plan with local pytest, type checker, tox, hook, CI, - rename inventory, contract map, and follow-up plan evidence. -- 2026-05-28: Reworked command and evidence snippets to use indented examples - and expanded the decision log to match the required `PLANS.md` format. diff --git a/plans/2026-05-28-hook-ci-hygiene.md b/plans/2026-05-28-hook-ci-hygiene.md deleted file mode 100644 index 17abf93..0000000 --- a/plans/2026-05-28-hook-ci-hygiene.md +++ /dev/null @@ -1,377 +0,0 @@ -# Hook and CI hygiene before bearshape rename - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - -This ExecPlan is a living document. The sections `Progress`, -`Surprises & Discoveries`, `Decision Log`, and `Outcomes & Retrospective` must -be kept up to date as work proceeds. - -This repository contains `PLANS.md` at the repository root. This document must -be maintained in accordance with `PLANS.md`. - -## Purpose / Big Picture - -The baseline audit found that the core runtime and typing tests pass, but the -local hook suite and PR spelling job are not green. This matters because the -next major task is the bearshape rename, which will touch many files. Before -that larger rename, the formatting, spelling, and workflow checks should be -predictable so the rename diff is not mixed with hook noise. - -After this change, a maintainer should be able to run the local hook command and -inspect PR checks without seeing known hygiene failures unrelated to product -behavior. CuPy runtime validation remains out of scope because it requires a -CUDA-capable GPU environment. - -## Progress - -- [x] (2026-05-28 13:29Z) Created branch `codex/hook-ci-hygiene` in worktree - `/Users/ale/Code/bearshape-hook-ci-hygiene`, stacked on - `codex/baseline-audit`. -- [x] (2026-05-28 13:32Z) Pushed the branch and opened draft PR #5 targeting - `codex/baseline-audit`. -- [x] (2026-05-28 13:34Z) Reproduced the local `uv run prek run -a` failure in - this clean worktree. -- [x] (2026-05-28 13:35Z) Inspected the spelling behavior for `npt.NDArray`. -- [x] (2026-05-28 13:36Z) Decided the smallest configuration changes that make - hook and CI behavior intentional. -- [x] (2026-05-28 13:37Z) Implemented the scoped hygiene fixes. -- [x] (2026-05-28 13:39Z) Validated local hooks, typing integration, and docs - build. -- [x] (2026-05-28 13:42Z) Pushed the cleanup commit and inspected PR checks. -- [x] (2026-05-28 13:51Z) Diagnosed remaining compatibility-matrix failures. -- [x] (2026-05-28 14:26Z) Replaced impossible Python/backend matrix products - with explicit installable CI and tox environments. -- [x] (2026-05-28 14:33Z) Validated hooks and the Python 3.10 replacement - backend jobs locally. -- [x] (2026-05-28 14:39Z) Pushed the matrix fix and inspected PR checks. -- [x] (2026-05-28 14:39Z) Updated this plan with final PR check evidence and - follow-up work. - -## Surprises & Discoveries - -- Observation: This branch is intentionally stacked on `codex/baseline-audit`. - Evidence: the baseline audit PR contains `AGENTS.md`, `PLANS.md`, and the - baseline ExecPlan; those files are needed for the workflow but are not yet on - `main`. -- Observation: `uv sync` succeeded in this worktree and installed the locked - development environment, with only the existing packaging warning about the - deprecated MIT license classifier. -- Observation: The first `uv run prek run -a` failed because hooks rewrote or - rejected non-product files. Evidence: `end-of-file-fixer` touched `PLANS.md`, - markdown hooks failed on `PLANS.md` and plan files, `typos` wanted to rewrite - valid `npt.NDArray` notebook text, and Prettier rewrote the large - `docs/assets/js/tesseract.js` asset. -- Observation: `uv run typos .` is not available from the project environment. - Evidence: the command failed to spawn `typos`. The usable local spelling path - is the configured `prek` hook, and PR CI runs its own `typos .` action. -- Observation: `docs/stylesheets/extra.css` and `mkdocs.yml` receive small, - deterministic Prettier normalizations. Evidence: the CSS diff only wraps long - declarations and radial-gradient arguments; the MkDocs diff normalizes nested - nav indentation. `uv run mkdocs build --clean` still succeeds. -- Observation: After the hook cleanup commit, PR #5 passed spelling, ruff, - typecheck, typecheck-compat, locked dev tests, and most compatibility jobs, - but failed `py310-bt022-numpy24` and `py310-bt022-jax09` before tests ran. - Evidence: CI logs show NumPy 2.4.1+ and JAX 0.9 require Python 3.11+, while - those jobs ran on Python 3.10.20. - -## Decision Log - -- Decision: Target this PR at `codex/baseline-audit`, not `main`. - Rationale: Hook and CI hygiene is the next task after the baseline audit and - depends on the workflow files introduced there. Stacking keeps the cleanup - isolated without duplicating setup work on `main`. - Date/Author: 2026-05-28 / Codex -- Decision: Keep CuPy runtime validation out of this plan. - Rationale: CuPy requires CUDA GPU support. This plan is about hook and CI - hygiene that can be validated locally and in ordinary PR CI. - Date/Author: 2026-05-28 / Codex -- Decision: Exclude `AGENTS.md`, `PLANS.md`, and `plans/*.md` from `mdformat` - and `markdownlint-fix`. - Rationale: These files are workflow instructions and living ExecPlans with - intentionally prescriptive formatting. Generic markdown reflow and lint rules - were rewriting or rejecting plan structure instead of finding product issues. - The exclusion is narrow and keeps markdown hooks active for docs and README - files. - Date/Author: 2026-05-28 / Codex -- Decision: Add `ND` to `tool.typos.default.extend-words`. - Rationale: `npt.NDArray` is valid NumPy typing syntax and must not be - rewritten to `npt.ANDArray`. A narrow accepted word preserves the public - typing example without disabling spelling checks elsewhere. - Date/Author: 2026-05-28 / Codex -- Decision: Exclude `docs/assets/js/tesseract.js` from Prettier. - Rationale: The hook rewrites a large visual asset in a branch whose purpose is - CI hygiene. That churn would obscure the actual fix. Smaller Prettier - normalizations in CSS and MkDocs configuration are kept because they are - deterministic, readable, and validated by the docs build. - Date/Author: 2026-05-28 / Codex -- Decision: Use explicit CI and default tox compatibility environments instead - of product matrices that generate unsatisfiable Python/backend pairs. - Rationale: Python support and backend release floors move independently. - Python 3.10 should still be covered with supported backend floor versions, - while Python 3.12 and 3.13 cover current backend ceiling versions. This keeps - CI meaningful without pretending Python 3.10 can install NumPy 2.4 or JAX 0.9. - Date/Author: 2026-05-28 / Codex - -## Outcomes & Retrospective - -Local hook hygiene is now explicit. `uv run prek run -a` passes from a clean -hook hygiene worktree after the narrow exclusions and spelling configuration. -The typing integration suite still passes, and the docs still build. - -The first PR check pass proved that the hook hygiene failures are fixed. The -remaining red checks were compatibility-matrix dependency resolution failures, -not product test failures. The matrix now enumerates installable floor and -ceiling jobs explicitly, and PR #5 is green after the matrix fix. - -CuPy runtime validation remains intentionally deferred because the local machine -has no CUDA GPU. - -## Context and Orientation - -The previous ExecPlan at `plans/2026-05-28-baseline-audit.md` recorded the -baseline. The important findings for this plan are that `uv sync`, non-CuPy -pytest, typechecker integration, direct pyright, direct mypy, direct ty, and -`tox run -e dev` all pass. The known hygiene issues are separate from runtime -correctness. - -Local hook configuration lives in `.pre-commit-config.yaml`. The project uses -`prek`, not the older `pre-commit` CLI. Markdown lint configuration lives in -`.markdownlint.jsonc`. Package and checker configuration live in -`pyproject.toml`. GitHub workflows live in `.github/workflows/`. - -The baseline audit found two concrete hygiene problems. First, running -`uv run prek run -a` modified files and then failed, including markdown lint -failures involving `PLANS.md` and the baseline audit ExecPlan. Second, PR CI -spelling failed because the GitHub workflow runs `typos .` and reports -`npt.NDArray` in `examples/bearshape_tour.ipynb` as `ND` should be `AND`. - -The current worktree starts from the committed baseline audit branch and is -clean. A different worktree, `/Users/ale/Code/bearshape-baseline-audit`, still -contains hook-generated uncommitted edits from the previous audit run. Do not -use that dirty worktree for implementation in this plan. - -## Plan of Work - -First, reproduce the local hook failure from this clean worktree. Run -`uv run prek run -a` and record which hooks modify files and which hooks fail. -Inspect the resulting diff before keeping any formatter changes. - -Second, inspect the spelling failure. Use the PR logs if available and run the -same spelling command locally when possible. Determine whether the fix belongs -in typos configuration, notebook content, or workflow alignment. The expected -candidate is an intentional `typos` ignore for the identifier fragment `ND` -when it appears in `NDArray`, because `npt.NDArray` is valid NumPy typing -syntax. - -Third, resolve the markdown hook conflict. The solution must make `PLANS.md` -and plan files compatible with the configured hooks without weakening linting -broadly. Prefer narrow markdownlint configuration or file-specific hook -exclusions only when they match the purpose of ExecPlans. - -Fourth, reduce formatter churn. If prettier, mdformat, or other hooks rewrite -generated or asset files, decide whether those files should be formatted, -excluded, or committed as intentional normalization. Do not accept large -generated-asset churn without a reason. - -Fifth, validate. Run `uv run prek run -a`. Then run targeted checks affected by -the changes, such as `uv run pytest -n auto tests/test_typecheck.py` if typing -fixtures or config change. Inspect PR checks after pushing. - -## Concrete Steps - -Run all commands from the hook hygiene worktree: - - cd /Users/ale/Code/bearshape-hook-ci-hygiene - -Confirm branch and status: - - git branch --show-current - git status --short --branch - -Reproduce local hooks: - - uv run prek run -a - -Inspect hook-generated diffs: - - git status --short - git diff --stat - git diff -- .pre-commit-config.yaml .markdownlint.jsonc pyproject.toml - git diff -- PLANS.md plans/2026-05-28-hook-ci-hygiene.md - -Inspect spelling behavior: - - uv run typos . - -If `typos` is not available through `uv run`, use the hook command through -`prek` and record the limitation instead of adding a new dependency just for the -audit. - -Validate after fixes: - - uv run prek run -a - uv run pytest -n auto tests/test_typecheck.py - -## Validation and Acceptance - -This plan is accepted when hook and CI hygiene is explicit and reproducible. - -Required evidence: - -- The branch and draft PR exist. -- The local `prek` failure has been reproduced or, if already fixed by the - first change, explained with evidence. -- The `npt.NDArray` spelling failure has a narrow, documented fix. -- Markdown lint and ExecPlan formatting no longer conflict. -- Formatter churn in generated or asset files is either avoided, intentionally - committed, or documented as a follow-up. -- `uv run prek run -a` passes locally, or any remaining failure is explicitly - out of scope with a precise reason. -- Relevant PR checks pass, especially spelling, ruff, typecheck, and - typecheck-compat. - -## Idempotence and Recovery - -The hook command may rewrite files. Always inspect `git diff --stat` before -staging. If hooks create broad unrelated churn, do not commit it blindly. Either -exclude the generated files with a narrow configuration change or ask the user -whether the normalization should be accepted. - -This branch is stacked on `codex/baseline-audit`. If the baseline audit branch -changes, rebase or recreate this worktree only after inspecting the diff. - -## Artifacts and Notes - -Initial branch evidence: - - Worktree: /Users/ale/Code/bearshape-hook-ci-hygiene - Branch: codex/hook-ci-hygiene - Base: codex/baseline-audit at e0522b0 - -Known failure evidence from the baseline audit: - - uv run prek run -a failed. - end-of-file-fixer modified PLANS.md. - markdownlint-fix failed on PLANS.md and the baseline audit ExecPlan. - The PR spelling job failed on npt.NDArray in examples/bearshape_tour.ipynb. - -Draft PR evidence: - - PR: https://github.com/acecchini/bearshape/pull/5 - Base: codex/baseline-audit - -Reproduction evidence: - - uv sync - Resolved 99 packages and built bearshape successfully. - Warning: License classifiers are deprecated; use license expressions. - - uv run prek run -a - end-of-file-fixer modified PLANS.md. - markdownlint-fix failed on PLANS.md and plan files. - typos wanted to rewrite npt.NDArray to npt.ANDArray. - prettier rewrote docs/assets/js/tesseract.js. - - uv run typos . - Failed to spawn: typos - -Validation evidence: - - uv run prek run -a - All configured hooks passed. - - uv run pytest -n auto tests/test_typecheck.py - 30 passed in 36.91s - - uv run mkdocs build --clean - Documentation built successfully in 0.29 seconds. - MkDocs emitted the existing Material for MkDocs 2.0 compatibility warning. - -PR check evidence after the hook cleanup commit: - - Spell Check with Typos: passed - ruff: passed - typecheck: passed - typecheck-compat: passed - test: passed - py310-bt022-numpy24: failed during dependency resolution - py310-bt022-jax09: failed during dependency resolution - -Compatibility failure evidence: - - py310-bt022-numpy24 tried to install numpy>=2.4,<2.5 on Python 3.10.20. - NumPy 2.4.0 is yanked and NumPy 2.4.1+ requires Python >=3.11. - - py310-bt022-jax09 tried to install jax[cpu]>=0.9,<0.10 on Python 3.10.20. - JAX 0.9 requires Python >=3.11. - -Matrix fix validation evidence: - - uv run tox list - Listed explicit default tox environments without the unsatisfiable - Python 3.10 latest-backend pairs. - - uv run prek run -a - All configured hooks passed. - - uv run tox run -e py310-bt022-numpy22 - 690 passed, 46 skipped - - uv run tox run -e py310-bt022-jax05 - 206 passed, 21 skipped, 18 warnings - - uv run tox run -e py310-bt022-torch26 - 206 passed, 24 skipped - - uv run tox run -e py310-bt022-optree014 - 202 passed, 33 skipped - -PR check evidence after the matrix fix: - - GitGuardian Security Checks: passed - Spell Check with Typos: passed - ruff: passed - typecheck: passed - typecheck-compat: passed - test: passed - py310-bt022-numpy22: passed - py310-bt022-jax05: passed - py310-bt022-torch26: passed - py310-bt022-optree014: passed - py313-bt022-numpy24: passed - py313-bt022-jax09: passed - py313-bt022-torch210: passed - py313-bt022-optree019: passed - py313-bt022-type-pyright1408: passed - py313-bt022-type-mypy119: passed - py313-bt022-type-ty: passed - push-only matrix jobs: skipped on pull_request, as expected - -## Interfaces and Dependencies - -The plan should use the existing toolchain: `uv`, `prek`, `typos`, -`markdownlint-fix`, `mdformat`, `prettier`, `ruff`, pytest, and GitHub Actions. -Do not add new runtime dependencies. If a dev-only dependency or hook version -change is needed, explain why and validate it through the hook suite. - -Files most likely to change are `.pre-commit-config.yaml`, -`.markdownlint.jsonc`, `pyproject.toml`, `.github/workflows/ci.yml`, and -possibly the notebook or docs files that trigger spelling or formatter issues. - -## Revision Notes - -- 2026-05-28: Created the initial hook and CI hygiene ExecPlan stacked on the - baseline audit branch. -- 2026-05-28: Updated the plan after reproducing local hook failures, applying - narrow hook configuration fixes, and validating local hooks, type-check - integration, and docs build. The plan still needs final PR check evidence - after the cleanup commit is pushed. -- 2026-05-28: Updated the plan after diagnosing PR compatibility-matrix - failures and replacing unsatisfiable product matrices with explicit - floor-on-Python-3.10 and ceiling-on-newer-Python environments. -- 2026-05-28: Updated the plan with final PR check evidence after the matrix - fix turned PR #5 green. diff --git a/plans/2026-05-29-bearshape-rename.md b/plans/2026-05-29-bearshape-rename.md deleted file mode 100644 index d03e14a..0000000 --- a/plans/2026-05-29-bearshape-rename.md +++ /dev/null @@ -1,323 +0,0 @@ -# Rename Project Identity to bearshape - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - -This ExecPlan is a living document. The sections `Progress`, -`Surprises & Discoveries`, `Decision Log`, and `Outcomes & Retrospective` must -be kept up to date as work proceeds. - -This repository contains `PLANS.md` at the repository root. This document must -be maintained in accordance with `PLANS.md`. - -## Purpose / Big Picture - -The project is moving from its previous public identity to bearshape. After this -plan is complete, users should install the PyPI distribution named -`bearshape`, import `bearshape` in Python code, read docs that consistently say -bearshape, and see CI, tox, type-checker fixtures, docs, notebooks, and -packaging all validate that new identity. - -This is intentionally a broad cleanup task. The goal is not to add new runtime -features; the goal is to make the library's public name, package metadata, -source package, tests, examples, docs, and release path coherent before deeper -production refactors begin. - -## Progress - -- [x] (2026-05-29 08:49Z) Created branch `codex/bearshape-rename` in worktree - `/Users/ale/Code/bearshape-rename` from merged `origin/main`. -- [x] (2026-05-29 08:51Z) Pushed the branch and opened draft PR #6 targeting - `main`. -- [x] (2026-05-29 09:04Z) Built a complete rename inventory from code, tests, - docs, packaging, workflows, notebooks, and lock/config files. -- [x] (2026-05-29 09:05Z) Built the rename inventory, moved the package and - public docs/example paths, and replaced the previous identifier across source, - tests, docs, examples, workflows, lock/config files, and plan artifacts. -- [x] (2026-05-29 09:08Z) Decided not to add a short-lived compatibility - surface for the previous import package. -- [x] (2026-05-29 09:10Z) Updated `README.md`, docs, notebooks, and - `CHANGELOG.md` with concise bearshape-facing text. -- [x] (2026-05-29 09:12Z) Ran `uv sync`; the environment rebuilt the editable - distribution as `bearshape` and removed the previous installed distribution. -- [x] (2026-05-29 09:15Z) Verified direct imports and absence of the previous - import package in the uv environment. -- [x] (2026-05-29 09:22Z) Validated hooks, runtime tests, direct type checkers, - docs build, `tox -e dev`, and package build artifacts. -- [x] (2026-05-29 09:31Z) Recorded final PR #6 check evidence and asked the - user for validation before merge. -- [x] Record final PR check evidence and ask the user for validation before - merge. -- [x] Decide whether any short-lived compatibility surface for the previous - import package is needed; default is no compatibility shim unless the user - explicitly asks for one. -- [x] Update `README.md`, docs, notebooks, and `CHANGELOG.md` with concise - user-facing rename notes. -- [x] Regenerate lock or generated files only when required by metadata changes. -- [x] Validate hooks, runtime tests, type-checker integration, docs build, and - relevant tox environments. - -## Surprises & Discoveries - -- Observation: This work starts after the baseline audit and hook/CI hygiene - PRs were merged into `main`. - Evidence: branch `codex/bearshape-rename` was created from `origin/main` at - commit `17bd2ee`, the merge commit for PR #4. -- Observation: A broad replacement also touched the worktree `.git` pointer - file because it is a file, not a directory, in linked worktrees. - Evidence: git commands failed until `.git` was restored to point at the - original checkout's worktree metadata. Follow-up audits exclude both `.git` - and `.git/**`. -- Observation: Live PyPI was not modified during this PR task. - Evidence: no `uv publish` command was run. Local metadata, lockfile, built - wheel/sdist names, and the GitHub trusted-publishing workflow now target - `bearshape`. - -## Decision Log - -- Decision: Treat this as a clean public rename to `bearshape`. - Rationale: The user asked to rename the repo, PyPI package, and project - identity to bearshape before release. Carrying a long-lived compatibility - import alias for the previous identity would preserve stale surface area and - add maintenance cost. If a compatibility shim is needed, it should be - short-lived, explicit, tested, and documented as transitional. - Date/Author: 2026-05-29 / Codex - -- Decision: Keep feature behavior unchanged during this rename. - Rationale: A repository-wide rename is already high risk. Runtime semantics, - typing semantics, and backend behavior should remain stable so failures point - to rename mistakes rather than unrelated feature work. - Date/Author: 2026-05-29 / Codex - -- Decision: Do not publish to PyPI during the PR. - Rationale: Publishing is irreversible release work and should happen only - after the PR is reviewed, merged, tagged, and explicitly approved. - Date/Author: 2026-05-29 / Codex - -## Outcomes & Retrospective - -The rename is implemented locally in PR #6 and awaits user validation before -merge. The source package is `src/bearshape/`, the distribution metadata is -`bearshape`, docs and examples use bearshape, and no compatibility package for -the previous import name was added. - -Local validation passed: - -- `uv --cache-dir .uv-cache sync` -- `uv --cache-dir .uv-cache run python -c "import bearshape; print(bearshape.__name__, bearshape.__version__)"` -- `uv --cache-dir .uv-cache run python -c "import bearshape.numpy as bnp; print(bnp.__name__)"` -- `uv --cache-dir .uv-cache run python -c "import importlib.util; print(importlib.util.find_spec(''))"` -- old-name audit with `.git`, `site`, `.venv`, and `.tox` excluded: no matches -- `uv --cache-dir .uv-cache run pytest -n auto tests/`: 1063 passed, 5 skipped -- `uv --cache-dir .uv-cache run pyright src tests/typing`: 0 errors -- `uv --cache-dir .uv-cache run mypy src tests/typing`: no issues -- `uv --cache-dir .uv-cache run ty check src tests/typing`: all checks passed -- `uv --cache-dir .uv-cache run mkdocs build --clean` -- `uv --cache-dir .uv-cache run prek run -a` -- `uv --cache-dir .uv-cache run tox run -e dev`: 1063 passed, 5 skipped, - coverage 91.20% -- `uv --cache-dir .uv-cache build`: built `bearshape-0.0.1.tar.gz` and - `bearshape-0.0.1-py3-none-any.whl` - -CuPy runtime validation remains deferred locally because this machine has no -CUDA GPU and `cupy` is not installed. - -PR #6 validation passed on GitHub during this run: - -- GitGuardian Security Checks -- Spell Check with Typos -- ruff -- test -- typecheck -- typecheck-compat -- `py310-bt022-jax05` -- `py310-bt022-numpy22` -- `py310-bt022-optree014` -- `py310-bt022-torch26` -- `py313-bt022-jax09` -- `py313-bt022-numpy24` -- `py313-bt022-optree019` -- `py313-bt022-torch210` -- `py313-bt022-type-mypy119` -- `py313-bt022-type-pyright1408` -- `py313-bt022-type-ty` - -## Context and Orientation - -The repository implements a runtime shape and dtype checking library whose -target Python import package and PyPI distribution name are both `bearshape`. - -Important files and directories: - -- `src/bearshape/` contains the target source package. -- `tests/` contains runtime tests and type-checker integration tests. Imports - and expected strings in this tree must match the new package name. -- `tests/typing/` contains public static typing fixtures. These are product - contract artifacts and must import the new package. -- `docs/`, `mkdocs.yml`, and `README.md` are user-facing docs. They must say - bearshape and show `bearshape` imports. -- `examples/` contains notebooks or examples that may embed package names in - cells, metadata, or outputs. -- `pyproject.toml` owns package metadata, build-backend module name, uv config, - checker settings, and dependency groups. -- `tox.toml` and `.github/workflows/` own release confidence and CI matrix - behavior. -- `CHANGELOG.md` must record the major user-visible rename. -- `AGENTS.md` already describes the new bearshape mission and should remain - concise. - -Use "distribution name" to mean the name users install from PyPI, as in -`uv add bearshape`. Use "import package" to mean the Python module users import, -as in `import bearshape`. This plan changes both. - -## Plan of Work - -First, build an inventory. Search for exact and case-insensitive references to -the previous identifier, GitHub URLs, docs paths, import statements, module -names, wheel names, notebook text, and generated docs references. Record the -counts and notable categories in this plan before editing. - -Second, rename the source package to `src/bearshape/` and update all imports, -module references, doctest snippets, type-checker fixtures, and beartype claw -references. Update `pyproject.toml` so the project name is `bearshape` and the -uv build-backend module name is `bearshape`. - -Third, update tests and typing fixtures. Runtime tests should import -`bearshape` and backend modules such as `bearshape.numpy`, `bearshape.jax`, -`bearshape.torch`, `bearshape.cupy`, and `bearshape.optree`. Typing fixtures -must use the same public syntax under the new import name. Expected error -messages should be updated only when they mention module names; semantics should -not change. - -Fourth, update docs and examples. Rewrite the README as a concise bearshape -intro. Update docs pages, MkDocs nav entries, module API paths, notebooks, and -examples so every shown command and import is real. Keep docs short and avoid -promising future behavior. - -Fifth, update release and CI configuration. Check `.github/workflows/pypi.yml`, -docs workflows, tox environment names or descriptions, package build outputs, -and any lockfile metadata. Regenerate `uv.lock` only if `uv sync --locked` or -package metadata validation shows it is stale. - -Sixth, validate in layers. Run fast hooks first, then runtime and typing tests, -then docs build, then relevant tox environments. CuPy runtime tests remain -deferred locally because the machine has no CUDA GPU. - -## Concrete Steps - -Run commands from the rename worktree: - - cd /Users/ale/Code/bearshape-rename - -Confirm branch and status: - - git branch --show-current - git status --short --branch - -Build the inventory: - - rg -n --hidden --glob '!.git' --glob '!.git/**' . - find src -maxdepth 2 -type d -print - -Rename source package and imports using file-aware edits, not blind global -replacement. Use `git mv` for package and docs/example path moves. Use -structured tooling when practical for notebooks and generated metadata. - -Validate progressively: - - uv sync - uv run prek run -a - uv run pytest -n auto tests/test_typecheck.py - uv run pytest -n auto tests/ - uv run pyright src tests/typing - uv run mypy src tests/typing - uv run ty check src tests/typing - uv run mkdocs build --clean - -Run relevant tox environments after the basic suite is green: - - uv run tox run -e dev - uv run tox run -e py310-bt022-numpy22 - uv run tox run -e py313-bt022-numpy24 - uv run tox run -e py313-bt022-type-pyright1408 - uv run tox run -e py313-bt022-type-mypy119 - uv run tox run -e py313-bt022-type-ty - -## Validation and Acceptance - -The rename is accepted when bearshape is the only production identity and all -changed surfaces prove it. - -Required evidence: - -- `python -c "import bearshape; print(bearshape.__name__)"` prints - `bearshape`. -- `python -c "import bearshape.numpy as bnp; print(bnp.__name__)"` prints - `bearshape.numpy` in an environment with NumPy installed. -- The package metadata names the distribution `bearshape`. -- No package for the previous import name exists unless an explicit - transitional compatibility shim is approved and documented. -- Public docs and examples use `bearshape`. -- `uv run prek run -a` passes. -- Runtime tests and type-checker integration pass. -- Direct pyright, mypy, and ty runs pass. -- Docs build succeeds. -- Relevant tox environments pass. -- PR CI is green. - -CuPy runtime validation is not required on this local machine because there is -no CUDA GPU. Any CuPy rename changes must still be syntax-checked and included -in CI or future GPU validation plans where possible. - -## Idempotence and Recovery - -This rename should be performed in small commits or amendable milestones. If a -rename command partially succeeds, inspect `git status --short` and use -file-scoped fixes rather than broad reset commands. Do not delete user-created -work outside `/Users/ale/Code/bearshape-rename`. - -If generated files change unexpectedly, inspect the diff before keeping them. -Keep generated or lockfile changes only when a validation command proves they -are required. - -## Artifacts and Notes - -Initial setup evidence: - - Worktree: /Users/ale/Code/bearshape-rename - Branch: codex/bearshape-rename - Base: origin/main at 17bd2ee - Draft PR: https://github.com/acecchini/bearshape/pull/6 - -Merged setup PRs: - - PR #5 Hook and CI hygiene before rename: merged into codex/baseline-audit - PR #4 Baseline audit before bearshape rename: merged into main - -## Interfaces and Dependencies - -Use the existing toolchain: `uv`, `pytest`, `prek`, `ruff`, `pyright`, `mypy`, -`ty`, `tox`, and MkDocs. Do not add runtime dependencies for the rename. - -Public import paths at the end of this plan should include: - - import bearshape - import bearshape.numpy - import bearshape.jax - import bearshape.torch - import bearshape.cupy - import bearshape.optree - -The PyPI distribution name should be: - - bearshape - -## Revision Notes - -- 2026-05-29: Created the initial rename ExecPlan after merging the baseline - audit and hook/CI hygiene setup stack into `main`. -- 2026-05-29: Updated the plan with draft PR #6 after pushing - `codex/bearshape-rename`. diff --git a/plans/2026-09-07-typing-ci-floor.md b/plans/2026-09-07-typing-ci-floor.md deleted file mode 100644 index f2ad6c1..0000000 --- a/plans/2026-09-07-typing-ci-floor.md +++ /dev/null @@ -1,129 +0,0 @@ -# Keep typing checks aligned with supported Python versions - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - -This ExecPlan is a living document maintained according to `PLANS.md`. Update Progress, Surprises & Discoveries, Decision Log, and Outcomes & Retrospective as work proceeds. - -## Purpose / Big Picture - - -Bearshape promises Python 3.10 and newer, but its default type checkers currently target Python 3.12. A target is the Python version whose annotation rules a checker evaluates; it is distinct from the interpreter running that checker. This gap allowed unsupported standard-library typing imports to pass CI. PR #10 replaces those imports with typing_extensions backports. This companion change makes ordinary checker commands enforce Python 3.10 and runs the existing automated compatibility tests in each supported Python environment, 3.10 through 3.14, targeting the interpreter whose dependencies are installed. - -## Progress - - -- [x] (2026-09-07) Review PR #10 at 63bb0fa98aea5bd4060bc240227f711928f73939; reproduce 480 Python 3.10 errors on main and zero with the fix. -- [x] (2026-09-07) Audit checker configuration, CI, nightly, publishing, tox, test selection, and fixture coverage; authorize the reviewed external CI run under the user's instruction. -- [x] (2026-09-07) Create codex/typing-ci-floor and its isolated worktree based on PR #10. -- [x] (2026-09-07) Open companion draft PR #11 with this plan before implementation. -- [x] (2026-09-07) Set checker defaults to 3.10; prototype cross-target tests and discover NumPy stub incompatibility in Python 3.13 tox. -- [x] (2026-09-07) Match each suite target to its interpreter and add a Python 3.10-3.14 typecheck-compat environment matrix. -- [x] (2026-09-07) Validate all three default checkers, 30 local typing tests, six structured dtype tests, all three declared tox checker environments, hooks, lock consistency, and actionlint. -- [x] (2026-09-07) Complete hosted run 34162817643 at 6a28164851a4612483b09750784e010d2b2a7a22: all 20 applicable jobs passed, including five Python typing environments, coverage, eight backend combinations, and three tox checker environments. -- [x] (2026-09-07) Prepare publication under the user's explicit approval, preserving the contributor commit through PR #11. Merge only after the final documentation revision also passes CI, then refresh main and remove owned worktrees; GitHub PR #11 records the merge receipt. - -## Surprises & Discoveries - - -The existing tox environments run checker tooling on Python 3.13 but inherit a Python 3.12 target. Their comment incorrectly treats type stubs as version-independent. The existing tests already exercise all backend aliases, including CuPy's static protocol, so new duplicate annotation fixtures are unnecessary. The typecheck-compat job already runs tests/test_typecheck.py, and tox's type environments collect that same file. The compatibility job will use five Python environments; tox retains its current runtime and checker-version matrices. Each test invocation targets its active interpreter to match its dependency stubs. - -PR #10's GitHub CI was awaiting approval for an external contribution. The user explicitly authorized auditing and changing CI and merging when green; the reviewed workflow has now been approved. CuPy runtime coverage remains unavailable on this CPU-only Mac and the existing CPU GitHub runners. - -## Decision Log - - -Decision: Keep Python 3.10 defaults for ordinary commands, and run the compatibility suite on each supported interpreter with an explicit matching checker target. Rationale: on Python 3.13 tox, NumPy 2.4 stubs contain Python 3.12 type statements; mypy correctly rejects them when forcibly targeting 3.10. Separate compatible environments test the actual supported combinations without suppressing dependency errors. The initial five-targets-in-one-environment prototype passed with the Python 3.10 locked dependencies but failed in the newer tox environment, so replace it with five workflow environments. Date/author: 2026-09-07, Codex. - -Decision: Preserve PR #10 and open a companion branch based on its reviewed commit. Rationale: the CI change depends on the backports, and a companion change preserves contributor credit while exposing the CI audit for review. The original PR cannot become green with its floating Ruff workflow. Validate the combined PR #11 and merge it with a merge commit; it contains PR #10 unchanged, preserves contributor authorship, and makes that contribution reachable from main. Verify GitHub marks PR #10 merged through the same history. Do not bypass failing checks: the complete final tree must pass the repaired workflow. Date/author: 2026-09-07, Codex. - -Decision: Treat the user's latest instruction as authorization to enable CI and merge once review and checks pass; no additional merge confirmation is required. Rationale: the user expressly delegated these decisions after the initial review. Date/author: 2026-09-07, Codex. - -## Outcomes & Retrospective - - -Implementation, local validation, and the complete hosted matrix are green. Run 34162817643 passed all 20 applicable jobs for the final code revision 6a28164851a4612483b09750784e010d2b2a7a22. This final plan-only revision records those results; its own CI must also pass before publication. Hosted CI identified a pre-existing lint blocker: ruff-action resolved Ruff 0.16.6 from >=0.15.9, while uv.lock contains 0.15.15. New suppression-comment rules fail unchanged source, preventing all downstream tests. Fix the version drift through the lock, not by weakening lint or editing unrelated source. - -The original backport review passed all three checkers across five targets, the CPU runtime suite, hooks, lock validation, package build, and isolated minimum-dependency imports on Python 3.10 and 3.14. - -## Context and Orientation - - -The main checkout is /Users/ale/Code/bearshape. Work for this plan takes place in /Users/ale/Code/bearshape-typing-ci-floor on codex/typing-ci-floor. The reviewed contribution is https://github.com/acecchini/bearshape/pull/10. The companion branch includes that unchanged contribution and will merge it through preserved commit history. - -pyproject.toml contains [tool.pyright] and [tool.mypy]; ty.toml contains ty's [environment]. tests/test_typecheck.py runs each supported checker against individual fixtures and against src plus tests/typing. tests/conftest.py restricts tox type environments to these tests. tox.toml names three checker environments on Python 3.13. .github/workflows/ci.yml and .github/workflows/nightly.yml already invoke these tests or environments. Existing tests/typing/check_annotations*.py and check_like_types.py exercise the public backend aliases involved in PR #10. - -## Plan of Work - - -Milestone 1 is the audit and a reviewable draft PR containing this plan. Check that the branch starts at the reviewed PR commit and that source behavior is untouched. - -Milestone 2 also replaces the floating astral-sh/ruff-action steps in .github/workflows/ci.yml with setup-uv and uv run --locked --only-group dev ruff check/format commands. This reads the existing uv.lock instead of independently resolving the broad Ruff lower bound. The same setup-uv revision already used by the workflow is retained. - -Milestone 2 changes pythonVersion and python_version in pyproject.toml and python-version in ty.toml to 3.10. Add a short comment explaining that this is the supported floor. In tests/test_typecheck.py, derive PYTHON_TARGET from sys.version_info and pass pyright --pythonversion, mypy --python-version, and ty check --python-version to both individual fixtures and whole-tree checks. In .github/workflows/ci.yml, give typecheck-compat a Python 3.10 through 3.14 matrix and pass each version to uv run --python. Ordinary default checker commands still run at 3.10 in the separate typecheck job. Update the test module's description and tox.toml's misleading comment. Add a concise CHANGELOG.md entry describing persistent floor and target coverage. No new public runtime or annotation API is needed. The existing DtypeSpec.structured factory also replaces its mypy-only suppression with a DTypeLike cast, as established by the latest ty diagnostic. - -Milestone 3 validates the complete typing tests, relevant tox checker environments, hooks, and hosted CI. Failures must be understood rather than suppressed. If the audit reveals another concrete CI blocker, record its cause and the smallest repair before changing the plan's scope. Confirm the GitHub head commit before merge. Once all applicable checks pass for the combined tree, merge PR #11 with a merge commit and verify both the original contribution and the CI improvements are present on main, including PR #10 status. Finish with a clean, current local main. - -## Concrete Steps - - -All development commands below run in /Users/ale/Code/bearshape-typing-ci-floor: - - uv sync --locked --no-group docs --no-group notebook - uv run --no-sync pytest -n auto tests/test_typecheck.py - uv run --no-sync pyright src tests/typing - uv run --no-sync mypy src tests/typing - uv run --no-sync ty check src tests/typing - uv run --no-sync tox run -e py313-bt022-type-pyright1408,py313-bt022-type-mypy119,py313-bt022-type-ty - uv run --no-sync prek run -a - uv lock --check - -Use gh pr checks and gh run view with the exact PR or run identifiers returned by GitHub. Do not merge a changed head without reviewing and validating it. Use a merge commit for PR #11 to preserve the contributor commit in main history and verify PR #10 is consequently marked merged. After both changes land, run git pull --ff-only from /Users/ale/Code/bearshape and verify git status --short --branch. - -## Validation and Acceptance - - -Each Python matrix environment must pass 30 typing tests: nine individual fixtures and one whole-tree check for each of three checkers. Across Python 3.10 through 3.14 this is 150 checks, each using dependencies compatible with its interpreter. Ordinary pyright, mypy, and ty commands must pass without a version override. The regression evidence is the original source producing 480 errors under Python 3.10 while the backport source passes; the permanent Python 3.10 matrix environment explicitly targets 3.10 regardless of future default configuration drift. - -Run all three declared tox checker environments to verify the distinction between checker interpreter and target works with the actual configured dependency versions. Repository hooks and the dependency lock must pass without unexpected edits. Require the complete applicable PR CI to succeed. Skipped event-specific jobs are expected; failed, cancelled, or awaiting-approval applicable jobs are not green. CPU backends remain tested; CuPy runtime remains explicitly unproven. - -## Idempotence and Recovery - - -All edits remain in the isolated worktree. Retry failed checks after correcting their evidenced cause. Do not overwrite main or the contributor's branch. A failed check leaves both PRs open. Avoid force-pushing unless an explicitly reviewed branch update requires it. Remove only the worktrees and local/remote companion branch created for this review, after successful merges and a clean status. The preserved shapix backup is outside this task. - -## Artifacts and Notes - - -Prior independent review evidence: - - main, pyright target 3.10: 480 errors - PR #10, pyright/mypy/ty targets 3.10 through 3.14: all pass - typing_extensions 4.6.0 with built wheel: root imports pass on Python 3.10 and 3.14 - final local typing suite: 30 passed - structured dtype regression subset: 6 passed - Python 3.13 tox: pyright1408 and mypy119 pass; ty passes after DTypeLike repair - final hosted run 34162817643: SUCCESS, 20 applicable jobs passed, none failed - final code revision: 6a28164851a4612483b09750784e010d2b2a7a22 - -## Interfaces and Dependencies - - -The latest ty 0.0.78 with NumPy 2.5.3 exposed an existing no-matching-overload diagnostic at DtypeSpec.structured: its object argument is passed to np.dtype with a mypy-only suppression. Replace that suppression with a cast to numpy.typing.DTypeLike, imported only under TYPE_CHECKING to preserve the root optional-dependency boundary. NumPy continues to validate and reject values at runtime. Run all three checkers and the existing structured dtype tests after this typing-only repair. - -No public interface or additional dependency is introduced by the companion change. It uses pytest parameterization and the existing supported CLI flags of pyright, mypy, and ty. PR #10 remains responsible for the typing_extensions runtime dependency and source imports. Neither change makes root import load a numerical backend. - -Revision note (2026-09-07): Initial plan records the audited coverage gap, focused implementation, validation criteria, and user-authorized merge conditions before implementation. - -Revision note (2026-09-07): Hosted PR #10 run 32062266937 proved floating Ruff drift blocks downstream tests. Add lock-based lint execution and validate/merge the combined tree in PR #11, preserving the original contribution commit. - -Revision note (2026-09-07): The first tox run exposed NumPy 2.4 stub syntax errors with a forced 3.10 target. Replace cross-target tests in one environment with a real Python 3.10-3.14 CI environment matrix and matching explicit checker flags for all existing fixtures. - -Revision note (2026-09-07): The final Python 3.13 tox run passed pyright and mypy but latest ty identified an existing dtype constructor annotation mismatch. Add a precise DTypeLike cast at that dynamic boundary rather than suppressing the checker or pinning away the diagnostic. - -Revision note (2026-09-07): Record completed local validation and the final narrow annotation repair. The final combined commit must still pass hosted CI before merge. - -Revision note (2026-09-07): Finalize the audit with all 20 hosted CI jobs passing. The source implementation is unchanged by this record update. The authorized publication step is gated on this final revision's CI; merge and cleanup receipts are recorded in GitHub and the task. diff --git a/plans/2026-09-08-action-runtimes.md b/plans/2026-09-08-action-runtimes.md deleted file mode 100644 index 6b29ef3..0000000 --- a/plans/2026-09-08-action-runtimes.md +++ /dev/null @@ -1,100 +0,0 @@ -# Use supported runtimes for artifact and Pages actions - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - -Owner update (2026-09-08): the reviewed implementation and recorded validation -are approved for merge. This supersedes earlier pending-approval statements. -Full native union composition remains required through supported upstream -integration, with a later candidate allowed; limited CuPy native static support -is accepted. Current merge execution and remaining release gates are tracked in -`plans/2026-09-08-agent-workflow.md` and the production-readiness roadmap. - - - -Maintain this ExecPlan according to PLANS.md. This focused CI maintenance PR follows #29 and addresses deprecation warnings observed during the actual release validation run. - -## Purpose / Big Picture - - -The validated release pipeline should not depend on GitHub forcibly substituting a deprecated Node runtime. Update artifact and Pages actions to reviewed immutable Node 24 releases while preserving artifact identity, extraction, environment permissions and the nonpublishing validation path. - -## Progress - - -- [x] (2026-09-08) Created codex/action-runtimes and matching worktree from the handoff candidate. -- [x] (2026-09-08) Verified upstream release tags, action inputs, Node 24 runtime and Pages' embedded artifact upload. -- [x] (2026-09-08) Opened #30 and updated all four reviewed action pins; required docs validation now packages Pages without deployment. -- [x] (2026-09-08) Hooks/actionlint and all PR checks pass. Validation-only run 34223582731 completed 38 jobs successfully and skipped publication; inspected action logs have no Node 20 warning. -- [x] (2026-09-08) Recorded final hashes, 1,101 installed-consumer tests per endpoint, unchanged GPU-validated wheel and inspected 46-file Pages archive. -- [x] (2026-09-08) Obtain user validation before merge. - -## Surprises & Discoveries - - -Run 34221337124 succeeded but warned that upload/download-artifact v4 target Node 20 and are forced onto Node 24. Current upstream upload-artifact 7.0.1 and download-artifact 8.0.1 explicitly use Node 24. Download 8 defaults to failing digest mismatches, which strengthens the existing artifact identity check. Upload still archives by default, preserving this workflow's named multi-file artifact contract. - -Upload-pages-artifact 5.0.0 uses a pinned upload-artifact 7.0.0 internally. Deploy-pages 5.0.1 uses Node 24. Their existing path, environment and output contracts remain applicable. Hosted GitHub.com runners satisfy the runtime requirement; no self-hosted CI runner is advertised. - -## Decision Log - - -Decision: Update these four actions together in a separate PR with immutable pins. Rationale: the warning concerns the same artifact/deployment runtime transition; feature/runtime implementations remain separate. Date: 2026-09-08. - -Decision: Retain archive=true and the existing candidate-distributions name/path. Rationale: installed consumers and publication must download the same wheel/sdist pair. Preserve failure-on-digest-mismatch behavior and never rebuild in the publisher. - -Decision: Validate Pages packaging without deploying the site during this task. Rationale: deployment is not required to prove the artifact transition, and the focused PR is unmerged. Existing Pages publication remains governed by its environment and branch event. - -## Outcomes & Retrospective - - -The Node 24 artifact pipeline succeeds end to end. Named artifact upload/download, full installed consumers, release evidence and Pages packaging are verified. The wheel is byte-identical to the artifact that passed 95 GPU tests at both endpoints. Actual Pages deployment was not run. The latest upstream downloader still emits a Buffer() deprecation notice; it is recorded without suppression and does not affect the successful digest/consumer checks. No package behavior, release authorization or ownership controls change. A04 and CuPy static policy remain open decisions. - -## Context and Orientation - - -Worktree /Users/ale/Code/bearshape-worktrees/action-runtimes, branch codex/action-runtimes. .github/workflows/validate.yml builds and distributes the tested artifact. .github/workflows/pypi.yml downloads it for evidence and possible publication. .github/workflows/docs.yml packages and deploys Pages. Dependabot already checks GitHub Actions weekly. - -Verified pins: upload-artifact 7.0.1 is 043fb46d1a93c77aae656e7c1c64a875d1fc6a0a; download-artifact 8.0.1 is 3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c; upload-pages-artifact 5.0.0 is fc324d3547104276b827a68afc52ff2a11cc49c9; deploy-pages 5.0.1 is 368f82528645a54fb793d4d04e342629a3f51346. - -## Plan of Work - - -Replace only the four reviewed action references in the three workflows, preserving inputs and job dependencies. Add the Pages artifact packaging step to the already-required documentation validation job so the updated composite upload executes without deployment. Use a distinct validation artifact name to avoid the real github-pages deployment artifact. - -Run hooks and actionlint. Push the focused branch, inspect all required hosted checks and dispatch pypi.yml from this branch with publish=false. Verify artifact consumers, evidence hashes and the skipped publisher. Inspect relevant logs for any remaining Node 20 warning on these actions. Record the exact run and artifact identity in this plan; do not claim the Pages deploy job actually ran. - -## Concrete Steps - - -From this worktree run uv run --locked prek run -a and its manual actionlint hook. After pushing, run gh workflow run pypi.yml --ref codex/action-runtimes -f ref=codex/action-runtimes -F publish=false. Read all required job conclusions and download release-evidence plus candidate-distributions for identity verification. - -## Validation and Acceptance - - -The full candidate matrix and validation-only release workflow succeed, with publication skipped. Named artifact extraction and installed consumers remain correct; digest mismatch handling is error by default. Required docs validation successfully packages a Pages artifact with the new composite action. These updated action logs no longer report a Node 20 runtime. Actual Pages/PyPI deployment and user merge approval remain pending. - -## Idempotence and Recovery - - -Only this feature worktree is edited. Do not deploy docs, publish packages, change tags/settings or merge an actual PR base. If a new action contract breaks consumers, inspect the observed behavior and keep publication ineligible until repaired. - -## Artifacts and Notes - - -Record logs under /Users/ale/Code/bearshape-implementation-2026-09-08/evidence/action-runtimes-*. Preserve the earlier release evidence as a separate artifact pair. The complete handoff report remains in docs/maintainers/production-readiness.md. - -## Interfaces and Dependencies - - -No Python dependency or API changes. GitHub Actions pins and the required docs packaging check are the only implementation surface. Keep OIDC write permissions confined to the actual deployment jobs. - -Revision note — 2026-09-08: Final validation-only run https://github.com/acecchini/bearshape/actions/runs/34223582731 used source 6f40e4a484b70535c58e2c86a645a64ab1079143. Wheel SHA256 c1806203da013c9eaf2482a309c686a984c0a7031a495efbd100a824536b57d2; sdist SHA256 38d89d4ce1b351601ff8602a9a27b4e9af46db056be3ac0eaf41a68ac56a3706. Artifact identity and nondeployment were verified, with owner review still pending. - -Revision note (2026-09-08): reconciled completed milestone/hosted evidence and -explicit owner merge approval. The combined artifact, checker and GPU proofs -are in `docs/maintainers/production-readiness.md`; this update does not mark -the unresolved native-union integration or release administration complete. diff --git a/plans/2026-09-08-agent-workflow.md b/plans/2026-09-08-agent-workflow.md deleted file mode 100644 index a2f1913..0000000 --- a/plans/2026-09-08-agent-workflow.md +++ /dev/null @@ -1,230 +0,0 @@ -# Align agent guidance and merge the approved production work - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - - -This living ExecPlan follows `PLANS.md`. Keep Progress, Surprises & Discoveries, -Decision Log, and Outcomes & Retrospective current. - -## Purpose / Big Picture - - -A contributor or coding agent should be able to choose the correct validation -commands, preserve the package contracts, and finish approved work without -following retired rename instructions. The owner approved merging the existing -production PRs and selected preserving full union composition through supported -upstream integration, allowing a later beartype candidate. The recommended -limited native CuPy static policy is accepted alongside verified GPU runtime. -This changes release acceptance, not the installed dependency by guesswork. - -## Progress - - -- [x] (2026-09-08) Re-read repository instructions, inspect all 19 open PR heads, - and confirm applicable checks are green. -- [x] (2026-09-08) Create `codex/agent-workflow` and a matching worktree from the - tested `codex/action-runtimes` head. -- [x] (2026-09-08) Opened draft PR #31 against `codex/action-runtimes` before implementation. -- [x] (2026-09-08) Reconciled current agent instructions, contributor commands, plan policy, - tooling guidance and accepted release decisions. -- [x] (2026-09-08) Hooks/docs pass, 1,097 initial local tests pass with five skips; all 36 jobs pass in PR run 34229100275 and main run 34229683377. -- [x] (2026-09-08) PR #31 merged at df81f00e2f62bda956244e680c980f87db1d4671; every reviewed head is preserved, main CI passed, and 20 clean merged worktrees/local branches were removed with evidence retained. -- [x] (2026-09-08) Recorded accepted policies, actual merge/admin boundaries, and the same failing probe against unpublished upstream 0.23.0rc1 at a2729e0. -- [x] (2026-09-08) Fixed actual hook stages and foreign Git environment leakage; all 23 release tests and real commit/pre-push hooks pass; PR #33 hosted run 34231187384 passed all required jobs. - -## Surprises & Discoveries - - -`CLAUDE.md` is a tracked symlink to `AGENTS.md`; there are no repository-owned -skills or `.claude`, `.codex`, or `.agents` configurations. Do not invent global -skill copies or rewrite personal memories. `CONTRIBUTING.md` still names retired -`bt022` tox environments and describes CI tiers that now share one matrix. -`docs.yml` currently deploys on every main push, although this approval covers -merging rather than publishing the candidate documentation. - -## Decision Log - - -The owner said “First option. Merge approved” and requested agent-file/tooling -updates on 2026-09-08. Apply the previously recommended first choices: full -native union composition through supported upstream integration, with a later -beartype candidate allowed; explicit limited CuPy static support. Preserve the -current rc0 lock and exact test lane until an available integration is proven. -Do not adopt unsupported composition restrictions or claim the defect fixed. - -Keep one authoritative `AGENTS.md` and its existing Claude symlink. Add local -operational guidance for the existing tools, rather than a speculative skill or -new framework. Existing approval covers merging this requested maintenance once -validated; publication, settings changes and ownership transfer remain separate. - -## Outcomes & Retrospective - - -The approved production history and agent guidance are merged through PR #31, -with every reviewed head retained and main validation successful. The lifecycle -follow-up in PR #33 fixes two defects that manual `prek run -a` did not expose: -commit-message routing and inherited Git repository variables. Real commits, -pre-push checks, foreign-repository regressions and the hosted matrix now pass. -Twenty merged worktrees are removed and their useful generated evidence is -retained. The original production goal remains incomplete until native union -integration and release/handoff prerequisites are satisfied. - -## Context and Orientation - - -Work runs in `/Users/ale/Code/bearshape-worktrees/agent-workflow`, initially based -on PR #30. The original checkout `/Users/ale/Code/bearshape` is clean main. -`AGENTS.md` is the shared Codex/Claude contract. `PLANS.md` defines living plans. -`CONTRIBUTING.md` is the human command reference. `tools/` contains archive, -installed-consumer, docs/notebook, release-identity and environment validators. -`.github/workflows/validate.yml` is the shared required matrix. Prior focused -implementation PRs are #13–21, #23–26 and #28–30; #12 is the roadmap and #22/#27 -are aggregates that preserve their commits and integration resolutions. - -## Plan of Work - - -First open the PR with this plan. Rewrite the short shared agent contract for -maintenance, actual four-checker support, explicit runtime/static boundaries, -locked uv commands, proof requirements and permission persistence. Add a brief -repository-specific section to `PLANS.md` and `tools/README.md` documenting the -existing tools and their dependencies. Correct contributor examples and link -all agent/tool guidance to a single command reference. - -Record the accepted union and CuPy decisions in the roadmap and current handoff -report. Retain dated historical evidence in earlier plans; add a clear pointer -to the current decision record rather than rewriting old test results. Restrict -Pages deployment to an explicit manual dispatch while retaining validation on -push. Update the changelog for the maintenance and deployment behavior. - -Bring any missing approved heads into this worktree with merge commits. Verify -that the resulting package tree matches the tested candidate before the scoped -maintenance edits. After local and hosted checks pass, retarget #31 to main and merge the validated -aggregate history in one update, as executed at df81f00. -Retain all focused commits and verify each PR head is reachable before deleting -its clean worktree and local/remote branch. Avoid intermediate main states that -would publish docs automatically. - -## Concrete Steps - - -From the worktree, stage and commit the plan, push `codex/agent-workflow`, and -open a draft PR against `codex/action-runtimes`. Use `uv sync --locked` followed -by `uv run --locked prek run -a` and -`uv run --locked prek run actionlint -a --stage manual`. Build docs with -`uv run --locked --only-group docs zensical build --clean` and run -`uv run --locked --only-group docs python tools/check_docs.py`. - -Inspect the existing tools' actual `--help`, tox listing and checker harness -before documenting commands. Confirm that Claude resolves the shared file and -that no current command names retired bt022 environments. Run the full shared -hosted matrix before the approved merge, then inspect main's required gate. -Use merge commits and exact expected head SHAs for the GitHub merge operation. - -## Validation and Acceptance - - -An agent entering the repository must find the supported Python/checker/optional -backend boundaries and a working command route without importing optional -backends from the root. The tools guide must accurately state which checks -build/install/execute code and which artifacts and dependencies they need. -Pages pushes must build but skip deployment; only explicit manual dispatch may -deploy. No PyPI release, ownership transfer, settings change or upstream message -is part of these merges. All focused heads must remain in main history. Local -hooks/docs and hosted required validation must pass before work is reported done. - -## Idempotence and Recovery - - -Read status and compare commits before every merge/cleanup. Stop if a worktree -contains user changes. Keep evidence outside disposable worktrees. Use ordinary -merge commits and revert a scoped commit if correction is required; never force -main or erase another contributor's work. A later candidate requires its own -proven integration, updated dependency/lock and complete release validation. - -## Artifacts and Notes - - -Existing evidence lives in -`/Users/ale/Code/bearshape-implementation-2026-09-08/evidence/`. The prior final -wheel SHA256 is `c1806203da013c9eaf2482a309c686a984c0a7031a495efbd100a824536b57d2`. -Its real GPU tests and the full hosted run 34223582731 remain historical proof; -new source archive/tool changes require fresh artifact consumers. - -## Interfaces and Dependencies - - -No public Python API or runtime dependency changes are planned here. Existing -uv, prek, tox, pytest and four checker engines remain authoritative. GitHub CLI -operations use the existing repository connection. Agent guidance remains plain -Markdown with the existing Claude symlink. No new skill runtime is needed. - -Revision note (2026-09-08): created before implementation to carry the owner's -contract choices and merge authorization into the maintained repository. - -Revision note (2026-09-08): incorporated every reviewed PR head, resolving only -CuPy plan progress text; verified src/tests/tools/dependency/workflow bytes were -unchanged before maintenance. Added the standalone union reproducer and checked -PyPI: rc0 is the only published 0.23 candidate. Current guidance records the -owner's selected path without inventing a newer version or reducing support. - -## Merge-record follow-up - - -PR #31 merged the complete approved history into main at -`df81f00e2f62bda956244e680c980f87db1d4671`. Main CI run 34229683377 passed all 36 -jobs; Pages run 34229683120 built successfully and skipped deployment. GitHub -marked main-based PRs merged automatically. Dependent PRs were closed with an -integration record after verifying their heads are ancestors of main; GitHub -refused retargeting them because they contained no new commits. - -The same authorized plan now continues on `codex/merge-record`, in its matching -worktree, to record the actual merge outcome and upstream development-head -failure and remove clean merged worktrees/branches. Open the bookkeeping PR -before editing the handoff/roadmap. Runtime code, package metadata, dependencies -and release settings stay as tested. Validate hooks, docs and hosted checks, -then merge this evidence update under the existing owner approval. - -Lifecycle discovery (2026-09-08): installing the configured hooks on main -exposed a real worktree commit failure. With no default stage restriction, -`check-illegal-windows-names` ran at `commit-msg` and rejected -`../../bearshape/.git/worktrees/merge-record/COMMIT_EDITMSG`. The attempted -plan commit did not happen. The configuration installs a commit-message shim -without defining any actual commit-message validators. Remove that generated -unused shim, commit this plan with the normal pre-commit checks, open the PR, -then scope unspecified hooks to pre-commit and remove commit-msg from the -installation list. Retain explicit pre-push, post-checkout/merge/rewrite and -manual actionlint stages. Verify the real lifecycle after the fix and document -how existing contributors remove the stale shim. No checks will be bypassed. - -Pre-push discovery (2026-09-08): Git exports repository-local variables into -hooks. The release fixtures inherited them while initializing other repositories, -which changed shared local `core.worktree` and caused parallel fixture failures. -Restored that setting to its original absence and verified main is clean at the -merged commit. New foreign-repository regressions fail before the fix. Clear -Git's own `rev-parse --local-env-vars` list in the existing release tool and -fixture subprocesses, retaining unrelated environment variables. Test fixture -construction with an explicit foreign hook owner and verify its config and HEAD -stay unchanged. The blocked pre-push prevents opening the follow-up PR until -this focused correction passes; no verification hooks are bypassed. - -Revision note (2026-09-08): reconciled the actual main merge, cleanup and -upstream-development probe. Real hook execution exposed two additional defects, -which were fixed in PR #33 without bypassing verification. Two new foreign-Git -identity cases failed before the isolation fix; all 23 release tests pass after -it. Hosted run 34231187384 validates the corrected tool/workflow tree. Later -bookkeeping edits preserve those runtime and tooling bytes. Final approval for -this continuation remains the owner's existing merge authorization. - -Final evidence reconciliation (2026-09-08): all 20 original remote feature refs -were deleted with expected-head leases after ancestry verification. The hook -follow-up's actual installed consumers pass 1,105 tests per Python endpoint, -with one absent-CuPy skip. Its wheel remains the exact GPU-tested c1806203 hash; -sdist SHA256 is 19b7e7252f2c64e4ea014e92a14b7a25a8409db20612205da257c1d04df9e85b. -Only the final documentation/plan record differs from tested source 0717df2. -The remaining worktree belongs to PR #33 and is removed after its approved merge -and main verification; there is no pending user merge decision for this scope. diff --git a/plans/2026-09-08-backend-conversion.md b/plans/2026-09-08-backend-conversion.md deleted file mode 100644 index ea64c93..0000000 --- a/plans/2026-09-08-backend-conversion.md +++ /dev/null @@ -1,103 +0,0 @@ -# Validate Like inputs with the target backend's converter - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - -Owner update (2026-09-08): the reviewed implementation and recorded validation -are approved for merge. This supersedes earlier pending-approval statements. -Full native union composition remains required through supported upstream -integration, with a later candidate allowed; limited CuPy native static support -is accepted. Current merge execution and remaining release gates are tracked in -`plans/2026-09-08-agent-workflow.md` and the production-readiness roadmap. - - - -Maintain this ExecPlan according to `PLANS.md`. This independent PR addresses audit A05 for the accepted bearshape `0.1.0rc0` release. - -## Purpose / Big Picture - - -A backend Like annotation should accept an input only when its documented converter can produce an array satisfying the shape and casting policy at validation time. The current generic NumPy fallback accepts inputs that Torch/JAX reject, and trusting every NumPy array bypasses backend constraints such as native byte order and supported dtype. - -## Progress - - -- [x] (2026-09-08) Inspected shared conversion and backend trust paths. -- [x] (2026-09-08) Opened PR #16; before correction, seven of thirteen converter-oracle cases failed. -- [x] (2026-09-08) Removed fallback, limited native trust, and retained optional import diagnostics. -- [x] (2026-09-08) All thirteen oracle cases and 1,047 runtime tests pass on baseline and exact rc0 with Python 3.10/3.14. -- [x] (2026-09-08) Thirty existing checker tests and all hooks pass; locked dev tox passes 1,077 tests, five platform/backend skips, 91.33% coverage. CuPy GPU validation remains pending. - -## Surprises & Discoveries - - -Torch rejects negative-stride and non-native-endian NumPy arrays, while its current F32Like accepts them. JAX/Torch reject NumPy string arrays while ShapedLike accepts them. A NumPy-only __array__ protocol can be accepted by fallback after Torch conversion fails. These defects reproduce on both baseline and exact beartype rc0. - -## Decision Log - - -Decision: Call the selected backend converter without a fallback that changes its meaning. Rationale: fallback acceptance does not establish the public target-backend contract. Keep NumPy as the default only when no converter is configured. Date: 2026-09-08. - -Decision: Default backend trust includes only its native array class, not all NumPy arrays. Rationale: backend-native metadata checks avoid unnecessary conversion, while foreign input requires actual conversion proof. Explicit custom trusted_types remains a factory-author assertion and must be documented as such. - -## Outcomes & Retrospective - - -Implemented converter/validator agreement for all observed counterexamples and ordinary valid inputs. The seven formerly accepted invalid cases now reject, while valid lists/views and native Torch autograd retain their behavior. CuPy source consistency can be reviewed locally; CUDA runtime behavior remains unverified until a GPU run. - -## Context and Orientation - - -Worktree `/Users/ale/Code/bearshape-worktrees/backend-conversion`, branch `codex/backend-conversion`, base `f43e00d`. `_array_types.py::_ArrayLikeChecker._convert` currently falls back to np.asarray after converter failure. `_validate` bypasses conversion for trusted arrays. `jax.py`, `torch.py`, and `cupy.py` define backend converters and trust tuples. `tests/test_jax.py`, `test_torch.py`, `test_numpy.py`, and `test_cupy.py` cover their surfaces. `docs/features/like-types.md` describes conversion/casting. - -## Plan of Work - - -Add failing regression tests comparing actual converter failure with Like rejection for negative strides, non-native byte order, string dtype and NumPy-only protocols. Cover custom converter failure on inputs NumPy would accept. Then select exactly one converter in `_convert`, retaining useful failure details, and narrow the backend trust tuples to native arrays. A configured custom converter without an explicit trust declaration must not be bypassed by the default NumPy fast path. - -Keep strict validators unchanged and preserve same-kind casting semantics. Like validation does not replace the function argument; test original-object identity, supported lists/scalars/views and native Torch autograd preservation. Run converter-oracle tests for backend-supported numeric and unsupported nonnumeric inputs. Revise tests asserting the obsolete NumPy trust tuple into behavioral checks or the corrected explicit contract. Update docs and CHANGELOG with the rejected false positives, converter semantics and potential validation allocation. - -## Concrete Steps - - -Run from this worktree: - - uv sync --locked - uv run --locked pytest -n 0 tests/test_torch.py tests/test_jax.py -k ConversionContract - uv run --locked pytest -n auto tests --ignore=tests/test_typecheck.py - uv run --locked pytest -n auto tests/test_typecheck.py - uv run --locked prek run -a - -Save regression failures before source changes, then run the complete runtime suite with the isolated exact-rc0 Python 3.10/3.14 interpreters and this worktree's source path. Do not treat these source checks as installed-artifact validation; the integration/release milestone handles that separately. - -## Validation and Acceptance - - -The converter and Like result agree for every new oracle case under the selected casting policy. Invalid values reject with useful conversion details; valid existing inputs pass unless correcting a documented false positive. Argument identity, dtype/device and autograd are preserved for native Torch inputs. Rank/dimension checks still run after conversion, and native strict checks do not convert. Current checker fixtures and hooks pass. CuPy remains an explicit GPU validation gate. - -## Idempotence and Recovery - - -Use the isolated feature worktree and pytest temporary state. Do not modify user arrays in validation or silently detach gradients. Keep explicit factory parameters stable. Preserve main and require user validation before merge. - -## Artifacts and Notes - - -Evidence is under `/Users/ale/Code/bearshape-implementation-2026-09-08/evidence/`: `conversion-before.log` (7 failed, 6 passed), `conversion-after.log` (13 passed), `conversion-runtime.log`, `conversion-rc0-py310.log`, `conversion-rc0-py314.log` (1,047 passed, 5 skipped each), `conversion-checkers.log` (30 passed), `conversion-hooks-final.log`, and `conversion-tox.log` (1,077 passed, 5 skipped, 91.33% coverage). Separate lifetime correction is PR #15; this PR must not duplicate that source change. - -## Interfaces and Dependencies - - -Public backend Like names and make_array_like_type parameters remain available. `asarray=None` selects NumPy conversion. A custom trusted_types tuple explicitly declares which inputs may bypass that converter, so its author must ensure that assertion is valid. Root imports remain backend-independent. No new runtime dependency is introduced. - -Revision note — 2026-09-08: Added focused conversion plan before implementation. - -Revision note — 2026-09-08: Implemented and validated target-backend conversion. Recorded CPU evidence and the remaining GPU gate. - -Revision note (2026-09-08): reconciled completed milestone/hosted evidence and -explicit owner merge approval. The combined artifact, checker and GPU proofs -are in `docs/maintainers/production-readiness.md`; this update does not mark -the unresolved native-union integration or release administration complete. diff --git a/plans/2026-09-08-checker-conformance.md b/plans/2026-09-08-checker-conformance.md deleted file mode 100644 index 2253f1e..0000000 --- a/plans/2026-09-08-checker-conformance.md +++ /dev/null @@ -1,112 +0,0 @@ -# Verify useful public typing with four checker engines - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - -Owner update (2026-09-08): the reviewed implementation and recorded validation -are approved for merge. This supersedes earlier pending-approval statements. -Full native union composition remains required through supported upstream -integration, with a later candidate allowed; limited CuPy native static support -is accepted. Current merge execution and remaining release gates are tracked in -`plans/2026-09-08-agent-workflow.md` and the production-readiness roadmap. - - - -Maintain this ExecPlan according to `PLANS.md`. This independent PR establishes the checker harness and tested tool baseline for audit A06. Tree and broader Like models remain separate implementation PRs. - -## Purpose / Big Picture - - -A checker must accept valid consumer calls, reject deliberately wrong calls, and retain useful inferred types. Existing fixtures mostly accept declarations; locked ty 0.0.40 reduces tested aliases to Unknown. Add meaningful consumer proof and integrate pyrefly without masking errors. - -## Progress - - -- [x] (2026-09-08) Inspected current checker harness, configuration and audited tool results. -- [x] (2026-09-08) Opened PR #17; old ty fails four real inferred-type assertions. -- [x] (2026-09-08) Updated four checker tools and corrected check's configuration overload. -- [x] (2026-09-08) Eight batched conformance tests pass, including four intended error sites per checker. -- [x] (2026-09-08) Python 3.10–3.14 all pass; each selected floor tox environment runs two tests successfully. Hooks pass. -- [x] (2026-09-08) Locked dev tox passes 1,042 tests, five platform/backend skips, 91.04% coverage; Tree/Like/CuPy model work remains separate. - -## Surprises & Discoveries - - -Current tests start each checker per fixture and then again on the whole source tree. They can pass while aliases lose useful types. `_tool_path` resolves the Python symlink before locating tools, which can select the wrong interpreter installation. NumPy contextual inference can hide the intended wrong-dtype error in an inline array constructor; the negative fixture uses an explicitly typed int32 array variable to test the caller contract consistently. Checker factor selection matches a complete tool name plus optional digits so the generic `type` factor cannot accidentally select `ty`. Pyrefly 1.2.0 reports a mismatch between check's omitted overload configuration and the implementation's None default. - -## Decision Log - - -Decision: Group fixtures and require valid, invalid and inferred-type evidence. Rationale: fewer redundant checker invocations with stronger user-visible proof. Expected invalid input must fail at the intended location/category, not merely cause a nonzero process exit. Date: 2026-09-08. - -Decision: Start with audited pyright 1.1.411, mypy 2.3.1, ty 0.0.79 and pyrefly 1.2.0; preserve proven pyright/mypy floor lanes. Rationale: ty's old locked version loses the tested alias information, and pyrefly is the planned fourth engine. Supported tools do not imply untested Tree/Like contracts are solved. - -## Outcomes & Retrospective - - -Implemented tool integration and core array/decorator conformance on Python 3.10–3.14. The harness reduces thirty redundant successful-check tests to eight stronger batches covering source, useful inference, and intended errors. Static Tree acceptance, broader Like inputs and CuPy native typing remain explicitly open under the production roadmap. - -## Context and Orientation - - -Worktree `/Users/ale/Code/bearshape-worktrees/checker-conformance`, branch `codex/checker-conformance`, base `f43e00d`. `tests/test_typecheck.py` runs checkers from the current interpreter with the matching Python target. Valid fixtures live in `tests/typing/`; create `tests/typing_negative/` for deliberate errors. `pyproject.toml` and `uv.lock` own tools; `tox.toml`, `tools/validate_tox_env.py` and CI route compatibility jobs. `src/bearshape/_decorator.py` owns check's ParamSpec-preserving overloads. - -## Plan of Work - - -Add a valid consumer fixture proving strict NumPy dtype/backend information and preserved decorated function/async signatures with assert_type. Add deliberate wrong dtype, wrong scalar type and wrong call shape cases under tests/typing_negative. Run the valid fixture with old ty and save the failure showing information loss before changing tools. - -Update the static group and lock to the audited starting versions. Type check's optional keyword conf as BeartypeConf or None with the actual default, preserving existing memo-only and combined modes. Add pyrefly to tox/CI and marker documentation. The harness must locate executables beside sys.executable before searching PATH, target the current interpreter, log versions when needed, and fail if an expected selected checker is missing. - -Batch source and positive/inference fixtures per checker. Run negative fixtures separately, parse supported diagnostics into source file/line/category, and compare with explicit expected-error markers. Reject crashes, unexpected diagnostics, missing imports, or success on deliberate errors. Restrict a single-checker tox environment to its selected checker; regular development and Python compatibility jobs run all four. Keep negative files outside normal src/tests/typing targets. - -## Concrete Steps - - -Run from this worktree: - - uv sync --locked - uv run --locked ty check tests/typing/check_conformance.py - uv lock - uv sync --locked - uv run --locked pytest -n 0 tests/test_typecheck.py - uv run --locked tox run -e py313-bt022-type-pyright1408,py313-bt022-type-mypy119,py313-bt022-type-ty,py313-bt022-type-pyrefly - uv run --locked prek run -a - -This branch starts independently from the pre-rc0 main revision, so its tox names initially use bt022; reconcile them with the separate rc0 PR in integration. Run the checker suite using interpreter-matched environments for Python 3.10–3.14. Record actual command output and selected checker versions. - -## Validation and Acceptance - - -All four engines accept valid strict-array/decorator consumer calls and preserve their asserted types. Wrong dtype, wrong scalar type and invalid call signatures produce the intended diagnostics in every selected engine. Invalid fixture crashes or missing tools fail the harness. Existing source/fixtures pass, Python targets use matching backends/stubs, and current floor checker environments retain their proved behavior. No Any/Unknown workaround, broad new ignore or removed annotation counts as conformance. - -## Idempotence and Recovery - - -Preserve the original checkout and lock resolutions unrelated to the deliberate tool updates. Use per-invocation mypy caches where concurrent tests would race. Do not execute negative consumer fixtures as Python programs. No merge without user validation. - -## Artifacts and Notes - - -Evidence is in `/Users/ale/Code/bearshape-implementation-2026-09-08/evidence/`: `checker-ty-before.log` records four inferred-type failures with ty 0.0.40; `checker-harness-first.log` records eight passing current-tool tests; `checker-python-3.11.log` through `checker-python-3.14.log` record successful interpreter-matched runs; `checker-tox-final.log` records dev coverage and two passing tests in each floor lane; `checker-hooks-final.log` records clean hooks. Current lock: pyright 1.1.411, mypy 2.3.1, ty 0.0.79, pyrefly 1.2.0. The floor lanes prove pyright 1.1.408 and mypy 1.19.x as well as exact ty/pyrefly baseline versions. Subsequent Tree/Like PRs extend the same harness instead of creating independent test frameworks. - -## Interfaces and Dependencies - - -Keep ParamSpec-based decorator signature preservation and the existing public annotation syntax. Runtime dependencies remain unchanged. Checker tools are development dependencies. Use typing_extensions.assert_type for the Python 3.10-compatible inference fixtures. - -Revision note — 2026-09-08: Added focused checker-conformance plan before implementation. - -Revision note — 2026-09-08: Implemented the four-engine consumer harness, explicit pyrefly default configuration, and all Python/floor validation. Native Tree, broader Like, and CuPy typing remain separate work. - -Revision note — 2026-09-08: Hosted lint caught an annotation-only import in the new negative fixture; moved it into TYPE_CHECKING and reran conformance. Stage new files before the all-files hook run so they are included. - -Revision note — 2026-09-08: Removed pyrefly's unrecognized required-version configuration key after inspecting stderr from the pinned 1.2.0 binary. The static dependency group and exact tox lane already enforce the tested tool baseline. Upstream current documentation described a newer configuration capability. - -Revision note (2026-09-08): reconciled completed milestone/hosted evidence and -explicit owner merge approval. The combined artifact, checker and GPU proofs -are in `docs/maintainers/production-readiness.md`; this update does not mark -the unresolved native-union integration or release administration complete. diff --git a/plans/2026-09-08-ci-validation.md b/plans/2026-09-08-ci-validation.md deleted file mode 100644 index 1da053f..0000000 --- a/plans/2026-09-08-ci-validation.md +++ /dev/null @@ -1,108 +0,0 @@ -# Make CI reproduce the release support contract - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - -Owner update (2026-09-08): the reviewed implementation and recorded validation -are approved for merge. This supersedes earlier pending-approval statements. -Full native union composition remains required through supported upstream -integration, with a later candidate allowed; limited CuPy native static support -is accepted. Current merge execution and remaining release gates are tracked in -`plans/2026-09-08-agent-workflow.md` and the production-readiness roadmap. - - - -Maintain this ExecPlan according to `PLANS.md`. This focused CI PR is stacked on integration draft #22 and implements M7. Documentation formatting and publication authorization remain separate PRs. - -## Purpose / Big Picture - - -Maintainers need a single reproducible validation workflow that tests the candidate on supported interpreters and platforms, fails when expected backends/checkers are missing, and cannot report success after a required job fails or is skipped. CPU jobs should install CPU Torch. Local hooks and hosted checks should execute the same maintained tools. - -## Progress - - -- [x] (2026-09-08) Created matching branch/worktree from the combined candidate. -- [x] (2026-09-08) Opened PR #23 and inspected actual uv/tox installer configuration. -- [x] (2026-09-08) Added shared workflow with nine platform runtime lanes, five current checker lanes and twelve floor lanes. -- [x] (2026-09-08) Backend preflight asserts exact rc0 and CPU Torch; tox forwards UV_TORCH_BACKEND=cpu. -- [x] (2026-09-08) Full hooks/actionlint run in CI; validation/docs actions pinned with weekly update configuration. Publication action changes remain in M9. -- [x] (2026-09-08) All hosted required jobs pass at 688e669; local dev and candidate endpoints pass; gate probes reject failure, skip and cancellation. -- [x] (2026-09-08) Recorded implementation, hosted results and the reproduced pyright environment defect. -- [x] (2026-09-08) Obtain user validation before merge. - -## Surprises & Discoveries - - -The root uv source mapping does not control tox's uv pip installs, so Linux CPU compatibility lanes currently install CUDA Torch dependencies. The current PR workflow duplicates typing runs, differs from nightly, lacks a final required gate, and runs only a subset of local hooks. Docs deployment installs default development dependency groups despite its docs-only purpose. The installed uv supports UV_TORCH_BACKEND=cpu; validate that tox forwards it before claiming CPU-only behavior. - -## Decision Log - - -Decision: Keep one reusable validation workflow used by PR/push and nightly, accepting a ref for later immutable release validation. Rationale: shared checks prevent publishing from relying on a weaker, separate test path. Default caller ref remains the exact event SHA. Date: 2026-09-08. - -Decision: Exercise current locked CPU backends on Python 3.10–3.14 under Linux and both endpoints on macOS/Windows, subject to demonstrated backend wheel availability. Keep explicit dependency/checker floor lanes on Linux. Rationale: checkers and backends have interpreter-specific wheels; cross-platform claims require actual jobs. - -Decision: Make missing expected backends and non-CPU Torch fatal in their CPU lanes. Rationale: importorskip remains useful for optional local environments but cannot establish a required support lane. - -Decision: Use full commit pins for external actions with a maintained update configuration. Run the locked prek suite plus actionlint, and fail if formatting/locking changed tracked files. Rationale: local and hosted tool drift already caused failures during the audit. - -## Outcomes & Retrospective - - -All 32 required hosted jobs pass at implementation commit 688e669, including the aggregate gate, plus the external secret scan. Local development tests pass 1,074 cases with five documented skips and 91.62% coverage; exact-candidate CPU endpoint lanes each pass 1,066 runtime tests. The narrower tox-driver install exposed pyright environment routing that a populated developer environment hid; removing the fixed venv selection makes the selected interpreter authoritative. A successful CPU matrix does not prove CuPy GPU execution or resolve the native-union integration blocker. - -## Context and Orientation - - -Worktree `/Users/ale/Code/bearshape-worktrees/ci-validation`, branch `codex/ci-validation`, base integration `b2a1df0`. `.github/workflows/ci.yml` and `nightly.yml` duplicate matrices. `tox.toml` defines candidate/floor factors; `tests/conftest.py` filters optional backend suites. `tests/test_typecheck.py` executes all four checker positive/negative batches. `tools/check_distribution.py` and `tools/smoke_minimal.py` provide independent artifact/minimal checks. - -## Plan of Work - - -Introduce `.github/workflows/validate.yml` with explicit quality, current-runtime, checker, compatibility-floor, docs, distribution/minimal jobs and an always-running required gate. Keep CI/nightly as small callers of this common workflow. Parameterize only the checkout ref needed by release validation, rather than generating matrices in a separate framework. - -Add a small backend preflight command that imports requested modules, reports actual versions/origins, asserts exact beartype and verifies CPU Torch when selected. Reuse it in locked CPU jobs and tox before tests. Configure tox's uv installer with CPU backend selection and inspect generated commands plus Linux package resolution. Preserve absent-backend skips only outside the selected lane. - -Run all normal prek hooks in quality, then manual actionlint. Replace the standalone unpinned pre-push pyright hook with the locked four-checker harness. Keep the existing local pytest pre-push behavior. Pin external actions, add weekly GitHub Actions updates, and limit docs deployment to the locked docs group. Add a changelog/contributor note describing the actual validation commands and support matrix. - -## Concrete Steps - - -Run targeted tox configuration inspection and backend preflight first, then: - - uv run --locked tox run -e dev,py310-bt023rc0-cpu,py314-bt023rc0-cpu - uv run --locked prek run -a - uv run --locked prek run actionlint -a --stage manual - -Push the draft to execute the hosted matrix. Read failed-job logs, fix demonstrated issues, and rerun only affected checks unless changes require broader validation. Test that the final gate accepts only success for every required job result. - -## Validation and Acceptance - - -The current locked suite executes every selected backend and checker. Exact rc0 is asserted. Linux CPU Torch has no CUDA build, macOS/Windows endpoint results are recorded accurately, backend/checker floor jobs pass, distributions/minimal installs pass, docs build passes, and all hooks execute. Required failures/skips/cancellations cannot produce a green final gate. No branch protection or environment settings are changed by this PR. - -## Idempotence and Recovery - - -Use only the isolated worktree and disposable test environments. Workflow edits may consume normal GitHub Actions runs but do not publish, deploy the candidate branch or change administrative settings. Keep main unchanged and request user validation before merge. - -## Artifacts and Notes - - -Record `/Users/ale/Code/bearshape-implementation-2026-09-08/evidence/ci-*` and hosted run/job links. Use actual platform/version results when updating the final support matrix. The combined pre-CI baseline passed 1,074 tests with five skips and 91.62% coverage. - -## Interfaces and Dependencies - - -Runtime dependencies remain beartype and typing_extensions. CI uses the locked uv/prek/checker toolchain, the existing test/backend groups and tox factors. The reusable workflow's checkout-ref input is for validation only and carries no publication permission. - -Revision note — 2026-09-08: All nine hosted platform runtime lanes, current checker lanes, backend floors, docs, quality and artifacts passed. The pyright floor failed because hard-coded venvPath/venv overrode its explicit tox interpreter. Reproduced locally only after exact-syncing the driver to the test-only group; inexact uv run had retained backend packages and hidden the defect. Removed the redundant fixed environment selection, retaining explicit harness interpreter paths. - -Revision note (2026-09-08): reconciled completed milestone/hosted evidence and -explicit owner merge approval. The combined artifact, checker and GPU proofs -are in `docs/maintainers/production-readiness.md`; this update does not mark -the unresolved native-union integration or release administration complete. diff --git a/plans/2026-09-08-claw-caller.md b/plans/2026-09-08-claw-caller.md deleted file mode 100644 index 1d76e16..0000000 --- a/plans/2026-09-08-claw-caller.md +++ /dev/null @@ -1,103 +0,0 @@ -# Instrument the actual caller package through bearshape.claw - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - -Owner update (2026-09-08): the reviewed implementation and recorded validation -are approved for merge. This supersedes earlier pending-approval statements. -Full native union composition remains required through supported upstream -integration, with a later candidate allowed; limited CuPy native static support -is accepted. Current merge execution and remaining release gates are tracked in -`plans/2026-09-08-agent-workflow.md` and the production-readiness roadmap. - - - -Maintain this ExecPlan according to `PLANS.md`. This independent PR closes audit finding A02 under the accepted `0.1.0rc0` production goal. - -## Purpose / Big Picture - - -Calling `bearshape_this_package()` in a user's package initializer must instrument that package's subsequently imported modules. Currently the forwarding wrapper makes upstream discover `bearshape.claw` as the caller instead, so invalid inputs return normally. Preserve the public import name while allowing beartype to inspect the real calling package. - -## Progress - - -- [x] (2026-09-08) Read the wrapper and its mocked forwarding test. -- [x] (2026-09-08) Opened PR #14; both real-package regressions failed before the fix. -- [x] (2026-09-08) Replaced forwarding with a direct alias and updated docs/changelog. -- [x] (2026-09-08) Passed baseline and exact-rc0 Python 3.10/3.14 integration tests, full CPU runtime suite, all three current checkers, and hooks. -- [x] (2026-09-08) Record evidence and request user validation before merge. - -## Surprises & Discoveries - - -The current forwarding mock verifies only that conf reaches a function. It cannot detect the wrong caller-package discovery. Real isolated package imports are required. Import-hook registration is process-global, so use subprocesses to prevent test contamination. - -## Decision Log - - -Decision: Directly re-export `beartype.claw.beartype_this_package` as `bearshape_this_package`. Rationale: preserve upstream signature and caller discovery with no additional stack-search logic. Date: 2026-09-08. - -## Outcomes & Retrospective - - -The alias fixes actual caller-package checking. Both regression variants passed on baseline and exact rc0 at Python 3.10/3.14. The complete baseline runtime suite passed 1,035 tests with five expected skip records. Pyright, mypy, ty, and hooks passed. Hosted CI and user validation remain pending. - -## Context and Orientation - - -Worktree `/Users/ale/Code/bearshape-worktrees/claw-caller`, branch `codex/claw-caller`, base `f43e00d`. `src/bearshape/claw.py` contains the forwarding function; `tests/test_coverage_edges.py::TestClawWrapper` mocks its callee. `tests/conftest.py` restricts backend-specific tox collection by filename, so include the new `tests/test_claw.py` in the NumPy suite. Runtime arrays and dimensions come from `bearshape.numpy` and package root. - -## Plan of Work - - -First write `tests/test_claw.py` to create a temporary package whose initializer calls the public hook, then imports a nested module containing functions annotated with F32[N]. A subprocess imports that package and exercises valid equal shapes, invalid second parameters, invalid returns, configuration that changes violation types, and an unrelated sibling package which must remain unchecked. Run the new tests before changing source and save the failing results. - -Then replace the forwarding function with the direct alias. Remove the obsolete forwarding mock and its unused imports, revise wrapper terminology in relevant claw documentation, and add the behavioral fix to CHANGELOG. Keep this PR independent from the metadata floor PR; run the normal baseline suite plus isolated exact-rc0 source tests, and revalidate their combined installed artifact in the program's integration stage. - -## Concrete Steps - - -Run from this worktree: - - uv sync --locked - uv run --locked pytest -n 0 tests/test_claw.py - uv run --locked pytest -n auto tests/test_claw.py tests/test_coverage_edges.py - uv run --locked pyright src tests/typing - uv run --locked mypy src tests/typing - uv run --locked ty check src tests/typing - uv run --locked prek run -a - -Use the goal's isolated exact-rc0 interpreter with this worktree's source path to run `tests/test_claw.py` on Python 3.10 and 3.14. Record actual paths/results; this source test proves the fix on rc0, while normal artifact installation belongs to the compatibility/integration PRs. - -## Validation and Acceptance - - -The unmodified wrapper fails the real-package regression. The alias makes parameter and return mismatches raise the intended configured violation classes in subsequently imported nested modules, valid calls pass, and unrelated packages stay unaffected. All supported checker and formatting checks remain green. No backend is newly required for root import. - -## Idempotence and Recovery - - -Each test uses pytest temporary paths and a subprocess, without globally registering hooks in the parent test runner. Preserve the main checkout and use only this feature worktree. No merge occurs before user validation. - -## Artifacts and Notes - - -Save failing and passing logs under `/Users/ale/Code/bearshape-implementation-2026-09-08/evidence/`. This finding is independently reproducible on beartype 0.22.9 and 0.23.0rc0. - -## Interfaces and Dependencies - - -The public name stays `bearshape.claw.bearshape_this_package`, including upstream's keyword-only conf argument. There is no additional runtime dependency and no new root export. Tests use NumPy and pytest already included in development dependencies. - -Revision note — 2026-09-08: Added focused plan before implementing the caller-package fix. - -Validation evidence — 2026-09-08: `claw-before.log` shows two failures for unchecked caller parameters. `claw-after.log` shows 55 targeted passes; each `claw-rc0-py310.log`/`claw-rc0-py314.log` shows two passes. `claw-runtime.log` records 1,035 passes and the expected CuPy/platform-precision skips. `claw-checkers.log` and `claw-hooks.log` pass. No source changes were needed beyond replacing the wrapper and removing its obsolete mock. - -Revision note (2026-09-08): reconciled completed milestone/hosted evidence and -explicit owner merge approval. The combined artifact, checker and GPU proofs -are in `docs/maintainers/production-readiness.md`; this update does not mark -the unresolved native-union integration or release administration complete. diff --git a/plans/2026-09-08-cupy-runtime.md b/plans/2026-09-08-cupy-runtime.md deleted file mode 100644 index a1ce4c2..0000000 --- a/plans/2026-09-08-cupy-runtime.md +++ /dev/null @@ -1,100 +0,0 @@ -# Verify the corrected CuPy runtime on CUDA - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - -Owner update (2026-09-08): the reviewed implementation and recorded validation -are approved for merge. This supersedes earlier pending-approval statements. -Full native union composition remains required through supported upstream -integration, with a later candidate allowed; limited CuPy native static support -is accepted. Current merge execution and remaining release gates are tracked in -`plans/2026-09-08-agent-workflow.md` and the production-readiness roadmap. - - - -Maintain this ExecPlan according to `PLANS.md`. This independent validation PR is based on integration PR #22, which includes the lifetime and converter corrections. - -## Purpose / Big Picture - - -CuPy users need evidence from actual GPU arrays. Prove strict shape/dtype validation, backend conversion, preservation of device/native objects, and optree containers against a normally installed candidate wheel with exact beartype 0.23.0rc0. CPU skips cannot establish this contract. - -## Progress - - -- [x] (2026-09-08) Created codex/cupy-runtime and matching worktree from b2a1df0. -- [x] (2026-09-08) Opened draft PR #26 and added 12 conversion/device/tree cases. -- [x] (2026-09-08) Published 51aa332 and verified all 18 package files plus tests against the public commit before transfer. -- [x] (2026-09-08) All 95 GPU cases passed without skips on Python 3.10.20 and 3.14.3 with exact rc0, CuPy 14.2.0 and optree with CUDA 12.9. -- [x] (2026-09-08) Hooks and applicable hosted checks pass. -- [x] (2026-09-08) Obtain user validation before merge. - -## Surprises & Discoveries - - -The baseline already passed 83 CuPy tests with CuPy 14.2.0 and both Python endpoints. That artifact predates the lifetime/conversion corrections, so it is insufficient evidence for the combined candidate. The first corrected-candidate run passed 94 tests and exposed one incorrect new test assumption: CuPy 14.2.0 accepts structured host arrays. Verified dtype preservation and generic Shaped/Like acceptance, then corrected the test and stale module comment. Native CuPy 14.2.0 has no py.typed marker or ndarray stubs; the static support decision remains separate and pending. - -## Decision Log - - -Decision: Add GPU behavioral tests to tests/test_cupy.py without changing runtime or static promises. Rationale: the combined corrections require device-backed verification; this milestone does not authorize a reduced static contract. Date: 2026-09-08. - -Decision: Validate normally installed candidate archives in isolated CUDA environments. Record package provenance and keep project validation independent of machine-specific administration. - -## Outcomes & Retrospective - - -The normally installed corrected wheel passes all 95 CuPy tests at both Python endpoints. Native device/stream identity, host conversion, generic structured dtype acceptance and nested optree validation are proven with CuPy 14.2.0. Multi-GPU transfer behavior and other CUDA/CuPy combinations are not established. A04 native union rollback and CuPy static support remain separate release decisions; successful GPU tests cannot close them. - -## Context and Orientation - - -Worktree /Users/ale/Code/bearshape-worktrees/cupy-runtime, branch codex/cupy-runtime. tests/test_cupy.py owns existing GPU tests. src/bearshape/cupy.py selects cp.asarray and trusts only native CuPy arrays. src/bearshape/_array_types.py now obeys the selected converter and rolls back failed leaf validation. bearshape.optree.Tree validates all leaves and shared structure using optree's default registry. - -Use isolated environments for each Python endpoint. Verify archive hashes against the candidate commit before validation. Machine-specific locations are not part of the project setup. - -## Plan of Work - - -Add observable cases comparing Like acceptance with cp.asarray for valid noncontiguous/endian host arrays and unsupported string/object arrays and supported structured arrays. Test that validation leaves a native device array's identity, device and allocation unchanged, including nondefault CUDA streams. Exercise nested optree containers, inconsistent leaf shapes/dtypes, structure binding and failed-check recovery on device arrays. - -Build a source archive and wheel from that archive. Normally install the wheel with exact beartype rc0 in each isolated endpoint environment, then run copied tests outside source checkouts. Require real CuPy/optree imports and an available GPU before pytest; an importorskip-only exit is not proof. Record source commit, artifact SHA256, installed origin, versions, GPU and CUDA data. - -## Concrete Steps - - -From the worktree run uv build --sdist and uv build --wheel with the resulting archive, then tools/check_distribution.py. Publish the authorized draft PR commit first and verify public provenance before transferring the wheel and tests. - -In an appropriately provisioned CUDA environment, normally install the candidate and beartype==0.23.0rc0. Use python -I -m pytest against the copied test_cupy.py. Run the maintained hooks and inspect hosted PR checks locally. - -## Validation and Acceptance - - -Both endpoints must pass existing and added GPU tests without missing-CuPy/optree skips. Valid host values must convert with cp.asarray and satisfy Like; unsupported values must fail both conversion and validation. Native validation must preserve object/device/pointer and tree checks must reject inconsistent shapes, dtypes and structures. Logs must prove site-packages imports and exact beartype. Report the tested CuPy/CUDA/GPU versions without implying every driver or multi-GPU combination is covered. - -## Idempotence and Recovery - - -Use isolated task directories and selected free device only. Never kill unrelated processes, install global packages, change main, merge, publish a package or transfer ownership. Retry failed validation after understanding its cause and preserve the logs. - -## Artifacts and Notes - - -Save evidence under /Users/ale/Code/bearshape-implementation-2026-09-08/evidence/cupy-candidate-*. Include a provenance record and exact commands so maintainers can rerun on another CUDA host. - -## Interfaces and Dependencies - - -No public API changes. Tests use NumPy, CuPy, optree, beartype and pytest. CuPy remains outside CPU dependency groups. The configured GPU environment has CuPy 14.2.0; explicit optree installation is required for the additional container cases. - -Revision note — 2026-09-08: Completed CUDA endpoint validation. Wheel SHA256 7328836ecc1d0f8dbba93d6bd213517a97d9ad39e1407b6519bd6f740eeff04c; public source 51aa3327ea59a82f19fce616d7d9d7cb6bf657a6. Logs cupy-candidate-final-3.10.log and cupy-candidate-final-3.14.log record installed origins, CUDA configuration and 95 passing tests each. - -Revision note (2026-09-08): reconciled completed milestone/hosted evidence and -explicit owner merge approval. The combined artifact, checker and GPU proofs -are in `docs/maintainers/production-readiness.md`; this update does not mark -the unresolved native-union integration or release administration complete. - -Revision note — 2026-10-11: Removed machine-specific operational details; dated package versions, artifact hashes and test results remain historical evidence. diff --git a/plans/2026-09-08-distribution-integrity.md b/plans/2026-09-08-distribution-integrity.md deleted file mode 100644 index e51ba59..0000000 --- a/plans/2026-09-08-distribution-integrity.md +++ /dev/null @@ -1,104 +0,0 @@ -# Ship complete, testable source and wheel distributions - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - -Owner update (2026-09-08): the reviewed implementation and recorded validation -are approved for merge. This supersedes earlier pending-approval statements. -Full native union composition remains required through supported upstream -integration, with a later candidate allowed; limited CuPy native static support -is accepted. Current merge execution and remaining release gates are tracked in -`plans/2026-09-08-agent-workflow.md` and the production-readiness roadmap. - - - -Maintain this ExecPlan according to `PLANS.md`. This independent PR addresses audit A07 for the accepted bearshape `0.1.0rc0` release; version and beartype metadata are separate PR #13. - -## Purpose / Big Picture - - -A downstream user must receive the actual MIT license notice with the installed package. A maintainer receiving the source archive must be able to rebuild the wheel and run the included regression suite without retrieving missing configuration from GitHub. Check the real archives, not just the source metadata. - -## Progress - - -- [x] (2026-09-08) Created isolated feature worktree and reviewed uv's inclusion rules and the audit evidence. -- [x] (2026-09-08) Opened PR #18 and reproduced missing License-File metadata/license with the new archive check. -- [x] (2026-09-08) Included license/testing inputs, added the archive validator and required CI job. -- [x] (2026-09-08) Rebuilt and normally installed the wheel in an external consumer; root imports no optional backend. Copied archive tests pass against the installed wheel: 652 passed, seven explicit missing-backend/platform skips. -- [x] (2026-09-08) All hooks pass; recorded hashes and retained exact-rc0 integrated artifact validation as a separate release gate. - -## Surprises & Discoveries - - -The original wheel and sdist contain `License-Expression: MIT` but omit LICENSE. uv includes license files only when declared, and its default source archive omits the repository tests/configuration. A successful build alone does not prove either property. - -## Decision Log - - -Decision: Keep uv_build, declare `license-files = ["LICENSE"]`, remove the redundant license classifier, and explicitly include the existing tests and their configuration in the sdist. Rationale: this corrects artifact contents without replacing the build backend or adding runtime dependencies. Date: 2026-09-08. - -Decision: Add one small archive validation command usable by CI/release work. Check the license bytes and metadata, package typing marker, expected modules, and source test inputs. Build a wheel from the produced source archive before installation. Rationale: publishing must validate the exact artifact it will upload, without rebuilding after approval. - -## Outcomes & Retrospective - - -Implemented complete source/wheel contents with executable archive checks. The unchanged artifacts fail, while the rebuilt artifacts pass and support 652 installed-wheel tests. Exact beartype rc0 installation requires integrating PR #13 because this independent branch retains main's old dependency bound. Record this distinction rather than treating a source overlay or dependency-free install as distribution proof. - -## Context and Orientation - - -Worktree `/Users/ale/Code/bearshape-worktrees/distribution-integrity`, branch `codex/distribution-integrity`, base `f43e00d`. `pyproject.toml` owns build metadata and source inclusion. `LICENSE` contains the notice. The module tree is `src/bearshape`, with `py.typed` declaring inline typing information. `tests/`, `pytest.toml`, `tox.toml`, `ty.toml`, `ruff.toml`, `tools/`, and `uv.lock` support downstream validation. Add `tools/check_distribution.py` for inspecting a wheel and source archive. - -## Plan of Work - - -First build the unchanged project into an evidence directory. Implement archive checks and show that the old archives fail because their license is absent. Then declare the license files and source inclusion in pyproject. Include tests, tools, checker/pytest/tox configuration, the lockfile, contributor instructions and changelog. Exclude caches, virtual environments, audit evidence and generated docs by retaining deliberate inclusion rather than adding the entire repository. - -Build the sdist with `uv build --sdist`, then pass that archive to `uv build --wheel`. Inspect both archives with the new command, including matching license/version metadata and the package typing marker. Record SHA-256 hashes. Install the rebuilt wheel with normal dependency resolution in a fresh environment outside all checkouts; prove imports originate in that environment and root import loads no optional backend. Run representative runtime tests copied from the source archive, and verify that those tests do not load source from the original checkout. - -Add contributor commands for reproducible archive inspection and update CHANGELOG. The broader CI/release PR will invoke this command for its built artifacts and extend installed-wheel proof to the integrated checker suite and exact candidate on both Python endpoints. - -## Concrete Steps - - -From this worktree: - - uv build --sdist --out-dir /Users/ale/Code/bearshape-implementation-2026-09-08/evidence/distribution-before - uv build /absolute/path/to/bearshape-0.0.1.tar.gz --wheel --out-dir /absolute/path/to/artifacts - python tools/check_distribution.py /absolute/path/to/artifacts/bearshape-0.0.1-py3-none-any.whl /absolute/path/to/artifacts/bearshape-0.0.1.tar.gz - uv run --locked prek run -a - -Use the actual filenames produced by each build. No publication command is part of this work. Preserve all before/after artifacts under the implementation evidence directory. - -## Validation and Acceptance - - -The unchanged archives fail the license check. Corrected wheel and sdist contain identical LICENSE text and matching license/version metadata; wheel contains all package modules and py.typed; sdist contains a runnable test/configuration set. A rebuilt wheel installs normally outside the source tree and imports from site-packages. Core NumPy and tree consumer checks succeed with installed optional dependencies. Hooks leave no uncommitted formatting changes. Integration must repeat the normal installation with beartype 0.23.0rc0 before final release signoff. - -## Idempotence and Recovery - - -Use separate output directories so old and new archives remain inspectable. Do not clear or overwrite user releases. Fresh temporary consumers avoid editable import leakage. Do not merge without user validation or publish without explicit authorization. - -## Artifacts and Notes - - -Evidence is under `/Users/ale/Code/bearshape-implementation-2026-09-08/evidence/`: `distribution-before-check.log` fails for the absent License-File; `distribution-after-check.json` records the matching archive check and hashes; `distribution-install.log` shows a normal wheel install and site-packages import with only declared dependencies before optional NumPy/optree installation; `distribution-installed-tests.log` reports 652 passed and seven explicit platform/missing-JAX/Torch skips; `distribution-hooks-final.log` is clean. The isolated consumer is `/Users/ale/Code/bearshape-implementation-2026-09-08/distribution-consumer`; it contains no package source tree. Its tests came from the sdist. - -## Interfaces and Dependencies - - -The archive validator accepts a wheel path followed by an sdist path and exits nonzero for missing/mismatched required contents. Use Python's standard library for archive/metadata/hash inspection. Keep runtime dependencies and public API unchanged. Test/archive tooling uses uv, already the project's supported development tool. - -Revision note — 2026-09-08: Added focused distribution plan before implementation. - -Revision note — 2026-09-08: Implemented archive integrity checks and recorded normal external wheel installation plus downstream runtime evidence. Final combined rc0 artifacts remain an integration requirement. - -Revision note (2026-09-08): reconciled completed milestone/hosted evidence and -explicit owner merge approval. The combined artifact, checker and GPU proofs -are in `docs/maintainers/production-readiness.md`; this update does not mark -the unresolved native-union integration or release administration complete. diff --git a/plans/2026-09-08-docs-contract.md b/plans/2026-09-08-docs-contract.md deleted file mode 100644 index 93b31c7..0000000 --- a/plans/2026-09-08-docs-contract.md +++ /dev/null @@ -1,106 +0,0 @@ -# Repair rendered documentation and executable examples - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - -Owner update (2026-09-08): the reviewed implementation and recorded validation -are approved for merge. This supersedes earlier pending-approval statements. -Full native union composition remains required through supported upstream -integration, with a later candidate allowed; limited CuPy native static support -is accepted. Current merge execution and remaining release gates are tracked in -`plans/2026-09-08-agent-workflow.md` and the production-readiness roadmap. - - - -Maintain this ExecPlan according to `PLANS.md`. This focused documentation PR is stacked on CI PR #23 (which uses integration draft #22) and implements the documentation portion of M8. Artifact installation and publication gating remain separate work. - -## Purpose / Big Picture - - -Users must be able to read rendered shape/casting tables, distinguish runtime checks from static types, and run the documented examples on the Python 3.10 floor. Correct a build that currently succeeds while flattening tables and admonitions and leaving stale claims after the implementation fixes. - -## Progress - - -- [x] (2026-09-08) Created isolated documentation branch/worktree. -- [x] (2026-09-08) Opened draft PR #24; reproduced table corruption with the pinned formatter and fixed it with explicit gfm 1.0.0. -- [x] (2026-09-08) Restored ten tables/seven malformed admonitions, corrected typing/memo guidance, and replaced Python 3.12-only alias syntax. -- [x] (2026-09-08) All 29 notebook cells execute on Python 3.10.20 and 3.14.5 with exact candidate dependencies; 92 doc snippets parse at the Python floor. -- [x] (2026-09-08) Executed all five guide example blocks plus scalar dot on both Python endpoints, including valid results and expected violations. -- [x] (2026-09-08) Maintained checker validates expected table rows, admonitions, favicon and snippet syntax; visually inspected the casting table and Boolean warning in the local browser. -- [x] (2026-09-08) Hook formatting round trip and docs-only build pass; notebook outputs and formatter before/after evidence retained externally. -- [x] (2026-09-08) Shared hosted validation including docs and both notebook endpoints passes in run 34218035673 at f8d582b. The simultaneous earlier run was cancelled after the PR base changed. -- [x] (2026-09-08) Obtain user validation before merge. - -## Surprises & Discoveries - - -The current docs contain flattened tables (`| |` between intended rows) and admonition text outside the required indentation. A successful Zensical build does not detect this. The installed hook pins mdformat-mkdocs 5.2.0b2 and explicitly selects mkdocs/frontmatter; first test whether the current formatter corrupts valid syntax or whether the malformed input is historical damage. The combined Like guide also retains one stale backend-only static claim despite the corrected aliases. - -## Decision Log - - -Decision: Test a valid formatting round trip before changing formatter dependencies. Rationale: avoid speculative tool upgrades if repairing historical source damage is enough. Date: 2026-09-08. - -Decision: Use Python 3.10-compatible aliases and test-backed examples; remove fixed coverage badges and missing asset references. Rationale: docs are user contracts and should not show metrics or syntax the selected environment cannot support. - -Decision: Preserve explicit runtime-only syntax and CuPy's observed typing limitations without declaring an unresolved support policy accepted. Rationale: runtime metadata checks and static backend stubs establish different guarantees. - -## Outcomes & Retrospective - - -The pinned formatter originally flattened a valid table. Explicit gfm support preserves it. Ten restored tables and eight rendered admonitions now pass semantic checks. The original notebook failed on Python 3.10 at its Python 3.12 alias syntax; the corrected notebook executes all 29 cells at both Python endpoints, including expected violations that now assert the precise exception. Fixed the broadcast token, native notebook await and previously hard-coded endian results. Cleared stale committed output and added a repeatable kernel runner. - -## Context and Orientation - - -Worktree `/Users/ale/Code/bearshape-worktrees/docs-contract`, branch `codex/docs-contract`, base CI PR #23 at `f396e72`. `docs/features/` contains dimensions, Like, Tree, decoration and static guides. `docs/getting-started/` owns installation and quickstart. `zensical.toml` defines navigation/assets and markdown extensions. `README.md` is the concise entry point. The example notebook contains 29 code cells according to the audit; inspect actual contents before execution. - -## Plan of Work - - -Probe the pinned formatter on a minimal valid table and admonition, saving original/formatted text. Correct its configuration only if this round trip fails. Restore each damaged table and admonition in source, retaining intended content and reviewing cell boundaries. Repair stale static Like/Tree descriptions, Python 3.12-only aliases in floor-compatible examples, and misleading bare check examples. Keep intentional expected failures clearly labeled. - -Execute representative examples in an isolated process using the current candidate, with assertions for valid output and expected rejection. Execute the notebook from a disposable copy, inspect errors and outputs, and update the source only where behavior or claims require it. Build docs with the locked docs-only group. Inspect actual HTML for table rows, admonitions and referenced assets, then visually inspect representative built pages. Re-run all hooks and build to establish a stable round trip. - -## Concrete Steps - - -Use external probe/output files under the implementation evidence directory. From this worktree run: - - uv run --locked prek run -a - uv run --locked --only-group docs zensical build --clean - -Use a separate candidate runtime environment for examples so a docs-only build does not accidentally imply backend validation. Record actual Python/backend versions and rendered checks. - -## Validation and Acceptance - - -Tables render with the expected headers/rows; admonitions render as structured blocks; referenced local assets exist. Maintained examples use supported Python syntax and demonstrate the documented runtime/static contract. The notebook executes without unexpected errors. Hooks leave tracked files unchanged after formatting and the docs-only build succeeds. No full static shape inference or native CuPy stub completeness is promised. - -## Idempotence and Recovery - - -Work only in the isolated branch. Do not overwrite the original audit or unreviewed notebook outputs. Store execution copies/screenshots outside the repository unless they serve a maintained test. Do not deploy the candidate documentation or change organization URLs before ownership transfer. - -## Artifacts and Notes - - -Evidence belongs under `/Users/ale/Code/bearshape-implementation-2026-09-08/evidence/docs-*`. Keep formatter before/after files, example/notebook output summaries and rendered validation results. - -## Interfaces and Dependencies - - -Use the existing Zensical documentation system and public bearshape API. Add no runtime dependency. Any additional formatter or execution tooling belongs in the appropriate development group or an isolated validation environment and must have a demonstrated use. - -Revision note — 2026-09-08: Stacked on CI PR #23 to add semantic docs and endpoint notebook jobs to shared validation. Kept outputs per interpreter under build/ and enabled only the development notebook dependency group for execution. - -Revision note — 2026-09-08: Actual five guide blocks and scalar-dot consumer checks pass on both endpoints; shared hosted run 34218035673 passes with required notebook/docs jobs. - -Revision note (2026-09-08): reconciled completed milestone/hosted evidence and -explicit owner merge approval. The combined artifact, checker and GPU proofs -are in `docs/maintainers/production-readiness.md`; this update does not mark -the unresolved native-union integration or release administration complete. diff --git a/plans/2026-09-08-framework-validation.md b/plans/2026-09-08-framework-validation.md deleted file mode 100644 index a8e0fd9..0000000 --- a/plans/2026-09-08-framework-validation.md +++ /dev/null @@ -1,112 +0,0 @@ -# Prove framework transformations and minimal runtime imports - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - -Owner update (2026-09-08): the reviewed implementation and recorded validation -are approved for merge. This supersedes earlier pending-approval statements. -Full native union composition remains required through supported upstream -integration, with a later candidate allowed; limited CuPy native static support -is accepted. Current merge execution and remaining release gates are tracked in -`plans/2026-09-08-agent-workflow.md` and the production-readiness roadmap. - - - -Maintain this ExecPlan according to `PLANS.md`. This independent validation PR covers the framework/import-boundary portion of M6 and is stacked on exact-candidate compatibility PR #13. - -## Purpose / Big Picture - - -ML users need to know when validation occurs around JAX transformations and Torch compilation, and users of custom array classes should not need to install an unrelated backend. Maintain small behavioral tests of those boundaries and document the actual execution behavior. - -## Progress - - -- [x] (2026-09-08) Created isolated branch/worktree from exact-rc0 compatibility. -- [x] (2026-09-08) Opened draft PR #21 and inspected backend transform behavior with small CPU probes. -- [x] (2026-09-08) Added four JAX and two Torch transformation tests with valid and invalid calls. -- [x] (2026-09-08) Normally installed candidate wheel passes minimal custom-array checks on Python 3.10.20 and 3.14.5. -- [x] (2026-09-08) Current suite, JAX/Torch floors, exact-candidate endpoint probes, hooks and docs build pass. -- [x] (2026-09-08) Added framework placement guide and recorded validation evidence. -- [x] (2026-09-08) Obtain hosted CI results and user validation before merge. - -## Surprises & Discoveries - - -The existing runtime suite validates metadata but does not establish JAX jit/vmap/grad or Torch compile behavior. Transform placement changes whether Python validation runs at an outer call or while tracing the function. Separate preliminary GPU validation passed 83 existing CuPy tests with the normally installed candidate wheel and exact beartype rc0. Comprehensive CuPy/static validation remains separate from this CPU transform PR. - -## Decision Log - - -Decision: Add observed behavior tests without promising static shape inference or checks inside every compiled execution. Rationale: framework tracing and compilation are separate execution models; tests must demonstrate the placement/limits. Date: 2026-09-08. - -Decision: Use small CPU arrays, JAX transformations, and Torch's eager compile backend to test the compiler front end. Rationale: no GPU or platform-specific native compiler is needed for these maintained checks. Do not claim this proves every compiler backend or dynamic-shape mode. - -Decision: Add an isolated minimal-install smoke command, using only declared runtime dependencies and a custom shape/dtype object. Rationale: source checkout imports with all developer dependencies cannot prove the lightweight root contract. - -## Outcomes & Retrospective - - -Six maintained transformation cases pass on Python 3.10 and 3.14 with exact beartype 0.23.0rc0. The development suite passes 1,070 tests with five platform/optional skips and 91.04% coverage. Floor lanes pass 210 JAX tests and 208 Torch tests; their 21/24 skips cover intentionally absent other backends and unavailable extended precision. JAX 0.5 emits 18 existing FutureWarnings for None conversion; these do not come from the new transformation cases. The framework guide builds without issues. - -Minimal normally installed wheels pass custom-array acceptance, shape/dtype/return rejection and optional-import assertions on Python 3.10.20 and 3.14.5. These environments contain only bearshape, exact beartype rc0 and typing_extensions. These tests establish the documented placements, not exhaustive framework compatibility. - -## Context and Orientation - - -Worktree `/Users/ale/Code/bearshape-worktrees/framework-validation`, branch `codex/framework-validation`, base `346347b`. `tests/test_jax.py` and `tests/test_torch.py` own backend tests and are selected by existing tox factors. `src/bearshape/_memo.py` discovers beartype frames; `_decorator.py` adds explicit contexts. No behavior changes are initially planned here. Add `tools/smoke_minimal.py` and a concise framework guide linked from the docs navigation. - -## Plan of Work - - -Probe beartype placement inside/outside JAX jit and verify valid results, shape/dtype rejection, and tracing versus repeated execution. Exercise vmap over validated row functions and gradients of a validated scalar loss. Keep dimension annotations consistent with the function's logical unbatched input shape. - -Exercise native Torch autograd through strict validation and torch.compile with backend="eager" for a small validated function. Verify valid outputs and wrong metadata rejection; characterize graph breaks or unsupported fullgraph placement rather than asserting optimization properties. Keep optional compiler/tool availability separate from normal eager/autograd support. Promote observed supported cases into the existing backend test files so their dependency-floor tox lanes execute them. - -Create a minimal-install smoke command that imports the installed root, verifies no optional backend module was imported, builds a custom array annotation through the public factory, and demonstrates correct/incorrect shape and dtype calls. Run it with Python's isolated mode from a fresh environment containing the normally installed wheel plus exact beartype rc0 and no NumPy/JAX/Torch/CuPy/optree. Verify the package is imported from that environment's site-packages. Add a focused CI job to reproduce this proof; broader CI consolidation can reuse it later. - -Document actual supported placement and tracing/compilation limitations in a concise guide, and update CHANGELOG for the validated support contract. Run current/floor backend tests and exact-candidate Python endpoints. Preserve known native-union rollback work as a separate release blocker. - -## Concrete Steps - - -From this worktree: - - uv sync --locked - uv run --locked pytest tests/test_jax.py tests/test_torch.py -n 4 - uv run --locked tox run -e py310-bt023rc0-jax05,py310-bt023rc0-torch26 - uv run --locked prek run -a - -Use an external fresh environment for `python -I tools/smoke_minimal.py`; installing the project with no dependencies or using PYTHONPATH does not establish artifact compatibility. The artifact can be normally installed with an exact beartype constraint. Record the actual installed version and source path. - -## Validation and Acceptance - - -Each maintained transform case demonstrates a valid result and a relevant rejection, with tracing behavior documented accurately. The NumPy-free custom-array smoke command passes on normally installed candidate wheels at the Python endpoints. Existing runtime/checker/hooks pass. Backend-floor test runs execute the added cases. No CUDA support, fullgraph compilation, dynamic-shape specialization, or per-compiled-invocation check is claimed without corresponding evidence. - -## Idempotence and Recovery - - -Use tiny arrays, temporary install environments and isolated worktrees. Do not alter framework global defaults, existing GPU workloads, system Python packages or package ownership. Keep main unchanged and obtain user validation before merge. - -## Artifacts and Notes - - -Record `/Users/ale/Code/bearshape-implementation-2026-09-08/evidence/framework-*.log` and minimal-install logs. GPU baseline evidence is `cupy-remote-baseline.log` and is explicitly preliminary; source integrity was verified against the public PR before transfer. - -## Interfaces and Dependencies - - -Use existing beartype/bearshape public annotations and JAX/Torch APIs already in dependency groups. No runtime dependency or public API addition is planned. Runtime shape relationships remain distinct from static backend/dtype information. The minimal smoke script relies only on Python and the declared runtime dependencies. - -Revision note — 2026-09-08: Added focused framework/import validation plan before implementation. - -Revision note — 2026-09-08: Recorded implemented transformation and minimal-install contracts, endpoint/floor results and existing JAX warning scope. - -Revision note (2026-09-08): reconciled completed milestone/hosted evidence and -explicit owner merge approval. The combined artifact, checker and GPU proofs -are in `docs/maintainers/production-readiness.md`; this update does not mark -the unresolved native-union integration or release administration complete. diff --git a/plans/2026-09-08-handoff-evidence.md b/plans/2026-09-08-handoff-evidence.md deleted file mode 100644 index 7811d68..0000000 --- a/plans/2026-09-08-handoff-evidence.md +++ /dev/null @@ -1,102 +0,0 @@ -# Prepare the production review and ownership handoff evidence - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - -Owner update (2026-09-08): the reviewed implementation and recorded validation -are approved for merge. This supersedes earlier pending-approval statements. -Full native union composition remains required through supported upstream -integration, with a later candidate allowed; limited CuPy native static support -is accepted. Current merge execution and remaining release gates are tracked in -`plans/2026-09-08-agent-workflow.md` and the production-readiness roadmap. - - - -Maintain this ExecPlan according to PLANS.md. This focused evidence PR follows publication gate #28 and closes independent M6/M9 documentation and measurement work. It does not authorize merge, publication, settings changes or transfer. - -## Purpose / Big Picture - - -Receiving maintainers need a concise, accurate map of what bearshape does, which behavior is tested, where the implementation lives, and which release decisions remain. Provide reproducible performance observations and a review packet tied to fixing PRs and artifact evidence, without claiming unresolved compatibility is complete. - -## Progress - - -- [x] (2026-09-08) Created codex/handoff-evidence and matching worktree from 3ee4c1d. -- [x] (2026-09-08) Opened #29 and mapped 17 feature families to positive/negative tests; added four default-argument/wrapped-signature cases passing at both endpoints. -- [x] (2026-09-08) Added a bounded benchmark and compared normally installed wheels with identical Python/backend versions; recorded medians/spread and profiled scope cost. -- [x] (2026-09-08) Wrote the support/module map, A01–A10 closure table, exact artifact/run evidence and concrete administrative proposal. -- [x] (2026-09-08) Full hooks, rendered tables, 93 Python snippets, browser inspection and every hosted check passed at 6845638. -- [x] (2026-09-08) Present remaining contract decisions and obtain user validation before merge. - -## Surprises & Discoveries - - -Most features already have focused positive/negative tests; wholesale test reorganization would add churn. The fixes needed new actual caller, lifecycle, converter and checker proofs. Real CuPy 14.2.0 accepts structured arrays through its converter, contradicting an old comment; 95 GPU tests now pass at both Python endpoints. Native CuPy typing and native union-alternative rollback remain separate unresolved release decisions. - -## Decision Log - - -Decision: Keep a concise feature-to-test map and link existing tests instead of duplicating them for coverage counts. Rationale: maintainers should see the contract and closing evidence directly. Date: 2026-09-08. - -Decision: Record medians and min/max for ordinary successful checks, Like conversion, Value, trees, nesting and diagnostic failures. Rationale: metadata checks, conversion and leaf traversal have different scaling. Use no noisy timing threshold in CI and make no universal speed claim. Benchmark ordinary already-correct cases while explicitly retaining the unresolved union blocker. - -Decision: Keep ownership URLs pointed at the real current repository and document exact proposed settings without changing them. Rationale: transfer and access controls require explicit owner authorization. Record PyPI publisher configuration as unverified until an authorized administrator checks it. - -## Outcomes & Retrospective - - -The feature map, matched measurement and handoff report are implemented. Strict native checks measured 19.8 microseconds versus 21.8 in the baseline; no material regression was observed. Scope/signature lookup remains a significant cost, with optimization deferred until the composition boundary is settled. Both exact hosted artifact GPU runs passed 95 tests; the release dry run completed 38 successful jobs and skipped publication. Documentation, browser inspection and all hosted checks for this evidence PR pass. Production readiness remains withheld for A04 and the CuPy static support decision. The final review must distinguish implemented/validated source changes from administrative release readiness and merge approval. - -## Context and Orientation - - -Worktree /Users/ale/Code/bearshape-worktrees/handoff-evidence, branch codex/handoff-evidence. Runtime code is under src/bearshape; tests are organized by shape/dimensions/dtypes/memo/decorator/backend/tree/checker contracts. The shared workflow proves the CPU platform matrix and normally installed artifacts. GPU logs under /Users/ale/Code/bearshape-implementation-2026-09-08/evidence prove real CuPy behavior separately. - -The audit benchmark used Python 3.10.20, NumPy and exact beartype 0.23.0rc0. The rc0-compat worktree retains the old runtime with the rc0 floor; its .tox/py310-bt023rc0-cpu interpreter is suitable for a matched baseline. The current candidate uses the same interpreter generation and hardware. Verify dependency versions and source origins before comparing. - -## Plan of Work - - -Add tools/benchmark_runtime.py using timeit, statistics and existing NumPy/optree dependencies. Report interpreter/platform, package versions/origin, call counts, repeat count and medians/min/max. Use tiny and million-element native arrays, cap conversion/failure repetitions appropriately, and vary tree leaf count. Do not mutate runtime behavior or add optimization caches. - -Inspect the public-feature tests and record representative positive/negative classes in docs/maintainers/production-readiness.md. Include intended users and deployment boundaries, module map, backend/checker/platform support evidence, private beartype integration assumptions, A01–A10 closing PRs, migrations, known blockers and artifact/CI links. Add the page to documentation navigation and keep the README short. - -Record the inspected main/ruleset/environment state and exact proposed controls: reviewed required validation status, protected release tags, pypi reviewers and tag-only policy, OIDC publisher identity, docs hosting and package owners. No administrative mutation occurs. Complete the release validation-only run and preserve its artifact identity in the report when available. - -## Concrete Steps - - -Run the benchmark script with the rc0-compat Python 3.10 interpreter and the current candidate's Python 3.10 environment, using the same script and machine. Save JSON outputs under evidence/performance-*. Compare only matched workloads and versions. - -Run uv run --locked prek run -a, the manual actionlint hook, the clean docs build and tools/check_docs.py. Inspect the feature map's referenced test classes and final hosted jobs. Update this plan and the roadmap with verified counts and open decisions. - -## Validation and Acceptance - - -Every maintained feature family has identifiable positive/negative evidence, with runtime-only syntax and upstream static limitations explicit. The benchmark is reproducible and reports spread; no speed claim depends on mismatched environments. The handoff report maps all audit findings to fixes or explicit blockers, includes source/artifact identity and observed CI/GPU results, and states administrative controls accurately. User validation and unresolved contract decisions remain visible. - -## Idempotence and Recovery - - -Measurements and documentation can be repeated without changing runtime or external ownership. Use task-local files and environments; do not overwrite audit evidence. Do not merge any actual PR base, publish packages, change protections or contact maintainers. Preserve the original checkout and all focused PR review boundaries. - -## Artifacts and Notes - - -Store measurement and handoff evidence under /Users/ale/Code/bearshape-implementation-2026-09-08/evidence. The report should link public PRs and Actions runs; local logs supply detailed supporting evidence. Keep actual final candidate hashes distinct from earlier validation artifacts. - -## Interfaces and Dependencies - - -No runtime dependency or public API changes. The benchmark uses standard timing tools plus the existing optional CPU backends. The report and navigation use the existing Zensical site and corrected Markdown formatter configuration. - -Revision note — 2026-09-08: Corrected an initial optree version mismatch by comparing two normal wheel environments with identical dependencies. Added focused boundary tests where the feature map found no direct proof; both Python endpoints pass. - -Revision note — 2026-09-08: Recorded the completed hosted validation and retained user merge approval as the only remaining review action for this focused scope. Program-level release decisions remain in the roadmap and handoff report. - -Revision note (2026-09-08): preserved final reviewed-head evidence and recorded -owner merge approval without changing outstanding release prerequisites. diff --git a/plans/2026-09-08-installed-consumers.md b/plans/2026-09-08-installed-consumers.md deleted file mode 100644 index bc8adf7..0000000 --- a/plans/2026-09-08-installed-consumers.md +++ /dev/null @@ -1,107 +0,0 @@ -# Prove the normally installed candidate artifact - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - -Owner update (2026-09-08): the reviewed implementation and recorded validation -are approved for merge. This supersedes earlier pending-approval statements. -Full native union composition remains required through supported upstream -integration, with a later candidate allowed; limited CuPy native static support -is accepted. Current merge execution and remaining release gates are tracked in -`plans/2026-09-08-agent-workflow.md` and the production-readiness roadmap. - - - -Maintain this ExecPlan according to `PLANS.md`. This focused artifact-consumer PR is stacked on CI PR #23 and implements the remaining installation proof in M8. - -## Purpose / Big Picture - - -The package users install must pass the same runtime and static consumer contracts as the checkout. Build the wheel from the source archive, normally install it with exact beartype 0.23.0rc0, and run copied downstream tests outside every source checkout. Keep the resulting hashes and module origins traceable to the candidate commit. - -## Progress - - -- [x] (2026-09-08) Created isolated branch/worktree from the combined CI candidate. -- [x] (2026-09-08) Opened draft PR #25 and inspected archive/test configuration. -- [x] (2026-09-08) Added explicit --installed-package mode; normal source targets remain unchanged. -- [x] (2026-09-08) Added normal wheel installation driver with copied archive fixtures, dependency lock and site-packages origin checks. -- [x] (2026-09-08) Initial isolated wheel runs each passed all 1,074 tests with five documented platform/CuPy skips. -- [x] (2026-09-08) Added required endpoint jobs consuming the same candidate-distributions artifact. -- [x] (2026-09-08) Final archive-owned-lock runs passed 1,074 tests with five documented skips at both endpoints; full hooks and actionlint pass. -- [x] (2026-09-08) Every required hosted job passed at 73b3ec9; PR #25 is ready for user review. -- [x] (2026-09-08) Record hashes, origins and results; obtain user validation before merge. - -## Surprises & Discoveries - - -Source tests currently assume a src directory in the checker target list. The archive already ships tests and configuration, but copied installed-package checks must omit that source target explicitly. The CI work exposed a hard-coded pyright venv override that could conceal the actual environment; its fix is present in this base. - -## Decision Log - - -Decision: Add an explicit pytest installed-package option rather than infer mode from a missing source directory. Rationale: an accidental missing source tree must not silently reduce normal validation. Date: 2026-09-08. - -Decision: Copy only downstream tests/configuration from the source archive into a temporary consumer directory, leaving package source absent. Rationale: source imports can mask incomplete wheels and missing typing markers. Install the wheel normally, with declared dependencies and exact beartype; never bypass resolution with --no-deps. - -Decision: Reuse the candidate-distributions artifact from the shared build job. Rationale: consumer validation and subsequent publication must refer to the same bytes. Keep publication changes in a separate PR. - -## Outcomes & Retrospective - - -The final normally installed wheel passes all 1,074 runtime/checker tests on Python 3.10.20 and 3.14.5. Both environments import bearshape from site-packages with exact beartype 0.23.0rc0, no editable project and no copied src directory. Five skips are CuPy absence and platform long-double distinctions. Hosted validation and user merge review remain. - -## Context and Orientation - - -Worktree `/Users/ale/Code/bearshape-worktrees/installed-consumers`, branch `codex/installed-consumers`, base CI `f396e72`. `tools/check_distribution.py` checks license, metadata, package bytes and source-test inclusion. `tests/test_typecheck.py` runs four positive/negative batches. `tests/conftest.py` owns pytest filtering; `pytest.toml` configures the shared runner defaults. The shared workflow builds one sdist-derived wheel and makes it available as candidate-distributions. - -## Plan of Work - - -Add --installed-package to pytest and make only the positive source/checker batch omit src in that explicit mode. Runtime and negative fixtures stay unchanged. Build and inspect archives, then create a fresh normal virtual environment for the selected interpreter. Export locked runtime/backend/checker/test dependencies without the editable project, install those dependencies and the actual wheel with exact beartype. - -Extract downstream tests and required configuration into a temporary directory without src. Verify bearshape imports from the new environment's site-packages, no editable project is installed, and exact versions/hashes are reported. Run the full CPU runtime suite plus every checker against copied fixtures. Fail on missing tools, unexpected diagnostics or source origins. Keep optional CuPy skips explicit; separate GPU evidence remains required. - -Wire endpoint consumer jobs to the existing distribution artifact and include them in the required gate. Save concise results and hashes. Run hooks and workflow lint, then inspect hosted results. - -## Concrete Steps - - -From this worktree build sdist and then its wheel, using tools/check_distribution.py before installing. Use a separate temporary consumer root and normal uv pip installation. Run copied tests with: - - python -I -m pytest tests/ --installed-package -n 4 - -Record actual checker imports and ensure their interpreter paths point to the consumer environment. Use the maintained command from CI at both endpoints. - -## Validation and Acceptance - - -The consumer directory contains no src/bearshape. Normal wheel resolution permits exact beartype rc0. Runtime tests and all four checker batches pass under Python 3.10 and 3.14, with only documented absent-CuPy/platform skips. Report artifact SHA256 and installed module paths. The final CI gate requires both endpoint results and no rebuild occurs between artifact validation stages. - -## Idempotence and Recovery - - -Use disposable directories and local virtual environments only. Do not modify system Python, main, release tags or ownership. Keep feature PRs separate and require user validation before merge. - -## Artifacts and Notes - - -Evidence goes under `/Users/ale/Code/bearshape-implementation-2026-09-08/evidence/installed-*`. The final local wheel SHA256 is ef8d38266da7150efa80191589b7ba0310007a6ae2dbb82d30d4bfe4e0ed49cf; source archive SHA256 is e738d7ab34d74d7ea221f1db3aef291e37baf7ad38c5c9dfa7276735dc93c23a. Consumer logs are installed-final-3.10.log and installed-final-3.14.log; each reports its temporary site-packages origin. Hosted builds record their own hashes because each archive is tied to its source state. These results complement, but do not replace, exact GPU runtime tests or the unresolved native-union contract decision. - -## Interfaces and Dependencies - - -No public runtime API or dependency change is planned. The pytest option is for downstream artifact validation. Use the existing locked backend/checker/test groups and standard-library archive/process tools for orchestration. - -Revision note — 2026-09-08: Validated the final driver using the archive's own lockfile and required both installed-consumer jobs in CI. - -Revision note — 2026-09-08: Recorded the completed hosted validation and retained user merge approval as the only remaining review action for this focused scope. Program-level release decisions remain in the roadmap and handoff report. - -Revision note (2026-09-08): reconciled completed milestone/hosted evidence and -explicit owner merge approval. The combined artifact, checker and GPU proofs -are in `docs/maintainers/production-readiness.md`; this update does not mark -the unresolved native-union integration or release administration complete. diff --git a/plans/2026-09-08-memo-discovery-performance.md b/plans/2026-09-08-memo-discovery-performance.md deleted file mode 100644 index cefe48c..0000000 --- a/plans/2026-09-08-memo-discovery-performance.md +++ /dev/null @@ -1,129 +0,0 @@ -# Reduce the cost of locating the active checking frame - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - - -This living ExecPlan follows `PLANS.md` and continues the existing production-readiness goal. Keep Progress, Surprises & Discoveries, Decision Log, and Outcomes & Retrospective current. - -## Purpose / Big Picture - - -Array validation repeatedly searches for the beartype frame that owns shared dimension bindings. The search currently materializes every visited frame's local-variable mapping, including unrelated library frames. Rejecting impossible candidates using their code metadata first should reduce this cost while preserving exactly which frame owns the memo. This also reduces the cost of the proposed upstream union transactions, which introduce additional call frames. - -The owner requested substantially lower overhead before contacting the upstream maintainer. This change is independent of the proposed integration and therefore has its own branch, worktree and PR. It keeps the published beartype 0.23.0rc0 dependency and all public behavior unchanged. No merge, release, transfer or maintainer contact is authorized for this new change. - -## Progress - - -- [x] (2026-09-08) Profiled the initial upstream proposal: frame discovery is a material part of repeated checks. -- [x] (2026-09-08) Created `codex/memo-discovery-performance` and `/Users/ale/Code/bearshape-worktrees/memo-discovery-performance` from main `795ec391123437beb5167de1e1519411dbabe479`. -- [x] (2026-09-08) Opened draft PR #35 before implementation. -- [x] (2026-09-08) Added the candidate filter and regression proving unrelated frames do not materialize locals. Existing real decorated/DOOR behavior remains covered. -- [x] (2026-09-08) Targeted tests passed; full CPU runtime tests passed 1,094 with five existing skips; all eight four-checker harness cases passed; hooks passed. -- [x] (2026-09-08) Matched installed comparisons show the rc0 strict-check baseline improving by about 13% on 3.10 and 27% on 3.14. Combined upstream effects are recorded separately. -- [ ] Present the focused change for review; merge remains pending user validation. - -## Surprises & Discoveries - - -The first transaction prototype magnified existing frame-search work: both its snapshot getter and the ordinary validator independently locate the checking scope. Profiling 10,000 strict calls showed 420,000 candidate-frame inspections. This is evidence about the initial prototype, not a portable latency claim. - -## Decision Log - - -Decision: Change only candidate rejection in frame discovery, and keep scope parsing, Value expression handling, frame ownership and the transaction protocol out of this PR. Rationale: the filter is independently useful and can be assessed without changing library behavior or coupling release decisions. Date/author: 2026-09-08, Codex. - -## Outcomes & Retrospective - - -The focused filter passes existing real-frame behavior, lifetime, CPU and static consumer tests, plus a regression that forbids reading unrelated-frame locals. Matched measurements and normally installed combination tests have passed; both PRs remain unmerged for review. No new cache or lifetime mechanism was introduced. - -## Context and Orientation - - -`src/bearshape/_memo.py` finds the live decorated call or DOOR checker frame. `_is_beartype_wrapper_frame` currently reads `frame.f_locals` before determining whether the code can be such a wrapper. Beartype function wrappers declare `__beartype_func`, `args` and `kwargs`; DOOR checker names begin with `__beartype_checker_` and expose pith locals. `get_memo` stores the memo in the live frame, while explicit scopes use context variables. Preserve these paths and their priority. - -`tests/test_memo.py` and `tests/test_decorator.py` cover scope, nested calls, cancellation and lifetime. Do not replace live frame ownership with a global cache, scan bytecode for union decisions, or cache argument objects. Python code-variable names are a cheap candidate filter; the existing live values remain the final validity check. - -## Plan of Work - - -First open the draft PR with this plan. Then inspect the wrapper code metadata before accessing local values. Reject code that declares neither the decorated-function marker nor a DOOR checker name. Preserve all existing checks for candidates. Add a focused regression that checks both real checking surfaces and confirms ordinary helper frames are rejected without reading their local mappings. Use a minimal frame stand-in only for proving the latter property, alongside existing real-frame behavioral coverage. - -Finally run targeted tests, the full CPU runtime suite, all four checker consumers and hooks. Build a normal wheel for matched benchmarks and combined integration validation outside this worktree. Keep timing assertions out of CI because wall-clock noise is unsuitable for a unit-test gate. - -## Concrete Steps - - -From this worktree, initialize and validate with: - - uv sync --locked - uv run --locked prek install - uv run --locked pytest tests/test_memo.py tests/test_decorator.py -q - uv run --locked pytest tests/ --ignore=tests/test_typecheck.py -n auto - uv run --locked pytest tests/test_typecheck.py -q - uv run --locked prek run -a - -Benchmark artifacts and comparisons belong under `/Users/ale/Code/bearshape-implementation-2026-09-08/evidence/union-transactions/optimization/`. Record source commits, interpreter and package versions, commands and result distributions. Preserve the initial proposal artifacts rather than overwriting them. - -## Validation and Acceptance - - -Normal decorated functions, standalone DOOR checks, explicit scopes, nested calls, async calls and failures keep their original memo ownership. Existing weak-reference tests continue to prove objects are released. Frame rejection avoids local mapping access for impossible candidates, without rejecting real beartype wrappers. Runtime, static consumer and hook checks pass. Matched benchmarks show the cost separately from changes in the upstream transaction machinery. - -## Idempotence and Recovery - - -Use the isolated worktree and locked environment. Keep main unchanged. Record changes in normal commits and preserve clean unmerged work for review. No backend is imported by root import as a result of this change. Earlier CPU/GPU results do not automatically validate newly built artifacts. - -## Artifacts and Notes - - -This is a dependent investigation within the union optimization work, but the code change applies independently to the published rc0 baseline. Exact validation and performance results will be added as measured. - -## Interfaces and Dependencies - - -No new dependencies or API. `_is_beartype_wrapper_frame(frame: types.FrameType) -> bool` keeps its signature and final recognition rules. The optional fast rejection uses code metadata only; it does not infer validation outcomes or union boundaries. - -Revision note — 2026-09-08: Created the plan before implementation to isolate the independent frame-search improvement. - - -## Final evidence - - -Implementation commit `344d390c4099685cc3ea6519f5bb8b5bde0fb13e` is isolated in -draft PR #35. Local integration commit -`c53d14f99d71fd4884282642b98e8bd63bd7b871` combines it with PR #34 solely for -validation. Main and both PR branches were not merged together. - -On published beartype rc0, the strict parameter/return baseline changed from -19.546 to 16.955 microseconds on Python 3.10.20 and from 18.262 to 13.358 on -3.14.5: approximately 13% and 27% lower total latency. Each value is the median -of 14 samples of 20,000 calls, across two process runs in reversed scenario -order. This is a host measurement with no timing gate or portable guarantee. -The optimized adapter's proposed hook is ignored by rc0 on both sides, so the -measured runtime change is the frame filter. - -The independent branch passed 1,094 CPU runtime tests, all eight four-checker -harness cases and hooks, with five existing CPU skip records. The combined -normally installed artifacts passed 1,125 tests from sdist-extracted consumers -outside the source checkout on each Python endpoint, including the 22 upstream -integration cases. Minimal environments passed with no optional backends. -No new CUDA coverage is claimed. - -Detailed measurements, commands, hashes and final hosted CI states are retained -under `/Users/ale/Code/bearshape-implementation-2026-09-08/evidence/union-transactions/optimization/`. -The combined wheel SHA256 is -`a0cb17c0b4a67b49f6e6cc10ee76e0f911ad9441877e994cdd6f495366325851`. -The source archive SHA256 is -`ac4cf3b1b87c700fece1fbdb35f5b7503b90b199606e4367b4dbdb2193a5c2f0`. -Merge approval remains pending for this independent change. - -Revision note — 2026-09-08: Added matched baseline timings and installed -combination evidence, keeping this change separate from upstream integration -and release acceptance. diff --git a/plans/2026-09-08-production-readiness.md b/plans/2026-09-08-production-readiness.md deleted file mode 100644 index aa184a4..0000000 --- a/plans/2026-09-08-production-readiness.md +++ /dev/null @@ -1,408 +0,0 @@ -# Make bearshape ready for a verified beartype 0.23.0rc0 release - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - - -This ExecPlan was accepted for implementation on 8 September 2026. The target release is bearshape `0.1.0rc0`, independently versioned from beartype. It follows the repository's `PLANS.md`. Keep `Progress`, `Surprises & Discoveries`, `Decision Log`, and `Outcomes & Retrospective` current during execution. The user authorized implementation, isolated worktrees, and separate focused PRs for independent changes. Merge still requires user validation; publication and administrative transfer require separate authorization. - -The audited checkout is `/Users/ale/Code/bearshape`, at `f43e00d2fe1714ae87d9f736f2a35692713ed0d4` on `main`. The maintained copy is `plans/2026-09-08-production-readiness.md` on `codex/rc0-roadmap`. Each feature PR carries a smaller self-contained ExecPlan and its own validation results. The audit remains evidence, not the specification for every implementation detail; all essential findings and acceptance criteria are included below. - -## Purpose / Big Picture - - -bearshape should give numerical Python developers reliable runtime relationships between array shapes and dtypes while preserving useful backend types in editors and static analysis. Its principal users are NumPy, JAX, PyTorch, and CuPy developers, and library authors who expose typed numerical APIs to other people. Existing beartype users should be able to adopt it through ordinary decoration or package instrumentation without learning a second general-purpose checking framework. - -After this work, a user must be able to install the built distribution with exactly beartype `0.23.0rc0`, catch inconsistent input and output dimensions, perform independent checks without stale state, and use supported annotations in real calls accepted by supported static checkers. A failed speculative validation must not contaminate a later successful one. An annotation advertising backend convertibility must reflect that backend's actual conversion rules. Maintainers must be able to reproduce these properties from the release artifacts and a documented test matrix. - -Keep the product focused. Shape equality, arithmetic dimensions, broadcasting, and tree-structure relationships remain runtime contracts. Static checking preserves backend identity, dtype information where the backend exposes it, accepted input families, and function signatures. Do not promise static shape arithmetic, add another shape syntax, build a replacement for beartype, or introduce speculative features to justify a redesign. - -The recommended release policy is to make `0.23.0rc0` the minimum beartype version, with a proposed dependency range `>=0.23.0rc0,<0.24` and an exact `==0.23.0rc0` required test lane. The accepted implementation plan raises the beartype floor to rc0; 0.20–0.22 compatibility lanes will be retired. Preserve the existing ordinary annotation syntax and decorator modes. Targeted changes to previously incorrect conversion or typing behavior are proposed where the contract cannot otherwise be made honest; describe their migration impact before accepting them. - -## Progress - - -- [x] (2026-09-08) Completed the production audit and preserved its evidence outside the repository. -- [x] (2026-09-08) Prepared this implementation proposal without changing the repository. -- [x] (2026-09-08) M0: Accepted independent `0.1.0rc0` versioning, active goal, and focused branches/worktrees/PRs #12–#30. -- [x] (2026-09-08) M1: PR #13 makes exact rc0 normally installable; locked suite and exact-candidate CPU endpoint suites pass. Subsequent PRs preserve failing-before regressions. -- [ ] M2: Import-hook repair is implemented in PR #14. Native composite-alternative rollback is not feasible through the inspected rc0 leaf callbacks; the owner selected supported upstream integration with a later candidate allowed. Full composition remains required. -- [ ] M3: Invocation-owned state and diagnostic replay removal are implemented in PR #15 (1,043 runtime tests on exact rc0 endpoints; 91.31% dev coverage). Whole-alternative rollback remains a release blocker. -- [x] (2026-09-08) M4: PR #16 fixes seven converter false positives; thirteen oracle cases and 1,047 runtime tests pass on exact rc0 endpoints. CuPy GPU proof is now supplied by PR #26 and the exact hosted artifact runs under M6. -- [x] M5: PR #17 implements four-engine positive/negative/inference conformance on Python 3.10–3.14. PR #19 corrects Like/Shaped inputs and PR #20 replaces nominal Tree stubs; all four checkers pass real positive/negative/inference fixtures on Python 3.10–3.14. The owner accepted explicitly limited native CuPy static support alongside verified GPU runtime. -- [x] (2026-09-08) M6: #21 proves framework/minimal behavior; #26 passes 95 real CUDA tests at both endpoints, including the exact hosted artifact. #29 supplies 17 feature/test families, four default/wrapped-signature cases at both endpoints, and matched performance/profile evidence with no material regression. -- [x] (2026-09-08) M7: #23 implements locked reusable validation across nine platform runtime lanes, five four-checker lanes and twelve compatibility factors, strict preflight/required gates, CPU resolution and aligned hooks. All hosted checks pass; #30 updates the artifact/Pages actions to Node 24 and passes the final validation-only run. -- [x] (2026-09-08) M8: #18/#25 prove distribution contents and normal installs. The hosted release artifact passes 1,097 installed-consumer tests per endpoint (one absent-CuPy skip). #24 fixes Markdown rendering and executes all 29 notebook code cells at both endpoints; #29 adds the rendered handoff report. -- [ ] M9: #28 gates immutable workflow/tag/package identity, validates the complete candidate and reuses its exact artifacts. Actual validation-only run 34221337124 completed 38 jobs successfully and skipped publication. #29 prepares the full handoff/admin proposal. Remaining: supported native-union integration and administrative controls. The approved history is integrated in main through PR #31. - -## Surprises & Discoveries - - -The existing suite is substantial but does not establish the advertised contract. On Python 3.10.20 with beartype 0.22.9 it reported 1,064 passed and five skip records. Runtime-only runs with exact rc0 on Python 3.10.20 and 3.14.5 each reported 1,034 passed and five skip records, while independent probes reproduced four runtime defect families. The candidate tests used isolated environments or an overlay; they did not prove that current package metadata permits installation. It does not. - -The import-hook wrapper changes the immediate caller frame that upstream uses to discover the package. A mocked forwarding test passes while an actual package is left unchecked. Cached validators also hold mutable replay state after boolean-only failures, including a strong reference to a failed array. Successful leaf checks in failed union alternatives bind dimensions beyond the alternative's lifetime. These are separate failures; fixing the dependency bound does not fix them. - -Checker success can hide information loss. Locked ty 0.0.40 accepts the current fixtures while reducing tested aliases to Unknown and missing deliberately wrong inputs. The audit's ty 0.0.79 probe restores the tested useful information. All tested checkers reject ordinary calls through the current nominal Tree representation. An upstream helper with a promising name is not proof of a usable static tree model: optree's dynamic runtime type construction also requires real consumer testing. - -The repository layout is already reasonable: about 5,114 source lines across 16 implementation/public modules plus the package initializer. Combined coverage was 91.04%, with 89.39% branch coverage. CuPy had no local runtime coverage. The five skip records include an unavailable entire CuPy test module and four platform-specific extended-precision cases. - -Build and workflow success also hid release defects. LICENSE is absent from both archives. The publication workflow builds an arbitrary selected ref without a test gate. The audited GitHub response reported main unprotected; organization rulesets, environment approval rules, and PyPI publisher configuration were not inspected. Documentation built successfully with malformed rendered tables and admonitions. CPU Torch compatibility jobs installed CUDA-related dependencies despite the root project's CPU index configuration. - -Implementation discovery (2026-09-08): a failed native union alternative can bind a dimension in a bearshape leaf and then fail in an ordinary `str` check. rc0's generated boolean union expression has no bearshape-visible whole-alternative entry/exit boundary. Frame-owned memo state fixes independent-call leakage and diagnostic object retention, but does not solve this separate compositional failure. No bytecode heuristic, upstream monkeypatch, hidden expected failure, or reduced contract was introduced. The owner now selected supported upstream integration, permitting a later candidate and retaining full composition. - -## Decision Log - -Decision (2026-09-08, owner): “First option. Merge approved.” Preserve full -native union composition through supported upstream integration, allowing a -later beartype candidate; accept explicit limited CuPy native static support. -This supersedes prior pending-choice statements. Exact rc0 remains the current -validation baseline until a concrete replacement passes the integration matrix. -The owner also requested shared agent-file and tool guidance updates. Merge -approval persists for that scope; publication, settings changes, ownership -transfer and upstream communications remain separately authorized operations. - - - -Decision: Preserve the package boundaries and primary product direction. Rationale: the defects concern contracts, integration, and validation; the audit found no justification for a broad file-layout rewrite. Date/author: 2026-09-08, Codex proposal. - -Decision: Recommend rc0 as the beartype floor and test that exact candidate explicitly. Rationale: one supported integration generation reduces private-integration complexity before organizational maintenance begins. Status: accepted with implementation authorization. If older releases must remain supported, retain their matrix lanes and prove every semantic fix there; do not silently lower acceptance. Date/author: 2026-09-08, Codex proposal. - -Decision: Preserve named dimensions, existing backend imports, ordinary bracket syntax, the distinction between strict and Like aliases, and both existing check decorator modes. Rationale: these are useful product surface. Incorrect accepts or rejects may need targeted correction, with an explicit migration note. Status: accepted; any newly discovered public API redesign still requires a concrete decision. Date/author: 2026-09-08, Codex proposal. - -Decision: Put a bounded architecture feasibility milestone before a large memo rewrite. Rationale: beartype evaluates native union branches; leaf validators cannot assume they receive branch entry and exit notifications. A successful prototype must demonstrate the needed boundary on unmodified rc0. Date/author: 2026-09-08, Codex proposal. - -Decision: Treat checker support as positive calls, expected rejection, and useful inferred types. Rationale: accepted declarations alone passed the existing tests while hiding practical incompatibilities. Proposed tested versions begin with pyright 1.1.411, mypy 2.3.1, ty 0.0.79, and pyrefly 1.2.0, with existing pyright/mypy floor lanes retained where they satisfy the stronger suite. These are observed starting points, not claims that every earlier version fails or every later version works. Date/author: 2026-09-08, Codex proposal. - -Decision: Use separate feature branches, matching worktrees, and early draft PRs for independent changes. Rationale: the user explicitly requested independent review units on 2026-09-08. Keep prerequisites visible for dependent PRs, and validate the combined result in an integration worktree before release. Maintain this roadmap on its own PR; user merge validation was granted on 2026-09-08. Date/author: 2026-09-08, user decision. - -Decision: Separate code readiness, publication, and administrative transfer. Rationale: a green PR is not authorization to publish a package or change ownership/access. Prepare concrete review material first and perform those external actions only with the corresponding authorization. Date/author: 2026-09-08, Codex proposal. - -## Outcomes & Retrospective - - -Implementation outcome: sixteen focused implementation/evidence PRs and separate roadmap/validation aggregates preserve independent review. Normal exact-rc0 installation, caller-sensitive claw behavior, invocation lifetime, selected backend conversion, four-checker consumers, Like and Tree static inputs, framework/GPU behavior, locked CI, rendered/executed docs, archives and publication gates are implemented and validated. The owner approved merging the reviewed work on 2026-09-08; PR #31 integrated every reviewed head into main at df81f00e2f62bda956244e680c980f87db1d4671, with all 36 main CI jobs passing. PR #33 corrects defects found by installing and exercising the actual Git hooks. The exact hosted wheel passes CPU/checker consumers and real CUDA tests; the release dry run never enters publication. Native whole-alternative union rollback remains incorrect because rc0 exposes no reliable whole-alternative boundary, and CuPy native typing lacks adequate upstream stubs. The open union integration and administrative protections prevent a production-ready verdict. Do not trade them for green test counts. - -## Context and Orientation - - -The `src/bearshape/` package separates public backend modules from shared validation. `numpy.py`, `jax.py`, `torch.py`, and `cupy.py` expose array and Like aliases. NumPy intentionally has the widest surface, including scalar-like types and structured dtype factories. `optree.py` and JAX's Tree surface expose tree checking. Root `__init__.py` exports dimensions and shared tools and must not import optional numerical backends. - -`_dimensions.py` represents dimension expressions. `_shape.py` parses and checks shape specifications. `_dtypes.py` normalizes and compares dtypes. `_array_types.py` implements array validators and conversion checks. `_tree.py` validates leaves and tree structure. `_runtime_hints.py` supplies common validation/failure helpers including `ReplayFailureState`. `_memo.py` discovers and manages the dimension memo: a mutable record of dimension names and tree structures already bound during a check. `_decorator.py` provides explicit memo management and optional combined beartype decoration. `claw.py` exposes package instrumentation. - -A transaction here means recording bindings before a speculative check, committing them if that check succeeds, and restoring them if it fails. A branch is one alternative of a union such as `A | B`. The transaction must encompass the entire alternative, not just a failing leaf. A validation invocation is one decorated call, including its parameter and return checks, one independent DOOR check, or an explicitly shared manual context; diagnostic rechecking of that invocation may need its original state, while a later independent call must start independently. Explicit `check_context()` intentionally shares bindings across manual checks inside its block. Its currently documented child-task sharing behavior must not be changed implicitly. - -Tests mostly live in feature files such as `tests/test_memo.py`, `test_numpy.py`, `test_tree.py`, and `test_decorator.py`. `tests/test_typecheck.py` runs the checker fixtures in `tests/typing/`. `tests/conftest.py` selects backend tests using environment factors and filenames. `pyproject.toml` owns package metadata, dependency groups, and several checker settings; `uv.lock` owns normal development resolution. `tox.toml` and `tools/validate_tox_env.py` define and validate compatibility environments. `.pre-commit-config.yaml` uses prek-specific builtins and priorities despite its conventional filename. `.github/workflows/` contains CI, compatibility, docs, and publication workflows. `zensical.toml` builds `docs/`. - -Use the repository's two-space Python indentation. Do not move these modules merely for symmetry. Introduce a shared helper only when it removes repeated real logic, and keep integration-specific assumptions in one small private location. - -## Plan of Work - - -### M0 — Set the release contract and execution boundary - - -Implementation is now authorized. Record the accepted beartype floor and targeted correction policy here. Create separate feature branches and worktrees under `/Users/ale/Code/bearshape-worktrees/`; the first are `codex/rc0-roadmap` and `codex/rc0-compat`. Recheck the base commit and uncommitted work first; if main has moved, review the delta from the audited SHA rather than discarding it. Commit the initial maintained plan, open an early draft PR, and start an implementation goal explicitly tied to the accepted plan. - -Add a concise supported-behavior statement to the maintained plan before code changes. Plain beartype decoration, package instrumentation, DOOR checks, and explicit check contexts are required integration surfaces. Keep bare `@check` as memo management and `@check(conf=...)` as combined checking. Generator and async-generator functions remain explicitly unsupported by `check`; ordinary functions and coroutines remain supported. Root imports remain independent of NumPy, JAX, Torch, CuPy, and optree. Static shape equality is not promised. - -Acceptance is a reviewable draft PR containing the plan and a recorded compatibility policy, with no unspecified general API redesign. Administrative transfer and actual package publication remain outside automatic execution. - -### M1 — Establish exact-rc0 installation and failing contract tests - - -Address A01 in `pyproject.toml`, `uv.lock`, `tox.toml`, and `tools/validate_tox_env.py`. Under the proposed policy use `beartype>=0.23.0rc0,<0.24`; exact-rc0 tox environments must install `beartype==0.23.0rc0`. Do not rely on prerelease selection by a loose resolver, a source overlay, `PYTHONPATH`, or `--no-deps` to prove compatibility. Keep runtime dependencies limited to beartype and typing_extensions unless a concrete fix demonstrates a necessary additional dependency. - -Introduce explicit `py310-bt023rc0-cpu` and `py314-bt023rc0-cpu` environments first. The `cpu` factor means all four CPU-testable components: NumPy, JAX, Torch, and optree. Resolve backend versions appropriate to each interpreter; a Python 3.14 job cannot install a dependency floor with no 3.14 wheel. Log exact imported versions and paths, and fail if an expected backend is absent. The audit proved runtime execution with NumPy 2.2.6/JAX 0.6.2/Torch 2.12.0/optree 0.19.1 on 3.10 and NumPy 2.5.3/JAX 0.11.1/Torch 2.14.0/optree 0.20.0 on 3.14. Use these as reproducibility references, not universal cross-Python pins. - -Promote the audit's minimal failures into repository tests before correcting behavior. Put actual package-instrumentation tests in a focused new `tests/test_claw.py`; state lifetime and branch rollback belong in `tests/test_memo.py`, with array/tree variants in their existing feature files. Add Like failures to `tests/test_torch.py` and `tests/test_jax.py`. The failing assertions must describe desired user behavior, not internal implementation choices. Temporary expected failures may be used on the draft branch only if strict, explained, and removed before claiming the finding closed. - -Acceptance: ordinary resolver installation with exact rc0 succeeds, the existing runtime baseline remains green in the two endpoint environments, and the newly promoted tests reproduce A02–A05 on the audited implementation. Save both initial failure and eventual passing evidence. Do not lower existing coverage thresholds or erase unrelated failures to establish this baseline. - -### M2 — Prove integration feasibility and fix caller-package instrumentation - - -Address A02 first with the smallest supported change in `src/bearshape/claw.py`: directly re-export upstream `beartype_this_package` as `bearshape_this_package`, preserving the caller frame and public import name. If actual rc0 behavior prevents that solution, use a correctly targeted public upstream hook with an explicit package target and prove its discovery; do not add a second implicit stack-search system. Remove the forwarding mock as the primary proof, retaining it only if it still tests distinct behavior. - -The integration test must create and import real temporary packages in isolated subprocesses so beartype's global import-hook registration cannot contaminate other tests. In a subsequently imported submodule, valid inputs must pass, inconsistent `F32[N]` parameters must raise `BeartypeCallHintParamViolation`, and an inconsistent annotated return must raise the corresponding return violation. Exercise supplied configuration, both an unrelated sibling package and a nested submodule, and the documented import order. - -Run a bounded feasibility investigation for A03 and A04 before committing to a new state architecture. Read the installed rc0 code generation and error-reporting paths. Relevant upstream locations in the audited wheel include `beartype/_check/code/_pep/pep484/codepep484604union.py`, `beartype/_check/error/_pep/errpep484604.py`, and `beartype/_check/error/_nonpep/errnonpeptype.py`. These are research references, not permission to monkeypatch upstream internals. Find a stable way to identify logical check lifetime, diagnostic replay, and entry/exit of an entire speculative union alternative. - -Prototype only these boundaries in small focused experiments, retaining a prototype in production only after it meets the acceptance contract. It must handle ordinary `@beartype`, `@check(conf=...)`, boolean `is_bearable`, raising `die_if_unbearable`, and real claw instrumentation on exact rc0 at both Python endpoints. A wrapper-only prototype does not establish the plain-beartype contract. A leaf-only snapshot does not establish branch rollback. Arbitrary replay counts, bytecode offsets, tracing the entire process, or matching a particular generated local-variable spelling are not adequate foundations. - -The promotion gate is explicit: demonstrate that failed alternatives undo all their bindings, successful alternatives keep theirs, and diagnostics cannot be mistaken for subsequent independent calls. Test nested composites and permutations with a uniquely valid branch. Where more than one branch succeeds but implies different bindings, record the exact supported selection semantics; do not promise function-wide backtracking or textual union order that upstream does not guarantee. - -If unmodified rc0 cannot provide a reliable solution within the required integration surfaces, record a blocking design result with the minimal failing example and evidence. Continue independent work, but do not declare M3 or release readiness complete. Prepare a concrete choice for the user and receiving maintainers: an upstream-supported integration change and revised beartype target, or a deliberately reduced/enforced composition contract with migration consequences. A documentation warning alone does not repair silent wrong behavior, and adopting either alternative requires explicit acceptance. Stop this investigation after demonstrating the missing boundary rather than building a replacement type checker. - -### M3 — Make state lifetime, diagnostics, and rollback correct - - -Implement the design proven in M2 in `_memo.py`, `_runtime_hints.py`, `_array_types.py`, `_tree.py`, and `_decorator.py` as needed. Keep cached annotation definitions immutable with respect to per-call validation results. `ReplayFailureState` must no longer retain a failed user object globally until a future unrelated call happens to clear it. Any retained diagnostic information must have a defined owner and termination path. Do not fix retention by losing the useful original expected/actual dimension message. - -A transaction must restore dimensions and tree-structure bindings together when the enclosing supported operation fails. Preserve successful bindings across parameters and into return validation. Independent nested decorated calls must not overwrite their caller's bindings; an explicit `check_context()` must continue sharing deliberately. Restore state in exceptions and coroutine cancellation. Honor the existing explicit-context child-task contract or present any proposed change separately; task-local storage by itself does not make shared mutable values isolated. - -The minimum observable regression is that a failed `tuple[F32[N], F32[N]]` check on vectors of lengths two and three is followed by a successful independent `F32[N]` check on the same length-three object. Repeat with boolean-only checks, formatted exceptions, a changed shape on the same object where supported, recursion, and interleaved threads. Use separate explicit contexts for the promised isolated async-task scenario. A weak-reference test must show that after the failing invocation and user references end, garbage collection releases the array without another validation being required. Release exception/traceback references in that test before attributing retention to bearshape. - -The union regression uses `tuple[F32[N], I32[N]] | tuple[F32[C], F32[C]]` followed by an `F32[N]` parameter. Two float32 length-two arrays in the pair and a float32 length-three final parameter must pass because only the second alternative succeeds. A genuinely inconsistent input must still fail. Cover nested tuple/union and supported tree-leaf variants; verify diagnostics do not introduce new bindings or change the result. Maintain useful argument/return locations and expected-versus-observed details in messages without freezing all upstream formatting in snapshots. - -Acceptance: promoted A03/A04 regressions pass on exact rc0 in every required integration surface, lifetime tests release their objects, and existing dimension/shape/tree/decorator tests remain correct. An unsupported M2 boundary remains an open release blocker, never a silent fallback. - -### M4 — Make Like mean conversion the target backend can perform - - -Address A05 in `_array_types.py` and each backend module. Define Like acceptance in terms of the documented converter, its supported input families, the existing casting policy, and the resulting shape/dtype. Validation may perform a conversion to inspect the result, but it must not replace the function's original argument. Same-kind casting is not a promise of lossless conversion; preserve that distinction. A mutable or stateful foreign object can change after checking, so describe convertibility at validation time. - -Remove the generic NumPy fallback when it turns a failed target-backend conversion into acceptance. Narrow trusted fast paths to cases demonstrated equivalent to the target converter; belonging to `np.ndarray` alone is insufficient for Torch or JAX. Keep strict array checks based on backend identity and metadata without conversion. Preserve existing factory parameters unless a targeted API change is proven necessary and accepted. Catch real conversion failures narrowly enough to retain actionable information; do not mask bugs in shape/dtype logic with broad fallback handling. - -Use the backend converter as the test oracle. Torch Like must reject a negative-stride NumPy array or non-native-endian array if the documented Torch conversion rejects it. Torch and JAX ShapedLike must reject NumPy string arrays that their converters reject. A NumPy-only `__array__` object must not become Torch-convertible by an undocumented fallback. Also test valid lists, scalars, native arrays, empty inputs, non-contiguous supported views, booleans, complex values, structured dtypes, and invalid protocol implementations where relevant to each backend's existing surface. - -Check rank and dimension binding after conversion, consistent cast-policy decisions, and rollback when conversion or subsequent validation fails. For native Torch tensors, validation must not silently detach gradients or mutate device/dtype; strict JAX checks must not transfer arrays to the host. GPU/device-specific conversion claims remain subject to M6's GPU gate. Document unavoidable allocation costs for Like checks. - -Acceptance: every positive conversion fixture has a successful target-converter counterpart under the stated policy, every negative counterexample rejects, valid existing inputs remain accepted unless a documented defect correction deliberately narrows them, and the downstream typing model in M5 describes those same input families. - -### M5 — Prove useful typing at real consumer call sites - - -Address A06 in the backend `TYPE_CHECKING` branches, `_decorator.py`, checker configuration, `tests/typing/`, and `tests/test_typecheck.py`. Keep ordinary NumPy strict aliases informative about dtype and backend. JAX and Torch should preserve native Array/Tensor methods and return types to the degree provided by their upstream stubs. Do not invent static shape guarantees by attaching dimension parameters that checkers ignore. - -First extend the fixture harness with three kinds of proof: accepted consumer calls, deliberately rejected calls, and exact or bounded inferred-type assertions. Keep current valid fixtures in `tests/typing/`; add invalid fixtures under `tests/typing_negative/` so normal source checking does not fail on intentional errors. Group related fixtures and invoke each checker once per relevant group where possible, rather than launching the same checker afresh for every file. Parse its supported diagnostic output and match the intended location/category; do not count any nonzero process exit as a successful negative test. A crash, missing import, or wrong interpreter is a test failure. - -Use real variables from normal backend construction, not only declarations or contextually typed literals. Check `F32[N]` rejects an integer-dtype array and a string, that a valid `np.ndarray` consumer retains native array methods, and that decorated functions retain parameter names, arity, return type, and coroutine behavior. Include controls using direct backend types so a backend-stub limitation can be distinguished from bearshape information loss. Scope existing broad Unknown/Any and missing-import suppressions as narrowly as practical; the public conformance fixtures must not pass merely because the library disappears into Any or Unknown. - -Fix the `check` overload's omitted/None configuration mismatch while preserving `Callable[P, R]` behavior through ParamSpec. Establish a tested checker baseline beginning with pyright 1.1.411, mypy 2.3.1, ty 0.0.79, and pyrefly 1.2.0. Retain pyright 1.1.408/1.1.409 and mypy 1.19.1 compatibility lanes if they pass the strengthened contract. Raise the documented ty floor to a version actually proven useful. Integrate pyrefly as supported only after the complete fixture contract passes. Do not add zuban in this program. - -Prototype Tree typing before replacing the current fake nominal class. `Tree[int]` must accept ordinary integer leaves and documented nested containers supplied through already-typed variables. Test lists, tuples, dictionaries, mixed nesting, invalid leaves, and the existing custom-node runtime surface. Account for mutable-container variance: a recursively defined alias that only accepts a freshly contextualized literal is insufficient. Do not replace Tree with Any, or assume that a general Sequence alias is correct when it also admits strings that are runtime leaves. Do not assume an upstream dynamic PyTree factory is checker-compatible without running the same tests. - -Promote the smallest model that works across the supported checkers. If arbitrary registered custom nodes cannot be represented faithfully, retain their runtime support and define a documented explicit static escape using the user's own node type together with separately expressed runtime checking. If this requires a new public form or a meaningful narrowing of the documented Tree contract, record and obtain acceptance before adopting it. This gate is satisfied by an honest tested support boundary, not by claiming every runtime tree is statically representable. - -Align Like inputs with conversion rather than the target dtype alone: NumPy F32Like under same-kind casting must not statically reject every float64 array that runtime accepts. Preserve useful distinctions between numeric input families; do not broaden all inputs to object. JAX/Torch Like must accept their documented scalar/list input families where runtime does. NumPy Shaped must reflect its actual broad dtype surface, including tested nonnumeric dtypes. CuPy typing needs both an absent-backend import-boundary check and a real installed-CuPy consumer fixture; a minimal shape/dtype protocol is not proof that native CuPy methods survive. - -Acceptance: all four selected checkers pass the valid and inference suite, reject the designated invalid examples for the intended reasons, and behave consistently at every advertised Python target. Run the same consumer suite against the installed wheel outside the checkout in M8. Advanced fixed-literal/arithmetic/broadcast/Value syntax must either have a demonstrated checker-safe spelling or be explicitly documented as runtime-only; declaration acceptance alone does not establish support. - -### M6 — Close feature and framework validation gaps before optimization - - -Build a concise feature-to-test map covering existing named, anonymous, fixed, arithmetic, and broadcast dimensions; Scalar and Value; dtype families, byte order, structured fields, datetime/timedelta; strict and Like arrays; explicit and automatic memo contexts; and tree leaf/structure binding. Use the current feature tests first. Add cases where a public promise lacks proof, especially negative examples and interactions exposed by M3/M4; do not reorganize all tests or duplicate them merely to increase counts. - -Verify annotation evaluation and decoration on the Python 3.10 and 3.14 endpoints, including postponed annotations, forward references, wrapped functions, methods, return checks, defaults, and coroutines. Keep unsupported generator behavior explicit. For Value expressions, preserve the current allowed expression operations and lexical lookup behavior; test rejected operations and missing names without widening the evaluator. Avoid introducing evaluation of arbitrary Python strings. - -Exercise a small representative JAX jit/vmap/grad workload and a Torch autograd/compile workload using the documented decorator order and real numerical output. Define whether validation occurs on each Python call or during tracing/compilation; do not promise checks on every compiled invocation unless tests demonstrate that. Use small CPU examples. Platform or compiler limitations may justify a documented integration boundary, but a skipped example cannot support a claim that the transformation works. - -Validate root import in a clean environment containing only declared runtime dependencies, then validate each backend with its own dependencies installed. Installing one backend must not make another optional backend mandatory. Test the custom strict-array factory without NumPy. Import-path isolation and source-tree absence are essential to this proof. - -CuPy requires a real CUDA-capable runner for runtime signoff. Run strict dtype/shape, Like conversion, device behavior, and tree integration where advertised, logging GPU, CUDA, CuPy, and Python versions. If no suitable runner exists, retain the API but label its runtime verification status precisely and withhold an equal production-support claim. Do not broaden the release statement based on CPU skips. Whether to delay the release or approve an explicitly limited CuPy support statement is a release decision. - -Measure performance after correctness. Reproduce a small benchmark comparing bare beartype backend checks, strict bearshape checks, explicit context decoration, and Like checks, using matched interpreter/hardware and tiny versus large arrays. The audit observed roughly 20.4 microseconds for a representative strict input/return call and about 14 microseconds with explicit decoration; these are observations, not universal thresholds. Profile scope/signature discovery only if it remains a material cost. Cache or avoid repeated work when lifetime correctness permits it; do not add a caching framework or trade semantic correctness for a headline speedup. Record medians and spread, and investigate material regressions rather than imposing a noisy wall-clock CI assertion. - -Acceptance: each maintained feature has positive and negative evidence, representative framework behavior is accurately documented, optional boundaries hold, and the performance report distinguishes metadata-only checks from conversion and tree traversal costs. - -### M7 — Make dependencies, hooks, tox, and CI enforce the same contract - - -Address A10 using `pyproject.toml`, `uv.lock`, `tox.toml`, `tools/validate_tox_env.py`, `tests/conftest.py`, `.pre-commit-config.yaml`, and the CI/compatibility workflows. Keep normal jobs locked and interpreter-matched. A deliberate latest-dependency canary may resolve newer versions separately and report its resolved set, but it must not silently change the required release baseline. Update the environment-name validator whenever factors change, and verify both valid names and actual installable version pairs. - -Retain targeted backend-floor environments: NumPy 2.2, JAX 0.5, Torch 2.6, and optree 0.14 on interpreters where they install. Add exact-rc0 current-backend CPU coverage on Python 3.10 through 3.14. Proposed required PR coverage includes Linux endpoint CPU suites, all advertised Python typing targets, supported dependency floors, hooks, docs build, and artifact checks. Main/release validation adds the intermediate Python runtime environments and macOS/Windows endpoint core/NumPy/optree runs. Run additional JAX/Torch platform lanes where supported wheels exist and the project advertises those combinations; document narrower boundaries instead of silently skipping. CuPy is a separate GPU requirement or recorded support limitation. - -Configure CPU Torch resolution explicitly for tox-created environments: the root `tool.uv.sources` mapping does not automatically establish the source used by every dependency-install command. Use the appropriate platform-specific CPU distribution source without changing users' own CUDA environments. Log the selected Torch wheel/build and verify that dedicated Linux CPU jobs do not pull the unnecessary CUDA dependency set observed in the audit. - -Reduce incidental installations with deliberate groups. Documentation-only jobs should use `uv sync --locked --only-group docs` and `uv run --locked --only-group docs zensical build --clean`. Ordinary developer defaults can remain convenient, but document minimal runtime, typing, and docs commands accurately. Ensure checker executables come from the intended environment and log their versions; resolving a Python symlink must not accidentally select tools from a different installation. - -Use prek as the documented hook runner, since the configuration uses its builtins and priorities. Run the relevant local checks in CI, including secret scanning and actionlint. Prefer a locked local checker entry for pre-push over a separately drifting pyright hook version. Where hooks fix files, CI must fail on the resulting diff. Keep fast formatting/lint checks before expensive tests and avoid redundant complete test-suite launches. Pin external actions consistently to reviewed commits with an update mechanism; update existing tooling rather than inventing a workflow generator. - -Keep matrix definitions understandable. Share a reusable validation workflow or small existing configuration source where it removes real duplication, but do not introduce a framework just to describe a few factors. Provide one final required validation status that fails if a required job fails, is unexpectedly skipped, or is cancelled. Environment-dependent skips must be classified: missing an expected installed backend is failure; unsupported platform precision and an explicitly excluded GPU suite are visible limitations. Preserve the existing coverage gate and report branch coverage separately. - -Acceptance: a draft-PR CI run exercises the declared PR contract, a validation-only full matrix can be run before release, workflow names agree with tox validation, hooks leave the checkout clean, and CPU jobs install the intended dependency families. Record counts, versions, skips, and job links; do not infer success from the aggregate badge alone. - -### M8 — Publish an accurate contract and test the actual distributions - - -Address A07 and A09 in `pyproject.toml`, `README.md`, `docs/`, `zensical.toml`, examples, and `CHANGELOG.md`. Add `license-files = ["LICENSE"]`, remove the redundant deprecated license classifier, and inspect actual wheel and source archive contents. Keep `py.typed` in the wheel. Include the source tests and their needed pytest/configuration files deliberately in the source distribution so a downstream maintainer can build and test it; exclude audit outputs, virtual environments, caches, generated site files, and irrelevant development artifacts. - -Build the source distribution, build a wheel from that source distribution, and install the resulting wheel outside every source checkout. With normal dependency resolution and an exact rc0 constraint, run runtime smoke/integration checks and the consumer typing suite. Check archive metadata, the included license, public exports, installed version, optional import boundaries, and absence of accidental editable/source imports. Both Python endpoints must perform the exact-candidate artifact test. Do not validate one wheel and publish a freshly rebuilt different wheel. - -Keep README short: purpose, installation, one valid beartype example, and links to backend/typing contracts. Fix the NDArray spelling, use Python-3.10-compatible syntax in universal examples, repair malformed tables and admonitions, and remove or correct the missing favicon reference. Replace hardcoded coverage claims with maintained evidence or omit them. Render representative pages and inspect their visible result; a successful Zensical exit code is insufficient. Add a narrow rendered-output smoke check only for meaningful regressions such as tables/admonitions disappearing, not snapshots of every layout detail. - -Document strict versus Like behavior, same-kind casting, backend input families, Tree runtime/static boundaries, automatic versus explicit contexts, decorator order, tracing/compilation behavior, and all version/platform limitations agreed earlier. Explain the bare-check mode accurately. Execute maintained example code on the Python floor where claimed, and execute the existing notebook in an isolated environment with outputs reviewed; stale stored notebook output is not execution evidence. If a formatter damages valid documentation syntax, demonstrate and fix that round trip rather than assuming which tool caused the existing damage. - -Update CHANGELOG for actual user-visible milestone changes, including compatibility-floor changes and migration notes. Do not preannounce unimplemented behavior. Use the user-approved `0.1.0rc0` candidate version. PyPI currently lists `0.0.1`; do not overwrite or reuse it. A final `0.1.0` release and publication still require a release decision. - -Acceptance: wheel and sdist carry LICENSE and correct metadata, a rebuilt-from-sdist wheel installs and passes outside the checkout with exact rc0, static consumers retain useful types, rendered docs match tested behavior, and release notes describe all meaningful corrections without unsupported claims. - -### M9 — Gate publication and prepare a reviewable ownership handoff - - -Address A08 in `.github/workflows/pypi.yml` and reusable validation configuration. Resolve a requested release tag/ref to an immutable commit. Verify the tag/version relationship, run the required validation against that commit, build and validate the artifacts, and publish only those artifacts after the protected release decision. The publish job must need successful validation, not merely a build. Avoid a second rebuild between validation and upload. Preserve OIDC trusted publishing and minimal permissions; do not introduce a long-lived upload token. - -Provide a validation-only path that executes release checks and produces inspectable artifacts without publication. Test that a failed required validation prevents the publish job from becoming eligible. Restrict accepted publication refs/events intentionally; an arbitrary dispatch ref must not bypass release rules. Handle prerelease status deliberately, including the fact that the integration target is a release candidate. Record artifact hashes, source commit, resolved dependency versions, and validation results in the release evidence. - -Prepare a handoff note for the user and receiving maintainers: product scope, support matrix, unresolved limitations, module map, integration assumptions on beartype, release procedure, and the mapping from audit findings A01–A10 to fixing commits/tests. Inventory repository protection, required checks, release-environment reviewers, trusted publisher repository/workflow/environment identity, documentation hosting, and package ownership. Read current settings before proposing concrete changes; the audit did not inspect all organization controls. Do not claim source changes alone establish these administrative protections. - -Keep links pointing to the current real repository until the actual transfer is coordinated, then update repository/docs/badge metadata and confirm redirects as part of an explicitly authorized handoff. Never send messages to maintainers, transfer ownership, change access controls, or publish a release merely because this plan contains a handoff milestone. Prepare all unaffected work and the precise settings proposal first. - -At the final review, provide the complete diff, CI and artifact evidence, compatibility/migration notes, and any remaining support limitations. Obtain the user's validation before merging, as required by AGENTS.md. After explicit merge approval, merge and clean up the implementation branch/worktree only when local changes and evidence are preserved. Actual publication and transfer follow their corresponding authorization and verified settings. If settings or GPU access remain unresolved, distinguish code readiness from release readiness instead of declaring the full objective achieved. - -Acceptance: the exact reviewed commit cannot publish through the supported workflow without its required validation, artifacts are traceable to that commit, all P1 findings are fixed or replaced by an explicitly accepted enforceable contract, and the user has a concrete handoff packet and an accurate readiness verdict. - -## Concrete Steps - - -Use the following command patterns in each focused worktree; replace the original umbrella branch/path with the actual feature branch/path tracked below. Use `/Users/ale/Code/bearshape` only for initial inspection and worktree creation. Before creation, inspect `git status --short`, `git worktree list`, and `git branch --list codex/production-readiness`. If the branch/worktree already exists, inspect and reuse the intended one; do not overwrite it. - - git -C /Users/ale/Code/bearshape rev-parse HEAD - git -C /Users/ale/Code/bearshape log --oneline f43e00d2fe1714ae87d9f736f2a35692713ed0d4..HEAD - git -C /Users/ale/Code/bearshape worktree add -b codex/production-readiness /Users/ale/Code/bearshape-production-readiness HEAD - -After authorization, copy this document into the new worktree's `plans/2026-09-08-production-readiness.md`, commit that plan, push the implementation branch, and open the draft PR with a prose body stored in a file and passed through `gh pr create --draft --body-file`. Describe the final intended behavior and current draft status. Use the goal tool for the explicitly authorized implementation goal; do not fake it with a comment or create a recurring automation. - -All remaining project commands run from `/Users/ale/Code/bearshape-production-readiness`. After a deliberate dependency edit, regenerate the lock once with `uv lock`, inspect the diff, and then use locked commands: - - uv sync --locked - uv run --locked python -c 'import beartype; print(beartype.__version__, beartype.__file__)' - uv run --locked pytest -n auto tests/test_memo.py tests/test_decorator.py tests/test_tree.py - uv run --locked pytest -n auto tests/test_claw.py tests/test_numpy.py tests/test_jax.py tests/test_torch.py - uv run --locked pytest -n auto tests/test_typecheck.py - uv run --locked pyright src tests/typing - uv run --locked mypy src tests/typing - uv run --locked ty check src tests/typing - uv run --locked pyrefly check src tests/typing - -The new claw test file and pyrefly command become valid once their milestones add the file/dependency/configuration. The ordinary checker commands cover positive/inference fixtures; `tests/test_typecheck.py` must also exercise `tests/typing_negative/` and verify intended rejection. A checker process crash must be reported as failure, never as an expected error. - -After M1 defines the proposed environments, run: - - uv run --locked tox run -e py310-bt023rc0-cpu - uv run --locked tox run -e py314-bt023rc0-cpu - -The final M7 matrix extends the same convention to `py311-bt023rc0-cpu`, `py312-bt023rc0-cpu`, and `py313-bt023rc0-cpu`, with named backend-floor and checker environments listed explicitly in the maintained plan once resolved. Avoid combining factors whose package versions cannot install on that interpreter. Every rc0 environment must log `0.23.0rc0` as the imported version. - -Before final review run the full suite, configured coverage environment, hooks, workflow checks, and documentation build: - - uv run --locked pytest -n auto tests - uv run --locked tox run -e dev - uv run --locked prek run -a - uv run --locked prek run -a --stage pre-push - uv run --locked prek run actionlint -a --stage manual - uv run --locked --only-group docs zensical build --clean - git diff --check - git status --short - -Hook stages may repeat the full suite while the old configuration remains; M7 should eliminate redundant launches without removing distinct validation. Some hooks modify files: review the diff, rerun the affected checks, and record a clean result. Rendered documentation must then be inspected for actual tables, admonitions, examples, and links. - -Build distributions into a fresh version-specific evidence directory outside the checkout. For example, after selecting an unused directory for the current candidate: - - uv build --out-dir /tmp/bearshape-release-candidate/dist - -Use `uv venv` to create separate Python 3.10 and 3.14 artifact environments. Select the one wheel/sdist from the fresh output by its actual name; do not use a wildcard that could match stale releases. Run `uv pip install --python 'beartype==0.23.0rc0'` with normal dependency resolution. Extract the source distribution into a fresh directory and run `uv build --wheel --out-dir `. The executing agent must replace these placeholders with actual recorded paths and names in this living section once available. Run consumer tests from an independent directory with source/editable paths absent, and verify `bearshape.__file__` resolves inside the artifact environment. - -Expected final observations are behavioral: mismatched inputs/returns raise; the previously poisoned independent check returns true; the union example succeeds without leaked N; backend conversion counterexamples reject; valid typed calls retain useful backend types; designated invalid calls produce their intended diagnostics; the installed rc0 version is exact; and license/py.typed are present. Test counts will increase from the audited baseline and should be recorded as observed, not invented in advance. - -## Validation and Acceptance - - -Every audit finding has a closing proof. A01 closes through normal exact-rc0 wheel installation and the candidate matrix. A02 closes through actual imported-package parameter and return failures. A03 closes through independent boolean checks, diagnostic correctness, memory-release evidence, and supported concurrent-context scenarios. A04 closes through whole-alternative rollback in the required integration surfaces or an explicitly accepted, enforceable revised contract; a skipped or documented known failure does not count as fixed. - -A05 closes when the target converter and Like acceptance agree on both positive and negative backend fixtures. A06 closes when supported checkers accept real valid callers, reject deliberate errors, preserve useful types, and document runtime-only syntax accurately. A07 closes through inspected wheel/sdist contents and rebuilt-from-source installation. A08 closes through tested publication dependencies plus verified or explicitly pending administrative controls. A09 closes through correctly rendered and executed documentation examples. A10 closes through an observed matrix run, locked routine dependencies, intended CPU packages, and visible skip/support accounting. - -The release gate requires all P1 findings to be resolved under the accepted contract, every required CI job successful for the exact candidate commit, normal artifact installation with exact rc0 at both Python endpoints, complete archive metadata/license, and no unsupported parity claim for CuPy or static shape inference. Python support means the relevant declared interpreter matrix actually ran. Checker support means the complete consumer contract ran on the declared tool versions. Beartype support means exact rc0 was used; a range in metadata is not proof for future versions. - -Maintain readable failure messages and the optional dependency boundary throughout. Do not accept blanket ignores, xfails, removed annotations, disabled checks, lowered coverage gates, or a conversion to Any as substitutes for fixing a finding. If a genuine upstream limitation requires a support change, make it an explicit reviewed release decision with tests for the replacement boundary. - -## Idempotence and Recovery - - -Work only in the isolated worktree for the current feature. Preserve the original checkout and audit evidence. Commit small coherent changes after targeted validation so a failed experiment can be reverted independently. Never use a hard reset or forced branch replacement to recover from unexpected local work. If an experiment does not meet its promotion gate, remove its production path while retaining the minimal regression and a concise result in this plan. - -Use fresh artifact directories for each candidate and record commit/hash/version. Delete only task-created temporary environments after evidence is preserved; do not remove unrelated caches or environments. A lock regeneration is deliberate and reviewed, whereas normal checks use the existing lock. Installing a candidate in an isolated environment must not upgrade the user's normal workspace environment accidentally. - -If source or dependencies change after validation, rerun the affected checks and any release-artifact checks whose inputs changed. Do not repeatedly run unrelated expensive suites after their inputs remain unchanged. Before merging or releasing, validate the final commit. If external settings or GPU access block the final gate, keep their exact unresolved status visible and continue independent work; do not manufacture success or repeatedly ask for the same approval. - -## Artifacts and Notes - - -The original evidence is `/Users/ale/Code/bearshape-audit-2026-09-08/AUDIT.md` and its `evidence/` directory. Preserve it unchanged. During implementation, record concise logs for initial failing regressions, passing targeted runs, complete matrix runs, checker versions/diagnostics, artifact contents/hashes, and representative rendered docs. Use PR/CI artifacts for large logs rather than checking virtual environments or full build output into the repository. - -Two minimal contracts summarize the highest-risk regressions. The first checks lifetime: - - a = np.ones(2, dtype=np.float32) - b = np.ones(3, dtype=np.float32) - assert not is_bearable((a, b), tuple[F32[N], F32[N]]) - assert is_bearable(b, F32[N]) - -The second checks a failed alternative's bindings: - - @beartype - def f( - pair: tuple[F32[N], I32[N]] | tuple[F32[C], F32[C]], - y: F32[N], - ): - return y - - # Both pair members are float32 with length 2; y is float32 with length 3. - # The second alternative succeeds and must not leave N bound by the first. - assert f((a, a), b) is b - -These snippets assume imports of NumPy, beartype, beartype.door.is_bearable, bearshape's N/C, and bearshape.numpy's F32/I32. The full repository regressions must also verify real rejection cases so an implementation cannot pass merely by disabling validation. - -The final handoff packet must include the readiness verdict, accepted support matrix, known limitations, migration notes, fixing commits for A01–A10, validation links, artifact hashes, and the concrete remaining administrative actions. Summarize results for maintainers who have not read the conversation. - -## Interfaces and Dependencies - - -Keep `bearshape.claw.bearshape_this_package` callable under its current public import name with upstream-compatible keyword configuration. Prefer aliasing the upstream function to preserve caller-package discovery. Keep `check(fn, /)` preserving `Callable[P, R]` and `check(*, conf=...)` returning a decorator with the same signature preservation; describe and type the existing None/omitted configuration behavior truthfully. Keep `check_context()` a synchronous and asynchronous context manager with explicit shared bindings and reliable cleanup. - -Keep strict backend annotations nominally related to their actual backend array class and dtype where supported. Keep Like as an input contract that validates but does not replace the argument. Keep NumPy's scalar-like, structured dtype, and broad Shaped surface in its backend module. Keep runtime tree structure checking explicit, and admit only the static promises demonstrated by M5. No new public transaction, replay, or backend-registration abstraction is prescribed: first solve the proven private integration problem with the smallest maintainable design. - -Use uv, tox/tox-uv, pytest, pyright, mypy, ty, pyrefly, prek, and the existing Zensical documentation system. Additional runtime dependencies, a new checker framework, a new documentation generator, or a replacement for beartype are outside this plan unless a later accepted decision establishes their necessity. NumPy, JAX, Torch, CuPy, and optree remain user-selected optional backends. Pin reproducible development/CI resolutions while maintaining an honest documented support range. - -Revision note — 2026-09-08: Initial proposal derived from the completed audit. The plan makes rc0 installation, invocation/branch feasibility, real consumer typing, backend conversion, and tested release artifacts explicit acceptance gates. Implementation has not started. - -## Implementation PR map - - -The roadmap PR owns this living program. Planned independent changes are rc0 compatibility/release metadata; caller-package claw integration; validation lifetime and composite feasibility; backend conversion; consumer typing; CI/dependency enforcement; documentation; distribution contents; and publication gates. Runtime feature/performance evidence accompanies the relevant fixes. Where one change requires another, use an explicit dependent PR and record its base. Merge approval was granted on 2026-09-08 and executed through PR #31; every reviewed head is preserved and its main gate passed. - -Revision note — 2026-09-08 implementation start: User selected `0.1.0rc0`, independent versioning, and separate PRs. These decisions supersede the original single-PR proposal. Goal created; implementation work is beginning. - -Revision note — 2026-09-08: Recorded implemented PRs and validation evidence, with the unresolved native-union design decision and remaining typing/artifact/docs work stated explicitly. - -Revision note — 2026-09-08: Recorded PRs #19–#22, combined runtime/checker validation, minimal installation and CUDA baseline evidence. CuPy native creation/reshape returns Any or Unknown under all four installed checkers because the backend lacks ndarray stubs; no full static-support claim was added. GPU transfer was initially blocked, then approved after proving the payload matched the public repository commit. - - -## Implemented review map and current release boundary - - -PR #12 owns this roadmap. Focused PRs #13–#21 cover rc0 compatibility, caller import hooks, validation lifetime, conversion, checker conformance, archive contents, Like inputs, Tree consumers and framework/minimal validation. #22 is their validation aggregate. Focused #23–#26 add CI, docs, installed consumers and CUDA proofs; #27 aggregates them without modifying their actual PR bases. #28 adds the publication gate, #29 the feature/performance/handoff evidence, and #30 the observed Node runtime maintenance. Preserve the prerequisite relationships in each PR before requesting merge approval. - -The validated release run https://github.com/acecchini/bearshape/actions/runs/34221337124 used source 3ee4c1d8a0c3d22f537a24b447a9d75e025a5b2d. Wheel SHA256 c1806203da013c9eaf2482a309c686a984c0a7031a495efbd100a824536b57d2; sdist SHA256 e2454095144fb4bb5a08d3bd998d0f6a8bee4bc5ad81dfab763c339ca91666df. Both Python endpoints passed 1,097 installed consumer tests with one absent-CuPy skip, and the exact same wheel passed 95 GPU tests per endpoint with CUDA 12.9/CuPy 14.2.0. Later source changes require their own archive identity and applicable validation. - -Matched normally installed baseline/candidate measurements on CPython 3.10.20 with NumPy 2.2.6 and optree 0.19.1 show strict checks around 19.8 microseconds versus 21.8 in the baseline, explicit checks around 14 microseconds, and expected conversion/tree scaling. Scope/signature discovery remains costly; no speculative cache was added while the composition boundary is unresolved. Evidence files performance-matched-*.json and performance-profile.log record versions, origins, medians and spread. - -Read-only controls inspection found main unprotected, no repository rulesets, and no approval reviewers on pypi; its policies allow main and v* tags with admin bypass. PyPI publisher configuration remains unverified. docs/maintainers/production-readiness.md in #29 gives the exact proposed protections, release process, module/support map, migrations and A01–A10 review links. No owner settings, package publication, repository transfer or messages to other maintainers occurred. - -Revision note — 2026-09-08: Updated M6–M9 and the outcome with the completed independent PRs, exact installed/GPU artifact evidence, actual release dry run, performance observations and remaining release decisions. #30 final hosted action validation is complete. - -Revision note — 2026-09-08: Final validation-only run https://github.com/acecchini/bearshape/actions/runs/34223582731 completed 38 required jobs and skipped publication. It passes 1,101 installed-consumer tests per endpoint (one absent-CuPy skip), validates Pages packaging without deployment, and retains the exact GPU-validated wheel SHA256 c1806203da013c9eaf2482a309c686a984c0a7031a495efbd100a824536b57d2. Source 6f40e4a484b70535c58e2c86a645a64ab1079143; sdist SHA256 38d89d4ce1b351601ff8602a9a27b4e9af46db056be3ac0eaf41a68ac56a3706. The former Node 20 runtime warning is gone; the current upstream downloader still emits a Buffer() deprecation notice, recorded without suppression. All independent implementation work is prepared for review; full production readiness still depends on the explicit contract decisions and owner validation. - -Revision note — 2026-09-08 owner approval: recorded accepted union/CuPy policies -and merge authorization; PR #31 updates AGENTS/CLAUDE, PLANS, contributor/tool -commands and Pages deployment semantics. A later dependency is allowed but no -available fix is claimed. Historical exact-rc0 acceptance records remain proof -of the tested baseline, not a restriction against the newly selected path. - -Revision note — 2026-09-08 merge execution: PR #31 integrated the complete -approved history without squashing. Main run 34229683377 passed all 36 jobs; -Pages run 34229683120 built and skipped deployment. Dependent PRs were closed -as integrated after ancestry verification. Twenty clean merged worktrees and -local branches were removed with generated evidence preserved. PR #33 fixes -actual hook stage routing and Git environment isolation, adds four regressions -(23 release-tool cases total), and passed hosted run 34231187384. The root -checkout's hook installation is active; its temporary checkout-path setting -introduced by the old fixture was restored and verified clean. - -An isolated normal install of upstream beartype main at -a2729e0e358bf963ee6f177e300ae08a622d05d6 reports 0.23.0rc1 and still fails the -native-union probe. Keep the current rc0 lock; the owner allows a later candidate -but no working supported integration exists in either tested version. The -production goal remains incomplete for that integration and release controls. diff --git a/plans/2026-09-08-publication-gate.md b/plans/2026-09-08-publication-gate.md deleted file mode 100644 index 5dcd638..0000000 --- a/plans/2026-09-08-publication-gate.md +++ /dev/null @@ -1,97 +0,0 @@ -# Publish only the exact validated release artifacts - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - -Owner update (2026-09-08): the reviewed implementation and recorded validation -are approved for merge. This supersedes earlier pending-approval statements. -Full native union composition remains required through supported upstream -integration, with a later candidate allowed; limited CuPy native static support -is accepted. Current merge execution and remaining release gates are tracked in -`plans/2026-09-08-agent-workflow.md` and the production-readiness roadmap. - - - -Maintain this ExecPlan according to PLANS.md. This focused M9 PR builds on aggregate #27. Implementation is authorized; publication, access-control changes and ownership transfer are not. - -## Purpose / Big Picture - - -A release must not bypass runtime, typing, documentation or installed-package validation. Resolve the requested ref to one immutable commit, validate it fully, and publish the exact wheel and source archive that passed. Maintainers also need a validation-only path that produces inspectable evidence without uploading to PyPI. - -## Progress - - -- [x] (2026-09-08) Created codex/publication-gate and matching worktree from 51b5f08. -- [x] (2026-09-08) Inspected current publication workflow, reusable validation, GitHub protection settings and official OIDC guidance. -- [x] (2026-09-08) Opened #28 and implemented matching workflow/tag/commit, version, prerelease and main-ancestry gates. -- [x] (2026-09-08) All 19 real-Git-history tests pass; inspected 128 publication-result combinations and exact artifact/OIDC dependencies. -- [x] (2026-09-08) Full hooks/actionlint and all PR checks pass. Validation-only run 34221337124 succeeded with every required job green and publication skipped. -- [x] (2026-09-08) CONTRIBUTING records the release procedure and inspected/proposed administrative controls. -- [x] (2026-09-08) Obtain user review before merge. - -## Surprises & Discoveries - - -The current publish workflow accepts any dispatch ref, builds it and publishes without test dependencies. Main has no branch protection; repository rulesets are empty. The pypi environment allows main branches and v* tags, has no approval reviewers and permits administrator bypass. The github-pages environment allows docs/main branches. These are read-only observations on 2026-09-08; no controls were changed. PyPI trusted-publisher configuration is not verified through the available repository API. - -## Decision Log - - -Decision: Keep release-published events and add dispatch publication defaulting to false. Rationale: validation-only runs should be possible for a branch/commit without making it eligible for publication. Actual publication must use a canonical v tag whose commit is already on main and whose event prerelease flag matches the version. Date: 2026-09-08. - -Decision: Use the existing reusable validation and its candidate-distributions artifact. Rationale: the wheel tested by minimal and installed consumers must be the wheel published; no second build is allowed. Resolve once and pass the immutable SHA to every checkout. Record archive hashes, version and source SHA separately from the dist directory. - -Decision: Keep OIDC write permission only on the final protected pypi job, with pinned actions and no long-lived token. Rationale: build and validation jobs do not need publication credentials. Environment reviewers and tag/main protections are administrative acceptance items, not implied by YAML. - -## Outcomes & Retrospective - - -The release workflow now validates one immutable commit and publishes only its tested artifact pair. The actual validation-only run at 3ee4c1d succeeded, produced provenance and skipped the OIDC publisher. Tests reject branch publication, mismatched versions/prerelease flags/workflow identity, missing or mismatched tags and unmerged commits. A04 native union rollback and CuPy static policy remain release blockers outside this workflow change. A green workflow does not authorize publication or establish unconfigured administrative protections. - -## Context and Orientation - - -Worktree /Users/ale/Code/bearshape-worktrees/publication-gate, branch codex/publication-gate. .github/workflows/pypi.yml is the existing release/dispatch entry point. .github/workflows/validate.yml owns all required CPU, checker, dependency, docs, notebook and artifact jobs. tools/check_distribution.py validates archive metadata and contents. tools/check_installed.py consumes copies of downstream tests outside src. pyproject.toml declares 0.1.0rc0 and beartype >=0.23.0rc0,<0.24. - -## Plan of Work - - -Add a small release validation tool that reads the event and resolved repository state, validates the canonical tag/version relationship for publication and prerelease status, and emits JSON plus GitHub job outputs. Use argument-list subprocess calls and strict ref handling; reject branch publication, mismatched versions, unresolved tags and tags outside main history. Permit arbitrary repository refs only in validation-only mode. - -Refactor pypi.yml into resolve, reusable validation, evidence and publish jobs. The evidence job consumes the existing distributions, checks their metadata version against the resolved project version, and records SHA256/source commit/run URL. Publish downloads those same immutable artifacts and needs successful validation and evidence. Validation-only runs skip publication explicitly. - -Add focused tests for valid rc/final releases and rejected branch, mismatch, prerelease and ancestry cases. Validate the workflow graph and failed-required-job exclusion without uploading anything. Keep source-archive consumer tests runnable when they reference the release helper. Document the command, release procedure and concrete settings still requiring the owner's authorization. - -## Concrete Steps - - -From this worktree run targeted pytest for release validation, then uv run --locked prek run -a and its manual actionlint stage. Exercise the release tool with temporary Git repositories and synthetic GitHub event files. Build and inspect artifacts, then run the hosted candidate matrix. Exercise a validation-only dispatch only if GitHub can run this branch workflow without merging it; otherwise record that platform constraint and use the PR-hosted equivalent plus local event tests. - -## Validation and Acceptance - - -A branch or version/prerelease mismatch must fail before publication eligibility. A tag outside main history must fail. Every required validation job must succeed for the immutable SHA. Published artifact selection must refer to the validated artifact without rebuilding. Evidence must contain source SHA, version, wheel/sdist hashes and run link. Validation-only mode must never enter the OIDC publisher job. Actual publishing and administrative settings remain pending explicit authorization. - -## Idempotence and Recovery - - -Use temporary Git repositories for destructive tag/ancestry tests. Never create release tags in the real repository, publish GitHub releases, upload packages, change controls or transfer ownership during validation. Preserve diagnostic logs and retry only understood failures. Main and focused PR branches remain untouched. - -## Artifacts and Notes - - -Store local evidence under /Users/ale/Code/bearshape-implementation-2026-09-08/evidence/publication-*. Record exact GitHub protection observations and proposed controls in the handoff documentation. Archive hash evidence is separate from the files passed to PyPI. - -## Interfaces and Dependencies - - -Use the standard library and existing locked uv tools. Keep the supported Python package range unchanged. GitHub Actions uses immutable action pins, the local reusable validation workflow, artifact upload/download, and pypa/gh-action-pypi-publish with environment pypi and job-scoped id-token: write. No new runtime dependency. - -Revision note — 2026-09-08: Verified the actual validation-only workflow at https://github.com/acecchini/bearshape/actions/runs/34221337124. Source 3ee4c1d8a0c3d22f537a24b447a9d75e025a5b2d; wheel SHA256 c1806203da013c9eaf2482a309c686a984c0a7031a495efbd100a824536b57d2; sdist SHA256 e2454095144fb4bb5a08d3bd998d0f6a8bee4bc5ad81dfab763c339ca91666df. Administrative protections remain unconfigured and publication unauthorized. - -Revision note (2026-09-08): preserved final reviewed-head evidence and recorded -owner merge approval without changing outstanding release prerequisites. diff --git a/plans/2026-09-08-rc0-compat.md b/plans/2026-09-08-rc0-compat.md deleted file mode 100644 index 3ef194a..0000000 --- a/plans/2026-09-08-rc0-compat.md +++ /dev/null @@ -1,108 +0,0 @@ -# Install and validate the 0.1.0rc0 candidate with exact beartype rc0 - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - -Owner update (2026-09-08): the reviewed implementation and recorded validation -are approved for merge. This supersedes earlier pending-approval statements. -Full native union composition remains required through supported upstream -integration, with a later candidate allowed; limited CuPy native static support -is accepted. Current merge execution and remaining release gates are tracked in -`plans/2026-09-08-agent-workflow.md` and the production-readiness roadmap. - - - -Maintain this ExecPlan according to `PLANS.md`. This focused PR implements the dependency and version baseline from the accepted production roadmap; it does not claim the remaining audit defects are fixed. - -## Purpose / Big Picture - - -Users must be able to normally install bearshape `0.1.0rc0` with beartype `0.23.0rc0`. Current metadata requires `<0.23` and rejects that candidate. The user selected independent bearshape versioning and authorized raising the beartype floor. Existing runtime and checker CI must continue to resolve after this change. - -## Progress - - -- [x] (2026-09-08) Inspected the audited base and accepted version policy. -- [x] (2026-09-08) Opened draft PR #13 before implementation. -- [x] (2026-09-08) Updated metadata, lock, compatibility factors, and installation documentation. -- [x] (2026-09-08) Verified normal wheel installation and both exact-rc0 CPU endpoints. -- [x] (2026-09-08) Record results and request user validation before merge. - -## Surprises & Discoveries - - -The current dependency is `beartype>=0.20,<0.23`. Tox and both CI workflows refer to 0.20–0.22, so changing only package metadata would make those jobs unsatisfiable. CPU runtime on exact rc0 already passed in isolated audit probes, but those probes bypassed the metadata conflict and do not establish normal installation. - -## Decision Log - - -Decision: Version bearshape independently as `0.1.0rc0`, require `beartype>=0.23.0rc0,<0.24`, and make the required compatibility axis exactly `beartype==0.23.0rc0`. Rationale: user accepted this release and the implementation plan. Date: 2026-09-08. - -Decision: Retire excluded beartype factors and update their existing workflow references in this PR. Rationale: every intermediate PR must have installable CI. Broader workflow restructuring belongs to a separate PR. - -## Outcomes & Retrospective - - -Local validation closes A01: the wheel installs with exactly beartype 0.23.0rc0 using normal dependency resolution. The locked complete suite passed 1,064 tests with five skip records; both endpoint CPU tox suites passed 1,034 tests with five skip records. Hooks and actionlint passed after reviewing formatter changes. Hosted CI and user validation remain pending; other release blockers are tracked separately. - -## Context and Orientation - - -Worktree: `/Users/ale/Code/bearshape-worktrees/rc0-compat`, branch `codex/rc0-compat`, base `f43e00d`. `pyproject.toml` owns version/dependencies, `uv.lock` routine resolution, `tox.toml` compatibility environments, `tools/validate_tox_env.py` accepted factor names, and `tests/conftest.py` backend selection. `.github/workflows/ci.yml` and `nightly.yml` call tox factors. Installation instructions are `docs/getting-started/installation.md`. - -## Plan of Work - - -First change the release metadata and regenerate the lock deliberately. Replace bt020/bt021/bt022 factors with bt023rc0 and remove duplicate matrix entries. Add py314 to the validator and a cpu factor installing NumPy/JAX/Torch/optree on interpreter-compatible versions. The cpu environment must exclude checker-only tests because checker versions have their own environments, while recording missing expected backends as errors. Add endpoint cpu environments to default tox and CI. Log the imported candidate and backend versions. Keep all normal uv invocations locked. Update installation requirements and CHANGELOG for the actual floor/version change. - -Then build a wheel in a fresh external directory, install it normally with exact rc0 in an isolated environment, and verify root import without optional backends. Run both endpoint cpu environments and the existing locked complete suite. Inspect the lock diff for unrelated upgrades and workflow syntax for factor consistency. - -## Concrete Steps - - -Run from this feature worktree: - - uv lock - uv sync --locked - uv run --locked pytest -n auto tests - uv run --locked tox run -e py310-bt023rc0-cpu - uv run --locked tox run -e py314-bt023rc0-cpu - uv run --locked prek run -a - uv run --locked prek run actionlint -a --stage manual - uv build --out-dir /Users/ale/Code/bearshape-implementation-2026-09-08/evidence/rc0-compat-dist - -Create a fresh `uv venv` and install the actual built wheel path alongside `beartype==0.23.0rc0` using `uv pip install --python `. Do not use an editable install, `--no-deps`, or an overlay for this installation proof. Record actual paths and outputs below. - -## Validation and Acceptance - - -The wheel declares `0.1.0rc0` and resolves exact rc0 normally. Imported versions match intended environments, all expected CPU backends are present, existing runtime/checker behavior remains green, and neither CI workflow references excluded beartype factors. Root import loads no optional backend. Unexpected resolver conflicts or missing CPU dependencies fail validation; CuPy remains explicitly unverified without CUDA. - -## Idempotence and Recovery - - -Preserve the main checkout. Use new artifact/venv directories without overwriting published versions. Review lock changes and commit small coherent updates. No merge or publication occurs without user approval. - -## Artifacts and Notes - - -Record commands, observed test counts, artifact path and normal resolver result in this section as work proceeds. Audit reference: `/Users/ale/Code/bearshape-audit-2026-09-08/AUDIT.md`, finding A01. - -## Interfaces and Dependencies - - -Public syntax and runtime validators remain unchanged. Runtime dependencies remain beartype and typing_extensions. CPU tox environments explicitly install NumPy, JAX, Torch and optree and assert exact beartype rc0. Do not add backend imports to package root. - -Revision note — 2026-09-08: Created the focused prerequisite plan before implementation. - -Validation evidence — 2026-09-08: `compat-tests.log`, `compat-tox.log`, `compat-versions.log`, `compat-hooks.log`, and `compat-actionlint.log` in the external evidence directory. `rc0-compat-dist/bearshape-0.1.0rc0-py3-none-any.whl` installed in the separate `compat-consumer` venv with beartype 0.23.0rc0 and typing-extensions 4.16.0; isolated root import loaded no NumPy/JAX/Torch/CuPy/optree. Lock changes are limited to bearshape metadata and beartype. Tox braces initially swallowed a version-print dictionary; replaced it with a list and reran the configured commands. CuPy and four platform precision cases remain explicitly skipped. - -Hosted follow-up — 2026-09-08: The first hosted run passed both CPU endpoints and locked tests/checkers but exposed a conditional tox `commands_pre` value that became a string in non-CPU environments. Fixed it using a list-valued conditional with explicit empty else and extension. Validated configuration loading for CPU, NumPy-floor and checker environments and ran the NumPy-floor suite: 691 passed, 46 backend/platform skip records. Hooks pass. Hosted validation is being rerun on this correction. - -Revision note (2026-09-08): reconciled completed milestone/hosted evidence and -explicit owner merge approval. The combined artifact, checker and GPU proofs -are in `docs/maintainers/production-readiness.md`; this update does not mark -the unresolved native-union integration or release administration complete. diff --git a/plans/2026-09-08-rc0-integration.md b/plans/2026-09-08-rc0-integration.md deleted file mode 100644 index 9df5dcf..0000000 --- a/plans/2026-09-08-rc0-integration.md +++ /dev/null @@ -1,107 +0,0 @@ -# Validate the combined release candidate - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - -Owner update (2026-09-08): the reviewed implementation and recorded validation -are approved for merge. This supersedes earlier pending-approval statements. -Full native union composition remains required through supported upstream -integration, with a later candidate allowed; limited CuPy native static support -is accepted. Current merge execution and remaining release gates are tracked in -`plans/2026-09-08-agent-workflow.md` and the production-readiness roadmap. - - - -Maintain this ExecPlan according to `PLANS.md`. This branch combines the focused production-readiness PRs for integration evidence. Their individual PRs remain the review units; this draft is not authorization to merge them into main. - -## Purpose / Big Picture - - -Prove that the runtime fixes, static aliases, packaging and framework checks work together under bearshape 0.1.0rc0 and exact beartype 0.23.0rc0. Enable focused CI, docs and release follow-up PRs against a common candidate tree while main stays unchanged. - -## Progress - - -- [x] (2026-09-08) Created isolated integration branch/worktree from main. -- [x] (2026-09-08) Opened draft integration PR #22. -- [x] (2026-09-08) Combined PRs #13–#21, preserving all tests, entries, four-checker rc0 lanes and corrected Tree/Like guides. -- [x] (2026-09-08) Run all four checkers, runtime tests, hooks and candidate Python endpoints together. -- [x] (2026-09-08) Build and normally install the combined sdist-derived wheel outside the checkout. -- [x] (2026-09-08) Validate corrected GPU behavior using a verified public candidate artifact. -- [x] (2026-09-08) Record evidence and remaining release blockers without implying merge approval. - -## Surprises & Discoveries - - -Independent PRs touch shared changelog, CI and typing sections. Backend conversion removes runtime NumPy imports, while static Like aliases still require NumPy inside TYPE_CHECKING. Integration must preserve both optional dependency boundaries and checker names. Whole-native-union rollback and the scope of CuPy static support remain unresolved decisions documented in the feature plans. - -## Decision Log - - -Decision: Use a temporary integration branch, preserving original feature commits and individual PRs. Rationale: source-level passes from isolated branches cannot establish combined behavior. Main merges still require the user's validation. Date: 2026-09-08. - -Decision: Resolve overlap by reading each side's intended behavior and keeping focused changes together. Rationale: blanket ours/theirs resolution could discard fixes or reintroduce obsolete dependency factors. - -## Outcomes & Retrospective - - -Integration pending. A green aggregate does not establish production readiness while an explicit release blocker remains unresolved. - -## Context and Orientation - - -Worktree `/Users/ale/Code/bearshape-worktrees/rc0-integration`, branch `codex/rc0-integration`, base main `f43e00d`. PRs #13–#21 cover candidate compatibility, caller-sensitive claw integration, memo lifetime, backend conversion, checker conformance, distribution integrity, Like/Shaped static inputs, recursive Tree inputs and framework/minimal validation. The roadmap is PR #12. - -## Plan of Work - - -Merge the feature branches into this isolated branch in dependency order, keeping their identities. Resolve changelog entries additively, retain rc0 factors alongside the four-checker updates, and retain corrected Like/Tree documentation. Put static-only NumPy imports inside TYPE_CHECKING after backend conversion import cleanup. - -Run the combined runtime and checker suites, exact-candidate Python endpoints, and all hooks. Build sdist then wheel; inspect metadata, package bytes and license using the maintained distribution checker. Normally install that wheel outside all source checkouts and execute representative consumers and the minimal smoke command. Publish the integration branch only as a reviewable draft. Any remote artifact validation must have verified source/public provenance and stay inside an isolated environment. - -Separate subsequent CI, documentation and publication changes into their own worktrees and PRs stacked on this integration tree. Keep the final handoff record tied to exact commits, versions, artifact hashes and actual support limits. - -## Concrete Steps - - -Use git merge --no-ff for each feature branch here, inspect conflicts and commit the resolution. Then run: - - uv sync --locked - uv run --locked pytest tests/ -n 4 - uv run --locked tox run -e py310-bt023rc0-cpu,py314-bt023rc0-cpu - uv run --locked prek run -a - uv build --sdist - uv build dist/*.tar.gz --wheel - uv run --locked python tools/check_distribution.py dist/*.whl dist/*.tar.gz - -Record external installed-consumer commands and package origins separately from source validation. - -## Validation and Acceptance - - -Every combined change remains traceable to a focused PR. All supported checker cases execute, negative diagnostics remain effective, runtime regressions pass, and packaging/minimal checks use normal installation of the validated wheel. The exact beartype candidate is asserted. Main, release tags, package publication and ownership settings remain subject to their separate approval requirements. - -## Idempotence and Recovery - - -This worktree isolates conflicts and generated artifacts from main and the feature branches. Abort an unresolved merge rather than discarding unrelated edits. Do not force-update another contributor's branch or remove worktrees until approved merges are complete. - -## Artifacts and Notes - - -Evidence goes under `/Users/ale/Code/bearshape-implementation-2026-09-08/evidence/integration-*`. GPU baseline logs cover the earlier compatibility wheel only; they must not be presented as evidence for combined conversion/lifetime fixes. - -## Interfaces and Dependencies - - -No new public API is introduced by integration. Preserve all optional imports, Python 3.10 syntax and the existing four-checker test harness. Changes needed to resolve integration must be documented here and, when substantive, returned to the owning feature PR. - -Revision note — 2026-09-08: Combined feature commits; restored NumPy imports inside TYPE_CHECKING in JAX/Torch after conversion cleanup removed their former runtime binding. Kept both framework and conversion test classes and both minimal/distribution jobs. - -Revision note (2026-09-08): reconciled completed milestone/hosted evidence and -explicit owner merge approval. The combined artifact, checker and GPU proofs -are in `docs/maintainers/production-readiness.md`; this update does not mark -the unresolved native-union integration or release administration complete. diff --git a/plans/2026-09-08-release-candidate.md b/plans/2026-09-08-release-candidate.md deleted file mode 100644 index b6a2fc4..0000000 --- a/plans/2026-09-08-release-candidate.md +++ /dev/null @@ -1,94 +0,0 @@ -# Validate the full independent PR set together - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - -Owner update (2026-09-08): the reviewed implementation and recorded validation -are approved for merge. This supersedes earlier pending-approval statements. -Full native union composition remains required through supported upstream -integration, with a later candidate allowed; limited CuPy native static support -is accepted. Current merge execution and remaining release gates are tracked in -`plans/2026-09-08-agent-workflow.md` and the production-readiness roadmap. - - - -Maintain this ExecPlan according to PLANS.md. This branch is a review and validation aggregate; it is not approval to merge any focused PR. - -## Purpose / Big Picture - - -The focused CI, documentation, installation and GPU changes must work together on top of the runtime/typing corrections. A fresh branch preserves all original review branches while providing one candidate for complete validation and the publication-gate work. - -## Progress - - -- [x] (2026-09-08) Created codex/release-candidate from documentation PR #24. -- [x] (2026-09-08) Opened aggregate draft PR #27 against #22. -- [x] (2026-09-08) Combined #25 and #26, preserving all tests and requiring both notebook and installed-consumer jobs. -- [x] (2026-09-08) Full hooks/actionlint and every required hosted job passed at e402dea. -- [x] (2026-09-08) Recorded the complete combined result; original focused PRs remain open. -- [x] (2026-09-08) Obtain user merge approval. - -## Surprises & Discoveries - - -Focused PRs have explicit dependent bases. Pushing a merge into a PR's own base can close it automatically; this separate aggregate prevents that while preserving the original commits. CI #23 and docs #24 are already green independently. Installed checks pass 1,074 tests at both endpoints. GPU candidate validation is in progress. - -## Decision Log - - -Decision: Create a new aggregate instead of merging into #22 or #23. Rationale: preserve independent review and the user's required merge validation. Date: 2026-09-08. - -Decision: Resolve additive workflow/changelog overlaps without changing runtime behavior. Rationale: both notebook and installed-consumer jobs must remain required, and every focused change must retain its release note. - -## Outcomes & Retrospective - - -The combined checkout passes the full hooks and all hosted runtime/checker/compatibility/docs/notebook/artifact/installed jobs. A04 whole native-union rollback and CuPy static release policy remain open. Green integration checks cannot establish production readiness while those decisions remain unresolved. - -## Context and Orientation - - -Worktree /Users/ale/Code/bearshape-worktrees/release-candidate, branch codex/release-candidate. Base #22 includes PRs #13–21. This branch begins at docs #24, which already contains CI #23. The shared .github/workflows/validate.yml runs platform runtime, four checkers, dependency floors, quality, docs, notebooks, archive integrity and minimal installs. #25 adds full installed consumers; #26 adds CUDA cases skipped explicitly in CPU lanes. - -## Plan of Work - - -Merge the committed heads of codex/installed-consumers and codex/cupy-runtime into this new branch with merge commits. Keep all changelog entries. Resolve the shared workflow by retaining both notebook and installed jobs and including both in the final required gate. No parent feature branch is modified. - -Run the full hooks, workflow lint and hosted matrix. Review any failures against the actual merged source. Record the final commit, job results and artifact hashes. Publication workflow changes remain in a separate dependent PR. - -## Concrete Steps - - -From this worktree use git merge --no-ff with each verified local feature branch. Review git diff and run uv run --locked prek run -a plus the manual actionlint hook. Push this branch only, then inspect its CI job results. - -## Validation and Acceptance - - -All required runtime, checker, compatibility, quality, docs, notebook, distribution, minimal and installed jobs must succeed. The package remains version 0.1.0rc0 with exact beartype rc0 validation. Preserve the source commit history and original PR bases. No merge into main or release publication occurs. - -## Idempotence and Recovery - - -Only this isolated aggregate is mutated. Conflict resolutions are reviewable; abort a merge if its intended behavior is unclear. Do not reset another worktree or delete evidence. User validation remains required for merge. - -## Artifacts and Notes - - -Use /Users/ale/Code/bearshape-implementation-2026-09-08/evidence/release-candidate-* for validation evidence. The focused PRs retain their own detailed ExecPlans and logs. - -## Interfaces and Dependencies - - -No additional public API or dependency changes beyond the focused PRs. Keep the locked uv workflow and optional backend boundaries intact. - -Revision note — 2026-09-08: Recorded the completed hosted validation and retained user merge approval as the only remaining review action for this focused scope. Program-level release decisions remain in the roadmap and handoff report. - -Revision note (2026-09-08): reconciled completed milestone/hosted evidence and -explicit owner merge approval. The combined artifact, checker and GPU proofs -are in `docs/maintainers/production-readiness.md`; this update does not mark -the unresolved native-union integration or release administration complete. diff --git a/plans/2026-09-08-static-like-inputs.md b/plans/2026-09-08-static-like-inputs.md deleted file mode 100644 index 5eb4bea..0000000 --- a/plans/2026-09-08-static-like-inputs.md +++ /dev/null @@ -1,106 +0,0 @@ -# Make static Like inputs reflect ordinary backend conversion - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - -Owner update (2026-09-08): the reviewed implementation and recorded validation -are approved for merge. This supersedes earlier pending-approval statements. -Full native union composition remains required through supported upstream -integration, with a later candidate allowed; limited CuPy native static support -is accepted. Current merge execution and remaining release gates are tracked in -`plans/2026-09-08-agent-workflow.md` and the production-readiness roadmap. - - - -Maintain this ExecPlan according to `PLANS.md`. This PR addresses the Like/Shaped part of audit A06 and depends on the checker harness in PR #17. Its base is `codex/checker-conformance`; runtime conversion correctness remains separate PR #16. - -## Purpose / Big Picture - - -Users should be able to pass float64 NumPy arrays to F32Like and ordinary numeric lists/scalars to JAX/Torch Like functions without spurious static errors. Strict annotations still describe native backend arrays. Like describes convertible input, so its inferred type must include those input forms rather than pretending conversion has replaced the argument. - -## Progress - - -- [x] (2026-09-08) Created isolated branch/worktree and inspected the current aliases and converter contract. -- [x] (2026-09-08) Opened PR #19; all four checker positive batches failed before the alias corrections. -- [x] (2026-09-08) Corrected NumPy casting families and Shaped/ ShapedLike dtype models. -- [x] (2026-09-08) Added shared static-only numeric input models for native/NumPy arrays, scalars and nested sequences. -- [x] (2026-09-08) Four-engine consumer checks and runtime example pass on Python 3.10–3.14; floor lanes pass; exact rc0 runtime consumers pass on both endpoints. -- [x] (2026-09-08) Updated docs/changelog. Locked dev tox: 1,043 passed, five expected platform/backend skips, 90.97% coverage; hooks pass. - -## Surprises & Discoveries - - -Current NumPy Like aliases use the destination precision as the allowed input dtype, even though same-kind casting permits other widths and lower numeric kinds. JAX/Torch Like aliases are only the native Array/Tensor type. NumPy Shaped excludes strings and object arrays despite their valid runtime shape checks. The existing public NumPy ArrayLike template uses NumPy's nested-sequence protocol, which must be exercised with already-typed nested lists and deliberate invalid strings/dictionaries. - -## Decision Log - - -Decision: Preserve numeric families and widen input dtype widths according to same-kind casting; keep scalar/list support explicit. Rationale: accepting all objects would hide ordinary mistakes, while exact destination dtype gives false rejections. Runtime remains responsible for shape, representable backend dtypes, byte order, device and value-dependent conversion constraints. Date: 2026-09-08. - -Decision: Use concrete native/NumPy array types for JAX/Torch inputs and numeric nested sequences, without treating every NumPy __array__ protocol as proof of Torch conversion. Rationale: PR #16 demonstrates that a NumPy-only protocol can be rejected by Torch. No new public factory parameter or runtime syntax is introduced. - -## Outcomes & Retrospective - - -Implemented the ordinary NumPy/JAX/Torch input families and broader NumPy Shaped typing. Native Tree and CuPy static models remain independent work. Like return types describe original convertible values; callers must explicitly convert before using backend-only methods. Do not suppress such meaningful errors in old fixtures. - -## Context and Orientation - - -Worktree `/Users/ale/Code/bearshape-worktrees/static-like-inputs`, branch `codex/static-like-inputs`, base `3eac024`. `src/bearshape/numpy.py` defines the public ArrayLike template and all NumPy static aliases. `jax.py` and `torch.py` define their TYPE_CHECKING aliases. `tests/typing/check_conformance.py` and `tests/typing_negative/` are checked by the four-engine harness in `tests/test_typecheck.py`. Add separate Like consumer files to those fixture directories and focused runtime controls under each backend's existing test file. - -## Plan of Work - - -Create positive calls using already-typed float64/int32 arrays, numeric scalars, tuples, lists and nested lists. Include NumPy Shaped inputs with string/object/datetime/structured dtypes and useful backend result inference. Add intended errors for nonnumeric strings, dictionaries and incompatible numeric kinds where the backend's static dtype information supports rejection. Save the initial four-checker failures. - -Change only TYPE_CHECKING alias definitions for NumPy Like families: bool inputs remain boolean, unsigned integer inputs admit booleans/unsigned integers, signed integer inputs admit booleans/integers, real inputs admit booleans/integers/floats, and complex inputs admit all numeric kinds. Destination precision and actual casting remain runtime checks. Shaped permits every NumPy generic dtype. Use `src/bearshape/_typing.py` for numeric dtype families shared by NumPy/JAX/Torch and the convertible-input template shared by JAX/Torch. Import it only inside backend TYPE_CHECKING branches, so it adds no runtime import dependency. - -For JAX/Torch, include native arrays, NumPy numeric arrays/scalars and numeric nested sequences in their Like aliases. Preserve meaningful scalar numeric families where feasible, while native backend dtype is not statically parameterized. Check the nested-sequence model across all four engines before promotion. Correct existing fixtures that use backend-only methods on unconverted Like inputs by converting explicitly. Decorate the positive consumer functions with beartype and execute the fixture in `tests/test_examples.py` to maintain runtime controls for the newly statically accepted typical calls and update concise static/Like docs. - -## Concrete Steps - - -From this worktree: - - uv sync --locked - uv run --locked pytest tests/test_typecheck.py -n 4 - uv run --locked pytest tests/test_numpy.py tests/test_jax.py tests/test_torch.py -n 4 - uv run --locked tox run -e dev - uv run --locked prek run -a - -Save initial failures before alias changes. Repeat all four checker batches with interpreter-matched Python 3.10–3.14 environments and the maintained floor checker lanes. Later integration combines the corrected runtime converter and exact beartype rc0 dependency. - -## Validation and Acceptance - - -All four checkers accept the documented ordinary input families through already-typed variables, preserve strict-array result types after explicit conversion, and reject designated invalid inputs for the intended reason. Existing public syntax remains accepted. Runtime controls prove the newly accepted examples, while docs clearly identify runtime-only shape/casting/device constraints. Hooks and the full existing runtime suite pass. No whole-input object/Any alias or broad new checker suppression is an acceptable shortcut. - -## Idempotence and Recovery - - -Keep source changes isolated from the runtime-conversion branch until integration. Negative fixtures must never execute as Python programs. Keep before/after checker evidence. Require user validation before merge and do not widen Tree/CuPy claims in this PR. - -## Artifacts and Notes - - -Evidence is `/Users/ale/Code/bearshape-implementation-2026-09-08/evidence/static-like-*.log`: `before` records failures in all four positive checker batches; `first` records all eight batches passing; `python-3.11` through `python-3.14` include all four checkers and the executable consumer; `tox` records all floor lanes; `dev-final` reports 1,043 passed, five skips and 90.97% coverage; `rc0-py310` and `rc0-py314` prove the decorated consumer against the exact candidate; `hooks-final` is clean. The runtime example contains 31 ordinary calls and assert_type checks; the negative fixture adds nine intended invalid input sites per checker. - -## Interfaces and Dependencies - - -Retain the public NumPy ArrayLike template and named strict/Like aliases. Use existing NumPy typing helpers and typing_extensions.TypeAliasType for Python 3.10 syntax compatibility. Add no runtime dependency or root import. Keep backend-specific static input aliases private. - -Revision note — 2026-09-08: Added focused Like/Shaped typing plan before implementation. - -Revision note — 2026-09-08: Implemented static-only shared input families, executable typed consumers and deliberate error fixtures. Recorded all Python, floor, exact-rc0 consumer and hook evidence. - -Revision note (2026-09-08): reconciled completed milestone/hosted evidence and -explicit owner merge approval. The combined artifact, checker and GPU proofs -are in `docs/maintainers/production-readiness.md`; this update does not mark -the unresolved native-union integration or release administration complete. diff --git a/plans/2026-09-08-static-tree-containers.md b/plans/2026-09-08-static-tree-containers.md deleted file mode 100644 index 9b4f762..0000000 --- a/plans/2026-09-08-static-tree-containers.md +++ /dev/null @@ -1,108 +0,0 @@ -# Give ordinary Tree consumers a useful static type - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - -Owner update (2026-09-08): the reviewed implementation and recorded validation -are approved for merge. This supersedes earlier pending-approval statements. -Full native union composition remains required through supported upstream -integration, with a later candidate allowed; limited CuPy native static support -is accepted. Current merge execution and remaining release gates are tracked in -`plans/2026-09-08-agent-workflow.md` and the production-readiness roadmap. - - - -Maintain this ExecPlan according to `PLANS.md`. This independent PR addresses the Tree portion of audit A06 and is stacked on checker harness PR #17. Runtime tree traversal and structure binding remain unchanged. - -## Purpose / Big Picture - - -Tree[int] should accept integer leaves and existing typed lists, tuples and dictionaries of integer leaves. It should reject strings and wrong nested leaves. The present nominal stub rejects real containers. Replace it only after demonstrating a model that retains leaf information in all four supported checkers. - -## Progress - - -- [x] (2026-09-08) Created feature worktree and tested recursive-container/protocol prototypes with all four checkers. -- [x] (2026-09-08) Opened PR #20 and reproduced real-call failures with the old nominal stubs. -- [x] (2026-09-08) Replaced both nominal stubs with one shared static model under TYPE_CHECKING. -- [x] (2026-09-08) Verified ordinary pretyped containers, named tuples, arrays, empty inputs, strings, fourteen negative sites per checker, and the concrete custom JAX node alias. -- [x] (2026-09-08) All four engines pass on Python 3.10–3.14 and floor lanes. Exact rc0 endpoints each pass 108 tree tests. Locked dev tox: 1,044 passed, five expected skips, 91.24% coverage. -- [x] (2026-09-08) Updated docs/changelog and recorded default-registry limits. Hooks pass. - -## Surprises & Discoveries - - -A recursive alias using list/dict directly rejects already-typed containers because their element types are invariant. In the same prototype ty accepts even deliberate errors. A sequence/protocol model can admit strings through recursive iteration: type stubs expose inherited sequence behavior that is not equivalent to Python's runtime attributes. Another protocol version rejects direct strings but mypy accepts a list of strings. - -The current successful small probe uses private covariant protocols for list, tuple and mapping behavior, with a nonrecursive outer union. List's pop result carries recursive leaf information; tuple indexing and tuple concatenation distinguish it from self-iterating strings; mapping values carry recursive leaf information without constraining keys. All four engines accept six valid pretyped cases and reject both deliberate wrong cases. These protocol members are descriptive only; validation does not call them or mutate inputs. The full implementation must extend the probe to mixed nesting, NumPy leaves and additional invalid forms before promotion. - -## Decision Log - - -Decision: Preserve Tree[Leaf] syntax and share the model in the TYPE_CHECKING section of `src/bearshape/_tree.py`, re-exporting it from optree/JAX. Rationale: the two public tree backends should not carry divergent fake nominal classes or duplicate static definitions. No runtime dependency or new module is needed. The existing typing_extensions.TypeAliasType represents the outer alias so ty also retains existing checker-only aliases built from Tree. Date: 2026-09-08. - -Decision: Establish tested static support for ordinary lists, tuples, dictionaries, leaves and None; keep arbitrary backend registration a runtime property. Rationale: Python static typing cannot infer a dynamically modified pytree registry. For custom nodes, document the existing TYPE_CHECKING alias pattern using the user's concrete node type and the runtime Tree annotation. This preserves existing runtime support without introducing a new public form or claiming every structural match is registered. - -## Outcomes & Retrospective - - -Implemented real ordinary-container acceptance and maintained exact negative diagnostics for direct/nested strings and invalid array dtypes. The same positive consumer executes with beartype, including a custom registered JAX node; a separate runtime test rejects that node with the wrong leaf dtype. State backend registration limits accurately. Structure-bearing Tree syntax remains runtime-only. - -## Context and Orientation - - -Worktree `/Users/ale/Code/bearshape-worktrees/static-tree-containers`, branch `codex/static-tree-containers`, base `3eac024`. `src/bearshape/_tree.py` owns runtime traversal and structure checking. The TYPE_CHECKING branches in `optree.py` and `jax.py` each define a nominal Tree class. `tests/typing/` and `tests/typing_negative/` use the four-engine harness from PR #17. `tests/test_tree.py` owns runtime tree regressions; add an executable consumer fixture and a maintained runtime invocation there. - -## Plan of Work - - -Add real positive consumer calls with typed leaves, list[int], list[list[int]], tuple mixtures, dict[str, list[int]], None, empty containers, and nested NumPy arrays. Add negative wrong scalars, nested strings, sets and incompatible NumPy dtype examples for both optree/JAX aliases. Save the failing-before checker results. - -Implement private covariant protocols and the shared static Tree alias under TYPE_CHECKING in `_tree.py`; replace the public nominal classes with imports of that alias. Use the smallest protocol member sets demonstrated by the prototypes. Extend inference checks to ensure a Tree annotation does not collapse to Any/Unknown. Execute positive consumer functions decorated with beartype so the same examples establish runtime acceptance. Keep custom-node registration and structure binding unchanged and covered by existing tests. - -Document the ordinary-container model, the runtime registry boundary and the existing conditional-alias technique for custom registered node types. Do not imply that a structurally matching arbitrary class is registered automatically. Update CHANGELOG. Repeat the complete checker contract on Python 3.10–3.14 and maintained floor engines; run runtime tree tests with exact rc0 endpoints, hooks and locked dev coverage. - -## Concrete Steps - - -From this worktree: - - uv sync --locked - uv run --locked pytest tests/test_typecheck.py -n 4 - uv run --locked pytest tests/test_tree.py -n 4 - uv run --locked tox run -e dev - uv run --locked prek run -a - -Before implementation preserve the nominal-stub failures. Use interpreter-matched environments for the other Python versions and the existing exact-rc0 CPU environments for runtime source checks. The integrated artifact milestone must repeat consumer checking against the installed wheel. - -## Validation and Acceptance - - -Every checker accepts the maintained valid pretyped containers and rejects all marked errors at the intended source line/category. None and empty containers match actual backend flattening. NumPy leaf annotations retain useful dtype information. Runtime-decorated consumers and existing tree tests pass; no runtime mutation, registry change, Any-valued leaf, or broad new checker suppression is introduced. Custom nodes retain their existing runtime path and have an explicit static spelling based on the user's concrete node type. - -## Idempotence and Recovery - - -Keep prototypes outside the source package and preserve their counterexamples. Only promote the model after complete negative/inference proof. Work remains isolated from other PRs until integration. Do not merge without user validation. - -## Artifacts and Notes - - -Prototypes are under `/Users/ale/Code/bearshape-implementation-2026-09-08/evidence/tree-typing-prototypes/`: `recursive_containers.py`, `recursive_protocols.py`, `reverse_protocols.py`, and `pop_protocols.py`, with per-engine outputs. The first three demonstrate why acceptance-only validation is inadequate. Production evidence uses `tree-typing-*.log`: `before` captures the nominal-stub failures; `focused` captures the initial 115 passing tree/checker tests; `tox` captures 1,044 passing dev tests, 91.24% coverage and all floor engines; `python-3.11` through `python-3.14` capture the interpreter-matched checker matrix; `rc0-py310` and `rc0-py314` each report 108 passing tree tests; `hooks-final` is clean. The final model uses tuple indexing because pinned pyrefly describes named-tuple iteration as Iterable rather than Iterator. A namespaced optree custom registration is not visible to the current default-registry Tree; the maintained custom-node example is explicitly JAX. - -## Interfaces and Dependencies - - -Keep public `bearshape.optree.Tree` and `bearshape.jax.Tree` subscriptions unchanged. The static alias describes leaves and supported container behavior; runtime still uses _TreeFactory and the backend registry. Use standard typing/collections protocols and the existing checker harness. No new runtime or development dependency is required. - -Revision note — 2026-09-08: Recorded prototype counterexamples and focused Tree implementation plan before source changes. - -Revision note — 2026-09-08: Implemented and validated the shared static model, corrected the prototype for named tuples and existing aliases, and documented the actual registry boundary. - -Revision note (2026-09-08): reconciled completed milestone/hosted evidence and -explicit owner merge approval. The combined artifact, checker and GPU proofs -are in `docs/maintainers/production-readiness.md`; this update does not mark -the unresolved native-union integration or release administration complete. diff --git a/plans/2026-09-08-union-transactions.md b/plans/2026-09-08-union-transactions.md deleted file mode 100644 index 289223d..0000000 --- a/plans/2026-09-08-union-transactions.md +++ /dev/null @@ -1,337 +0,0 @@ -# Roll back failed native union alternatives - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - - -This is a living ExecPlan governed by `PLANS.md`. Keep Progress, Surprises & Discoveries, Decision Log, and Outcomes & Retrospective current. It continues the existing production-readiness goal rather than starting a duplicate goal. - -## Purpose / Big Picture - - -A valid call must not fail because a rejected union alternative left dimension or tree-structure bindings behind. For `tuple[F32[N], str] | tuple[F32[C], int]`, a length-two float array paired with an integer selects the second alternative. A later `F32[N]` argument of length three must succeed: the rejected first alternative must not retain N=2. Successful alternatives must still bind dimensions, and wrong shapes, dtypes, ordinary values and return values must still fail. - -The user requested resolving this defect after approving the earlier implementation merge and choosing full native composition through a supported beartype integration. Preserve native annotations and beartype's checking and sampling policy. No monkeypatch, bytecode inference, replacement checker, weakened composition contract, or hidden expected failure is acceptable. - -## Progress - - -- [x] (2026-09-08) Read the current agent contract, roadmap, prior feasibility evidence, bearshape memo/checker implementation and beartype union generator. -- [x] (2026-09-08) Created branch `codex/union-transactions` and matching worktree at `/Users/ale/Code/bearshape-worktrees/union-transactions` from main `795ec391123437beb5167de1e1519411dbabe479`. -- [x] (2026-09-08) Committed the plan and opened draft PR #34 before implementation. -- [x] (2026-09-08) Initial regressions reproduced 12 failures and two passes on published rc0 before implementation; expanded the suite to 22 behavioral cases. -- [x] (2026-09-08) Implemented the snapshot protocol in isolated upstream commit `4aef992d1cd0a6d09fe5c3784523c44e0874b178`, based on `a2729e0e358bf963ee6f177e300ae08a622d05d6`. No upstream message, fork push or PR submitted. -- [x] (2026-09-08) Connected the shared runtime-hint metaclass to existing memo snapshots. All 22 integration cases pass, including late aliases, sampling, cancellation and thread isolation. -- [x] (2026-09-08) Normally installed packages passed 1,124 tests plus five existing CPU skip records on each of Python 3.10.20 and 3.14.5, including all four checkers. Upstream serial unit tests passed 426/439 with 20/7 pre-existing skips. Upstream pyright passed. -- [x] (2026-09-08) Hooks and docs passed. Final sdist-extracted consumers outside the checkout passed 1,124 tests with five existing CPU skip records on each endpoint. Minimal wheel environments passed with no optional backends. Final normal-install benchmarks and artifact hashes are recorded below. -- [x] (2026-09-08) Prepared the concrete upstream patch and submission text locally and updated the handoff and agent/tool guidance. -- [x] (2026-09-08) Profiled and reduced the local proposal overhead before maintainer contact, preserving rollback, diagnostics, lazy aliases, sampling and state lifetime. -- [x] (2026-09-08) Validated optimized normal installations and archive consumers on both endpoints, recorded matched comparisons, and prepared a local Zulip draft without sending it. -- [x] (2026-09-08) Reproduced and fixed copied-context state retention and stale parent registration; repeated affected installed tests and matched benchmarks against final upstream head. -- [ ] Upstream acceptance/publication and a later supported dependency migration remain external steps, not a completed release fix. - -## Surprises & Discoveries - - -The exact published beartype 0.23.0rc0 and the previously inspected upstream development commit `a2729e0e358bf963ee6f177e300ae08a622d05d6` both use ordinary boolean expressions for union alternatives. A successful bearshape leaf can bind a name before a following plain `str` check fails. The leaf receives no notification of that failure. Existing leaf snapshot/restore is necessary but insufficient. - -Creating the new worktree succeeded, but its post-checkout hook could not find `prek` before that worktree's environment existed. Initialize the environment with locked uv and install hooks normally; do not bypass validation. - -## Decision Log - - -Decision: Implement and test the smallest upstream source extension needed if no existing public rc0 interface can expose the required boundary. Rationale: the owner explicitly selected supported integration; a local source patch is a reviewable step toward that outcome, while runtime patching installed beartype internals would violate the contract. Date/author: 2026-09-08, Codex. - -Decision: Keep the published dependency baseline and normal lock unchanged during prototyping. Rationale: an unpublished local extension is not a released supported API. A later version floor can change only when a concrete compatible dependency is normally available. Date/author: 2026-09-08, Codex. - -Decision: Prepare any upstream proposal locally before seeking permission to submit it. Rationale: the request authorizes implementing a fix but not sending messages to external maintainers. Earlier merge approval covered earlier reviewed work; this new feature remains reviewable in its own draft PR. Date/author: 2026-09-08, Codex. - -## Outcomes & Retrospective - - -The optimized local proposal retains the rollback contract and reduces added strict-check overhead by 57% on Python 3.10 and 74% on Python 3.14. It uses the smaller state-object adapter and an upstream checker compiled once at decoration. Draft PR #35 isolates the independent frame filter. Normally installed combined artifacts passed 1,125 tests on each endpoint, including all four checkers and 22 integration cases, with five existing CPU skip records. Upstream's final source passed 434/447 unit tests, including 22 protocol tests with 600 independent-reference cases and two copied-context regressions, and pyright. Remaining nested ordinary-reference overhead is disclosed below. No upstream contact, merge into main, publication or transfer occurred. Upstream acceptance, publication and coordinated dependency adoption remain release prerequisites. - -## Context and Orientation - - -`src/bearshape/_memo.py` owns ShapeMemo, the dictionaries binding single dimensions, variadic dimensions and tree structures. It supports snapshot and restore. Automatic memo ownership is the live beartype checking frame; `check_context` and `check` also support explicit scopes. `_runtime_hints.py` creates hint classes with metaclass instance checking. `_array_types.py` and `_tree.py` restore state when their individual checks fail and isolate diagnostic callbacks. `_decorator.py` manages explicit synchronous and asynchronous call scopes. `tools/probe_union.py` is the unresolved integration reproducer. - -The inspected public upstream clone is `/Users/ale/Code/bearshape-implementation-2026-09-08/evidence/beartype-upstream-review`. Create a separate branch/worktree for changes rather than changing this recorded checkout. Upstream `beartype/_check/code/_pep/pep484/codepep484604union.py` builds the union expression. `beartype/_check/code/codemain.py` visits the annotation tree and substitutes child expressions. Diagnostic traversal is under `beartype/_check/error/`. Its public plugin documentation and tests are the appropriate place to describe and prove any new opt-in state integration, without depending on bearshape or NumPy in upstream tests. - -A transaction here means taking snapshots of participating validator state, evaluating an entire alternative, retaining state only on success, and restoring it on rejection or an exception. Nested transactions must restore only their own additions. Diagnostics must report failures without permanently modifying live checking state. - -## Plan of Work - - -### Milestone 1: Failing behavioral evidence - - -Commit this plan and open a bearshape draft PR. Add regression cases for plain-type rejection after a successful shape check, alternative order, earlier bindings, nested alternatives, all alternatives failing, return checking, and explicit scopes. Run against the unmodified locked candidate and preserve failures outside temporary worktrees. Keep incomplete upstream-dependent cases visibly separate until they can run as required checks against an available dependency; do not mark them xfail. - -### Milestone 2: Upstream integration prototype - - -Design a narrowly scoped opt-in protocol on stateful runtime hints. Generate transaction boundaries only when participating hints require them; ordinary stateless annotation code should retain its existing path. Use beartype's own type traversal and checking expressions, and preserve short-circuit order and sampling. Cover exceptions with actual `try/finally` behavior rather than only boolean suffixes. Integrate diagnostic traversal so a failed check cannot poison later checks or alter its own explanation. Test with a tiny upstream-only stateful hint and inspect generated code for scope and evaluation-count regressions. Record the concrete API and modifications here once proven. - -### Milestone 3: Bearshape integration and reviewable delivery - - -Expose the new opt-in callback from bearshape runtime hints using existing memo snapshots. Normally install the patched upstream and bearshape into isolated environments. Run the expanded regression suite, existing lifetime/weak-reference tests, CPU backend tests, all four static consumer checkers, and relevant package consumers on Python 3.10 and 3.14. Preserve the known failing published-rc0 baseline and successful patched-version evidence separately. Update CHANGELOG, relevant agent instructions, the runtime contract and handoff report to describe precise availability. Prepare the upstream patch with its test results and a concise proposed PR description for approval. - -## Concrete Steps - - -From `/Users/ale/Code/bearshape-worktrees/union-transactions`: - - uv sync --locked - uv run --locked prek install - uv run --locked python tools/probe_union.py - -The initial probe should fail with `dimension 'N' expected 2 but got 3`. After a complete integration fix, the same call must succeed unchanged. - -Run focused tests first, then the existing routes when changes warrant them: - - uv run --locked pytest tests/test_memo.py tests/test_decorator.py -q - uv run --locked pytest tests/ --ignore=tests/test_typecheck.py -n auto - uv run --locked pytest tests/test_typecheck.py -q - uv run --locked prek run -a - -Do not use `uv run --locked` to silently replace a patched dependency installation during its integration tests. Use a separate environment with explicit normal installs and invoke that environment's interpreter directly. Document the exact commands and source commits once established. - -## Validation and Acceptance - - -The original valid call succeeds. Rejected alternatives discard single, variadic and tree-structure bindings. Selected alternatives retain bindings used by later arguments and returns. Bindings from earlier arguments survive rollback. Nested unions and containers work with repeated objects and repeated calls. Explicit and automatic contexts, async calls, cancellation and thrown validator exceptions leave no leaked state. Negative checks still raise useful beartype violations rather than desynchronization errors. Upstream ordinary annotations keep their prior behavior and do not pay runtime transaction costs when no participating stateful hints occur. - -A passing local prototype is not enough to claim published rc0 compatibility. Completion must state whether the needed upstream API exists in a released artifact. If upstream acceptance/publication is pending, deliver the concrete tested patch and bearshape integration while leaving that release gate open. - -## Idempotence and Recovery - - -Use isolated worktrees and virtual environments. Do not edit shared installed dependency files, published artifacts, main, or existing evidence. Keep logs and patch artifacts under `/Users/ale/Code/bearshape-implementation-2026-09-08/evidence/union-transactions/`. Preserve worktrees while review or upstream acceptance is outstanding. Do not publish releases, deploy Pages, transfer ownership, modify account settings or contact upstream maintainers without explicit authorization. - -## Artifacts and Notes - - -Baseline main is `795ec391123437beb5167de1e1519411dbabe479`. Prior upstream baseline is `a2729e0e358bf963ee6f177e300ae08a622d05d6`, reporting development version 0.23.0rc1. Exact source identities, regression outputs, generated-code evidence and patch files will be recorded here as milestones finish. - -## Interfaces and Dependencies - - -No new third-party runtime dependencies. Use existing ShapeMemo snapshot/restore and upstream public plugin conventions. The proposed upstream protocol must remain optional, avoid imports of bearshape/backends, deduplicate shared state providers, clean up on all outcomes and avoid retaining caller objects after checks end. Its final callable signatures, discovery rules, diagnostic behavior and supported scope must be specified before promotion from prototype. - -Revision note — 2026-09-08: Created the focused plan before implementing the union rollback fix. - -## Implementation discoveries and concrete interface - - -The optional upstream hook is `__beartype_snapshot__() -> Callable[[], None]`. All bearshape hint classes expose the same static getter object, so their shared state is snapshotted once per boundary. The getter returns a closure holding the active ShapeMemo and a copy of its three binding maps. It imports no optional backend and no upstream private API. Existing leaf rollback remains for published rc0 and bare Python instance checking. - -Upstream collects getter identities during its existing sanitized code-generation traversal. Union alternatives receive deferred start/commit/rollback expression boundaries only when a descendant opts into state or could resolve lazily. One closure around the complete expression preserves the lexical scope of generated assignment expressions; a separate closure per alternative would lose variables shared by the generator's sampling logic. ExitStack unwinds failed branches and exceptions, including a broken plugin rollback. Diagnostic traversal uses the same getter set, retains successful sibling bindings while describing a failure, and restores all diagnostic changes afterward. - -Late aliases required additional evidence. The first prototype passed 14 cases but failed an alias defined after decoration. Lazy references now enrol a newly discovered getter in active transactions before validation mutates state. The generator retains beartype's existing preference for concrete classes before unresolved proxies, so `Optional["NotYetDefined"]` still accepts None. No unused reference is resolved eagerly. Transactions use ContextVar tracking and invocation-owned snapshots, not a global binding cache. - -Upstream tests exposed dedicated NoReturn and legacy tuple diagnostic paths outside the ordinary expression generator. These retain their original special handling. A parallel run also hit an existing shared bytecode-cache cleanup race; the upstream project's suite passes serially without modifying or skipping that fixture. Test-only dynamic classes require distinct qualified names because upstream caches some hint representations. - -The first benchmark observed a cost for stateful hints (strict small-array call about 20 to 31 microseconds), while a native NumPy-only annotation remained about 0.11 microseconds. This is a correctness-versus-overhead tradeoff for the upstream proposal; final matched normal-install measurements are pending. No portable performance guarantee is made. - -The local patch file is `/Users/ale/Code/bearshape-implementation-2026-09-08/evidence/union-transactions/beartype-stateful-hints.patch`. Apply it to a clean checkout of the recorded upstream base with `git apply --check` followed by `git apply`; normal-install both packages into an isolated interpreter as documented in `tools/upstream/README.md`. The patch must be accepted and published upstream before dependency metadata, lock and required CI are migrated. Do not turn this local result into a released-rc0 compatibility claim. - -Revision note — 2026-09-08: Recorded the working callback design, successful endpoint suites, upstream patch commit, discovered alias/diagnostic paths and remaining artifact/review steps. - -## Final local evidence - - -The final 22-case suite passes serially on Python 3.10.20 and 3.14.5. With published rc0, the suite records 20 failures and two passes; the hook alone does not change that dependency's behavior. Initial archive validation exposed a pre-existing upstream cache collision between dynamically recreated `Is` validators sharing a qualified name. The ValueError and cancellation fixtures now use distinct module-level functions, so they reliably exercise both exception classes in one process. Runtime code did not change during this fixture correction. - -Normally installed immutable wheels, with tests and configuration extracted from the final bearshape source archive into `consumer-final310` and `consumer-final314` outside the checkout, passed 1,124 tests and five existing CPU skip records on each interpreter. These commands include `--installed-package`, all four checker consumers, and the explicitly named upstream integration suite. The five skips are CuPy and four unavailable macOS dtype-precision cases. The earlier broad suites also checked the bearshape source. New GPU evidence is deferred until candidate validation after the upstream dependency is available; old GPU artifacts do not validate this changed wheel. - -The built bearshape wheel is byte-identical before and after the fixture-only correction. SHA256 identities: - - bearshape-0.1.0rc0-py3-none-any.whl - 0393873fa2bf0e55cfa9b26fe718ad19759bbd314a5150a5bde1e21640d7b163 - bearshape-0.1.0rc0.tar.gz - 70624c97463c090c91e162e9332cf2af09339c9e63a348d485f5b72122e9f95c - beartype-0.23.0rc1-py3-none-any.whl - 18b7179c8d45828f20b909e733b0999ac50906c0d064c57150c39efafc6819e5 - beartype-0.23.0rc1.tar.gz - 5904fbe8883b703269e202bc7ec1db0b23d8e857bbc2b7b251af8b4974b223a3 - beartype-stateful-hints.patch - 7784b95c8f338190ecf1b83e4a65ee3104c5c16d663c97077e67c27bc5621f2e - -All files are under the evidence root given above, in `bearshape-dist-final`, `beartype-dist`, and the top-level patch file. `distribution-check-final.json` verifies wheel/source consistency. `installed-final310.log` and `installed-final314.log` contain the archive-consumer results. `minimal310.log` and `minimal314.log` prove the optional-import boundary. `upstream-pyright-final.json` reports 477 analyzed source files with zero errors or warnings. `upstream-serial310.log` and `upstream-serial314.log` contain the complete upstream suite results; the final callback typing and context-token cleanup also passed its focused protocol tests. - -Matched normal-install benchmarks used the same Python 3.10.20, NumPy 2.2.6, optree 0.19.1 and bearshape wheel, changing only rc0 versus the patched beartype wheel. Each ordinary case ran 10,000 calls per repeat for five repeats. Median strict small-array calls changed from 18.974 to 31.272 microseconds, Like from 9.817 to 15.711, one-leaf Tree from 30.866 to 42.871, and diagnostics from 115.403 to 142.045 (diagnostics use the tool's 1,000-call cap). Native-only annotations remained below 0.2 microseconds in both runs; their generated expression has no transaction operations. These are host-specific observations. The roughly 12-microsecond strict-call cost is an explicit review tradeoff, not hidden behind correctness results. - -Hosted rc0 CI run 34239118985 passed for implementation head `983f7dc0983378662acd0b22924c09489389db87`. That does not test the unpublished upstream extension. The final fixture/report follow-up will receive its own normal CI run; local patched-wheel evidence is tracked independently. - -Revision note — 2026-09-08: Recorded final installed-archive verification, fixture correction, hashes, minimal imports, performance tradeoff and the remaining upstream approval/release boundary. - - -## Performance follow-up authorized by the owner - - -The owner requested a deeper investigation and substantially lower overhead before contacting the beartype maintainer. The owner has a direct Zulip contact; prepare discussion material locally, but do not send it or submit upstream. Continue the existing draft PR and matching worktrees because this refines the same unmerged integration. Preserve the initial committed patch and immutable wheel evidence for comparison. - -Profile the initial normally installed proposal against published rc0 before editing. Extend measurement to successful first and later union alternatives, rejection, nested unions, explicit scopes, multiple domains and stateless forward references. Time setup separately from repeated checking; compare equal interpreters, packages and inputs. A faster incorrect rc0 result is not a correctness equivalent. - -First replace avoidable per-call bookkeeping if profiling confirms it is material. Consider a direct path for a single known state provider without internal union boundaries, compact callback storage, and avoiding repeated state lookup. Keep the public callback interface small; any interface change must be justified by measured improvement and equivalent semantics. Do not make unselected references eager, drop exception cleanup, weaken negative tests or remove runtime composition. Record rejected approaches as well as measured improvements. - -Then validate focused regressions and upstream tests, followed by normal installed packages on Python 3.10 and 3.14, CPU backends, four checkers, archive/minimal consumers, hooks and docs as affected. Add behavioral regressions for newly discovered risks. Preserve the original package artifacts and record optimized hashes separately under evidence/union-transactions/optimization/. Report both total latency and the change in added overhead, including remaining costs. Do not impose unstable wall-clock CI thresholds. - -Decision: Optimize this tested local proposal before any upstream contact. Rationale: the current extra cost is material for a runtime checker; a smaller design with measurements will make the owner's maintainer discussion more useful. The user's Zulip contact does not authorize sending a message. Date/author: 2026-09-08, Codex. - -Revision note — 2026-09-08: Reopened the local optimization milestone at the owner's request; existing completed evidence remains historical baseline, not proof of the next revision. - - -## Optimization design and current evidence - - -The current proposal supersedes the original `__beartype_snapshot__` callback -with `__beartype_state__()`, returning a library-owned object with `snapshot()` -and `restore(token)` methods. A token is an opaque saved-state value. Bearshape -now exposes its existing `get_memo` function directly; no new memo wrapper or -per-snapshot closure is needed. Locate known state once per checking expression -and reuse it across alternatives. Validate newly discovered domains before use. - -The upstream generator compiles one checking function at decoration. It retains -one scope for assignment expressions and receives the original sampled random -integer. Compact restore/token lists replace per-checkpoint ExitStacks; general -unwinding is retained on the exceptional path when a restore method fails. A -root union uses its alternatives' complete boundaries without another duplicate -checkpoint. Leading stateless native alternatives are checked once before state -setup. Root forward references delegate to the resolved hint, while nested lazy -references still enrol domains in active checks before mutation. - -The original prototype's published-rc0 compatibility status has not changed. -The initial patch and artifacts remain historical evidence. No upstream message -has been sent. The independent frame filter lives in draft PR #35, branch -`codex/memo-discovery-performance`; validate its combination on a separate local -integration branch before any merge approval. It filters code metadata before -reading unrelated frame locals and introduces no state cache. - -Initial profiling attributed a material part of the cost to repeated frame -inspection. A bookkeeping-only prototype reduced a 54-microsecond corrected -second-alternative case to about 45; reusing state then reduced it to about 39. -These are exploratory measurements, not the final matched artifact comparison. -The maintained `tools/upstream/benchmark_transactions.py` reports incorrect rc0 -cases explicitly and covers native checks, resolved/unselected references, -synthetic plugin checks, automatic/explicit array checks and nested/rejected -unions. Final comparisons must use the same script and package versions. - -Discovery: compiling a fresh helper for a root forward reference changed the -upstream uncached-expression equality contract. Delegating such roots directly -to the existing resolver both preserved that contract and removed unnecessary -transaction setup for ordinary references. The upstream tests remain intact. -A transient missing import and an unsupported pytest override were corrected; -final validation uses the project's supported options and explicit Python -interpreter/version arguments for pyright. - -Decision: Prefer a state object over per-snapshot callbacks. Rationale: this -reuses the library's existing snapshot/restore interface, avoids repeated scope -lookups and closure creation, and keeps state ownership with the library. -Decision: Preserve complete boundaries but eliminate redundant checkpoints and -stateless setup. Rationale: equivalent outcomes can be proved by regressions -without weakening composition or exception cleanup. Date/author: 2026-09-08, Codex. - -Revision note — 2026-09-08: Recorded the optimized interface, rejected redundant -work, independent PR #35 and the distinction between exploratory and final -performance evidence. - - -## Optimized delivery and final comparison - - -The final upstream head is `76e27706fb137c6a676ee7b79a66d8b3092b52ad`, against -`a2729e0e358bf963ee6f177e300ae08a622d05d6`. The independent frame filter is -`344d390c4099685cc3ea6519f5bb8b5bde0fb13e`. Local validation commit -`c53d14f99d71fd4884282642b98e8bd63bd7b871` combines both bearshape changes. -Its normally installed wheel and sdist are recorded under -`evidence/union-transactions/optimization/` outside these worktrees. The -benchmark script at `46e7f4d657b5272cc0be8543848e794fefb45f41` adds a -measurement-only nested-reference case after that package build; package code -and runtime tests are unchanged. The PR branches remain independent. - -Matched medians pool 14 samples per correct case: 20,000 calls per sample, seven -repeats in each of two process runs, reversing scenario order in the second run. -Python 3.10.20 uses NumPy 2.2.6; Python 3.14.5 uses NumPy 2.4.6. Both use -optree 0.19.1 and typing_extensions 4.15.0. Runtime imports and decoration are -not timed. The manifest preserves exact commands, script hash and versions. - -For strict parameter/return checks, original bearshape with rc0 measured -18.442/17.736 microseconds on 3.10/3.14, and the first working proposal measured -30.451/30.240. Optimized bearshape with rc0 measured 16.384/13.208, and the -final working combination measured 21.589/16.418. Thus added transaction -overhead fell from 12.009/12.504 to 5.206/3.209 microseconds, a 57%/74% reduction -after accounting separately for the frame filter. The filter alone improves the -rc0 strict baseline by about 11%/26% in this repeat. - -Correct second-alternative calls fell from 51.499/52.596 to 32.908/25.489 -microseconds. Explicit-scope fallback calls fell from 39.986/45.178 to -21.048/15.042, and nested union calls from 25.569/23.746 to 14.717/11.752. -An unselected ordinary reference remains close to the rc0 baseline. Nested ordinary -references still add about 0.74/0.42 microseconds over rc0, approximately -2.0x/1.9x their small baseline; this remains a maintainer discussion point. -Ordinary root references retain a smaller hook lookup cost. No zero-overhead -or portable latency guarantee is claimed. - -The final archive consumers, with no source directory available, passed 1,125 -tests on each endpoint. There were four unavailable platform precision cases -and one skipped CuPy module; this provides no new CUDA evidence. Minimal -normal installations passed with no optional backends. Distribution integrity, -hooks and documentation passed. Upstream passed 434 tests with 20 existing -skips on 3.10 and 447 with seven on 3.14; pyright checked 477 source files with -zero errors and warnings for each interpreter target. Its 22 protocol tests -include 600 deterministic comparisons of nested acceptance and final bindings -against an independent reference. - -The combined bearshape wheel SHA256 is -`a0cb17c0b4a67b49f6e6cc10ee76e0f911ad9441877e994cdd6f495366325851`; the sdist is -`ac4cf3b1b87c700fece1fbdb35f5b7503b90b199606e4367b4dbdb2193a5c2f0`. The optimized -beartype wheel is -`0db860846b16c6fbb61f0b494dd0b30065cbd683d063356a3dbf5ae928da6d20`; its sdist is -`8bacac19c91d0150943a6c9be90149302d4f2b6849add2b97d972005ee3954dc`. - -`OPTIMIZATION.md` contains the full report, `RESULTS.json` the source/artifact -record, `benchmark-summary.json` the samples, and `benchmark-manifest.json` the -commands, all under the optimization evidence directory. `ZULIP-DRAFT.md` is -prepared for the owner; it has not been sent. Normal hosted CI still uses rc0 -and does not prove this unpublished upstream integration. Final PR-head CI -results are recorded in the external results file when available. - -Revision note — 2026-09-08: Closed the requested local optimization milestone -with matched measurements, immutable artifacts and expanded correctness proof; -kept upstream acceptance and release adoption explicitly outstanding. - - -## Final copied-context correction - - -The lifetime review found that `copy_context()` could retain an invocation's -state after its transaction completed. A later root forward-reference check -could then mistake the completed transaction for a live parent and omit root -rollback. Two focused regressions failed before the fix, preserved in -`copied-context-before.log`. Completed transactions now clear their getters and -state objects, and new checks ignore parents whose transaction token has closed. -Both regressions pass. All 22 upstream protocol cases also pass against the -normally installed wheel outside the upstream source checkout on both endpoints. - -The final source, artifact hashes, 1,125 consumer results per endpoint and matched -benchmarks above include this correction. The earlier optimization evidence is -preserved under `optimization/before-context-lifetime/`, including the first -matched comparison cited by PR #35. No earlier artifact evidence was discarded. - -Revision note — 2026-09-08: Added failing copied-context lifetime evidence, -corrected cleanup, repeated affected installed validation and refreshed the -matched timing matrix against the final upstream patch. - -## October 2026 continuation - -The owner selected Python 3.11+ and beartype 0.23.1 on 11 October and requested the complete release program in focused PRs. Merged the new baseline and ownership changes into this PR while preserving its original reviewed head and all dated evidence. Resolved documentation conflicts in favor of the verified beartype organization ownership and current baseline, retaining the local-proposal distinction. - -Ported the upstream proposal onto released v0.23.1 in `/private/tmp/beartype-union-0231`. The preserved September checkout is unchanged. Both normally installed 3.11/3.14 environments pass all 22 integration cases and the original probe. Upstream unit tests passed 446/457 with 18/7 pre-existing interpreter/optional-dependency skips; pyright passed. Logs and the concrete patch are under the main checkout's `build/release-2026-10-11/`. Published 0.23.1 still lacks the hook and fails 20 integration cases. This refresh does not close upstream availability or authorize publication/contact. Final combined archive, lifetime/performance and GPU evidence are tracked by `plans/2026-10-11-release-readiness.md`. - -Revision note — 2026-10-11: Preserved historical evidence while refreshing the upstream proposal and resolving current-baseline/ownership conflicts. diff --git a/plans/2026-09-08-validation-lifetime.md b/plans/2026-09-08-validation-lifetime.md deleted file mode 100644 index b0ddd8a..0000000 --- a/plans/2026-09-08-validation-lifetime.md +++ /dev/null @@ -1,115 +0,0 @@ -# Scope validation state to the check that owns it - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - -Owner update (2026-09-08): the reviewed implementation and recorded validation -are approved for merge. This supersedes earlier pending-approval statements. -Full native union composition remains required through supported upstream -integration, with a later candidate allowed; limited CuPy native static support -is accepted. Current merge execution and remaining release gates are tracked in -`plans/2026-09-08-agent-workflow.md` and the production-readiness roadmap. - - - -Maintain this living ExecPlan according to `PLANS.md`. This PR implements the validation-lifetime portion of the accepted production goal and records the separate composite-union feasibility result. - -## Purpose / Big Picture - - -A failed manual check must not poison the next independent check or retain its array. A single decorated call must still share dimensions across arguments and returns and provide accurate errors. Current cached validator objects carry mutable ReplayFailureState between calls. Investigate storing call state in its live invocation rather than on shared annotation instances. - -## Progress - - -- [x] (2026-09-08) Read current memo, replay, array, tree, decorator and upstream error paths. -- [x] (2026-09-08) Opened PR #15 and reproduced eight failures in nine new regression cases. -- [x] (2026-09-08) External prototype passed existing runtime tests on exact rc0 at Python 3.10/3.14. -- [x] (2026-09-08) Demonstrated that frame lifetime does not fix native union rollback; no branch transaction callback is exposed by the inspected rc0 union generator. A04 remains a release gate. -- [x] (2026-09-08) Implemented live-frame memo ownership and removed global/cached replay state; runtime, checker, coverage and hook validation passed. -- [x] (2026-09-08) Record unresolved contract gates and obtain user validation before merge. - -## Surprises & Discoveries - - -ReplayFailureState is cached per annotation and strongly references a failed object after boolean-only composite checks. The memo uses a thread-local stack with frame tokens and bytecode positions to approximate invocation lifetime. The live frame already has stable identity through an injected local token, suggesting direct frame ownership may remove stale global state. This is a hypothesis until endpoint and diagnostic tests pass. - -## Decision Log - - -Decision: Prototype state attached to the active check frame before adopting a replacement. Rationale: avoid global references to user objects, bytecode-position bookkeeping, or guessed replay counters. Preserve explicit check_context sharing and nested call independence. Date: 2026-09-08. - -Decision: Native composite unions require a separate feasibility result. Rationale: a successful leaf can bind N before another leaf rejects its enclosing branch, and beartype owns the union's control flow. Do not pretend leaf rollback fixes whole-alternative rollback. - -## Outcomes & Retrospective - - -A03 is fixed locally. All 1,043 runtime tests pass on baseline and both exact-rc0 endpoints; all 30 current typing tests pass. The required dev tox environment passed 1,073 tests with five expected skip records and 91.31% combined coverage. Nine new lifetime cases pass, including object release and mutation. Hooks passed. A04 remains open: frame ownership provides invocation lifetime but cannot observe a native union alternative failing after a successful leaf. - -## Context and Orientation - - -Worktree `/Users/ale/Code/bearshape-worktrees/validation-lifetime`, branch `codex/validation-lifetime`, base `f43e00d`. `_memo.py` stores ShapeMemo dimension/structure bindings and explicit context stacks. `_runtime_hints.py::ReplayFailureState` stores cached failures. `_ArrayChecker`, `_ArrayLikeChecker`, and `_TreeChecker` snapshot bindings around their checks. `_decorator.py` brackets explicit calls and coroutine execution. Feature tests include tests/test_memo.py, test_decorator.py, test_numpy.py, and test_tree.py. - -## Plan of Work - - -First reproduce: two float32 vectors with lengths two and three fail `is_bearable((a,b), tuple[F32[N],F32[N]])`, after which the independent `is_bearable(b,F32[N])` must succeed. Repeat for Like and tree hints where their contracts bind the same dimension. Add weak-reference tests that discard user and traceback references, collect garbage, and require the failed array to be released without a later validation. Add valid/failing decorated and DOOR diagnostics so disabling validation cannot pass. - -In an external prototype, replace automatic memo bookkeeping with state owned by the live check frame and disable cached failure replay. Run existing runtime tests in-process so prototype monkeypatches actually apply. Verify parameter/return, tree, explicit-context, nested-call and coroutine error paths at Python 3.10 and 3.14 with rc0. Promote only a design preserving accurate violations; if diagnostic traversal creates a distinct checker invocation, identify a reliable lifetime boundary before implementation. Do not hold a frame globally or rely on generated instruction offsets. - -For union feasibility reproduce `tuple[F32[N],I32[N]] | tuple[F32[C],F32[C]]` followed by an F32[N] argument. Two length-two float arrays in the pair and a length-three final array should pass through the second alternative. Inspect rc0's native union generation and public hooks for whole-alternative transactions. Record a minimal demonstrated blocker if upstream offers no usable boundary; keep independent work moving and present a concrete contract/upstream choice before claiming A04 resolved. - -After a successful prototype, replace obsolete replay/global-stack code with the smallest private design, update behavior-based tests, remove tests specific only to retired bookkeeping, and update CHANGELOG. Preserve root optional imports and the documented intentional sharing of inherited explicit contexts. - -## Concrete Steps - - -Run targeted and full tests in the feature worktree with uv-managed environments: - - uv sync --locked - uv run --locked pytest -n 0 tests/test_memo.py tests/test_decorator.py tests/test_tree.py - uv run --locked pytest -n auto tests --ignore=tests/test_typecheck.py - uv run --locked pytest -n auto tests/test_typecheck.py - uv run --locked prek run -a - -Use existing isolated rc0 Python 3.10/3.14 environments with this worktree's source path for candidate validation. Before/after prototype logs live in the external implementation evidence directory. Record exact commands and outcomes below. - -## Validation and Acceptance - - -Independent checks of the reused object succeed after composite failure, arrays are released after their invocation ends, and valid checks remain valid while wrong dtype/shape/returns still reject with useful details. Explicit contexts, nested calls, threads, async cleanup/cancellation, and supported tree checks preserve their contract on rc0 at both endpoints. A union prototype must roll back the entire failed alternative; otherwise A04 remains an explicit release blocker. No permanent xfail or disabled check counts as a fix. - -## Idempotence and Recovery - - -Keep prototypes outside source until their promotion gate passes. Never patch installed beartype or mutate the main checkout. Revert an unsuccessful experiment in this worktree without resetting unrelated work. Preserve minimal failing probes and evidence even if their architecture is discarded. - -## Artifacts and Notes - - -Evidence directory: `/Users/ale/Code/bearshape-implementation-2026-09-08/evidence/`. Store prototype commands, missing-boundary evidence, baseline failures and final passing logs. Record any public API decision explicitly before implementing it. - -## Interfaces and Dependencies - - -Keep public check/check_context and array/tree syntax unchanged. Runtime dependencies remain beartype and typing_extensions. Per-call state must not live on cached hint definitions. Diagnostic replay must belong to the current invocation; future calls cannot be mistaken for replay. - -Revision note — 2026-09-08: Added the lifetime and union feasibility plan before experimentation. - -## Composite union feasibility result - - -The inspected exact-rc0 generator `beartype/_check/code/_pep/pep484/codepep484604union.py` expands union alternatives into native boolean expressions. Its corresponding snippets in `_data/check/code/pep/datacodepep484604.py` provide no callback entering, committing, or rolling back an entire alternative. The public instance-check and diagnostic hooks see leaves. For `tuple[F32[N], str] | tuple[F32[C], int]`, the first alternative can bind N and then fail at the plain str test without calling another bearshape validator. Resetting N at the next leaf would also erase legitimate earlier-argument bindings in other annotations. - -The external prototype independently confirms the original audit example still rejects a valid length-three final argument after a length-two successful C alternative. A03 is therefore independently fixable; A04 needs an upstream composition boundary or a deliberately accepted/enforced alternative API/contract. No upstream code was modified, no unsupported workaround was added, and no failing union test was hidden as a passing regression. This remains a production-release blocker for the promised general native-composition semantics. - -Validation evidence — 2026-09-08: `lifetime-before.log` records eight failures and one existing-success control; `lifetime-after.log` records 187 targeted passes; runtime endpoint logs each record 1,043 passes/five expected skips. `lifetime-checkers.log`: 30 passed. `lifetime-coverage.log`: 1,073 passed/five skips, 91.31% coverage. `lifetime-mutation.log`: nine passes using supported ndarray.resize on NumPy 2.5. `lifetime-hooks.log`: passed. Source shrank by removing ReplayFailureState and thread-local frame bookkeeping. - -Revision note (2026-09-08): reconciled completed milestone/hosted evidence and -explicit owner merge approval. The combined artifact, checker and GPU proofs -are in `docs/maintainers/production-readiness.md`; this update does not mark -the unresolved native-union integration or release administration complete. diff --git a/plans/2026-09-10-ownership-transfer.md b/plans/2026-09-10-ownership-transfer.md deleted file mode 100644 index ac85e00..0000000 --- a/plans/2026-09-10-ownership-transfer.md +++ /dev/null @@ -1,103 +0,0 @@ -# Restore bearshape after transfer to beartype - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - - -This ExecPlan follows `PLANS.md` and is maintained throughout this repair. - -## Purpose / Big Picture - - -Restore the documentation at https://beartype.github.io/bearshape/ and make repository links, installation metadata, and maintainer procedures use the verified new owner, `beartype/bearshape`. The user explicitly requested restoration and all repository repairs caused by the transfer on 2026-09-10. This authorizes the focused repair, merge after passing validation, and Pages deployment. It does not authorize publishing a package or changing unrelated access controls. - -## Progress - - -- [x] (2026-09-10) Confirmed repository transfer, administrator access, active Actions, workflow-based Pages, and existing main/docs deployment policy. -- [x] (2026-09-10) Updated the local origin and created `codex/ownership-transfer` in `/private/tmp/bearshape-ownership-transfer` from main `795ec39`. -- [x] (2026-09-10) Dispatched existing main Pages workflow to restore service while preparing corrected metadata. -- [x] (2026-09-10) Committed plan at `951daae` and opened PR #36 before implementation. -- [x] (2026-09-10) Corrected active links, package metadata and current maintainer guidance; preserved authorship and historical plans. -- [x] (2026-09-10) Validated rendered docs, both archives' metadata, normal hooks and visual homepage preview; initial plan push also passed runtime and four-checker hooks. -- [ ] Hosted CI on the final repair head. -- [ ] Merge repair, deploy corrected main, verify live pages/assets and clean merged worktree. - -## Surprises & Discoveries - - -GitHub reports the new Pages URL and workflow build mode, but no deployment status. The docs workflow deploys only on explicit dispatch; normal main pushes only build artifacts. Existing repository and Pages references still name the former owner. GitHub redirects transferred repository links, but does not redirect Pages sites. Actions are enabled with allowed actions set to all. The Pages environment permits main/docs. No repository Actions secrets or webhooks are configured. - -## Decision Log - - -- Decision: Restore current main immediately through the existing dispatch workflow, then deploy corrected main after validation. - Rationale: The user's first priority is a working website; the current content can be restored before correcting canonical and repository links. - Date/Author: 2026-09-10, Codex. -- Decision: Preserve authorship, copyright, historical plan transcripts, runtime APIs, dependency pins and manual publication/deployment gates. - Rationale: These do not change through a GitHub ownership transfer. Current public links and current handoff status do change. PyPI publisher identity is an external setting and must not be represented as fixed by repository edits. - Date/Author: 2026-09-10, Codex. - -## Outcomes & Retrospective - - -The initial main dispatch restored the new Pages site (HTTP 200); the old Pages address returns 404. Active documentation, repository/edit/notebook links, package metadata and local origin now identify beartype. Authorship and historical plans are unchanged. All local repair checks pass. Final hosted validation, merge and corrected-site deployment are the remaining execution steps; record their exact run URLs in PR #36. PyPI publisher trust remains external and unverified, and published 0.0.1 retains old URL metadata. The unrelated native union integration remains a release blocker. - -## Context and Orientation - - -`zensical.toml` controls the generated site URL, repository navigation and edit links. `README.md` links to hosted guides. `pyproject.toml` supplies URLs embedded in built Python packages. `docs/examples/index.md` links to the notebook. `docs/maintainers/production-readiness.md` and `CONTRIBUTING.md` describe administration and release procedures. `.github/workflows/docs.yml` builds docs on pushes and deploys on dispatch through the `github-pages` environment. `pypi.yml` uses OpenID Connect (OIDC), GitHub's short-lived identity assertion, to publish only after validation and explicit publication selection. PyPI must separately trust the new repository owner. - -## Plan of Work - - -First commit this plan and open a PR. Update active repository/Pages links to the new organization, add an explicit Documentation package URL, and update the current administrative handoff with concrete PyPI publisher fields and Pages deployment commands. Keep historical plan evidence intact. Inspect all tracked files for other owner-dependent integrations; change workflows only if an actual transfer dependency is found. - -Then build docs and inspect rendered navigation, canonical URLs, nested pages and assets. Build the source archive and build its wheel, run the existing archive validator and inspect both archives' URL metadata. Run normal hooks and rely on the full hosted shared validation matrix for Python/runtime/checker/platform coverage. Merge only once required checks pass. Dispatch docs from the merged main and verify HTTP success, expected content, correct canonical URLs and reachable assets. - -## Concrete Steps - - -Run in `/private/tmp/bearshape-ownership-transfer`: - - uv sync --locked - uv run --locked prek install - uv run --locked --only-group docs zensical build --clean - uv run --locked --only-group docs python tools/check_docs.py - uv build --sdist - uv build dist/bearshape-0.1.0rc0.tar.gz --wheel - uv run --locked python tools/check_distribution.py dist/*.whl dist/*.tar.gz - uv run --locked prek run -a - -Use `gh pr checks --repo beartype/bearshape` for the created PR. After green checks merge the exact reviewed head and run `gh workflow run docs.yml --repo beartype/bearshape --ref main`. Inspect the resulting run and fetch https://beartype.github.io/bearshape/ plus nested pages and referenced assets. - -## Validation and Acceptance - - -The live home page, static typing guide, examples and logo must return HTTP 200. Canonical and sitemap URLs must use the new Pages origin, and repository/edit/notebook links must use `beartype/bearshape`. Both wheel and source archive metadata must contain the new repository, issues and documentation URLs. Normal hooks and the hosted required validation must pass. Record external settings that cannot be verified rather than claim successful future package publication. - -## Idempotence and Recovery - - -Use the existing Pages site and environment. Dispatch can be repeated safely. Corrective commits can revert these focused link/documentation edits. Do not recreate a repository at the old owner/name because that would replace GitHub's repository redirect. Preserve other open PRs and worktrees. Only remove this worktree after the merged head is reachable from main and all evidence is committed. - -## Artifacts and Notes - - -Local validation used uv 0.11.15 with the locked environment; hosted workflows pin uv 0.11.17. Zensical built cleanly; `check_docs.py` verified rendered tables, admonitions, favicon and 93 Python 3.10 snippets. Separate archive/render inspection verified 23 pages' canonical/repository URLs, 23 sitemap URLs, and all four Project-URL fields in both archives. The copied `site/overrides/main.html` is a template asset, not a generated documentation page. Browser inspection confirmed the homepage layout and new repository identity. Normal hooks pass after wrapping the longer release command. - -The validated local wheel SHA256 is `0922f70b0fa9c79236b044bef430e85f89715dfdde586cccb0de169f3b5695c4`; source archive SHA256 is `025ded7e59d1ba17ef2bc3bd7bfbf524e1c157cd66809d6f9a0c1b1d0c3f1495`. These are repair validation artifacts, not a publication or fresh GPU validation claim. - -Initial restoration workflow: https://github.com/beartype/bearshape/actions/runs/34451065635. Base main: `795ec39`. New repository homepage already matches https://beartype.github.io/bearshape/. - -## Interfaces and Dependencies - - -Keep Zensical, locked uv, the existing artifact/Pages actions, GitHub Pages and PyPI OIDC. No runtime function signatures or dependencies change. PyPI trust must identify owner `beartype`, repository `bearshape`, workflow `pypi.yml`, environment `pypi`; no upload token is introduced. - -Revision note — 2026-09-10: Initial plan records verified transfer, restoration dispatch and the user's repair/deployment authorization. - -Revision note — 2026-09-10: Recorded PR #36, successful initial restoration, completed link/metadata edits, external PyPI limits and local validation evidence before final hosted validation and merge. diff --git a/plans/2026-10-11-audit-followup.md b/plans/2026-10-11-audit-followup.md deleted file mode 100644 index a898a33..0000000 --- a/plans/2026-10-11-audit-followup.md +++ /dev/null @@ -1,332 +0,0 @@ -# Close the combined candidate audit in focused changes - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - - -This living ExecPlan follows `PLANS.md`. Keep Progress, Surprises & Discoveries, -Decision Log, and Outcomes & Retrospective current. It extends the reviewed -release and union plans already in this branch. - -## Purpose / Big Picture - - -Users must receive correct shape contracts even when they combine arithmetic, -broadcast dimensions, Tree predicates, ragged trees and custom array protocols. -The combined candidate audit at 89d84268cf500f576bd0f784df8912c6f5af5d5c found -six local gaps despite 1,262 passing installed tests per Python endpoint. Close -those gaps with failing-first regressions, then reduce measured overhead and -complete release CI and developer documentation. Keep Python 3.11–3.14 and -released beartype 0.23.1 as the baseline while separately validating the local -upstream proposal. The subsequent owner instruction on 11 October 2026 -authorizes merging the validated stack, verifying main and cleaning merged -branches/worktrees while preserving every reviewed commit. Publication, -deployment and maintainer contact remain unauthorized. - -## Progress - - -- [x] (2026-10-11) Audited the combined head, including all thirteen open PR heads; - retained 23 failing audit cases, a 676-case broadcast matrix and raw evidence. -- [x] (2026-10-11) Owner authorized all audit fixes in focused PRs, correctness - before optimization and CI/docs; explicitly prohibited publishing/contact. -- [x] (2026-10-11) M1: PR #48 preserves grouping with 64 arithmetic table cases - and three public decorator-mode regressions; failing-first evidence retained. - Dimension/NumPy suites pass with only platform precision skips. -- [x] (2026-10-11) M2: PR #49 retains strict variadic targets. Five new tests - failed first; the 676-pair matrix, equal-shape transition and public decorator/ - return checks now pass. The minimal consumer also checks strict transitions. -- [x] (2026-10-11) M3: PR #50 uses a public beartype leaf wrapper with - explicit memo ownership. All 12 isolation cases failed first, then passed; - cross-leaf/outer Value, parameter/return, exception rollback and lifetime tests - pass. Tree/JAX baseline suites pass; 189 Tree/proposal source tests pass with - the optimized upstream patch. Exact installed validation follows in M9. -- [x] (2026-10-11) M4: PR #51 checks suffixes on every terminal path. - Twenty-two paired-backend cases cover valid/mismatching ragged shapes, - multi-name suffixes, empty containers, shared bindings and rollback. Tree/JAX - suites pass. Rendered docs and all 94 Python snippets validate; changed - paragraphs were inspected in the generated HTML. -- [x] (2026-10-11) M5: PR #52 normalizes strict, trusted Like and converted - shapes and contains ordinary metadata exceptions. Twenty new cases include - four malformed shapes, nine failing properties, converter-owned inspection, - integer-index axes and cancellation. Failing-first evidence retained; NumPy, - JAX, Torch and edge suites pass. Minimal consumer checks negative metadata. -- [x] (2026-10-11) M6: PR #53 uses weak keys in the root Like trust cache. - Both lifetime regressions failed first; all 64 temporary protocol/native - classes now collect, while stable native positive/negative checks still pass. - The NumPy suite passes with only platform precision skips. -- [x] (2026-10-11) M7: PR #54 keeps Value binding lazy and directly reuses - owned array leaf validators, retaining all snapshots. Four optimization - guards failed first; expanded nested rejection, fresh metadata and seven - composition guards pass. Full runtime/four-checker push hooks pass. Matched - installed measurements on 3.11/3.14 with both released/proposed beartype show - strict checks about 44–62% faster and Tree/100 about 50–61% faster. Raw samples, - construction costs, limitations and hashes are in - `tools/evidence/2026-10-11-audit-performance/`. -- [x] (2026-10-11) M8: PR #55 collects all four composition modules, - adds the separate compatible-dependency nightly canary and tests its strict - preflight boundary. Native custom/Structured alias consumers pass all four - checkers, including explicit consumer-root resolution for Pyrefly. Current - changelog/handoff and developer release guidance are refreshed. Normal hooks, - actionlint, rendered docs/95 snippets and all 29 notebook cells pass. -- [x] (2026-10-11) M9: `codex/audit-integration-review` preserves all 21 - open PR heads. Both Python endpoints pass 1,300 normally installed baseline - tests and 1,427 proposal tests, plus the original 23 audit regressions with - each dependency. Fresh minimal environments, 91.10% branch coverage, normal - hooks, actionlint, rendered docs and both notebook endpoints pass. All eight - focused PR heads have 36 successful hosted checks; both new hosted dependency - canaries pass. Exact identities and remaining release prerequisites follow. -- [x] (2026-10-11) Owner approved merging the validated stack with all reviewed - commits preserved, followed by main verification and merged-worktree cleanup. - The closeout record is retained outside worktrees in `build/merge-closeout/`. -- [ ] External: supported upstream release, approved repository/PyPI controls, - exact final CUDA evidence and separately authorized publication. - -## Surprises & Discoveries - - -The audit's 23 new cases fail on both installed Python endpoints while existing -suites pass. Arithmetic, mixed variadics and Tree ownership also fail with the -published dependency, independently of the proposed upstream protocol. Current -release CI runs the original 22 union cases but omits 40 later scope cases. - -Hosted NumPy-only lanes exposed a misplaced Tree optimization guard, which -required optree. Move that guard into the Tree module and retain independent -strict/Like guards in the NumPy-compatible memo suite; no test is removed. - -Installed proposal consumers inside a checkout exposed Pyrefly loading different -ancestor configurations for dependency files. Pin its configuration to the copied -consumer pyproject, alongside the consumer search root and selected interpreter. -The failing positive dtype-identity consumer remains unchanged. - -## Decision Log - - -Decision: use a stack of focused branches/worktrees starting at PR #47, with a -plan commit and draft PR before each implementation. Each PR states its actual -base and focused scope. Rationale: the candidate already contains reviewed, -unmerged work; preserve that ancestry and avoid merging into an active PR's base -before approval. Date/author: 2026-10-11, Codex. - -Decision: preserve the documented leaf-adjacent meaning of Tree suffixes and -retain valid ragged trees. Strict variadics remain exact once established. -Rationale: the owner accepted the audit recommendations and requested preserved -functionality; silently weakening constraints or rejecting all ragged trees -would not meet that request. Date/author: 2026-10-11, Codex. - -Decision: keep unsupported upstream adoption and owner-controlled publication -settings explicit. Rationale: patches do not constitute a published dependency, -and the missing environment reviewer and private publisher identity cannot be -invented. Date/author: 2026-10-11, Codex. - -Decision: merge approved stacked heads into their actual bases without rewriting -commits, then merge the complete integration PR into main. Verify every saved -review head is reachable, main's CI and archive identity, and preserve ignored -evidence before removing only clean merged worktrees and branches. Replace live -links to disposable branches with durable destinations. Rationale: explicit -owner approval now covers merge and cleanup, but not publication or contact. -Date/author: 2026-10-11, Codex. - -## Outcomes & Retrospective - - -The six correctness fixes, measured optimizations and CI/docs work are implemented -in PRs #48–#55. No additional public feature was necessary. Nothing has been -merged at the pre-merge review recorded below. Merge and cleanup are now -authorized and their final evidence belongs in `build/merge-closeout/`. Nothing -has been published or deployed; the upstream proposal has not been sent. Local -and hosted CPU evidence is complete for the tested implementation below. Release -readiness remains withheld for the supported upstream dependency, fresh CUDA -evidence and owner-controlled prerequisites. - -### Final implementation validation - -Tested implementation: `dc3c58a936959440bbfb12fc8e45a536ba49e67f` (PR #55). -The separate integration branch includes every original PR head (#32, #34, #35, -#38–#47) and every audit-fix head (#48–#55). Main remains -`c0874f34615ca3797b24601a91324f3c9beb462a`. Later plan/handoff-only commits do not -change the package or copied consumer tests; verify identical archives when -building them. - -- Source-derived bearshape wheel SHA256: - `1e0bf25f4ad018d661d28b84a9136ade8f4f809a5c54c745a213c22d52284897`. -- Source archive SHA256: - `cb30f2b46cdec4e602fdeeff7372c1be9185cb43bdfe43cc33ed63f47d931527`. -- Published beartype 0.23.1 wheel SHA256: - `4461b4dc57e3fdd6c8a8464b22cf118002eea107c33e9fef651c69068ab3cce3`. -- Unchanged proposal beartype wheel SHA256: - `0580ede1fe87229728b42674d45fb8c32ce09a7e348f962cc2741304ef2f10d8`. - -`check_installed.py` passes 1,300 cases on CPython 3.11.15 and 3.14.5 with -published beartype. `check_upstream_proposal.py` applies the hash-checked series -to clean pinned source, builds normal installs, verifies origins, and passes -1,427 cases on both endpoints: those baseline cases plus 69 bearshape composition -cases and 58 upstream protocol/mixin cases. Both routes include all four static -engines' positive, negative and inference consumers. The five skips are the -missing CuPy module and four platform extended-precision cases; none is union -or scope validation. - -All 23 original audit regressions pass on each endpoint with both published and -proposed beartype. Fresh minimal venvs contain only the candidate and declared -runtime dependencies, pass custom/variadic checks, and import no optional backend. -Source runtime coverage is 91.10%, above the unchanged 90% floor. Normal hooks, -actionlint, all 95 documentation snippets, changed rendered structures and all -29 notebook cells on each endpoint pass. The final wheel is byte-identical to -the measured optimized wheel, so the committed performance evidence applies. - -The complete published-dependency release suite still fails honestly: 58 failures -and 11 passes out of 69 cases on each endpoint, plus the original failing probe. -No case is hidden, skipped or marked xfail. The proposal passes all of them. -The validation-only release run uses `publish=false`: -[expanded release gate](https://github.com/beartype/bearshape/actions/runs/38170318585). -Its conclusion and exact job evidence are retained in the local review packet; -a deliberately blocked run is not release readiness. - -[PR CI](https://github.com/beartype/bearshape/actions/runs/38170264797) and -[proposal CI](https://github.com/beartype/bearshape/actions/runs/38170264778) -provide 36 successful checks on the implementation head. The two new -[dependency canaries](https://github.com/beartype/bearshape/actions/runs/38170316908) -pass and retain resolved locks, versions and test output. Local full logs, -archive identities, original regressions and administrative snapshots are in the -ignored `build/audit-followup/` review packet. - -## Context and Orientation - - -`src/bearshape/_dimensions.py` formats runtime and symbolic expressions; -`src/bearshape/_shape.py` binds and compares dimensions. `src/bearshape/_memo.py` -resolves per-invocation state; at the audited baseline, `_tree.py` pushed an -unconditional memo while checking leaves. That shared intended leaf state but -also captured independent public checks. `_array_types.py` validates strict/Like -metadata and held a strong class-keyed trust cache at that baseline. Backend -modules expose runtime factories and checker-only native aliases. `tools/upstream/` contains unshipped integration -patches and tests, distinct from ordinary baseline tests in `tests/`. - -The candidate remains 0.1.0rc1. `docs/maintainers/production-readiness.md` contains -historical evidence that must remain dated. `docs/maintainers/releasing.md` owns -future publication instructions; `.github/workflows/validate.yml` shares normal -validation and `pypi.yml` adds the release contract and immutable artifact gate. - -## Plan of Work - - -M1 groups each expression operand and unary operand without changing public -syntax or losing Value scope. Add arithmetic table cases and decorated positive/ -negative consumers in `tests/test_dimensions.py` and `tests/test_numpy.py`. -Observe size=2 accepting `(size+1)*2 == 6`, rejecting 4, and `(-N)**2` accepting 4 -when N=2. Update the changelog, then validate before committing the implementation. - -M2 corrects `_check_variadic`: equal-shape matches retain stricter constraints; -broadcast-only bindings may accumulate a common target, but a strict occurrence -fixes that target. Add both-order pairs and strict/broadcast/strict transitions, -zero axes, rank differences, returns and the no-optional-backend smoke check. - -M3 replaces Tree's unconditional context with ownership limited to intended leaf -checking. Prototype using a public beartype-decorated leaf checker whose code is -known, so explicit memo ownership can distinguish it from nested independent -checks. Preserve composite leaves and original outer Value arguments. Validate -both tree backends, decorator modes, DOOR, aliases, errors, rollback and lifetimes -against released and proposed upstream. Do not modify upstream internals. - -M4 traverses suffix constraints relative to leaf-adjacent containers, not just -the globally deepest breadth-first layer. Validate matching and differing ragged -branches, several suffix names, empty containers and backend agreement. Clarify -mixed-depth examples in `docs/features/tree-annotations.md`. - -M5 normalizes custom metadata with integer-index dimensions and nonnegative -sizes, preserves ordinary diagnostic failures, and avoids accessing untrusted -input properties before a selected converter. Catch ordinary metadata exceptions -without swallowing BaseException/cancellation. Preserve original arguments and -avoid optional backend imports for strict custom arrays. - -M6 removes strong ownership of transient classes in the root Like fast-path -cache, with collection and native-path regressions. Do not conflate this cache -with annotation identity caches or introduce arbitrary value caching. - -M7 profiles the corrected candidate first. Avoid binding arguments in annotations -without Value expressions, and reduce repeated Tree leaf setup only through a -safe owned path. Precompute invariant annotation work if measurements justify it. -Retain snapshots, all-leaf traversal, dtype freshness, exception semantics and -weak-reference evidence. Compare matched normal installs on the same interpreter -and keep raw benchmark samples; timing is not a CI pass threshold. - -M8 runs all composition/scope tests as a release gate on the exact installed -wheel and normally available dependency. A separate proposal test remains useful -but cannot authorize publication. Add a separate dependency-upgrade canary if it -can keep the locked release lane deterministic. Add tested native TYPE_CHECKING -alias recipes for custom factories and Structured, refresh current evidence and -consolidate the Unreleased changelog without altering historical plans. - -M9 builds an integration review branch preserving all focused heads, validates -combined source and normally installed archives, and records hashes, versions, -commands and results. Verify the published union blocker still fails honestly. -Prepare concrete administrative settings and exact-wheel GPU commands for later -owner action; do not claim older GPU results cover new state code. - -## Concrete Steps - - -Use uv 0.11.17 (the existing local tool executable) from each worktree root: - - uv sync --locked - uv run --locked prek install - uv run --locked pytest tests/ --ignore=tests/test_typecheck.py -n auto - uv run --locked pytest tests/test_typecheck.py -q - uv run --locked prek run -a - uv run --locked prek run actionlint -a --stage manual - -Run new regressions before editing implementation; save failing logs outside the -worktree. Stage new files before normal hooks. Real pre-push hooks run runtime -and checker validation. Follow `CONTRIBUTING.md`/`tools/README.md` for docs, -notebook, exact archives and minimal consumers. For patched upstream, follow -`tools/check_upstream_proposal.py` with clean source at the series base and fresh -output directories; invoke the created interpreter directly, never uv run that -would replace the patched dependency. Record hosted checks for each exact head. - -## Validation and Acceptance - - -All 23 original audit regressions must pass after their fixes, alongside expanded -positive/negative cases and the existing CPU/four-checker suite. Array shapes, -Value scope, scalar/Like behavior and Tree registration remain intact. Rejected -alternatives and exceptions restore state; independent checks do not capture -Tree state; temporary classes and arrays can be collected. Root imports remain -backend-free. Optimizations must pass the same correctness suite and have matched -measurement evidence. Release gates must include the newer scope tests and fail -closed on the still-unsupported published dependency. - -## Idempotence and Recovery - - -Keep main and existing PR heads intact. Every branch is additive, prefixed codex, -and backed by a matching worktree. Do not overwrite earlier artifact evidence, -force-push main, bypass hooks, suppress diagnostics or turn failures into xfails. -Use a new output directory if an artifact build fails partway. Git tooling across -repositories clears hook-local variables through the existing git_environment -helper. Owner-controlled settings remain pending until explicitly configured and -verified; absence of a reviewer decision is not permission to bypass approval. - -## Artifacts and Notes - - -Original evidence lives in the main checkout's ignored -`build/full-audit-2026-10-11/`. New logs, exact archives, hashes and measurements -live in `build/audit-followup/` outside disposable worktrees. Record summary -results in this plan so repository reviewers do not depend on local files. - -## Interfaces and Dependencies - - -Keep the public annotation API, supported backends/checkers and beartype 0.23.1 -baseline. Use existing runtime validators, ShapeMemo snapshots, public beartype -entry points and the optional public scope adapter. No monkeypatch, bytecode -inference, replacement type checker or new public feature is part of this plan. - -Revision 2026-10-11: initial authorized follow-up plan, with separate correctness, -optimization and release-documentation milestones and explicit external limits. - -Revision 2026-10-11: record explicit merge/verification/cleanup approval and -keep branch-deletion-safe evidence links; publication and contact remain separate. diff --git a/plans/2026-10-11-converter-validation.md b/plans/2026-10-11-converter-validation.md deleted file mode 100644 index d1341c0..0000000 --- a/plans/2026-10-11-converter-validation.md +++ /dev/null @@ -1,85 +0,0 @@ -# Reject malformed custom Like converter results - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - - -This living ExecPlan follows `PLANS.md` and M2 of `plans/2026-10-11-release-readiness.md`. The program plan supplies the full release contract; this focused change is stacked on baseline PR #39. - -## Purpose / Big Picture - - -A converter returning None currently shares the validation-success sentinel and accepts arbitrary inputs. Validate converted shape/dtype metadata in `src/bearshape/_array_types.py::_convert` before `_validate` can report success. Reject None and malformed results with useful conversion errors, preserve the selected converter and caller argument, and cover DOOR, decorated checks, diagnostics and memo rollback in `tests/test_numpy.py`. Correct the factory docstring claiming a NumPy fallback. - -## Progress - - -- [x] (2026-10-11) Reproduced the defect during the whole-library audit; created the focused branch and plan. -- [x] (2026-10-11) Commit plan and open draft PR before implementation. -- [x] (2026-10-11) Add a failing behavioral regression, implement the surgical fix and update CHANGELOG. -- [x] (2026-10-11) Focused tests and normal hooks passed; complete runtime/four-checker pre-push validation is recorded in the finish log. - -## Surprises & Discoveries - - -The October audit reproducer demonstrates this defect on both earlier rc0 and released beartype 0.23.1. It is independent of the native composite-union upstream blocker. - -## Decision Log - - -Decision: Preserve public syntax, successful behavior and useful errors; fix only this demonstrated correctness defect. Rationale: the owner requested every audit finding be addressed in focused PRs on Python 3.11+ and beartype 0.23.1. Author/date: owner/Codex, 2026-10-11. - -## Outcomes & Retrospective - - -Seven failures and one pass before; 367 passed with two platform skips after in NumPy/coverage-edge tests. Full runtime and checker validation is enforced by the real pre-push hooks; hosted integration evidence remains pending. This PR does not authorize merging or publishing and does not claim to fix native union transactions. - -## Context and Orientation - - -The implementation and test locations are named above. Array and tree leaves use invocation-local `ShapeMemo` state from `src/bearshape/_memo.py`; failed leaf checks and diagnostic formatting must restore state. Root imports must remain free of NumPy/JAX/Torch/CuPy/optree. The baseline is `codex/python311-beartype0231`, with all four static consumer engines retained. - -## Plan of Work - - -First add a regression exercising the audited invalid behavior and run it against unchanged source. Save the failure under the main checkout's ignored `build/release-2026-10-11/evidence/`. Make the smallest source change described above, retaining the surrounding validation and state lifetime contract. Add positive/negative neighboring cases where the new branch needs proof, then run the focused modules. Update CHANGELOG and this plan, stage new files before hooks, review formatter changes and commit/push the concrete result. - -## Concrete Steps - - -From this worktree with uv 0.11.17 on PATH: - - uv sync --locked - uv run --locked prek install - uv run --locked pytest tests/test_numpy.py tests/test_coverage_edges.py -n 0 - uv run --locked pytest tests/test_typecheck.py -q - uv run --locked prek run -a - -Real pre-push hooks also run the complete runtime and four-checker suites. Archive, platform and CUDA evidence will be refreshed on the combined integration branch. - -## Validation and Acceptance - - -The audited reproducer fails before and passes after the source fix. Neighboring valid forms remain valid and wrong shapes/types still reject with useful errors. Existing memo rollback/lifetime and static inference tests remain effective. No xfail, suppression, lowered coverage or optional-backend import is introduced. Detailed scope and acceptance cases are stated in Purpose above. - -## Idempotence and Recovery - - -Use the matching isolated worktree/environment. Do not modify main or existing unmerged PR branches. Keep evidence outside disposable worktrees. Do not publish, deploy or send maintainer messages. Re-running the tests is safe. - -## Artifacts and Notes - - -Original audit evidence is `/Users/ale/Code/bearshape/build/audit-2026-10-11/`. New logs belong under `build/release-2026-10-11/evidence/` in that same main checkout. Append meaningful results and source identities after implementation. - -## Interfaces and Dependencies - - -No new runtime dependency or public API. Retain Python 3.11–3.14, exact tested beartype 0.23.1, existing backend semantics and the four supported checker engines. Dimensions remain runtime constraints rather than static shape proofs. - -Revision note — 2026-10-11: Created the focused regression/fix plan before implementation. - -Revision note — 2026-10-11: Recorded before/after regression evidence and the surgical fix. Real commit/push hooks remain required before the implementation head is delivered. diff --git a/plans/2026-10-11-dtype-normalization.md b/plans/2026-10-11-dtype-normalization.md deleted file mode 100644 index 8dbf85a..0000000 --- a/plans/2026-10-11-dtype-normalization.md +++ /dev/null @@ -1,180 +0,0 @@ -# Normalize builtin dtypes without retaining checked objects - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - -## Purpose / Big Picture - -Continue the approved audit optimizations from main `28e885837e61705d3d3295463874c3e0acf35ca8`. -Lazy Value arguments and owned Tree leaf validation are already merged. The -remaining profile shows NumPy dtype.name calculation consuming significant time -for every array and every Tree leaf. Normalize known builtin dtype classes once, -while reading each checked object's current dtype on every invocation. Keep -custom/extension dtype protocols, metadata errors, structured comparisons and -byte order unchanged. A separate PR will prepare invariant shape traversal. - -## Progress - -- [x] Compare the remaining validation worktree with main and preserve evidence. -- [x] Confirm both parents and both conflict resolutions already exist in main; - remove the obsolete clean worktree and branch after verifying the history bundle. -- [x] Record current main profile and this plan before implementation. -- [x] Open the focused PR, add regression guards, then implement normalization. -- [x] Run source/installed/checker/minimal/proposal validation on Python endpoints. -- [x] Record matched installed benchmarks and final evidence; request review. - -## Surprises & Discoveries - -The old validation head c53d14f contains only a merge of two existing parents. -Its conflict resolutions join existing tests and changelog bullets; no unique -runtime behavior remains. Its complete history is in the verified -`build/merge-closeout/post-merge-history.bundle`. Generated docs, environment -versions and the comparison are in `build/remaining-optimization/cleanup/`. - -The existing profile records 200,000 dtype.name calculations for 1,000 checks -of a 100-leaf input and return. Timing claims require new matched installations; -profile attribution alone is not a speedup measurement. - -## Decision Log - -- 2026-10-11: Optimize identities of known immutable builtin NumPy dtype classes, - never arbitrary dtype instances, class names, checked values or their results. - Root imports stay backend-free; custom properties remain live. This is a - measured hotspot, not authorization for general caching or new syntax. -- Keep the published beartype 0.23.1 baseline and the separate upstream proposal. - Reassess the remaining ordinary forward-reference cost without broadening the - code-factory contract or changing reference invalidation/exception timing. - -## Outcomes & Retrospective - -Implementation and local validation are complete; the focused PR remains open for review. Release readiness remains withheld; no publication, -upstream communication or repository administration is part of this work. - -## Context and Orientation - -`src/bearshape/_dtypes.py` extracts canonical names and matches DtypeSpec. -Strict arrays and Like checks share it; Tree's owned leaf path delegates to -those same checks. `tests/test_dtypes.py` covers builtin and extension dtype -behavior. `tools/benchmark_runtime.py` measures native controls, strict/Like, -Value and complete Tree traversal. Historical scope improvements are recorded -in `tools/evidence/2026-10-11-audit-performance/`; compare this change to main, -not to the older pre-optimization baseline. - -## Plan of Work - -Add guards for mutable custom dtype properties, spoofed class names, fresh array -dtype changes, extension dtype fallback and release of user objects held by dtype -metadata. Only builtin class identities may have prepared canonical names; no -checked object or dtype instance may enter persistent state. Extend benchmarks -with representative normalization/casting controls, use the same script on both -sides, and record raw timings plus wheel hashes. Evaluate a direct loop for Like -casting only if it removes measured repeated setup without changing targets or -exception handling. Do not add an unsupported target cache. - -## Concrete Steps - -From this worktree use locked uv 0.11.17: `uv sync --locked`, then -`uv run --locked prek install`. Add and exercise focused tests before changing -runtime code where practical. Run the standard runtime and four-checker routes, -normal hooks, normal installed-wheel consumers and fresh minimal consumers. -Use `tools/check_upstream_proposal.py` on clean pinned beartype sources for the -full composition contract at Python 3.11 and 3.14. Preserve commands and hashes. - -## Validation and Acceptance - -Every current passing behavior remains passing, including mutable metadata, -custom dtype access, all Tree leaves/snapshots, rollback and object collection. -Known builtin normalization avoids repeated name calculation, while fake or -extension dtype classes remain on their original protocol path. Installed -benchmarks must demonstrate improvement without hiding ordinary controls, -construction costs, conversion scaling or unfavorable cases. No CI timing gate. - -## Idempotence and Recovery - -Keep main unchanged and work on codex/dtype-normalization. The obsolete worktree -can be recovered from its verified Git bundle. Fresh benchmark environments and -outputs may be regenerated from pinned artifacts. Revert an optimization if -semantic preservation or its performance value cannot be demonstrated. - -## Artifacts and Notes - -Local cleanup evidence: `build/remaining-optimization/cleanup/assessment.json`. -Current runtime source is main 28e8858; prior released/proposal test results are -historical until validation of this changed wheel completes. - -## Interfaces and Dependencies - -No public API, annotation spelling, Python range or dependency change. -Use existing DtypeSpec, array checker and backend boundaries. Do not retain -user-defined classes/objects in a new cache. Keep 2-space Python indentation. - -Revision note — 2026-10-11: Created before implementation for the approved -remaining optimization work. - - -## Completed validation and review evidence - -The final runtime heads are dtype `6ae31a27fd5a2a95991c29433585cd342f47a1a0` -and shape `4c0a65be3ae737c13d82944b1c0592cd343cbe10`. The isolated combined -head `e5eddd6aa0cab07a35e1ed4b25c00b2f6dade5cf` preserves both histories. -Each focused implementation passed runtime tests and all four checker suites; -both PRs passed all 36 hosted checks at those implementation heads. Later -documentation commits rerun normal hooks and hosted checks without changing -runtime artifacts. - -The combined wheel passes 1,323 normally installed baseline tests and 1,450 -proposal tests per endpoint (CPython 3.11.15 and 3.14.5), including all four -consumer checkers, 69 composition cases and 58 upstream protocol/scope/mixin -cases. The original union probe passes with the proposal. Source coverage is -91.23%. Minimal installed consumers pass without optional backends. Documentation -build/render checks and 95 snippets pass. Five local skips cover absent CuPy -and platform-specific extended precision, not union behavior. - -Matched 5,000-call, nine-repeat measurements compare main, each PR independently, -and their combination with released and proposal dependencies. They run -sequentially on the same local host with identical normally installed inputs, -reversing variant order on 3.14. Cold initialization uses 13 fresh subprocesses; -root-only and ordinary beartype controls are recorded separately. The complete -report, hashes, methods and raw samples are in PR #56 under -`tools/evidence/2026-10-11-remaining-optimization/`. Local commands, logs and -exact archives are preserved in the main checkout's ignored -`build/remaining-optimization/`. - -The dtype implementation retains only known builtin class identities and names, -not dtype instances or checked values. Review caught custom metaclass hashing -and root-only string overhead; both have focused guards and are resolved in the -final head. Shape preparation retains only annotation layout and preserves -prefix/suffix/middle ordering, live Value scopes and every Tree snapshot. -An extra upstream lookup cache was rejected after isolated measurements showed -only about 20 ns best-case savings on 3.11 and a slowdown on 3.14, before cache -maintenance costs. The upstream patch series is unchanged. - -Main remains at 28e8858. The old validation worktree was removed only after -checking its conflict resolutions and parent reachability and preserving its -complete Git history plus generated documentation. The new validation checkout -is relevant to these still-open PRs. No publication, upstream contact or -repository administration has occurred. The published dependency still lacks -full union rollback; approved release controls and exact-wheel CUDA evidence -remain external release prerequisites. - -Revision note — 2026-10-11: Record the finished implementation, protocol guards, -matched performance tradeoffs and final installed validation; keep merge state -and release readiness distinct. - - -## Merge closeout — 12 October 2026 - -PR #56 is merged at main a475c9b5376601eb39c9e0641f16f62d56fed979. -The combined history preserves all 14 reviewed commits, including conflict -resolutions. Main passed 1,315 runtime tests, eight checker tests, 34 hosted CI -jobs and both proposal jobs; documentation built with deployment skipped. -The source/wheel matched the reviewed artifacts exactly. All three clean -optimization worktrees were archived and their local/remote branches removed -after preserving evidence. The earlier open-review statements above are dated -history. Release prerequisites remain outstanding; nothing was published. - -Revision note — 2026-10-12: Append verified merge and cleanup status without -rewriting the original implementation evidence. diff --git a/plans/2026-10-11-nested-value.md b/plans/2026-10-11-nested-value.md deleted file mode 100644 index 360925e..0000000 --- a/plans/2026-10-11-nested-value.md +++ /dev/null @@ -1,85 +0,0 @@ -# Preserve scope in nested Value arithmetic - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - - -This living ExecPlan follows `PLANS.md` and M2 of `plans/2026-10-11-release-readiness.md`. The program plan supplies the full release contract; this focused change is stacked on baseline PR #39. - -## Purpose / Big Picture - - -`N + (Value("size") + 1)` currently becomes a dimension-only expression and fails to resolve size. Recognize `_ValueExpr` in `src/bearshape/_dimensions.py::_binop` so all derived runtime expressions retain scope. Preserve all operators, operand orders and public annotations. Add nested arithmetic, unary, attribute and parameter/return positive and negative cases in `tests/test_dimensions.py` and `tests/test_numpy.py`. - -## Progress - - -- [x] (2026-10-11) Reproduced the defect during the whole-library audit; created the focused branch and plan. -- [x] (2026-10-11) Commit plan and open draft PR before implementation. -- [x] (2026-10-11) Add a failing behavioral regression, implement the surgical fix and update CHANGELOG. -- [x] (2026-10-11) Focused tests and normal hooks passed; complete runtime/four-checker pre-push validation is recorded in the finish log. - -## Surprises & Discoveries - - -The October audit reproducer demonstrates this defect on both earlier rc0 and released beartype 0.23.1. It is independent of the native composite-union upstream blocker. - -## Decision Log - - -Decision: Preserve public syntax, successful behavior and useful errors; fix only this demonstrated correctness defect. Rationale: the owner requested every audit finding be addressed in focused PRs on Python 3.11+ and beartype 0.23.1. Author/date: owner/Codex, 2026-10-11. - -## Outcomes & Retrospective - - -10 failures and one pass before; 431 passed with two platform skips after in dimension/NumPy tests. Full runtime and checker validation is enforced by the real pre-push hooks; hosted integration evidence remains pending. This PR does not authorize merging or publishing and does not claim to fix native union transactions. - -## Context and Orientation - - -The implementation and test locations are named above. Array and tree leaves use invocation-local `ShapeMemo` state from `src/bearshape/_memo.py`; failed leaf checks and diagnostic formatting must restore state. Root imports must remain free of NumPy/JAX/Torch/CuPy/optree. The baseline is `codex/python311-beartype0231`, with all four static consumer engines retained. - -## Plan of Work - - -First add a regression exercising the audited invalid behavior and run it against unchanged source. Save the failure under the main checkout's ignored `build/release-2026-10-11/evidence/`. Make the smallest source change described above, retaining the surrounding validation and state lifetime contract. Add positive/negative neighboring cases where the new branch needs proof, then run the focused modules. Update CHANGELOG and this plan, stage new files before hooks, review formatter changes and commit/push the concrete result. - -## Concrete Steps - - -From this worktree with uv 0.11.17 on PATH: - - uv sync --locked - uv run --locked prek install - uv run --locked pytest tests/test_dimensions.py tests/test_numpy.py -n 0 - uv run --locked pytest tests/test_typecheck.py -q - uv run --locked prek run -a - -Real pre-push hooks also run the complete runtime and four-checker suites. Archive, platform and CUDA evidence will be refreshed on the combined integration branch. - -## Validation and Acceptance - - -The audited reproducer fails before and passes after the source fix. Neighboring valid forms remain valid and wrong shapes/types still reject with useful errors. Existing memo rollback/lifetime and static inference tests remain effective. No xfail, suppression, lowered coverage or optional-backend import is introduced. Detailed scope and acceptance cases are stated in Purpose above. - -## Idempotence and Recovery - - -Use the matching isolated worktree/environment. Do not modify main or existing unmerged PR branches. Keep evidence outside disposable worktrees. Do not publish, deploy or send maintainer messages. Re-running the tests is safe. - -## Artifacts and Notes - - -Original audit evidence is `/Users/ale/Code/bearshape/build/audit-2026-10-11/`. New logs belong under `build/release-2026-10-11/evidence/` in that same main checkout. Append meaningful results and source identities after implementation. - -## Interfaces and Dependencies - - -No new runtime dependency or public API. Retain Python 3.11–3.14, exact tested beartype 0.23.1, existing backend semantics and the four supported checker engines. Dimensions remain runtime constraints rather than static shape proofs. - -Revision note — 2026-10-11: Created the focused regression/fix plan before implementation. - -Revision note — 2026-10-11: Recorded before/after regression evidence and the surgical fix. Real commit/push hooks remain required before the implementation head is delivered. diff --git a/plans/2026-10-11-python311-beartype0231.md b/plans/2026-10-11-python311-beartype0231.md deleted file mode 100644 index 78a0789..0000000 --- a/plans/2026-10-11-python311-beartype0231.md +++ /dev/null @@ -1,93 +0,0 @@ -# Adopt Python 3.11 and beartype 0.23.1 coherently - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - - -This living ExecPlan follows `PLANS.md` and milestone M1 of `plans/2026-10-11-release-readiness.md`, which supplies the full release contract and audit context. - -## Purpose / Big Picture - - -Users and developers should install and validate the same released dependency combination. Require Python >=3.11 and beartype >=0.23.1,<0.24, test exact 0.23.1 on supported Python 3.11–3.14, and preserve every existing backend and checker lane. This is the owner's explicit baseline decision, not a claim that released beartype fixes union rollback. - -## Progress - - -- [x] (2026-10-11) Inspected every active version reference and created the branch before implementation. -- [x] (2026-10-11) Commit plan and open draft PR against the program-plan branch. -- [x] (2026-10-11) Align metadata, lock, tools, tox, CI, hook and checker targets and current docs. -- [x] (2026-10-11) Add released-beartype compatibility regressions and canonical environment path checks. -- [x] (2026-10-11) Validate source/checker endpoints, four backend floors, hooks, actionlint and rendered docs; evidence in main build/release-2026-10-11/evidence/. - -## Surprises & Discoveries - - -The previous exact rc0 preflight would reject a valid 0.23.1 installation despite the broad metadata range. Existing minimal and installed checks compare a resolved package path with an unresolved environment prefix, failing on macOS's `/tmp` alias. - -## Decision Log - - -Decision: Retain uv 0.11.17 and existing backend/checker floors while moving the Python floor and beartype together. Rationale: avoid an unrelated toolchain upgrade and prove the retained compatibility contract. Owner authorized the baseline on 2026-10-11. - -Decision: Preserve historical plans and dated performance/GPU evidence verbatim. Update the handoff's current status and supported matrix only. Rationale: old measurements do not prove the new candidate. Author/date: Codex, 2026-10-11. - -## Outcomes & Retrospective - - -Implemented in PR #39, stacked on planning PR #38. Python 3.11 runtime: 1,097 passed, five platform/CuPy skips, 91.58% branch-aware coverage. All eight checker harness cases passed. Python 3.14 full suite: 1,105 passed with the same five skips. All four minimum backend tox lanes installed and passed. Normal hooks, actionlint, docs build and rendered checks passed (94 Python 3.11 snippets). Ruff migrated five imports to their Python 3.11 standard-library equivalents; no diagnostics or negative fixtures were removed. Full native composite-union rollback remains a separate upstream-dependent release blocker. - -## Context and Orientation - - -`pyproject.toml` owns package dependency/interpreter metadata and three checker defaults. `ty.toml`, `ruff.toml`, `.python-version` and `.pre-commit-config.yaml` provide other defaults. `tox.toml` names interpreter/dependency/backend combinations; `tools/validate_tox_env.py` rejects invalid names, and `tools/validate_runtime.py` checks installed modules. `.github/workflows/validate.yml` is reused by CI/nightly/candidates. `tools/check_installed.py` tests the normal wheel outside source; `tools/smoke_minimal.py` proves optional dependencies are absent. Docs snippet parsing lives in `tools/check_docs.py`. - -## Plan of Work - - -Replace current 3.10 floor references with 3.11, remove the redundant 3.10 entries rather than duplicating 3.11, and rename bt023rc0 tox factors to bt0231. Set every exact beartype test installation to 0.23.1 and metadata to >=0.23.1,<0.24. Regenerate the lock, retaining other locked versions where possible. Canonicalize both sides of origin comparisons. Update contributor/tool/installation/agent guidance and the current handoff summary and badge; keep dated evidence intact. - -Add integration coverage for dataclass self-forward-references and first-item deterministic container sampling using the public beartype APIs. Document import-hook contention and its public diagnostic without wrapping the caller-sensitive alias. Validate the minimum backend environments on 3.11, current endpoint runtime/checker tests and actionlint. Any actual dependency incompatibility must be diagnosed rather than suppressed. - -## Concrete Steps - - -From this worktree, with uv 0.11.17 on PATH: - - uv lock --upgrade-package beartype==0.23.1 - uv sync --locked - uv run --locked prek install - uv run --locked pytest tests/ --ignore=tests/test_typecheck.py -n auto - uv run --locked pytest tests/test_typecheck.py -q - uv run --locked tox run -e py311-bt0231-numpy22,py311-bt0231-jax05,py311-bt0231-torch26,py311-bt0231-optree014 - uv run --locked prek run -a - uv run --locked prek run actionlint -a --stage manual - -Repeat source/checker tests in a separate Python 3.14 environment. Installed archive and full hosted matrix evidence will also be refreshed on the final integration branch. - -## Validation and Acceptance - - -Metadata excludes Python 3.10. All current defaults and required lanes use the selected floor and exact beartype 0.23.1. Four real checker consumer batches pass, with no weakened diagnostics. Floor environments install and run backend-specific tests. Dataclass self-reference works; deterministic checking rejects a bad first container element and does not claim exhaustive checking. Normal installed packages under symlinked environment paths pass origin checks. Full union failure remains documented rather than hidden. - -## Idempotence and Recovery - - -Use this branch's isolated environment. Do not modify main or existing PR worktrees. Review lock changes for unrelated upgrades. Save logs under the main checkout's `build/release-2026-10-11/`. No publication or deployment occurs. - -## Artifacts and Notes - - -Source starts at main c0874f34615ca3797b24601a91324f3c9beb462a plus the program plan. Commands and meaningful results will be appended after execution. - -## Interfaces and Dependencies - - -No public annotation signatures change. Keep all four checker engines, NumPy/JAX/Torch/optree CPU floors, accepted CuPy limits, and uv 0.11. Existing runtime imports and memo ownership remain unchanged. - -Revision note — 2026-10-11: Created before implementation to coordinate the owner's selected baseline across all validation and documentation surfaces. - -Revision note — 2026-10-11: Recorded coordinated implementation and local validation. Full hosted matrix and final installed-archive evidence remain integration milestones. diff --git a/plans/2026-10-11-release-integration.md b/plans/2026-10-11-release-integration.md deleted file mode 100644 index d694dc9..0000000 --- a/plans/2026-10-11-release-integration.md +++ /dev/null @@ -1,235 +0,0 @@ -# Integrate and verify the next bearshape candidate - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - - -This living ExecPlan follows `PLANS.md` and M4/M6/M7 of `plans/2026-10-11-release-readiness.md`. Preserve the Progress, Surprises & Discoveries, Decision Log and Outcomes & Retrospective sections as execution proceeds. - -## Purpose / Big Picture - - -Reviewers need a concrete combined candidate that preserves every focused PR's history and exposes any remaining release blockers. Integrate the Python 3.11/beartype 0.23.1 baseline, four audited correctness fixes, release pipeline and existing action/memo/union PRs in a separate branch; prepare 0.1.0rc1 and validate its exact archives. No merge into main, tag, release, upload or deployment is authorized by this integration. - -## Progress - - -- [x] (2026-10-11) Created the integration branch from the validated baseline. -- [x] (2026-10-11) Commit plan and open draft PR before integrating implementations. -- [x] (2026-10-11) Merge focused heads and PRs #32/#34/#35, preserving ancestry and resolving conflicts surgically. -- [x] (2026-10-11) Set the independent candidate identity, update current readiness documentation and release notes. -- [x] (2026-10-11) Run combined source/checker/hooks/docs/notebook and installed-archive validation, plus hosted platform/floor lanes. -- [x] (2026-10-11) Run the final wheel on actual CUDA hardware; record versions/source/hashes and real results. -- [x] (2026-10-11) Validate the same final bearshape artifact with the refreshed upstream proposal, including transaction/lifetime/performance evidence. -- [x] (2026-10-11) Run validation-only release workflow; report the real published-0.23.1 contract failure explicitly. -- [x] (2026-10-11) Prepare all reviewed PR heads, evidence, external prerequisites and proposed dispositions for merge approval. Do not publish. - -## Surprises & Discoveries - - -The refreshed local upstream proposal passes all 22 transaction cases on both Python endpoints, while published 0.23.1 fails 20. It is not a normal supported dependency yet. CPU skips do not substitute for GPU proof. - -## Decision Log - - -Decision: Merge branch heads into this integration branch, not cherry-pick or squash them. Rationale: preserve reviewed contributors' changes and permit explicit reachability checks before any approved main merge. Author/date: Codex, 2026-10-11. - -Decision: Keep release readiness withheld while preparing candidate 0.1.0rc1. Rationale: the user requested implementation with no publishing, and unavailable supported union integration remains a real blocker. Author/date: Codex, 2026-10-11. - -## Outcomes & Retrospective - - -Independent implementation and ordinary candidate validation are complete. Supported union integration remains the release blocker, with a tested local upstream proposal prepared for review. No main merge, release tag, upload, deployment, access change or upstream message has occurred. Merge and publication readiness are separate outstanding decisions. - -## Context and Orientation - - -The parent program plan records all audit findings and original heads. New focused branches are `codex/python311-beartype0231`, `codex/nested-value`, `codex/converter-validation`, `codex/variadic-broadcast`, `codex/tree-ellipsis` and `codex/release-pipeline`. Existing #32 is `dependabot/github_actions/github-actions-9a5dc421c7`; #35 is `codex/memo-discovery-performance`; #34 is `codex/union-transactions`, now refreshed against the new baseline. Each already has its own reviewable scope and tests. - -The upstream proposal port is commit d0fe6e67a5ab693acb263e4bb0e1eb7131dc3fba in `/private/tmp/beartype-union-0231`, based on released v0.23.1. Its durable patch is in the main checkout's `build/release-2026-10-11/`; never apply it to installed library files or pretend the published version contains it. - -## Plan of Work - - -Open the plan PR, then merge each focused head using ordinary Git merges. Resolve changelog conflicts by retaining all independent entries, keep current beartype organization identity and baseline decisions, and correct action version comments to the verified pinned tags. Preserve #35's frame filter and #34's adapter/tests. Record every source head and confirm it is an ancestor of integration HEAD. - -Set pyproject version to 0.1.0rc1 and refresh the lock/current candidate filenames and agent guidance. Preserve historical evidence and the published-0.23.1 union blocker. Run required validation and build source then wheel into a clean directory. Normally install copied archive consumers on both endpoints, and validate the final CuPy artifact. Compare matched benchmark runs with the frame filter and upstream proposal separated. Use isolated upstream environments directly rather than uv run, which would restore published dependencies. - -Update the current handoff with exact source/version/hash evidence and links to checks. Dispatch the integration branch's release workflow with publish=false; it must report the full-composition failure while upload stays skipped. Do not submit upstream contact, apply administrative controls, merge main or publish without the appropriate separate approval. - -## Concrete Steps - - -From this worktree, use uv 0.11.17 and a worktree-specific environment: - - uv sync --locked - uv run --locked prek install - uv run --locked pytest tests/ --ignore=tests/test_typecheck.py -n auto - uv run --locked pytest tests/test_typecheck.py -q - uv run --locked prek run -a - uv run --locked prek run actionlint -a --stage manual - uv run --locked --only-group docs zensical build --clean - uv run --locked --only-group docs python tools/check_docs.py - uv run --locked python tools/check_notebook.py - uv build --sdist - uv build dist/bearshape-0.1.0rc1.tar.gz --wheel - uv run --locked python tools/check_installed.py dist/*.whl dist/*.tar.gz --python 3.11 - uv run --locked python tools/check_installed.py dist/*.whl dist/*.tar.gz --python 3.14 - -Use the source archive's copied tests on CUDA with the same wheel; capture its SHA256 and actual imported package origin. Record concrete remote commands and hosted run URLs after execution. - -## Validation and Acceptance - - -Every reviewed head is reachable. Ordinary source, static consumers, platform/backend floors, hooks, docs/notebook and normal archives pass without weakened negative tests or coverage. Changed custom broadcasting passes without optional imports. GPU evidence identifies the exact wheel and real CUDA execution. Prototype transaction cases pass with the port, and published dependency failures remain explicit. Publication is skipped. This is an implementation review packet, not a claim that private PyPI trust or upstream availability is complete. - -## Idempotence and Recovery - - -Never force main or alter existing evidence. Preserve all unmerged worktrees and clean up only after approval, successful merge and ancestry verification. Keep source and prototype environments separate. Store logs/artifacts under the main checkout's ignored build directory, which survives managed worktree cleanup. No release tag or upload is created. - -## Artifacts and Notes - - -All evidence belongs under `/Users/ale/Code/bearshape/build/release-2026-10-11/`. Record exact branch heads, commands, test counts, artifact hashes, backend/device versions and hosted URLs; distinguish local and queued checks. - -## Interfaces and Dependencies - - -Preserve all public annotation syntax, memo ownership and backend boundaries. Baseline is Python >=3.11, beartype >=0.23.1,<0.24 with exact 0.23.1 validation; supported matrix initially ends at 3.14. Full composition still requires a future supported upstream state hook. Publishing uses exact tested archives and OIDC, with separate owner-controlled prerequisites. - -Revision note — 2026-10-11: Created integration and final-evidence plan before combining focused changes. - -Revision note — 2026-10-11: Integrated #32/#34/#35 and #39–#44, retained both independently appended test groups, corrected action pin comments and prepared unpublished 0.1.0rc1. All focused heads are retained as merge parents. Final validation is now running. - -## Completed evidence, 11 October 2026 - - -Artifact-producing source is f7d54d5e9f68e4ef63cb727cff625d885281b0a7. Subsequent -documentation follow-up also corrects the changelog's obsolete Python endpoint; -the final source archive identity is recorded separately below. Durable local evidence is -`/Users/ale/Code/bearshape/build/release-2026-10-11/` and survives worktree cleanup. -The wheel is bearshape-0.1.0rc1-py3-none-any.whl, SHA256 -007d1905c677057240eaa2569b417325a7258fb0b4c68e7f2e19e0c6846b6231. The source archive -is bearshape-0.1.0rc1.tar.gz, SHA256 -2096217b3ebb94503e2b9cd80775a606d931f89248c72cfdfc4643d805aeddf2. - -Source Python 3.11 validation passed 1,142 cases with five existing CPU skip -records and 92.05% coverage with branch measurement enabled. Normal installed-wheel consumers copied from -the sdist, without src, passed 1,142 cases on EACH Python 3.11.15 and 3.14.5, -including the four checker harnesses. The five skips are absent CuPy and four -macOS extended-precision dtype cases. Fresh minimal consumers passed on both -endpoints with zero optional imports, including backend-free broadcasting and -canonical /tmp environment paths. Normal hooks and manual actionlint passed. -The rendered docs check covered 94 Python snippets; all 29 tour notebook cells -executed. Logs are evidence/integration-all311.log, installed311.log, -installed314.log, minimal-3.11.log, minimal-3.14.log, integration-docs.log, -integration-notebook311.log and integration-hooks-final.log. - -Hosted CI run 38132351427 passed every shared lane: Linux 3.11–3.14, -macOS/Windows 3.11 and 3.14, four static checkers on every interpreter, the twelve -configured backend/checker floor lanes, docs, endpoint notebooks, distribution, -minimal and normal installed-wheel consumers. See -https://github.com/beartype/bearshape/actions/runs/38132351427. - -Validation-only release run 38132526795 used the full artifact source SHA with -publish=false. Resolve and all shared validation jobs passed. The two full- -composition jobs failed for the real N=2 binding leak, and evidence/publication -were skipped. Downloaded candidate-distributions hashes exactly match the local -artifacts above. This is successful verification of the blocker, NOT successful -release acceptance. Run 38132402776 had previously failed at checkout because an -abbreviated SHA was supplied; the runbook now requires all 40 characters. See -https://github.com/beartype/bearshape/actions/runs/38132526795 and the saved -validation-only-run.json / validation-only-union-blocked.log. - -The exact wheel passed all 95 CuPy tests on Python 3.11.15 and 3.14.5 with -beartype 0.23.1, NumPy 2.4.6, CuPy 14.2.0, optree 0.19.1 and CUDA 12.9. -Together with shared dtype tests each endpoint had 193 passes and 28 unrelated -absent Torch/JAX skips. These results do not establish multi-device support or -native CuPy static inference. Machine-specific operational details are excluded -from project documentation. - -The upstream port d0fe6e67a5ab693acb263e4bb0e1eb7131dc3fba is based on released -v0.23.1 f85b67d8b0b6bd9c910bd97f0d2d417c4550b038. Upstream a00_unit passed -449/15 skipped on 3.11 and 457/7 skipped on 3.14. The initial 3.11 run -without optional scientific backends had 446 passes and 18 skips; the final -normally installed wheel run includes those available backend cases. Upstream pyright passed. With the normally -installed proposal and the exact final bearshape wheel, copied consumers passed -1,164 cases on EACH endpoint, including all 22 transaction cases and four -checker engines. The original probe passed. Protocol tests include 600 -independent reference cases and copied-context/lifetime regressions. -The proposal wheel SHA256 is -3cc168846f71053cc975d0e0fb202dcfa38a100e49b7d1d50afb6b7d98664a03; normal reinstalls -of this exact wheel passed the original probe and 22 cases on both endpoints. -Its unchanged upstream 0.23.1 version string is NOT the released 0.23.1 artifact. -The durable patch and UPSTREAM-PROPOSAL.txt are prepared but have not been sent. - -Matched benchmarks use 20,000 calls per repeat and seven raw repeats on macOS -arm64, both endpoint interpreters, NumPy 2.4.6 and the same final bearshape wheel. -A separate normally installed counterfactual wheel reverses only the memo.py -change from 344d390 to isolate PR #35. Strict medians improved from 13.706 to -12.506 microseconds on 3.11 and 17.599 to 12.604 on 3.14. Separately, adding the -upstream transaction proposal changes strict medians from 12.506 to 16.180 and -12.604 to 16.032; correct fallback unions take 25.163 and 25.261 microseconds. -Stateless native checks remain about 0.1 microseconds, while nested ordinary -forward references rise from 0.684 to 1.139 and 0.542 to 0.893. Keep this remaining -cost explicit. Incorrect union baselines are labelled incorrect, not timed as -successful calls. Raw samples, correctness flags, benchmark/source and artifact -hashes are in evidence/perf-{unfiltered,released,prototype}{311,314}.json. -No timing threshold was introduced into CI. - -Python 3.15 availability was evaluated using uv 0.11.17's interpreter inventory -and wheel-only resolution for the locked scientific stack on macOS arm64. The -locked NumPy 2.4.6 has no usable wheel there; no 3.15 compatibility claim follows. -Free-threaded builds exist in the inventory, but the required full backend, -checker and concurrency/lifetime evidence is absent, so this is outside the -claimed 3.11–3.14 matrix. See python-availability.json and python315-resolution.log. - -PR disposition: #32 action updates, #35 memo filtering and #38–#44 focused plan, -baseline, fixes and pipeline are reviewable in the combined history. #34 retains -the supported-upstream adoption blocker. #45 is the integration/evidence review -packet and remains a draft pending that decision. Do not close release request -#37 before publication; ownership discussion #8 can be closed administratively -later. No unsolicited comments have been sent. Main and all unmerged worktrees -are preserved for owner review. - -Revision note — 2026-10-11: Replaced queued validation with completed local, -hosted, archive, GPU and prototype evidence; recorded performance costs, the -failed-closed release run and remaining external work. Later evidence-only commits do not authorize any publication. - -## Final archive and review follow-up - - -Source 26b293cf6f7db9bbd928f6d0d2fda7c8bff93ce8 produces the final review archives -under `build/release-2026-10-11/final-dist/`. The wheel SHA256 remains -007d1905c677057240eaa2569b417325a7258fb0b4c68e7f2e19e0c6846b6231; the source -archive SHA256 is now -d75180399f300dde9bb947012a65e2610f6a4f055cf956b253b8a28dd7f793d0. -Comparing every source-archive member proves only CHANGELOG.md changed from the -first artifact set; it corrects an obsolete Python 3.10 endpoint. The wheel is -byte-for-byte identical. No new device execution was needed or performed. - -The final source's ordinary hosted CI passed all 34 jobs: -https://github.com/beartype/bearshape/actions/runs/38133983895. -Validation-only run https://github.com/beartype/bearshape/actions/runs/38134009706 -passed resolve and all shared lanes, failed only the two real composition checks, -and skipped evidence/upload. Its downloaded archives match the final local -hashes. Saved evidence files are final-integration-ci-run.json, -final-validation-only-run.json and final-validation-only-union-blocked.log. - -All four runtime-fix PRs have been refreshed against the final #39 baseline and -are independently mergeable, with all 34 checks passing per focused head. Their -baseline-merge commits preserve identical trees to their earlier implementation -heads. The final two ancestry-only integration merges were guarded by complete -tree equality and ancestor checks; they do not change any candidate files. -Every original and latest reviewed head is retained. #35 and #38–#44 are ready -for owner review; #34 and #45 remain drafts with the supported-upstream decision -explicit. Main is unchanged. No release or publication has occurred. - -Revision note — 2026-10-11: Recorded the final source-archive hash, fully finished -hosted runs and independent PR conflict resolutions. Machine-specific operating -instructions were removed from current review documentation; package evidence -is retained without personal infrastructure identifiers. diff --git a/plans/2026-10-11-release-pipeline.md b/plans/2026-10-11-release-pipeline.md deleted file mode 100644 index 7222574..0000000 --- a/plans/2026-10-11-release-pipeline.md +++ /dev/null @@ -1,108 +0,0 @@ -# Validate immutable candidates and publish only reviewed artifacts - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - - -This living ExecPlan follows `PLANS.md` and milestone M5 of `plans/2026-10-11-release-readiness.md`. It is stacked on baseline PR #39. Keep Progress, Surprises & Discoveries, Decision Log and Outcomes & Retrospective current. - -## Purpose / Big Picture - - -Maintainers need a repeatable route from a reviewed commit to tested wheel/source archives, then a separately authorized publication of the exact same bytes. Validation-only runs must never upload. A failed full-composition contract must block release even when ordinary CPU tests pass. The owner requested clean publishing automation, associated CI and developer documentation, and explicitly prohibited publishing now. - -## Progress - - -- [x] (2026-10-11) Reviewed current source/tag checks, reusable CI, archive validation and publishing workflow. -- [x] (2026-10-11) Commit the plan and open a draft PR before implementation. -- [x] (2026-10-11) Add explicit release-contract validation, archive evidence verification and publication concurrency. -- [x] (2026-10-11) Test positive/negative release inputs with disposable repositories and artifacts; run real hooks/actionlint. -- [x] (2026-10-11) Write developer/maintainer instructions, build and inspect rendered documentation, and prepare the administrative prerequisite list. -- [x] (2026-10-11) Exercised validation-only run 38132526795 against full source SHA f7d54d5e9f68e4ef63cb727cff625d885281b0a7: all shared lanes passed, both full-composition gates failed on the real union defect, and evidence/upload were skipped. This proves blocking behavior, not release acceptance. - -## Surprises & Discoveries - - -The existing workflow already builds a source archive before its wheel and downloads the same artifacts for publication. Preserve this useful foundation. However, the separate union reproducer is not a release gate; released 0.23.1 still fails it. GitHub main/tag protections and pypi environment reviewers are absent, and private PyPI trust remains unverified. YAML changes cannot establish those account settings. - -## Decision Log - - -Decision: Keep one reusable baseline matrix and add an explicit release-contract gate to candidate/publication validation. Rationale: do not confuse ordinary dependency compatibility with full native union correctness; the current published baseline must remain testable while releases fail closed. Author/date: Codex, 2026-10-11. - -Decision: Retain trusted publishing with OIDC and no upload token. Verify artifact filenames, hashes, version, source SHA and originating workflow immediately before the upload job. Rationale: approval should identify exact reviewed bytes, and publication must never rebuild. Author/date: Codex, 2026-10-11. - -Decision: Keep publication an explicit event after review and serialize publication attempts for a version. Do not create a tag/release, upload, deploy Pages or change access controls in this task. Rationale: explicit owner restriction and repository approval policy. Author/date: owner/Codex, 2026-10-11. - -## Outcomes & Retrospective - - -Implemented in PR #44. All 34 release identity/evidence tests pass. Normal hooks and manual actionlint pass; the docs build/render checks pass, and the new runbook navigation/headings were inspected. Both CLI modes passed against the real audited wheel/source archives in a clean directory. The initial CLI run correctly rejected uv build's extra .gitignore; downloaded GitHub distribution artifacts omit hidden files. The publisher receives exactly the two archives. Readiness remains blocked by supported upstream union integration and external release prerequisites; a working validation pipeline should expose those blockers rather than claim readiness. - -## Context and Orientation - - -`.github/workflows/validate.yml` is called by CI, nightly and pypi workflows. It requires quality, CPU runtime, four checker engines, floor environments, docs, notebook, distribution, minimal and installed-wheel jobs. `tools/check_release.py` validates canonical versions, tag/source/workflow identity, prerelease status and ancestry on origin/main. `tools/check_distribution.py` checks matching wheel/sdist contents, license, typing marker, metadata and SHA256 hashes. `tools/check_installed.py` normally installs a wheel and executes copied archive consumers outside source. `tools/probe_union.py` demonstrates the still-failing native union case. - -The existing `pypi.yml` has resolve, shared validation, evidence and environment-gated publishing jobs. Only publishing receives `id-token: write`; the pypi environment is the administrative approval boundary. The published package remains 0.0.1; future candidate identity is independent of beartype. Existing release tests use real temporary Git histories and the `git_environment` helper to avoid inherited hook variables. - -## Plan of Work - - -Add a required contract job to the release workflow on Python 3.11/3.14. It runs the original union probe and the expanded transaction suite when the adapter branch is integrated; absent required inputs must fail rather than silently skip. Keep it separate from ordinary baseline compatibility and make evidence/upload depend on success. Expose its current failure clearly in the developer runbook. Once supported upstream adoption is available, move the cases into mandatory source and installed-archive tests as described by M3. - -Extract the evidence record/verification logic from inline workflow Python into a small maintained tool with a record mode and a verify mode. Reuse `check_distribution` for archive contents. Bind a manifest to the source SHA, project version and workflow run URL; verification rejects altered bytes, extra/missing archives, filename traversal and identity mismatches. The publisher downloads only this run's candidate and evidence artifacts, verifies them, then invokes the pinned PyPI action without rebuilding. Keep permissions least-privileged and artifact upload failures fatal. Add concurrency without cancelling an in-flight publication. - -Extend realistic release tests for validation-only source identity and artifact manifest failure cases. Preserve canonical tag/version/event/ancestry checks and Git environment isolation. Add a release runbook under `docs/maintainers/`, link it from CONTRIBUTING/tools documentation, and include it in docs navigation. Document bootstrap, candidate preparation, validation-only dispatch, CPU/checker/GPU evidence, exact-artifact review, explicit future publish, retry/recovery and separate docs deployment. List precise required administrative settings and PyPI trust identity; do not apply them now. - -## Concrete Steps - - -From this worktree with uv 0.11.17 on PATH: - - uv sync --locked - uv run --locked prek install - uv run --locked pytest tests/test_release.py -n 0 - uv run --locked prek run -a - uv run --locked prek run actionlint -a --stage manual - uv run --locked --only-group docs zensical build --clean - uv run --locked --only-group docs python tools/check_docs.py - -Build source then wheel and test evidence against real archives. Run a validation-only workflow only after the integration head exists; never pass publish=true in this task. Its union job is expected to report a real failure with published beartype 0.23.1, which is a release block rather than successful acceptance. - -## Validation and Acceptance - - -A validation-only request cannot upload. A wrong/missing tag, wrong version/source/workflow, unmerged source, malformed prerelease flag, failed union contract or failed shared lane prevents upload. A changed/missing/extra archive or mismatched manifest is rejected. Only the exact validated wheel and source archive reach OIDC publication. Real hooks and actionlint pass; developer commands and rendered docs are checked. Private PyPI trust, approved GPU evidence and administrative controls remain explicitly separate prerequisites. - -## Idempotence and Recovery - - -Preserve previous artifacts and evidence; PyPI versions are immutable. Retry validation with fresh artifact names/runs, never overwrite a published version. Use dry validation by default. Do not store credentials or add tokens. Use the existing Git environment helper in all cross-repository subprocesses. Keep logs under the main checkout's ignored `build/release-2026-10-11/evidence/`. - -## Artifacts and Notes - - -The October audit contains the current GitHub control snapshots and exact baseline failures. Append source commits, test results, hashes and workflow URLs here as implementation proceeds. Successful local tests do not prove private publisher settings or a hosted run. - -## Interfaces and Dependencies - - -Use standard-library release tooling, existing check_distribution/git_environment helpers, pinned GitHub actions and uv 0.11.17. Trusted publisher identity must be owner beartype, repository bearshape, workflow pypi.yml, environment pypi. No runtime bearshape API changes or new runtime dependencies belong in this PR. - -Revision note — 2026-10-11: Created the focused automation/runbook plan before implementation, preserving the explicit no-publication boundary. - -Revision note — 2026-10-11: Recorded implementation and local evidence; hosted validation-only integration remains pending and full composition remains blocked by published upstream. - -Revision note — 2026-10-11: The first dispatch used an abbreviated SHA and failed -at checkout (run 38132402776); rerunning with the full SHA exercised the intended -contract failure (run 38132526795). The runbook now makes this requirement -explicit. Its downloaded archives exactly match the locally tested and GPU-tested -wheel/source hashes. The owner reports the PyPI project in their personal account; -that ownership arrangement is compatible with trusted publishing. The GitHub -reviewer choice and private publisher verification remain pending. No access -settings or publishing actions were changed. diff --git a/plans/2026-10-11-release-readiness.md b/plans/2026-10-11-release-readiness.md deleted file mode 100644 index cd558f9..0000000 --- a/plans/2026-10-11-release-readiness.md +++ /dev/null @@ -1,186 +0,0 @@ -# Prepare bearshape for Python 3.11 and released beartype - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - - -This living ExecPlan follows `PLANS.md`. Keep Progress, Surprises & Discoveries, Decision Log, and Outcomes & Retrospective current. It supersedes the current-version decisions in the September production roadmap while preserving that plan's historical evidence. - -## Purpose / Big Picture - - -Scientific Python users should be able to install the next bearshape candidate on Python 3.11–3.14 with released beartype, use every existing annotation and backend, and receive correct shape, dtype and tree errors. A rejected native union alternative must never leave dimension bindings behind. Developers should have one documented route from a reviewed source commit to tested archives and, only after a separate release decision, publication of those exact archives. - -The owner requested addressing the entire October audit in focused PRs, selected Python 3.11+ and beartype 0.23.1 as the baseline, and explicitly prohibited publishing now. Implement and validate the work; do not publish to PyPI, create a release, deploy Pages, or change account/repository access controls as part of implementation. Merge remains subject to review of concrete results. A local upstream prototype is not a published supported dependency. - -## Progress - - -- [x] (2026-10-11) Audited main c0874f34615ca3797b24601a91324f3c9beb462a and all three open PRs. Preserved raw results and independent reproducers under the main checkout's ignored `build/audit-2026-10-11/`. -- [x] (2026-10-11) Recorded the owner's Python 3.11+, beartype 0.23.1 and no-publication decisions; created the program worktree before implementation. -- [x] (2026-10-11) Committed this plan and opened PR #38 before implementation; live completion evidence is maintained in integration PR #45. -- [x] (2026-10-11) M1: Adopt the coordinated Python/dependency baseline and path-safe tooling in a focused PR. -- [x] (2026-10-11) M2: Fix nested Value expressions, malformed converters, backend-free broadcasting and Tree grammar with failing regressions in focused PRs. -- [x] (2026-10-11) M3 preparation: ported and tested the upstream proposal on 0.23.1, resolved #34 conflicts, and prepared the patch, submission text and performance evidence. -- [ ] M3 supported adoption: obtain authorization to submit upstream, upstream acceptance and a normally available supported release; update the dependency floor/lock/preflights/CI together and rerun final acceptance. Released 0.23.1 still fails the contract. -- [x] (2026-10-11) M4: Validate and reconcile existing action-update PR #32 and memo-performance PR #35, preserving their reviewed heads. -- [x] (2026-10-11) M5: Implement candidate validation and publication controls, exact-artifact evidence and a developer release runbook in a focused PR. -- [x] (2026-10-11) M6: Validate the combined source, four checker consumers, minimum dependency lanes, archives, documentation, notebook and actual CUDA hardware where available. -- [x] (2026-10-11) M7: Present the review packet with PR disposition, evidence, external prerequisites and merge readiness; do not publish. -- [ ] Merge approved heads, verify reachability and main, then remove only clean merged worktrees. No merge approval has yet been requested for this program. - -## Surprises & Discoveries - - -The audited ordinary suite passed 1,101 cases on Python 3.10 and 3.14 with released beartype 0.23.1, including four static checker engines. The 22 separate native-union cases still had 20 failures and two passes, even against PR #34's exact adapter. beartype 0.23.1 has the public diagnostic plugin but not the proposed state transaction protocol. Updating metadata cannot close that defect. - -Four independent existing defects were reproduced: nested `Value` arithmetic loses function-value scope; custom converters returning None bypass validation; custom variadic broadcasting imports optional NumPy; and invalid interior/repeated Tree ellipses are silently discarded. All need behavioral regressions, not broad rewrites. - -The host's global uv 0.12.22 is outside this repository's supported 0.11 range. An isolated locked environment already contains uv 0.11.17. Use that executable or install/bootstrap the documented version; do not loosen the constraint merely to accommodate this host. macOS aliases `/tmp` to `/private/tmp`, exposing two origin checks that canonicalize only one side of a path comparison. - -## Decision Log - - -Decision: Require Python >=3.11 and beartype >=0.23.1,<0.24, with exact 0.23.1 in the lock and validation lanes. Rationale: explicit owner direction on 2026-10-11; Python 3.10 support and the rc0 baseline are superseded. Full composition remains blocked until supported upstream integration is available. Author: owner/Codex. - -Decision: Keep supported interpreter claims at 3.11–3.14 initially. Rationale: Python 3.15 and free-threaded Python have no complete backend/checker/artifact proof; a >=3.11 metadata floor does not itself claim those combinations. Evaluate availability without silently adding new promises. Author/date: Codex, 2026-10-11. - -Decision: Prepare 0.1.0rc1 as the next independent bearshape candidate. Rationale: the changed interpreter floor and behavior warrant a new candidate identity; publication remains separately prohibited. Author/date: Codex, 2026-10-11. - -Decision: Preserve native composition and existing public syntax. No upstream monkeypatch, replacement checker, bytecode inference, xfail, weakened negative fixture, or restricted union support may make the gates green. Rationale: owner contract and actual correctness. Author/date: Codex, 2026-10-11. - -Decision: Use separate reviewable branches for baseline, each independent runtime fix, and release automation; use a separate integration branch to combine them and existing PR heads. Rationale: surgical review and preservation of contributors' history. Update draft PRs before any implementation milestone. Author/date: Codex, 2026-10-11. - -Decision: Do not send an upstream maintainer message or apply administrative controls without the appropriate authorization. Prepare the concrete tested upstream patch and exact settings first. Rationale: existing owner policy distinguishes code preparation from external contact and access changes. Author/date: Codex, 2026-10-11. - -## Outcomes & Retrospective - - -Independent implementation and combined validation are complete in PRs #39–#45. PR #38 retains the original pre-implementation program plan; this integration copy is the current progress record. Main remains c0874f34615ca3797b24601a91324f3c9beb462a, with no merges, tags, publication, deployment or administrative changes. All original and focused PR heads are preserved in the integration history. - -The candidate is ready for code review, not release. Supported upstream union integration remains unavailable in released 0.23.1. A local upstream proposal passes the complete contract, and the hosted release dry run correctly fails on the published dependency. Submission/acceptance/release and the separately controlled publishing prerequisites remain outstanding. Personal PyPI ownership can stay in place; private trusted-publisher settings still require verification. - -Audit coverage: A02–A07, A09–A11 and A13 are implemented and tested. A08 is reconciled in the integration history but awaits merge approval; #34 remains a proposal with the A01 upstream blocker. A12 has implemented workflow controls and documented external settings, with administrative verification still pending. A14 has fresh matched measurements. A15's release issue #37 stays open until an actual release; ownership discussion #8 is an optional administrative closure, with no code defect or unsolicited comment. The supported matrix remains Python 3.11–3.14: the locked NumPy 2.4.6 wheel set cannot resolve for CPython 3.15 on macOS arm64, and free-threaded full backend/checker/lifetime evidence is absent. - -## Context and Orientation - - -`src/bearshape/_dimensions.py` represents dimensions and trusted developer `Value` expressions. `_shape.py` compares integer shape tuples and binds named/variadic dimensions. `_array_types.py` implements strict arrays and Like conversion; Like validates a converted value while preserving the caller's original argument. `_tree.py` implements runtime Tree specifications with optree's default registry. `_runtime_hints.py` supplies the metaclass used by generated hints. `_memo.py` owns invocation-local bindings and their snapshot/restore operations. `_decorator.py` controls explicit scopes; bare `@check` remains scope-only and `@check(conf=...)` invokes beartype. - -A transaction means taking snapshots of participating validator state, checking a whole expression or alternative, retaining changes on success, and restoring changes on rejection or exception. A leaf check cannot observe that a later ordinary str check rejected its surrounding tuple. The upstream checker must expose that boundary. `tools/probe_union.py` reproduces the problem; PR #34 has 22 expanded cases in `tools/upstream/test_union_transactions.py` and a `__beartype_state__ = staticmethod(get_memo)` adapter. - -Main is c0874f34615ca3797b24601a91324f3c9beb462a. Existing unmerged PR #32 updates checkout/setup-uv actions (head b0aac01849f952e95cb72c9220a546fb86fd64af). PR #35 filters irrelevant frames before reading locals (head f4084ebd1f74610317d27e0d2a8595f39335203d). PR #34 proposes union transactions (head 66bc3b93a746c2430aa4b4d983fa057f4608539a) and conflicts with newer ownership documentation. Preserve all heads and worktrees. The local upstream proposal is `/Users/ale/Code/beartype-union-transactions`, head 76e27706fb137c6a676ee7b79a66d8b3092b52ad based on a2729e0e358bf963ee6f177e300ae08a622d05d6. It is source work, not an accepted published API. - -`pyproject.toml`, `uv.lock`, `tox.toml`, checker configuration, `tools/validate_runtime.py`, `tools/validate_tox_env.py`, `tools/check_installed.py`, and `.github/workflows/validate.yml` jointly define tested support. The shared workflow runs CPU backends, four checker engines, compatibility floors, documentation, notebook, archive and normal wheel consumers. Required validation aggregates every required lane. Actual CuPy runtime evidence requires a CUDA device. - -`tools/check_release.py` checks version/tag/source identity, while `tools/check_distribution.py` checks wheel/sdist contents and hashes. `.github/workflows/pypi.yml` resolves a source, calls shared validation, records artifacts, and grants OIDC upload permission only to the environment-gated publishing job. OIDC is short-lived identity-based authentication; no stored upload token is needed. Existing private PyPI trust and GitHub protections remain unverified/incomplete and are not fixed merely by editing YAML. - -## Plan of Work - - -### M1: A coherent released dependency baseline - - -Create `codex/python311-beartype0231` with a focused plan PR. Change requires-python, classifiers, `.python-version`, Ruff and four checker defaults, hook Python, tox names/validation, CPU/checker/compatibility/minimal/installed/notebook workflow matrices, exact dependency preflights and current documentation together. Remove obsolete 3.10 lanes and set beartype 0.23.1 everywhere current. Regenerate `uv.lock` using uv 0.11.17; verify backend floors actually resolve on 3.11. Preserve historical plan/evidence strings rather than blanket replacing the repository. Canonicalize both package origin and environment prefix in minimal/installed checks. Document the supported uv bootstrap. - -Add focused compatibility regressions for the dataclass self-forward-reference fixed by 0.23.1 and deterministic container sampling via `BeartypeConf(is_random=False)`. Preserve direct caller-sensitive import-hook aliases. Document public `warn_if_beartype_claw_inactive()` only with an executed example/test; deterministic sampling means the first item, never every item. Run endpoint source/checker and preflight tests before proceeding. - -### M2: Four independent correctness fixes - - -For Value arithmetic, recognize every `_ValueExpr` node rather than just its `Value` subclass in `_dimensions._binop`. Prove operand order, nesting, unary and attribute expressions, parameter and return checks, and wrong-value rejection. Preserve trusted expression evaluation rather than introducing a sandbox. - -For custom Like conversion, make a converted None or malformed shape/dtype object an explicit validation failure rather than the success sentinel. Preserve converter exceptions as useful mismatch errors, no fallback conversion, original argument identity and memo rollback. Correct the public factory docstring. Cover DOOR boolean checks, decorated calls, diagnostics and later valid calls. - -For variadic broadcasting, replace NumPy-only metadata calculation in `_shape._check_variadic` with tuple arithmetic respecting trailing alignment, dimension 1, zero-size dimensions and incompatible axes. Compare representative results with NumPy in full tests while extending the minimal normal-wheel smoke with valid and invalid custom arrays and zero optional imports. - -For Tree grammar, reject more than one ellipsis and any interior ellipsis before removing the permitted single leading/trailing marker in `_tree._parse_spec_args`. Prove documented forms still work and malformed forms raise a useful TypeError immediately. Each fix gets its own failing regression, implementation, CHANGELOG entry and focused plan PR. Run relevant existing tests and normal hooks. - -### M3: Correct union state through supported upstream integration - - -Fetch the released upstream v0.23.1 source into a separate checkout. Port the existing 13-file proposal without modifying installed upstream files or the recorded September worktree. Review upstream changes to code generation, lazy references, diagnostic traversal and context lifetime. Run the upstream protocol tests, complete relevant upstream unit tests and source checker. Normally install the new upstream source and bearshape adapter into separate environments; run the unchanged original reproducer, 22 integration cases and existing runtime/checker consumers on 3.11 and 3.14. Record exact commits, dependency origins and artifact hashes. - -Resolve #34's ownership/documentation conflicts by merging current main while preserving its head. Keep a clear distinction between published 0.23.1 baseline failure and prototype success. Prepare a concrete upstream submission patch/body and performance evidence for owner review. Only after a normally available supported dependency exposes the protocol can the main dependency floor advance and transaction regressions move into mandatory source and archive tests. Until then, candidate release validation must fail visibly on the union contract; never count the ordinary suite as release acceptance. - -### M4: Reconcile existing PRs and measure the combination - - -Inspect exact action revisions and runner requirements from upstream action metadata for #32; correct stale version comments when integrating. Revalidate #35's frame optimization with positive ownership, nested calls, async/thread and weak-reference cases on the new baseline. Measure matched normal installations before/after the filter and separately before/after transaction support; retain raw repeats, correctness flags and source hashes, with no flaky timing threshold in CI. - -Combine reviewed branch heads in a dedicated integration worktree, resolving conflicts without dropping either side's changes or earlier source history. Keep #32/#35 independent until merge review. #34 remains a draft until its support boundary is concrete. Issue #37 stays open until an actual release; prepare the eventual disposition of the resolved ownership discussion #8 without inventing a code defect or sending unsolicited messages. - -### M5: One auditable candidate and publishing path - - -Keep shared `.github/workflows/validate.yml` as the single reusable matrix used by CI, nightly and candidate workflows. Add an explicit required full-composition release gate so a broken union cannot publish. Validate a reviewed immutable commit, build the source archive first and derive the wheel from it, and test those exact archives in fresh minimal and full consumer environments. Produce machine-readable evidence binding source SHA, canonical version, artifact SHA256 values and workflow URL. Reject missing, extra, mismatched or stale release inputs. - -Strengthen `pypi.yml` so validation is the default and only an explicit publication action can reach the OIDC job after all candidate gates succeed. Prevent concurrent publication for the same release. Require exact canonical version tag/source/workflow identity and main reachability; preserve prerelease consistency and the rule that upload consumes existing validated artifacts rather than rebuilding. Test release tooling with realistic positive and negative temporary Git repositories, including inherited Git environment isolation. Exercise hooks and actionlint for changed workflows. - -Write a maintainer release runbook linked from `CONTRIBUTING.md` and `tools/README.md`: tool bootstrap, version/changelog preparation, validation-only dispatch, evidence review, GPU proof, tag/release identity, one explicit publish procedure, verification, retries and recovery. Explain immutable PyPI versions, no accidental re-upload or rebuild, and separate Pages deployment. Provide exact reviewed requirements for branch/tag protection, required validation, pypi reviewers/self-approval/bypass/tag policy, and PyPI trusted publisher owner `beartype`, repository `bearshape`, workflow `pypi.yml`, environment `pypi`. Do not apply these access changes or upload now. - -### M6: Validate the final candidate and document its limits - - -Set candidate 0.1.0rc1 once changes are integrated and update CHANGELOG, installation/support guidance and the current handoff summary. Run Linux 3.11–3.14, macOS/Windows endpoints, all four static engines, configured backend/checker floors, coverage at the existing threshold, normal hooks/manual actionlint, docs/rendered snippets and the executed notebook. Build and normally install archives outside source checkouts. Run the final wheel in a provisioned CUDA validation environment, capturing Python/CuPy/CUDA/device versions, source SHA and hashes. CPU skips and September GPU results do not constitute new GPU evidence. If a lane is unavailable, record that limit rather than claiming it passed. - -Evaluate Python 3.15/free-threaded dependency availability as a follow-up compatibility decision; retain only proven support claims. Report release controls and private publisher verification as separate owner prerequisites. Present every PR with completed/pending checks and a proposed disposition. After explicit merge approval and passing checks, preserve reviewed heads in history, verify main and clean only clean merged worktrees. Never publish during this program. - -## Concrete Steps - - -Run from each focused worktree root. Use uv 0.11.17 (the isolated audit environment at `/private/tmp/bearshape-audit-2026-10-11/venv310/bin/uv` currently provides it) and a worktree-specific environment. Keep logs under the main checkout's ignored `build/release-2026-10-11/` so worktree cleanup cannot erase evidence. - - uv sync --locked --python 3.11 - uv run --locked prek install - uv run --locked pytest tests/ --ignore=tests/test_typecheck.py -n auto - uv run --locked pytest tests/test_typecheck.py -q - uv run --locked prek run -a - uv run --locked prek run actionlint -a --stage manual - -After M1 the endpoint tox names become `py311-bt0231-cpu` and `py314-bt0231-cpu`. Run floor environments listed by `uv run --locked tox list`; do not invent factors. Run tools/validate_runtime.py with the documented lane arguments. For archive proof: - - uv build --sdist - uv build dist/bearshape-0.1.0rc1.tar.gz --wheel - uv run --locked python tools/check_distribution.py dist/*.whl dist/*.tar.gz - uv run --locked python tools/check_installed.py dist/*.whl dist/*.tar.gz --python 3.11 - uv run --locked python tools/check_installed.py dist/*.whl dist/*.tar.gz --python 3.14 - uv run --locked --only-group docs zensical build --clean - uv run --locked --only-group docs python tools/check_docs.py - uv run --locked python tools/check_notebook.py - -Use fresh environments for minimal consumers. For upstream prototype testing invoke its isolated interpreter directly; `uv run --locked` would reinstall published beartype and invalidate that experiment. Record concrete PR URLs and revised commands as milestones complete. - -## Validation and Acceptance - - -For every behavioral fix, a focused regression must fail on the original source and pass on the fix. Every existing named, anonymous, arithmetic, fixed and broadcast dimension, Scalar, Value, native backend alias, Like, scalar-like and Tree feature must remain covered by positive and negative cases. Root import must load none of NumPy/JAX/Torch/CuPy/optree. Static support means real accepted/rejected/inferred consumers for pyright, mypy, ty and pyrefly, not Any or skipped checks. - -Full union acceptance means failed alternatives/expressions restore single, variadic and tree bindings; successful alternatives and earlier bindings survive; diagnostics do not mutate checks; exceptions/cancellation unwind; lazy references, sampling and object lifetimes remain correct. The 22-case suite and original probe must pass with a normally installable supported dependency. A locally patched upstream pass is evidence for the proposal only. - -Release automation acceptance means validation-only cannot upload, any failed required lane or unresolved union contract prevents upload, source/tag/version and prerelease mismatches fail, and only identical tested artifacts enter the gated publisher. Administrative setup and private PyPI trust require separate verified evidence. Implementation completion is not publication readiness and publication is explicitly excluded. - -## Idempotence and Recovery - - -Preserve main, existing unmerged branches and September evidence. Create matching feature worktrees, inspect status before edits, and commit plans before implementation. Re-run validators safely in fresh environments; do not overwrite release artifacts with different content under the same evidence name. Never force main, delete another contributor's work, or erase dirty worktrees. If upstream support remains unavailable, leave the failing gate and concrete proposal visible and finish independent work. - -## Artifacts and Notes - - -Audit: `/Users/ale/Code/bearshape/build/audit-2026-10-11/AUDIT.txt`, with `evidence/` and `reproducers/`. Initial ordinary 0.23.1 tests: 1,101 passed with five CPU skip records per audited endpoint. Initial union tests: 20 failed, two passed. Current source and PR SHAs are recorded above. Future evidence belongs in `build/release-2026-10-11/` and focused plans with artifact hashes and URLs, excluding secrets. - -## Interfaces and Dependencies - - -Public annotation syntax, direct `bearshape.claw` alias and current backend boundaries remain stable. `ShapeMemo.snapshot()`/`restore(token)` remain the state contract. The proposed upstream `__beartype_state__` getter is opt-in and returns shared snapshot-capable state; it must not import bearshape/backends or retain caller objects after checking. No new runtime dependency is planned. Retain uv 0.11, the four supported checkers, optree's default registry and the accepted native CuPy static limits. Git tools creating temporary repositories must use the existing `git_environment` helper to remove inherited local Git variables. - -Revision note — 2026-10-11: Created the detailed program plan before implementation, incorporating audit A01–A15 and the owner's new baseline, Python floor and no-publication instruction. - -Revision note — 2026-10-11: Completed the independent fixes, combined matrix, -archive/GPU/prototype checks, matched performance and validation-only release -exercise. Exact results and hashes are in the integration plan. Personal -infrastructure and its administration are outside the repository documentation. diff --git a/plans/2026-10-11-shape-preparation.md b/plans/2026-10-11-shape-preparation.md deleted file mode 100644 index 4430698..0000000 --- a/plans/2026-10-11-shape-preparation.md +++ /dev/null @@ -1,175 +0,0 @@ -# Prepare invariant shape traversal once per annotation - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - -## Purpose / Big Picture - -Complete the remaining invariant preparation suggested by the audit, following -merged lazy-scope and Tree leaf optimizations. Array annotations have immutable -shape specifications, but every input, return and Tree leaf scans them for a -variadic dimension and repeatedly slices the same specification. Prepare this -layout when constructing a validator. Actual shapes, memo bindings and Value -arguments remain live per invocation; no array, frame, memo or scope is cached. - -This focused PR starts at main 28e8858 and is independent of dtype PR #56. -Validate each separately, then their combination in a temporary integration -checkout. Preserve every reviewed commit; no merge or publication is implicit. - -## Progress - -- [x] Read the current contract, profile and merged optimization evidence. -- [x] Create this plan before implementation. -- [x] Open focused PR and add relevant semantic guards. -- [x] Prepare shape traversal without changing order, errors or rollback. -- [x] Validate source and installed consumers, then matched benchmarks. -- [x] Record evidence and submit a concrete review result. - -## Surprises & Discoveries - -The 100-leaf profile performs 200,000 identical variadic searches per 1,000 -input/return calls. Dtype calculation is a separate hotspot handled by #56. -The earlier PR already avoids repeated Tree context discovery and keeps at -least 202 snapshots per 100-leaf input/return; preserve that guarantee. - -## Decision Log - -- 2026-10-11: Prepare only immutable annotation layout, including fixed rank or - variadic prefix/suffix. Share the same checking implementation with the - existing internal check_shape entry point. Avoid duplicated dimension logic, - global shape caches and generated checking code. -- Keep the existing check order: rank, prefix, suffix, variadic middle. Symbolic - expressions can depend on earlier bindings, and diagnostics expose that order. - -## Outcomes & Retrospective - -Implementation and local validation are complete; the focused PR remains open for review. Baseline beartype 0.23.1 still requires supported -upstream composition integration before release; this optimization cannot -remove that external prerequisite. - -## Context and Orientation - -`src/bearshape/_shape.py` owns immutable DimSpec values and matching. -`_ArrayChecker` and `_ArrayLikeChecker` in `_array_types.py` currently call -check_shape on each value. Tree delegates to these validators. Existing shape, -array, Tree, Value, rollback, lifetime and upstream composition tests cover the -contract and must continue passing without relaxation. - -## Plan of Work - -Introduce one private prepared shape checker, owned by each array validator. -Move the current traversal into it while retaining dimension-matching helpers. -The compatibility function check_shape delegates to the same implementation. -Add guards for reuse across independent memos/Value scopes and stable failure -order. Extend matched benchmarks to include multi-axis and variadic shapes, -construction and native controls. Use normal installs, identical scripts and -pinned inputs, recording unfavorable cases as well as improvements. - -## Concrete Steps - -Run locked uv 0.11.17 sync and install hooks. Exercise focused regressions, -then `uv run --locked pytest tests/ --ignore=tests/test_typecheck.py -n auto`, -`uv run --locked pytest tests/test_typecheck.py -q` and normal hooks. -Validate the combined final wheel with normally installed Python 3.11/3.14 -consumers, fresh minimal environments and the complete local upstream proposal. -Do not replace the released baseline in the lock or count skips as support. - -## Validation and Acceptance - -All current shapes and error text remain valid, including empty/anonymous, -fixed, named, arithmetic, broadcast and variadic dimensions. Repeated calls -must re-read mutable shape metadata and Value arguments and release owned -objects. Tree visits every leaf and preserves rollback snapshots. Installed -benchmarks must demonstrate useful savings against current main without a -flaky CI timing threshold or a universal zero-overhead claim. - -## Idempotence and Recovery - -Main remains unchanged. Branch codex/shape-preparation holds this independent -change; a temporary integration branch will combine approved work for testing. -Revert any unhelpful optimization. Benchmark outputs are regenerable; preserve -raw evidence and final artifact identities before cleanup. - -## Artifacts and Notes - -Start: main 28e885837e61705d3d3295463874c3e0acf35ca8. Earlier scope/Tree evidence -lives in tools/evidence/2026-10-11-audit-performance; it is historical and does -not establish the benefit of this new optimization. - -## Interfaces and Dependencies - -Keep check_shape's signature and return contract. No public API or dependency -changes. A private checker accepts each actual shape, ShapeMemo and optional -Value scope; its persistent fields contain only annotation DimSpec tuples and -rank/layout integers. Reuse existing _check_fixed_dims and _check_variadic. - -Revision note — 2026-10-11: Created before implementation to keep shape -preparation separate from dtype normalization. - - -## Completed validation and review evidence - -The final runtime heads are dtype `6ae31a27fd5a2a95991c29433585cd342f47a1a0` -and shape `4c0a65be3ae737c13d82944b1c0592cd343cbe10`. The isolated combined -head `e5eddd6aa0cab07a35e1ed4b25c00b2f6dade5cf` preserves both histories. -Each focused implementation passed runtime tests and all four checker suites; -both PRs passed all 36 hosted checks at those implementation heads. Later -documentation commits rerun normal hooks and hosted checks without changing -runtime artifacts. - -The combined wheel passes 1,323 normally installed baseline tests and 1,450 -proposal tests per endpoint (CPython 3.11.15 and 3.14.5), including all four -consumer checkers, 69 composition cases and 58 upstream protocol/scope/mixin -cases. The original union probe passes with the proposal. Source coverage is -91.23%. Minimal installed consumers pass without optional backends. Documentation -build/render checks and 95 snippets pass. Five local skips cover absent CuPy -and platform-specific extended precision, not union behavior. - -Matched 5,000-call, nine-repeat measurements compare main, each PR independently, -and their combination with released and proposal dependencies. They run -sequentially on the same local host with identical normally installed inputs, -reversing variant order on 3.14. Cold initialization uses 13 fresh subprocesses; -root-only and ordinary beartype controls are recorded separately. The complete -report, hashes, methods and raw samples are in PR #56 under -`tools/evidence/2026-10-11-remaining-optimization/`. Local commands, logs and -exact archives are preserved in the main checkout's ignored -`build/remaining-optimization/`. - -The dtype implementation retains only known builtin class identities and names, -not dtype instances or checked values. Review caught custom metaclass hashing -and root-only string overhead; both have focused guards and are resolved in the -final head. Shape preparation retains only annotation layout and preserves -prefix/suffix/middle ordering, live Value scopes and every Tree snapshot. -An extra upstream lookup cache was rejected after isolated measurements showed -only about 20 ns best-case savings on 3.11 and a slowdown on 3.14, before cache -maintenance costs. The upstream patch series is unchanged. - -Main remains at 28e8858. The old validation worktree was removed only after -checking its conflict resolutions and parent reachability and preserving its -complete Git history plus generated documentation. The new validation checkout -is relevant to these still-open PRs. No publication, upstream contact or -repository administration has occurred. The published dependency still lacks -full union rollback; approved release controls and exact-wheel CUDA evidence -remain external release prerequisites. - -Revision note — 2026-10-11: Record the finished implementation, protocol guards, -matched performance tradeoffs and final installed validation; keep merge state -and release readiness distinct. - - -## Merge closeout — 12 October 2026 - -PR #57 is merged at main a475c9b5376601eb39c9e0641f16f62d56fed979. -The combined history preserves all 14 reviewed commits, including conflict -resolutions. Main passed 1,315 runtime tests, eight checker tests, 34 hosted CI -jobs and both proposal jobs; documentation built with deployment skipped. -The source/wheel matched the reviewed artifacts exactly. All three clean -optimization worktrees were archived and their local/remote branches removed -after preserving evidence. The earlier open-review statements above are dated -history. Release prerequisites remain outstanding; nothing was published. - -Revision note — 2026-10-12: Append verified merge and cleanup status without -rewriting the original implementation evidence. diff --git a/plans/2026-10-11-tree-ellipsis.md b/plans/2026-10-11-tree-ellipsis.md deleted file mode 100644 index c4a2b33..0000000 --- a/plans/2026-10-11-tree-ellipsis.md +++ /dev/null @@ -1,85 +0,0 @@ -# Reject invalid Tree ellipsis syntax - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - - -This living ExecPlan follows `PLANS.md` and M2 of `plans/2026-10-11-release-readiness.md`. The program plan supplies the full release contract; this focused change is stacked on baseline PR #39. - -## Purpose / Big Picture - - -`src/bearshape/_tree.py::_parse_spec_args` discards middle and repeated ellipses. Accept only a single leading or trailing ellipsis with at least one structure name; reject malformed syntax eagerly with useful TypeError messages. Add invalid interior/repeated cases beside factory coverage in `tests/test_tree.py`, preserving every documented strict and wildcard form. - -## Progress - - -- [x] (2026-10-11) Reproduced the defect during the whole-library audit; created the focused branch and plan. -- [x] (2026-10-11) Commit plan and open draft PR before implementation. -- [x] (2026-10-11) Add a failing behavioral regression, implement the surgical fix and update CHANGELOG. -- [x] (2026-10-11) Focused tests and normal hooks passed; complete runtime/four-checker pre-push validation is recorded in the finish log. - -## Surprises & Discoveries - - -The October audit reproducer demonstrates this defect on both earlier rc0 and released beartype 0.23.1. It is independent of the native composite-union upstream blocker. - -## Decision Log - - -Decision: Preserve public syntax, successful behavior and useful errors; fix only this demonstrated correctness defect. Rationale: the owner requested every audit finding be addressed in focused PRs on Python 3.11+ and beartype 0.23.1. Author/date: owner/Codex, 2026-10-11. - -## Outcomes & Retrospective - - -Four malformed forms failed before; 165 tree/coverage-edge tests passed after, retaining the existing valid wildcard forms. Full runtime and checker validation is enforced by the real pre-push hooks; hosted integration evidence remains pending. This PR does not authorize merging or publishing and does not claim to fix native union transactions. - -## Context and Orientation - - -The implementation and test locations are named above. Array and tree leaves use invocation-local `ShapeMemo` state from `src/bearshape/_memo.py`; failed leaf checks and diagnostic formatting must restore state. Root imports must remain free of NumPy/JAX/Torch/CuPy/optree. The baseline is `codex/python311-beartype0231`, with all four static consumer engines retained. - -## Plan of Work - - -First add a regression exercising the audited invalid behavior and run it against unchanged source. Save the failure under the main checkout's ignored `build/release-2026-10-11/evidence/`. Make the smallest source change described above, retaining the surrounding validation and state lifetime contract. Add positive/negative neighboring cases where the new branch needs proof, then run the focused modules. Update CHANGELOG and this plan, stage new files before hooks, review formatter changes and commit/push the concrete result. - -## Concrete Steps - - -From this worktree with uv 0.11.17 on PATH: - - uv sync --locked - uv run --locked prek install - uv run --locked pytest tests/test_tree.py tests/test_coverage_edges.py -n 0 - uv run --locked pytest tests/test_typecheck.py -q - uv run --locked prek run -a - -Real pre-push hooks also run the complete runtime and four-checker suites. Archive, platform and CUDA evidence will be refreshed on the combined integration branch. - -## Validation and Acceptance - - -The audited reproducer fails before and passes after the source fix. Neighboring valid forms remain valid and wrong shapes/types still reject with useful errors. Existing memo rollback/lifetime and static inference tests remain effective. No xfail, suppression, lowered coverage or optional-backend import is introduced. Detailed scope and acceptance cases are stated in Purpose above. - -## Idempotence and Recovery - - -Use the matching isolated worktree/environment. Do not modify main or existing unmerged PR branches. Keep evidence outside disposable worktrees. Do not publish, deploy or send maintainer messages. Re-running the tests is safe. - -## Artifacts and Notes - - -Original audit evidence is `/Users/ale/Code/bearshape/build/audit-2026-10-11/`. New logs belong under `build/release-2026-10-11/evidence/` in that same main checkout. Append meaningful results and source identities after implementation. - -## Interfaces and Dependencies - - -No new runtime dependency or public API. Retain Python 3.11–3.14, exact tested beartype 0.23.1, existing backend semantics and the four supported checker engines. Dimensions remain runtime constraints rather than static shape proofs. - -Revision note — 2026-10-11: Created the focused regression/fix plan before implementation. - -Revision note — 2026-10-11: Recorded before/after regression evidence and the surgical fix. Real commit/push hooks remain required before the implementation head is delivered. diff --git a/plans/2026-10-11-union-ordinary-performance.md b/plans/2026-10-11-union-ordinary-performance.md deleted file mode 100644 index 1285bc7..0000000 --- a/plans/2026-10-11-union-ordinary-performance.md +++ /dev/null @@ -1,250 +0,0 @@ -# Reduce ordinary checking overhead without weakening rollback - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - - -This living ExecPlan follows `PLANS.md` and the correctness plan -`plans/2026-10-11-union-scope-correctness.md`. Keep all living sections current. - -## Purpose / Big Picture - - -Ordinary beartype users should not pay for state transactions after lazy references -are known to be plain classes. Keep first-call correctness, lazy resolution, -checker ordering, sampling and cache invalidation. Keep the correctness changes -independently reviewable in PR #46, and benchmark against published 0.23.1 as well -as the unoptimized correct proposal. - -## Progress - - -- [x] (2026-10-11) Integrate the invocation-isolation correction from #46 and - apply the same owner filter to the known-domain fast path. -- [x] Rerun both installed endpoints, upstream tests, hooks and matched sequential - benchmarks; retain historical measurements and report fresh artifact hashes. -- [x] Update the focused PR and unsent proposal with the corrected scope limits. - -- [x] (2026-10-11) Identify remaining tuple, mapping and nested-list overhead. -- [x] (2026-10-11) Committed plan and opened draft PR #47 before implementation. -- [x] (2026-10-11) Added known-domain and explicit atomic-leaf fast paths. -- [x] (2026-10-11) Added plain-class specialization and weak cache invalidation listeners. -- [x] (2026-10-11) Added eleven optimizer regressions; upstream units pass 467/475 cases on the endpoints. -- [x] (2026-10-11) Both installed endpoint suites pass 1,221 cases; matched sequential benchmarks are preserved. -- [x] (2026-10-11) Recorded exact artifacts, raw repeats and limits; implementation head has 36 passing hosted checks. - -## Surprises & Discoveries - - -The assessment reduced ordinary `list[LateClass]` overhead, but tuple, mapping and -nested-list cases still added approximately 0.3–0.4 microseconds per call. Resolving -unselected references eagerly would change existing behavior. A fast checker must -capture resolved plain classes so concurrent cache clearing cannot introduce a -stateful hint into an expression that has already chosen the stateless path. - -## Decision Log - - -Decision: The known-domain fast path must only enroll into live transactions -owned by the same public checking invocation. Reuse the parent's private owner -lookup only when an active parent exists; preserve the path without a published -ContextVar when domains are already known. No public API addition or eager scope -allocation is needed. Rationale: optimization must retain the corrected isolation -contract without introducing overhead when no parent can need enrollment. -Author/date: Codex, 2026-10-11. - -Decision: Stack this PR on #46; keep the public scope API and rollback fixes in the -parent. Rationale: reviewers can assess semantics before optimization. -Author/date: Codex, 2026-10-11. - -Decision: Never resolve references to enable a fast path. After native checking -has resolved every relevant reference to an ordinary class with the builtin -metaclass and no state hook, compile the same expression with those resolved -classes. Clear specialization alongside the upstream reference cache. Unknown, -custom-metaclass and composite-alias cases retain transactions. Rationale: avoids -stale capabilities, changed lazy errors, predicate replay and changed sampling. -Author/date: Codex, 2026-10-11. - -Decision: Opt-in atomic leaves promise to restore all mutations on False or any -BaseException. Only such primitive roots may omit an outer duplicate snapshot; -composite parents still own rollback. Existing bearshape leaf checks satisfy this -promise. Rationale: remove redundant work without assuming arbitrary plugins are -atomic. Author/date: Codex, 2026-10-11. - -## Outcomes & Retrospective - - -The isolation correction and refreshed tests/benchmarks are complete. The known- -domain path enrolls only into the same public invocation and avoids owner lookup -when there is no parent. Earlier results below describe the previous artifact. This is local upstream proposal work, -not a dependency release or publication authorization. - -## Context and Orientation - - -The parent PR stores the pinned upstream base and ordered patches in -`tools/upstream/patches/series.json`. Its validator builds both wheels and checks -normally installed consumers. The upstream `_HintCheckState` saves plugin state -before a composite or alternative and rolls it back on failure. Unknown references -require a context so newly discovered state can join existing checkpoints. Fully -known domains need not publish a new context. A primitive atomic hint can handle -its own failed-leaf restoration while its parent still restores rejected branches. - -## Plan of Work - - -Create a third upstream patch from the correctness head. Add an explicit atomic -leaf promise and the known-domain transaction variant. In the native expression -factory, keep a copy of the unwrapped expression and its lexical scope. For -expressions with references and no known state domains, create a dispatcher that -initially uses the transaction path. It may compile a direct plain-class expression -only after checking has resolved all proxies. Use the upstream cache lock to take -a consistent resolved snapshot. Register only weak invalidation listeners; cache -clear must release captured old classes immediately. In-flight checks may finish -against their captured pre-clear classes, but subsequent checks must re-resolve. - -Add upstream regressions for cold stateful checks, unresolved alternatives, cache -clear from plain to stateful and back, custom metaclasses, sampling count, caught -exceptions, concurrent clearing and release of old classes. Extend the benchmark -with tuple, mapping and nested-list references, cold and warm samples, correctness -checks and raw repeats. Keep benchmark thresholds out of CI. - -## Concrete Steps - - -Use uv 0.11.17. Follow the parent plan's locked baseline and hook commands. Export -`0003-ordinary-performance.patch` and update the series digest. Run -`tools/check_upstream_proposal.py` against fresh pinned upstream checkouts and new -output directories on Python 3.11 and 3.14, following `tools/upstream/README.md`. -Run upstream unit tests and pyright on the patched source. Compare the same -benchmark scripts in released, correctness-only and optimized environments, one -at a time while other tests are stopped. Use 20,000 calls and seven repeats; -record machine/interpreter versions and wheel/script hashes. Never compare an -incorrect union result as a valid faster implementation. - -## Validation and Acceptance - - -All 67 parent focused cases must remain passing with no skips, plus the new -optimizer regressions. Full runtime consumers and four static consumer engines -must pass on both endpoints; ordinary locked baseline tests remain passing. -Ordinary reference overhead should materially decrease relative to correctness- -only without a native stateless regression beyond local measurement variability. -Record actual results even if a path cannot safely be optimized. No new release -claims, dependency lock changes, retry checks, global monkeypatches or xfails. - -## Idempotence and Recovery - - -Use a separate local upstream branch and preserve parent wheels. The ordered -patch driver rejects mismatched inputs. Retry failed builds in fresh directories; -never erase earlier evidence. Store final logs and hashes under the main checkout's -ignored `build/union-scope-development/`. Main and upstream remotes stay unchanged. - -## Artifacts and Notes - - -Record commit and patch identities, normally installed import origins, exact -commands, test counts, raw timing samples and hosted checks. Keep correctness and -optimization evidence separate. Publication remains blocked on supported adoption. - -## Interfaces and Dependencies - - -Preserve `HintCheckScope` and the state getter protocol from #46. Add only the -optional `__beartype_state_atomic__ = True` promise on participating hint classes. -The optimization is internal and does not change beartype's public configuration, -annotation syntax, ordering, container sampling or DOOR semantics. - -Revision note — 2026-10-11: Created the focused optimization plan before code. - - -Decision update — 2026-10-11: Keep root references and one sampled-reference list -on the existing proxy path. Extending specialization there changed the existing -root expression-factory identity contract; that broader change is unnecessary -for the requested composite overhead reduction. The small remaining state-hook -lookup cost is explicit. No existing upstream test was weakened or removed. - - -## Completed evidence - - -Implementation head: 291af356856ce93ae87020cee8c4f18903e89d92. Local upstream head: -01f32470, based on correctness head 5071616b. Patch digests are recorded in the -series manifest. `tools/upstream/evidence/2026-10-11/README.md` contains matched -results and six raw benchmark files, using the same bearshape wheel in every -variant and sequential runs. All 17 runtime source files match that exact wheel. - -The optimized bearshape wheel SHA256 is -fe593320362bee43e8f1f91bb3ec10d1b3f85a0ea1039a3b7f7b409302ad8026; -its tested source archive is -45465be260ff82d4baba1967613c1dcb4bdd90930706e820b693d0b62ba67e2b. -The local upstream wheel SHA256 is -777f5641545dc78c4eec30447c6ddfadec6144767e6466781210831ff50c85fa. -Copies, commands and endpoint logs survive under the main checkout's ignored -`build/union-scope-development/optimized/`. Subsequent documentation/evidence -commits change source archive contents but not these runtime wheel inputs. - -Both Python 3.11.15 and 3.14.5 installed consumers pass 1,221 tests, with five -explicit skips (absent CuPy and four extended-precision platform cases). CPU -backend preflight and the unchanged union probe pass. Four checker consumers -retain positive, negative and inference assertions. Upstream unit tests pass -467/475 cases (15/7 interpreter or optional-dependency skips). Upstream pyright -analyzes 483 files with zero errors or warnings. Normal hooks and actual push -runtime/four-checker hooks pass. PR #47 implementation head has 36 passing hosted -checks, including both proposal lanes in run 38142309440. - -On 3.11 warm tuple/mapping/nested-list calls change from 1.107/1.126/1.147 -microseconds in the correctness proposal to 0.162/0.193/0.213. Released 0.23.1 is -0.672/0.693/0.723 on those same inputs. On 3.14 optimized medians are -0.176/0.214/0.245. Strict shape checking falls from 9.816 to 7.600 on 3.11 and -10.313 to 7.905 on 3.14. Correct fallback unions take 12.205/12.482; the released -baseline is incorrect and is never presented as a valid timing comparison. -Root references and simple sampled lists retain approximately 0.06–0.07 -microseconds extra cost on 3.11. Custom metaclasses and stateful aliases remain -general. Native checks stay around 0.09 microseconds. This is local evidence, -not a cross-platform performance guarantee or a release readiness claim. - -Revision note — 2026-10-11: Completed and validated the focused optimization, -recorded raw matched measurements and exact artifacts, and retained explicit -remaining costs. No existing regression or diagnostic was suppressed. - - -## Isolation correction evidence - -The optimized upstream head is `7d039bcbe49da0d23976429ccedeb7e13598c239`, -based on corrected source `e44afa92`. Bearshape integration commit `dee5bb1` -preserves the reviewed parent history and refreshes patches 0002/0003 with their -manifest hashes. The correction adds no public API. The source design review is -in `tools/upstream/DESIGN_REVIEW.md` from the parent PR. - -Fresh installed endpoint consumers pass 1,262 cases each with five explicit CPU -skips, including all four static engines. Upstream units pass 484/492 with 15/7 -existing skips, and upstream pyright reports zero errors/warnings across 483 -files. All 41 added isolation cases pass; focused proposal coverage is now 119. -The artifacts and full command logs are preserved under the main checkout's -`build/union-isolation-revision/`. Exact wheel hashes are in the benchmark report. - -`tools/upstream/evidence/2026-10-11-isolation/` retains six transaction benchmark -runs, six representative runtime runs, and a native-check stability probe. The -same bearshape wheel is installed in all three variants. Each transaction run -uses 20,000 calls and seven raw repeats; runtime runs use 10,000 and five. On -3.11, released/corrected/optimized tuple medians are 0.685/1.600/0.171 microseconds; -strict shape checks are 12.749/11.844/8.562. Correct fallback union checking is -15.942/13.787 for corrected/optimized; the released implementation is incorrect. -Remaining root/list overhead is about 0.08–0.09 microseconds on 3.11. - -The initial optimized native 3.14 result of 0.141 microseconds is retained. A -rotated-order follow-up using one million calls per repeat measured optimized -native medians of 0.094–0.096 versus released 0.101–0.103 across three rounds. -The outlier did not reproduce. No measurement was discarded and there is no CI -performance threshold. These results are local CPU evidence, not CUDA evidence -or a cross-platform speed guarantee. - -Revision note — 2026-10-11: Finished the invocation-isolation fast-path correction, -preserved the historical evidence, and refreshed the benchmark report. Hosted -checks are verified on the pushed review heads; no upstream contact, main merge -or publication is authorized. diff --git a/plans/2026-10-11-union-scope-correctness.md b/plans/2026-10-11-union-scope-correctness.md deleted file mode 100644 index 4144f7e..0000000 --- a/plans/2026-10-11-union-scope-correctness.md +++ /dev/null @@ -1,298 +0,0 @@ -# Preserve state across internal alias checks - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - - -This living ExecPlan follows `PLANS.md`. Keep Progress, Surprises & Discoveries, -Decision Log and Outcomes & Retrospective current. - -## Purpose / Big Picture - - -A late type alias is part of the enclosing check. It must see earlier dimension -bindings and function arguments, and successful bindings must constrain later -arguments. A separate decorated call or public DOOR call must remain independent. -The previous local upstream proposal passes 22 union regressions but fails eleven -new cases involving alias ownership and a caught nested failure. Develop a -supported scope interface and preserve all native composition and errors. - -## Progress - - -- [x] (2026-10-11, follow-up) Fix transaction enrollment across independent invocation scopes; review simpler alternatives and record the decision. -- [x] (2026-10-11, follow-up) Run failing isolation regressions, endpoint consumers, upstream units and typing; update this PR and its dependent optimization evidence. -- [x] (2026-10-11) Inspect the previous proposal and the additional failing cases. -- [x] (2026-10-11) Committed plan and opened draft PR #46 before implementation. -- [x] (2026-10-11) Implemented public lazy scope API and optional bearshape adapter. -- [x] (2026-10-11) Old proposal: eleven failures and five passes. Revised proposal: 67 focused passes on each endpoint. -- [x] (2026-10-11) Added pinned, hashed patch series and proposal-only installed-consumer CI. -- [x] (2026-10-11) Validated installed endpoint wheels, upstream units and all runtime/four-checker consumers. -- [x] (2026-10-11) Prepared review evidence; all 36 hosted checks passed. No main merge or publishing. - -## Surprises & Discoveries - - -A later source review found that transaction enrollment deduplicates by getter -identity across independent invocations. If an inner public check registers a -getter before an outer late alias resolves, the outer checkpoint retains the -inner state object and fails to restore the outer binding. Both DOOR and nested -decorated variants fail on both Python endpoints, while controls pass. Distinct -public scope objects alone do not constrain the transaction stack. - -Composite forward references delegate to a generated DOOR checker. Treating that -internal frame as a public DOOR invocation silently separates shape state. A -boolean local marker demonstrated the distinction but is not a public integration -API. A second defect allows a rejected late leaf to leak mutations when an outer -predicate catches the violation and succeeds. - -## Decision Log - - -Decision: Continue the existing PR and worktree under the owner's instruction to -fix isolation, review simplicity/compatibility, rerun tests and benchmarks, and -update the focused PRs and unsent Zulip draft. The implementation must enroll a -late domain only into transactions belonging to the same live public checking -invocation. Internal aliases remain transparent. First evaluate a private owner -identity derived from the existing scope-boundary lookup, retaining neither the -frame nor an invocation scope object for ordinary checks. Compare scope-object -allocation and new wrapper/context plumbing before choosing a larger design. -Keep public names and annotation syntax unchanged unless correctness requires a -new owner decision. Date/author: 2026-10-11, Codex. - -Decision: Stack on PR #45, the combined release candidate, and keep optimization -in a subsequent focused PR. Rationale: correctness must be reviewable independently -of fast paths, with the same baseline fixes and memo performance on both sides. -Author/date: Codex, 2026-10-11. - -Decision: Prepare upstream changes locally and carry source patches as review -artifacts in bearshape. Do not open an upstream PR or contact a maintainer. -Rationale: the user explicitly requested development before contact. These patches -are never imported, installed automatically by bearshape, or published. -Author/date: Codex, 2026-10-11. - -Decision: Expose `beartype.plug.get_hint_check_scope()` and `HintCheckScope`. The -scope provides invocation-owned state, owner code identity and lazily bound -arguments. Internal aliases share the enclosing scope; independent generated -entry points create separate scopes. Ordinary checks allocate no scope unless a -plugin asks for it. Keep the released-dependency fallback in bearshape. -Author/date: Codex, 2026-10-11. - -## Outcomes & Retrospective - - -The invocation-isolation correction is implemented and passes the expanded -regression matrix and both installed endpoint suites. The design review records -why a private live-invocation identifier is sufficient without changing the scope -API or allocating public scopes for ordinary checks. Earlier results below remain -historical evidence for their exact artifacts. The current evidence is recorded -in the isolation correction validation section. - -Published beartype 0.23.1 still lacks the protocol. Passing proposal tests does -not establish support in that published dependency or authorize release. - -## Context and Orientation - - -`src/bearshape/_memo.py` currently finds generated beartype frames and stores a -ShapeMemo in frame locals. ShapeMemo holds scalar dimensions, variadic dimensions -and tree structures. Its snapshot and restore methods implement rollback. -`tools/upstream/test_union_transactions.py` contains 22 integration cases. -The local beartype proposal based on released v0.23.1, commit -f85b67d8b0b6bd9c910bd97f0d2d417c4550b038, adds the `__beartype_state__` hook and -transaction boundaries around composite checks. A transaction saves the current -state and restores it after failure. Existing proposal commit is -d0fe6e67a5ab693acb263e4bb0e1eb7131dc3fba. It is not a released dependency. - -## Plan of Work - - -First preserve the original proposal as `tools/upstream/patches/0001-state.patch`. -Develop the correctness delta in a separate local upstream branch. Add a private -scope implementation exported by `beartype.plug`, tag generated public entry -points and internal alias delegates explicitly, and retain separate checker -caches so public and delegated checkers never share scope semantics. A scope -contains no frame reference and is created only when requested; frame ownership -ends with the check. Argument binding remains lazy and uses the original callable. - -Adapt `_memo.py` through the public API when available, retaining released-0.23.1 -behavior otherwise. Always give a stateful late leaf its own checkpoint so a -caught rejection cannot contaminate the caller. Preserve new regressions in -`tools/upstream/test_scope_transactions.py`, with generic protocol tests in the -upstream patch. Add developer instructions and a proposal CI lane that builds -from the pinned upstream base plus reviewed patches. It must exercise normally -installed wheels and must never upload anything. Keep existing release gates. - -## Concrete Steps - - -Work in this feature worktree using uv 0.11.17. Start with: - - uv sync --locked - uv run --locked prek install - uv run --locked pytest tests/ --ignore=tests/test_typecheck.py -n auto - uv run --locked pytest tests/test_typecheck.py -q - -For proposal validation, export locked tools excluding beartype, build a clean -upstream checkout with the ordered patches, build bearshape, and install both -wheels into fresh Python 3.11 and 3.14 environments. Run the environments directly; -`uv run --locked` would replace the proposal with published beartype. Copy tests -outside source checkouts to prove installed imports. Exact commands will be -recorded in `tools/upstream/README.md`. Stage files, run normal hooks and manual -actionlint, then commit implementation and evidence separately from the plan. - -## Validation and Acceptance - - -The old proposal must fail the eleven demonstrated regressions. The new proposal -must pass all existing 44 combined integration/protocol cases and the sixteen -additional cases without skips. Add direct scope lifetime, argument binding, -independent invocation and public/delegated cache-order tests. Existing runtime -consumers and four checker engines must pass on both supported endpoints. Check -upstream unit tests and typing. State explicitly which optional backend or -platform cases are unavailable; no skips establish unsupported hardware evidence. - -## Idempotence and Recovery - - -Keep the original proposal and published baseline environments unchanged. Use -separate local upstream branches and fresh artifact directories. Patches must -apply to the exact base with `git apply --check` and a clean checkout. No package -is monkeypatched, no user annotation is rewritten, and no upstream branch is -pushed. Main stays unchanged. Preserve evidence under the main checkout's ignored -`build/union-scope-development/` directory before any worktree cleanup. - -## Artifacts and Notes - - -Record source commits, patch and wheel SHA256 hashes, interpreter versions, exact -commands, imported package paths, test counts and hosted run URLs. The reviewable -patch series is a development artifact, not a forked dependency for publication. - -## Interfaces and Dependencies - - -Keep Python >=3.11 and released beartype 0.23.1 as the locked baseline. The proposed -public scope object exposes `state: dict[object, object]`, `owner_code: CodeType` -and `arguments: dict[str, object]`. Scope lookup returns None outside a generated -checking invocation. `__beartype_state__` remains a callable returning an object -with `snapshot()` and `restore(token)`; the snapshot token is opaque to beartype. -Optimization-specific promises are deferred to the next PR. - -Revision note — 2026-10-11: Created the correctness and scope plan before code. - - -## Completed validation evidence - - -The adapter and driver are commit c7350f3d5e6b6b44d32370586b6c17e9e60367fb. -The local upstream correctness head is 5071616b, based on the preserved original -proposal d0fe6e67 and released base f85b67d8. Exact patches and SHA256 digests are -committed in `tools/upstream/patches/series.json`. Subsequent changes to this plan -record evidence only. - -Fresh normally installed wheels built by `tools/check_upstream_proposal.py` -passed 1,210 tests on EACH Python 3.11.15 and 3.14.5, including the original union -probe and all four positive/negative/inference checker consumers. Five skips are -absent CuPy and four platform-specific extended-precision cases. The focused -scope/integration/protocol set passed 67 cases without skips on both endpoints; -the old proposal fails eleven of the sixteen added integration cases. Upstream -unit suites passed 456/464 cases with 15/7 interpreter or optional-dependency skips. -Upstream pyright analyzed 483 files with zero errors or warnings. Ordinary locked -runtime/checker push hooks, normal hooks and manual actionlint passed. - -Hosted run 38141512170 passed all 34 shared validation jobs; proposal run -38141512210 passed both normally installed CPU endpoint lanes. Together PR #46 -has 36 successful checks. These verify published-baseline compatibility and the -separate local proposal, respectively; only the proposal closes the regressions. - -The normally installed bearshape wheel SHA256 is -b80d0b473274ec0dbad4e31e4180eaaf7bbbdb34769d8c19d2dd54ccaef67037; -its source archive is -5ad73a416dcc2f1a5a84af057d8f5703ddb00731453b18b67d2cd19ab4922dea. -The local beartype wheel is -29bfe7ac44e8b8fd6157ac02853a933c256db88184dace6e4d85d01698e66342. -These exact archives, commands, imported paths, logs and endpoint evidence files -are preserved under the main checkout's ignored -`build/union-scope-development/correctness/`. They are test artifacts, not an -upstream release. Later documentation changes do not alter runtime wheel inputs. - -The first driver trial omitted the existing `--installed-package` pytest option: -all runtime cases passed but three checkers correctly rejected the absent `src` -target in the copied-consumer directory. The driver now uses that option and -requires the CPU-backend preflight. Fresh full reruns on both endpoints passed; -no diagnostics were suppressed. Diff artifacts also need their context whitespace -and exact upstream identifiers preserved, so only whitespace rewriting and typo -rewriting exclude the patch files; SHA256 checks protect their exact contents. - -Revision note — 2026-10-11: Completed correctness implementation and local/hosted -validation, recorded exact artifacts, and retained the supported-upstream release -prerequisite. No upstream PR, maintainer contact, main merge or upload occurred. - -## Isolation correction milestones - - -First add focused generic and bearshape regressions covering late state discovery -before and after independent public DOOR/decorated checks, recursive calls sharing -one wrapper, caught failures, internal alias propagation and lifetime. Run them -against the preserved candidate wheels and retain the expected failure evidence. - -Next factor the existing public-scope boundary traversal for private transaction -ownership, filter enrollment by live invocation identity, and clear ownership on -exit. Scope identity must distinguish recursive calls and copied contexts without -retaining frames or allocating public scope objects for ordinary users. Validate -the focused suite before integrating this change into upstream patch 0002. - -Finally use the existing clean-base proposal driver to build normally installed -Python 3.11/3.14 consumers, run upstream unit tests and pyright, and run normal -hooks. Update the dependent optimization PR without mixing its runtime changes -into correctness. Preserve fresh commands, archives, hashes and benchmarks under -the main checkout's ignored build/union-isolation-revision directory. Update PR -descriptions and the unsent draft only from completed evidence; no upstream -contact, main merge or publication is authorized. - -Revision note — 2026-10-11: Reopened correctness for the confirmed cross-invocation -transaction defect and documented the owner-authorized correction before code. - - -## Isolation correction validation - -The corrected upstream source is `e44afa9241cf656c39101375a3b729dff77c5142`; -bearshape implementation commit is `4d4ca48`. Patch 0002 was regenerated against -the preserved original proposal, with its SHA256 updated in the manifest. -`tools/upstream/DESIGN_REVIEW.md` records the root cause, alternatives and native -code-generation/cache compatibility review. The public API is unchanged. - -Before the fix, the new generic regression suite reports eight failures and nine -passes. After the fix, all 17 generic cases and all 24 bearshape cases pass. The -latter cover nested public testers, raisers and decorated calls, both discovery -orders, caught rejection and automatic/explicit scopes. Recursion, copied active -contexts across threads, object lifetime and lazy public-scope allocation are -covered directly upstream. Existing internal-alias and asynchronous cases remain -in the full suite. Total focused coverage is now 108 cases. - -Clean-base patch application and fresh normally installed wheels pass 1,251 tests -on each Python 3.11.15 and 3.14.5, including CPU backends, the union probe and all -four positive/negative/inference checker consumers. Five skips remain absent CuPy -and four platform precision cases. Upstream units pass 473/481 cases with 15/7 -existing interpreter, optional and known-issue skips. Upstream pyright analyzes -483 files with zero errors or warnings using an explicit 3.11 interpreter and -target. An initial invocation inherited an older system target; both that failed -log and the corrected command are retained. Normal hooks pass. - -Fresh source archives, wheels, exact commands, imported paths and hashes are -preserved under `build/union-isolation-revision/` in the main checkout. The -corrected upstream wheel SHA256 is -`0e19b66f35fd1a49dff124f67d69f273dd2309d1b850d4b6bc59cad6521a9100`. -The bearshape runtime wheel remains byte-identical to the earlier correctness -wheel (`b80d0b47...`); only proposal patches, tests and review documentation changed. -The dependent #47 reruns matched benchmarks with the same bearshape wheel across -released, corrected and optimized upstream variants. No main merge, upstream -message or publication is included in this work. - -Revision note — 2026-10-11: Completed the isolation correction and source design -review. Historical logs are retained; hosted validation is checked after pushing -the final review commits rather than inferred from older green runs. diff --git a/plans/2026-10-11-variadic-broadcast.md b/plans/2026-10-11-variadic-broadcast.md deleted file mode 100644 index 229f2df..0000000 --- a/plans/2026-10-11-variadic-broadcast.md +++ /dev/null @@ -1,87 +0,0 @@ -# Broadcast custom array shapes without NumPy - -> Historical execution record. Versions, commands and pending actions below -> describe this work at the time. Use the [plan index](README.md), -> [current contributor guide](../CONTRIBUTING.md) and -> [current handoff](../docs/maintainers/production-readiness.md) for today's -> workflow, merge status and release prerequisites. - - -This living ExecPlan follows `PLANS.md` and M2 of `plans/2026-10-11-release-readiness.md`. The program plan supplies the full release contract; this focused change is stacked on baseline PR #39. - -## Purpose / Big Picture - - -The metadata-only path in `src/bearshape/_shape.py::_check_variadic` imports NumPy for different broadcastable variadic shapes. Compute the combined tuple using trailing alignment and dimension-one expansion, preserving zero axes, incompatible-shape errors and existing memo rules. Add representative comparisons with NumPy in `tests/test_shape.py`; extend `tools/smoke_minimal.py` to prove custom arrays broadcast without optional imports in a fresh normally installed wheel. - -## Progress - - -- [x] (2026-10-11) Reproduced the defect during the whole-library audit; created the focused branch and plan. -- [x] (2026-10-11) Commit plan and open draft PR before implementation. -- [x] (2026-10-11) Add a failing behavioral regression, implement the surgical fix and update CHANGELOG. -- [x] (2026-10-11) Focused tests and normal hooks passed; complete runtime/four-checker pre-push validation is recorded in the finish log. - -## Surprises & Discoveries - - -The October audit reproducer demonstrates this defect on both earlier rc0 and released beartype 0.23.1. It is independent of the native composite-union upstream blocker. - -## Decision Log - - -Decision: Preserve public syntax, successful behavior and useful errors; fix only this demonstrated correctness defect. Rationale: the owner requested every audit finding be addressed in focused PRs on Python 3.11+ and beartype 0.23.1. Author/date: owner/Codex, 2026-10-11. - -## Outcomes & Retrospective - - -The minimal custom-array probe failed importing NumPy before. After: 421 focused tests passed with two platform skips; a normal sdist-derived wheel passed the expanded minimal smoke via /tmp, with no optional backends installed or imported. The shape test compares 64 combinations, including zero axes and differing ranks, with NumPy. Full runtime and checker validation is enforced by the real pre-push hooks; hosted integration evidence remains pending. This PR does not authorize merging or publishing and does not claim to fix native union transactions. - -## Context and Orientation - - -The implementation and test locations are named above. Array and tree leaves use invocation-local `ShapeMemo` state from `src/bearshape/_memo.py`; failed leaf checks and diagnostic formatting must restore state. Root imports must remain free of NumPy/JAX/Torch/CuPy/optree. The baseline is `codex/python311-beartype0231`, with all four static consumer engines retained. - -## Plan of Work - - -First add a regression exercising the audited invalid behavior and run it against unchanged source. Save the failure under the main checkout's ignored `build/release-2026-10-11/evidence/`. Make the smallest source change described above, retaining the surrounding validation and state lifetime contract. Add positive/negative neighboring cases where the new branch needs proof, then run the focused modules. Update CHANGELOG and this plan, stage new files before hooks, review formatter changes and commit/push the concrete result. - -## Concrete Steps - - -From this worktree with uv 0.11.17 on PATH: - - uv sync --locked - uv run --locked prek install - uv run --locked pytest tests/test_shape.py tests/test_numpy.py tests/test_coverage_edges.py -n 0 - uv run --locked pytest tests/test_typecheck.py -q - uv run --locked prek run -a - -Real pre-push hooks also run the complete runtime and four-checker suites. Archive, platform and CUDA evidence will be refreshed on the combined integration branch. - -## Validation and Acceptance - - -The audited reproducer fails before and passes after the source fix. Neighboring valid forms remain valid and wrong shapes/types still reject with useful errors. Existing memo rollback/lifetime and static inference tests remain effective. No xfail, suppression, lowered coverage or optional-backend import is introduced. Detailed scope and acceptance cases are stated in Purpose above. - -## Idempotence and Recovery - - -Use the matching isolated worktree/environment. Do not modify main or existing unmerged PR branches. Keep evidence outside disposable worktrees. Do not publish, deploy or send maintainer messages. Re-running the tests is safe. - -## Artifacts and Notes - - -Original audit evidence is `/Users/ale/Code/bearshape/build/audit-2026-10-11/`. New logs belong under `build/release-2026-10-11/evidence/` in that same main checkout. Append meaningful results and source identities after implementation. - -## Interfaces and Dependencies - - -No new runtime dependency or public API. Retain Python 3.11–3.14, exact tested beartype 0.23.1, existing backend semantics and the four supported checker engines. Dimensions remain runtime constraints rather than static shape proofs. - -Revision note — 2026-10-11: Created the focused regression/fix plan before implementation. - -Revision note — 2026-10-11: Recorded before/after regression evidence and the surgical fix. Real commit/push hooks remain required before the implementation head is delivered. - -Revision note — 2026-10-11: Recorded before/after regression evidence and the surgical fix. Real commit/push hooks remain required before the implementation head is delivered. diff --git a/plans/2026-10-12-dev-toolchain.md b/plans/2026-10-12-dev-toolchain.md deleted file mode 100644 index 0287cf9..0000000 --- a/plans/2026-10-12-dev-toolchain.md +++ /dev/null @@ -1,185 +0,0 @@ -# Upgrade the development toolchain together - -This ExecPlan follows `PLANS.md` and records implementation and validation. - -## Purpose / Big Picture - -Contributors and CI should use current stable development tools from a consistent -lock, including uv, its build backend, pytest/plugins, checkers, formatters, -notebook and documentation tools. The candidate must retain the supported Python -3.11–3.14 matrix and exact released beartype 0.23.1 acceptance baseline. - -## Progress - -- [x] (2026-10-12) Verify clean main 8af59e0 and current owner instructions. -- [x] (2026-10-12) Inventory declared/locked tools and query official registries. -- [x] (2026-10-12) Create the dedicated dev-toolchain worktree and feature branch. -- [x] (2026-10-12) Commit the plan and open draft PR #60 before implementation. -- [x] (2026-10-12) Update declarations, universal lock, uv/build/workflow and hook pins. -- [x] (2026-10-12) Update current developer instructions, retaining dated evidence. -- [x] (2026-10-12) Validate runtime, checkers, floors, hooks, docs/notebook and archives. -- [x] (2026-10-12) Validate the combination with the README/coverage PR. -- [x] (2026-10-12) Record results and complete the PR for review; merge is separate. - -## Surprises & Discoveries - -The project and build backend restrict uv to 0.11.x; current stable uv is 0.13.0. -Its default Python selection now differs, so keep the project's explicit 3.11 -pin and explicit CI interpreter matrix. Current tools include pytest 9.1.1, -Ruff 0.17.0, prek 0.5.5, mypy 2.4.0, ty 0.0.86, pyrefly 1.3.2, pyright 1.1.414, -Zensical 0.0.69 and ipykernel 7.4.0. pytest-cov, pytest-xdist and nbclient are -already at their latest stable releases. Backend versions can have newer Python -floors; the universal lock must retain compatible packages for Python 3.11. - -The refreshed lock preserves NumPy 2.4.6 and JAX 0.10.2 for Python 3.11 while -selecting NumPy 2.5.4 and JAX 0.11.2 on newer supported interpreters. Ruff 0.17 -mechanically migrates the existing lint-ignore syntax; no extra diagnostics were -suppressed. All 19 changed Python source/test/tool files have identical ASTs. -The updated Markdown formatter reformats 95 documentation snippets without -changing their ASTs; four long signatures needed trailing commas to keep the -existing Markdown line-length rule. Rendering and example tests pass. - -GitHub action releases are verified against official tags: setup-uv v10.3.0, -upload-artifact v7.0.2 and download-artifact v8.0.2 are now pinned by exact SHA. -Checkout, Pages actions and PyPI publish were already current and retain pins. - -## Decision Log - -- Decision: Upgrade the full development lock while constraining beartype to - 0.23.1. Update uv 0.13.0, uv_build 0.13.x, hook versions and all active workflow - uv pins in the same PR. Validate actual hook execution, not only configuration. - Rationale: Tool versions, archive generation and local/hosted validation must - agree. No global tool installation or unrelated machine changes are needed. - Date/Author: 2026-10-12, Codex. -- Decision: Keep runtime dependency metadata, public syntax, Python support and - compatibility-floor factors. Current development versions are distinct from - older backend/checker versions deliberately covered by compatibility lanes. - Retain CPU Torch source selection and do not infer CUDA support from skips. - Date/Author: 2026-10-12, Codex. -- Decision: Preserve historical plans and benchmark reports with their original - tool versions. Update only current commands/instructions and this plan. - Date/Author: 2026-10-12, Codex. - -## Outcomes & Retrospective - -The requested development upgrades and required formatter migrations are -complete. Source, normally installed archives, minimal consumers, compatibility -floors, docs/notebook and all 36 implementation-head hosted checks pass. Both -focused PRs also pass combined validation. Python support, beartype baseline, -public behavior and the union release blocker remain unchanged. Merge, -publication, deployment, upstream contact and access changes remain separate. - -## Context and Orientation - -pyproject.toml contains development groups, uv settings and the uv_build range; -uv.lock resolves the supported interpreters. pytest.toml and tox.toml define -validation inputs. `.pre-commit-config.yaml` owns real hook tools/stages. All -CI, nightly and release validation share `.github/workflows/validate.yml`. -AGENTS.md, CONTRIBUTING.md and README.md state the current contributor setup. -The separate README/coverage PR adds visibility and report artifacts. - -## Plan of Work - -Record registry versions, then update direct development group constraints and -resolve current compatible transitive/backend versions with exact beartype. -Coordinate uv CLI, build backend, workflow and uv-pre-commit versions. Update -hook tools and plugins to current stable tags. Investigate any real regressions -from newer checkers, formatters, docs or test runners with the smallest fix; -do not suppress diagnostics or weaken consumers. Keep current instructions in -sync and add this plan to the plan index. Verify both PRs together on a separate -integration branch, preserving their independent review scopes. - -## Concrete Steps - -Bootstrap and record the baseline with uv 0.11.17. Install uv 0.13.0 only in a -throwaway tool environment, then use it in this worktree after updating the -required-version setting. Preserve logs under ignored build/dev-toolchain/ in -the main checkout. Run: - - uv lock --upgrade --upgrade-package beartype==0.23.1 - uv sync --locked - uv run --locked prek install - uv run --locked pytest tests/ --ignore=tests/test_typecheck.py -n auto - uv run --locked pytest tests/test_typecheck.py -q - uv run --locked prek run -a - uv run --locked prek run actionlint -a --stage manual - uv run --locked --only-group docs zensical build --clean - uv run --locked --only-group docs python tools/check_docs.py - uv run --locked python tools/check_notebook.py - -Use documented tox floors and endpoint installed-archive consumers. Build the -sdist first and its wheel from that source, check distribution integrity and -record new hashes: newer uv may change archive bytes. Stage new files before -hooks and review formatting changes. Inspect final hosted checks at the reviewed -head and the combined PR validation before handing off. - -## Validation and Acceptance - -Current stable tools compatible with the supported interpreters are selected; -already-current tools are recorded rather than changed gratuitously. The lock, -uv/build/hook/workflow pins and current commands agree. Four checkers retain -positive, negative and native inference evidence. Runtime and all required CI -lanes, actual hooks, documentation/notebook and installed archives pass with -exact beartype 0.23.1. Compatibility floors and coverage are not lowered. - -## Idempotence and Recovery - -All environment/report outputs are ignored and regenerable. Feature commits -preserve main and historical evidence. Revert only this focused PR if needed; -the independent README/coverage change can remain. Never force main. - -## Artifacts and Notes - -Official registry inventories are retained in the main checkout's ignored build -outputs. Record before/after versions, source SHA, commands, artifacts/hashes, -failures and hosted runs here as validation completes. Union rollback remains a -release blocker regardless of tooling/CI success. - -## Interfaces and Dependencies - -No new checker engines or public annotation API. Use the existing validators, -locked uv toolchain, CPU backend index, hook framework and shared CI routes. - -Revision, 12 October 2026: update tool declarations and coordinated uv pins; -lock resolution and behavioral validation are next. - -Revision, 12 October 2026: locked runtime/checker/docs/notebook checks pass; -record necessary formatter migrations and current action pin upgrades. - -Initial validation, 12 October 2026: uv sync --locked and real hook installation -pass. Commit-message stage has no file checks; normal hooks and actionlint pass. -The upgraded environment passes 1,315 runtime tests (five expected skips), -91.23% line/branch coverage and all eight four-checker suite tests. Zensical -build and rendered-structure checks pass with 95 snippets; 29 notebook cells -execute. Tox passes py311-bt0231-numpy22 and all four py313 checker floor factors, -with no floor changes. The sdist-derived wheel passes archive checks: SHA256 -b41d831ecc41881e2078c28486688ceec9ef9cb9ce77087e3503617ae3fd8101; -sdist e27acf7597edfb7f4b13aed7c00883707877a2efd6f2751f7c32f7627f7e6cdd. -Fresh installed/minimal Python endpoints and combined validation follow. - -## Completed review evidence - -Implementation commit 743b3143ad530f807f47f89b25a1843509743f5a passes all 34 -[shared CI jobs](https://github.com/beartype/bearshape/actions/runs/38228648881) -and both [proposal jobs](https://github.com/beartype/bearshape/actions/runs/38228648912). -Normally installed consumer suites pass 1,323 tests at Python 3.11.15 and 3.14.5, -including all four checkers, with five expected hardware/precision skips. Both -fresh minimal environments pass with no optional backend installed. NumPy 2.5 -warns that dtype assignment in the deliberate same-object dtype-replacement -regression is deprecated; the regression passes and is retained without warning -suppression. Visual inspection of the rebuilt homepage and JAX API confirms -layout and code rendering; all 95 formatted snippets retain their original AST. - -Combined validation c545e017327e06a5b6eeffa4afa6ebb72a37f1ed preserves both -implementation heads and resolves the overlapping README, changelog and plan -index. Coverage uses the updated upload-artifact pin. Normal hooks/actionlint, -1,315 runtime tests with 91.23% coverage, rendered docs structures and 1,323 -normally installed consumer tests on each Python endpoint pass. Combined wheel -SHA256 is 3c2fc844f85f00bdd2fd99a27413144ec717174dd270f216b43e8b44ef6d0907; -sdist f52ada0686ec9089e648b76edb241b5200abe2c8b8c8c39bec3af45549ba8749. -Evidence lives in ignored build/dev-toolchain/ and build/maintenance-validation/ -in the main checkout. This final plan update changes no validation/archive -inputs; final-head hosted checks also run automatically on push. - -Revision, 12 October 2026: record completed archive, minimal, hosted and combined -validation, and mark implementation complete for review. Main is unchanged. diff --git a/plans/2026-10-12-docs-alignment.md b/plans/2026-10-12-docs-alignment.md deleted file mode 100644 index f376b50..0000000 --- a/plans/2026-10-12-docs-alignment.md +++ /dev/null @@ -1,286 +0,0 @@ -# Align user and contributor documentation with merged main - -This ExecPlan is maintained under `PLANS.md`. It covers documentation and the -checks needed to establish that the documented workflows and examples work. - -## Purpose / Big Picture - -A user should be able to install the intended revision, choose a backend, -write valid annotations, and understand current limitations without reading -maintainer history. An external contributor should be able to create a focused -change, run the appropriate checks and submit it through the repository's -review framework. Dated experiments remain evidence for their original sources; -current instructions must describe merged main and the unpublished candidate. - -## Progress - -- [x] (2026-10-12) Verify clean main a475c9b and read repository instructions, - current release contract, contributor commands and recent optimization plans. -- [x] (2026-10-12) Create a dedicated docs-alignment worktree and this plan. -- [x] (2026-10-12) Commit the plan and open draft PR #58 before implementation. -- [x] (2026-10-12) Inventory every tracked Markdown artifact, notebook narrative, - public docstring and relevant configuration; audit links and current claims. -- [x] (2026-10-12) Correct installation, usage and support guidance; close - contributor workflow gaps and distinguish current status from historical evidence. -- [x] (2026-10-12) Execute relevant examples and notebook, build and inspect - rendered docs, check local links and verify installed archive metadata. -- [x] (2026-10-12) Normal and real pre-push hooks pass. Hosted baseline - validation and both proposal endpoints pass on the implementation head. -- [x] (2026-10-12) Record coverage, outcomes, artifact hashes and hosted - validation; prepare PR #58 for review. Merge approval remains separate. - -## Surprises & Discoveries - -The initial pass finds installation commands which imply that PyPI contains the -unpublished 0.1.0rc1 candidate; landing pages omit the maintained Pyrefly engine; -and the handoff and optimization plans still describe merged PRs #56/#57 as -open. Current main is a475c9b5376601eb39c9e0641f16f62d56fed979 and preserves both -reviewed histories. These are documentation defects, not API changes. - -## Decision Log - -The owner requested a complete docs/artifact audit on 12 October 2026, including -README, AGENTS and contributor guidance. This authorizes documentation fixes -and validation in a focused PR. It does not authorize merge, publication, -deployment, external messages or administration for this new scope. - -Keep public syntax, Python 3.11–3.14 support, four checkers and exact beartype -0.23.1 validation. The existing union rollback defect remains a release blocker. -Do not modify runtime behavior or use documentation changes to narrow the -accepted contract. Use current source and tests as evidence; flag any actual -runtime discrepancy separately. Preserve dated results and append explicit -status updates where a completed plan would otherwise mislead a reader. - -## Outcomes & Retrospective - -The documentation corrections are implemented in PR #58. Local example, -checker, notebook, rendered-site, link and minimal-consumer validation passes. -The source changes affect docstrings only; runtime behavior, dependency metadata -and the unresolved union release blocker are unchanged. Normal/pre-push hooks -and all 36 hosted checks pass at implementation head 910bad8. Final audit -record updates are checked again on the PR head before handoff. This describes -the implementation review before merge approval; the subsequent review and -approval record follows below. No publication or deployment is authorized. - -## Context and Orientation - -`README.md` and `docs/getting-started/` are the entry points. `docs/features/` -and `docs/api/` describe annotations exported from `src/bearshape/`; tests and -`tests/typing/` establish runtime and static consumer support. `CONTRIBUTING.md` -owns the human workflow, `AGENTS.md` and its `CLAUDE.md` symlink own agent rules, -`PLANS.md` defines execution plans, and `tools/README.md` describes validators. -`docs/maintainers/production-readiness.md` and `releasing.md` describe current -release prerequisites and historical evidence. `plans/` and `tools/evidence/` -contain dated records; `tools/upstream/` contains a separate unshipped upstream -proposal. `zensical.toml`, `.github/workflows/`, `pyproject.toml`, `tox.toml` and -hook configuration are the executable source of workflow facts. - -## Plan of Work - -Start with a complete tracked-file inventory and record a disposition for every -document family. Read user guides and API tables against exports, converters, -decorators, dimension/Tree behavior and real consumer tests. Check notebook -narrative, rendered landing-page text, docstrings, badges, links and workflow -instructions. Verify public distribution/version facts against primary sources. - -Update README and installation pages so the current development candidate is -not confused with a published release. Explain the open composition defect, -backend installation and runtime/static boundaries at the right entry points. -Fix runnable examples if they contain placeholders or unsupported assumptions. -Complete contributor setup, change scope, regression expectations, validation -selection and review/merge responsibilities without duplicating agent policy. -Refresh the current handoff and completed-plan status while retaining historical -source identities, hashes and results. Keep the audit register in this plan. - -## Concrete Steps - -Use `/Users/ale/.codex/worktrees/docs-alignment/bearshape` for edits on -`codex/docs-alignment`. Use uv 0.11.17 with the repository lock. Run from that -worktree: - - uv sync --locked - uv run --locked prek install - uv run --locked pytest tests/test_examples.py -q - uv run --locked --only-group docs zensical build --clean - uv run --locked --only-group docs python tools/check_docs.py - uv run --locked python tools/check_notebook.py - uv run --locked prek run -a - -If the checker guidance or fixtures change, run the full four-engine harness: - - uv run --locked pytest tests/test_typecheck.py -q - -Build the source archive first and then the wheel from it, following the -contributor guide. Validate the matching archive pair with -`tools/check_distribution.py`. Inspect rendered changed pages in a local -browser, and use read-only checks to verify local documentation links. Stage -new files before hooks; inspect formatting changes before committing. Push the -focused PR and check hosted validation at its final reviewed head. - -## Validation and Acceptance - -All tracked documentation receives an explicit audited disposition. Current -user guidance must agree with exports, runtime tests, checker consumers and -installation metadata. Contributor commands must name existing groups, tools -and tox factors. Documentation builds without new broken local links; runnable -examples and notebook cells pass; normal hooks pass. Historical checks/skips -must not be presented as current backend evidence. Publication remains blocked -by supported union integration and the existing release prerequisites. - -## Idempotence and Recovery - -Docs builds and validation outputs are regenerable. Keep logs and the inventory -under ignored `build/docs-alignment/` in the main checkout, outside the temporary -worktree. Commit only reviewed documentation and any necessary example/checker -validation changes. Revert focused commits if wording is incorrect. Main stays -unchanged until this PR receives approval. - -## Artifacts and Notes - -The initial main commit is a475c9b5376601eb39c9e0641f16f62d56fed979. Its merged -optimization wheel and source archive are recorded in the preceding plans and -`tools/evidence/2026-10-11-remaining-optimization/README.md`. Documentation edits -will change archive hashes; do not claim byte-identical artifacts after them. - -## Interfaces and Dependencies - -No public runtime API, package version, dependency range or checker support -change. Reuse existing documentation tools and the shared validation workflow. -Do not add a parallel documentation framework, speculative features or broad -runtime cleanup. - -Revision note — 2026-10-12: Initial plan before implementation for the owner's -complete documentation-alignment request. - - -## Audit register — 12 October 2026 - -The final inventory contains 81 tracked Markdown entries (including the -`CLAUDE.md` symlink), plus the notebook, public source docstrings, badges, -HTML overrides and executable workflow/configuration references. - -- Root guidance (six entries): README, AGENTS, CLAUDE, CONTRIBUTING, PLANS and - CHANGELOG now agree on the unpublished candidate, support matrix, release - blocker, current commands and review responsibilities. The symlink still - resolves to AGENTS. The changelog preserves authorship and historical work. -- User/maintainer website (25 Markdown files): checked every guide and API page - against current exports, converters, memo ownership, dimension/Tree handling - and runtime/static consumers. Installation, Like typing, custom dtype/scalar - factories, check/check_context, standalone examples and release commands were - corrected. The unchanged CuPy, OpTree, claw and framework pages remain aligned - with their tested boundaries. Added an explicit composition limitation page - and its navigation entry. Current handoff evidence is separated from older - reports instead of silently rewriting their test results. -- Plans (42 entries): the index lists all 40 earlier dated plans. Their version, - command, pending-review and performance claims were checked for stale active - guidance. Each now explicitly identifies its contents as dated evidence; - #56/#57 have appended merge/cleanup closeouts. This plan owns the docs audit. - Historical implementation narratives and original results were preserved. -- Tool/proposal/evidence guidance (seven Markdown files): validator commands - agree with their parsers, tox factors and workflows; upstream integration is - clearly unshipped, with isolation-stage counts distinguished from final - optimization validation. Benchmark reports retain source identities, raw - samples and original interpreter/dependency versions. -- Contributor PR template (one Markdown file): prompts for the concrete change, - plan/dependency links, validation evidence, docs and compatibility effects. -- Notebook/public docstrings: use public DtypeSpec construction, correct native - static annotations, accurate scalar-casting/memo behavior and runnable import - context. Corrected Dimension doctest representations. No executable library - AST changed after stripping docstrings. -- Other artifacts: the active SVG badge already says Python 3.11–3.14. Removed - the unreferenced PNG saying 3.10–3.14. Repaired the theme's generated 404 page - skip-to-content anchor with a minimal template override. Package/workflow - metadata and lock remain unchanged; the current docs navigation includes - the composition guide. - -### Evidence and checks - -Primary-source checks used [PyPI](https://pypi.org/project/bearshape/) for the -0.0.1 upload date (29 May 2026), -[the GitHub release](https://github.com/beartype/bearshape/releases/tag/v0.0.1) -for the original release date (31 March 2026, retained in CHANGELOG), and -[CuPy installation](https://docs.cupy.dev/en/stable/install.html) for CUDA-specific -package selection. These are dated facts, not an assertion that current main is -published. - -On Python 3.11.15 with uv 0.11.17 and exact beartype 0.23.1: - -- Executed 81 CPU user-guide Python blocks, checking intended exception calls. - Nine contextual snippets depend on a containing application/static fixture; - their matching existing consumer/claw fixtures were checked separately. Three - CuPy snippets were not executed without CUDA. The known union reproducer is - deliberately documented as a defect, not counted as passing. Two corrected - positive examples were called explicitly: padded arrays have the advertised - result shape, and Tree processing returns its input. -- `pytest tests/test_examples.py tests/test_factory_aliases.py tests/test_claw.py - -q`: six passed. `pytest tests/test_typecheck.py -q`: eight passed across all - four engines. Dimension doctests: three attempted, zero failures. -- Zensical build and `tools/check_docs.py` passed: expected rendered tables, - admonitions and favicon; 95 Python 3.11 snippets parsed. Parsing and execution - totals intentionally differ. `tools/check_notebook.py`: all 29 code cells - executed. `tox list` confirms the documented environment names exist. -- Checked 237 local Markdown file links and 2,561 local HTML references, - including 1,298 anchors, with no unresolved targets. The HTML check maps the - configured `/bearshape/` site prefix to the build root. Inspected home, - installation, composition and handoff pages in a local browser. -- Built the sdist first, then its wheel; `tools/check_distribution.py` passed. - The documented fresh minimal-consumer recipe passed with no optional backend - installed or imported. Archive hashes are recorded below after final build. -- Runtime-source AST comparison with main a475c9b confirms docstring-only source - changes. Local logs and inventory are retained under ignored - `build/docs-alignment/` in the main checkout. - -Revision note — 2026-10-12: Record completed artifact audit, corrected user and -contributor contracts, preserved historical evidence and local validation. - - -### Final implementation validation and artifact identities - -The documentation implementation is 910bad807584476b0930ca76fc41457a8184361b, -following 871d42737f64fe0a8c4241d69e704d22b81cb5f9 and the initial plan commit. -All 34 [CI jobs](https://github.com/beartype/bearshape/actions/runs/38221049041) -and both [proposal endpoints](https://github.com/beartype/bearshape/actions/runs/38221048953) -passed on that implementation, including installed consumers, compatibility -floors, four checker engines, both notebook endpoints and docs. Real pre-push -runtime/checker hooks passed. Eight additional standalone public help examples -were executed on CPU; the CuPy help example still requires CUDA. An AST -comparison of all nine changed library modules confirms docstrings only. - -The final audit record restores the original GitHub release date in CHANGELOG -instead of substituting the later PyPI upload date. The final archive pair -includes that correction; normal hooks, archive integrity and the hosted -matrix are checked on the final PR head. The final run links and exact head are -recorded in the PR validation description rather than a self-referential commit -hash in this file. - -- Wheel SHA256: `4617bf301f9183f47fc1f7115cdd69afced2e345a2841a587e4729ef56ed5f39`. -- Source archive SHA256: `448f8b1b8fa36d4c525b36b0fa9693ab7af17af692ba2e0ce07cf35adce17453`. - -These identify documentation-audit artifacts, not release approval. The review -baseline is main a475c9b; supported upstream union integration and the release -runbook's external prerequisites remain open. No runtime optimization or public -API change is included in this audit. - -Revision note — 2026-10-12: Close out local and hosted documentation validation, -record final archive identities and preserve the original release chronology. - - -### Owner-approved review and merge — 12 October 2026 - -The owner subsequently requested review followed by merge into main. Review of -468fdabd30402044f15c3405ae893413c6cf7d4c found no blocking issues: public guidance -matches the current APIs and validation routes; historical evidence is retained; -all nine library edits are docstrings only; the unaccepted upstream proposal and -released-dependency union defect remain explicit. All 36 hosted checks passed -on that reviewed head. The plan/index now record approval rather than retaining -a pending-review statement. - -Merge with a merge commit, preserve every reviewed commit, verify main and -archive only the clean merged worktree after saving useful ignored evidence. -The final PR check status and merge SHA are recorded on -[PR #58](https://github.com/beartype/bearshape/pull/58); local review/main-check -results belong in ignored `build/docs-merge-closeout/` in the main checkout. -This approval does not authorize publication, deployment or upstream contact. - -Revision note — 2026-10-12: Record the owner's review-and-merge approval and -review outcome without changing release readiness or the upstream boundary. diff --git a/plans/README.md b/plans/README.md deleted file mode 100644 index 7d6eba0..0000000 --- a/plans/README.md +++ /dev/null @@ -1,81 +0,0 @@ -# Execution plans and historical evidence - -Use [CONTRIBUTING.md](../CONTRIBUTING.md) for current development commands, -[AGENTS.md](../AGENTS.md) for agent rules and [PLANS.md](../PLANS.md) to write a -new plan. The [handoff](../docs/maintainers/production-readiness.md) owns current -release status; [releasing.md](../docs/maintainers/releasing.md) owns publishing -prerequisites. A historical plan is not a current installation recipe. - -## Current development-toolchain work - -[Development-toolchain upgrade](2026-10-12-dev-toolchain.md) coordinates current -tools, the universal lock, uv/build/hook/workflow pins and developer setup in -[PR #60](https://github.com/beartype/bearshape/pull/60). Python support, exact -beartype acceptance and release prerequisites remain unchanged. - -## Latest documentation audit - -[Documentation alignment](2026-10-12-docs-alignment.md) covers user, contributor, -agent and maintainer guidance against the runtime baseline at a475c9b. The owner -approved review and merge on 12 October 2026; -[PR #58](https://github.com/beartype/bearshape/pull/58) records the reviewed head, -validation and merge status. Publication and upstream acceptance remain separate. - -## Completed implementation and remaining release work - -The reviewed candidate/audit stack through #55 merged at 28e8858. Optimizations -#56/#57 merged at a475c9b on 12 October 2026, with reviewed commits preserved and -main validation successful. Their temporary worktrees and branches were cleaned -up after saving evidence. The implementation and merge phases are complete; -publication remains withheld for supported native-union integration, final -artifact CUDA evidence and repository/PyPI controls. CuPy's limited static -protocol is an accepted boundary, not a pending policy choice. - -Plans below retain original dates, sources, test totals, pending-review wording -and experiments. Later decisions here and in the handoff supersede those older -status statements. Their local `build/` and temporary-checkout paths describe -evidence locations on the original validation host; use committed reports, -linked CI artifacts and documented drivers to reproduce results elsewhere. - -## Plan inventory - -- [2026-05-28-baseline-audit: Baseline audit before bearshape rename](2026-05-28-baseline-audit.md) -- [2026-05-28-hook-ci-hygiene: Hook and CI hygiene before bearshape rename](2026-05-28-hook-ci-hygiene.md) -- [2026-05-29-bearshape-rename: Rename Project Identity to bearshape](2026-05-29-bearshape-rename.md) -- [2026-09-07-typing-ci-floor: Keep typing checks aligned with supported Python versions](2026-09-07-typing-ci-floor.md) -- [2026-09-08-action-runtimes: Use supported runtimes for artifact and Pages actions](2026-09-08-action-runtimes.md) -- [2026-09-08-agent-workflow: Align agent guidance and merge the approved production work](2026-09-08-agent-workflow.md) -- [2026-09-08-backend-conversion: Validate Like inputs with the target backend's converter](2026-09-08-backend-conversion.md) -- [2026-09-08-checker-conformance: Verify useful public typing with four checker engines](2026-09-08-checker-conformance.md) -- [2026-09-08-ci-validation: Make CI reproduce the release support contract](2026-09-08-ci-validation.md) -- [2026-09-08-claw-caller: Instrument the actual caller package through bearshape.claw](2026-09-08-claw-caller.md) -- [2026-09-08-cupy-runtime: Verify the corrected CuPy runtime on CUDA](2026-09-08-cupy-runtime.md) -- [2026-09-08-distribution-integrity: Ship complete, testable source and wheel distributions](2026-09-08-distribution-integrity.md) -- [2026-09-08-docs-contract: Repair rendered documentation and executable examples](2026-09-08-docs-contract.md) -- [2026-09-08-framework-validation: Prove framework transformations and minimal runtime imports](2026-09-08-framework-validation.md) -- [2026-09-08-handoff-evidence: Prepare the production review and ownership handoff evidence](2026-09-08-handoff-evidence.md) -- [2026-09-08-installed-consumers: Prove the normally installed candidate artifact](2026-09-08-installed-consumers.md) -- [2026-09-08-memo-discovery-performance: Reduce the cost of locating the active checking frame](2026-09-08-memo-discovery-performance.md) -- [2026-09-08-production-readiness: Make bearshape ready for a verified beartype 0.23.0rc0 release](2026-09-08-production-readiness.md) -- [2026-09-08-publication-gate: Publish only the exact validated release artifacts](2026-09-08-publication-gate.md) -- [2026-09-08-rc0-compat: Install and validate the 0.1.0rc0 candidate with exact beartype rc0](2026-09-08-rc0-compat.md) -- [2026-09-08-rc0-integration: Validate the combined release candidate](2026-09-08-rc0-integration.md) -- [2026-09-08-release-candidate: Validate the full independent PR set together](2026-09-08-release-candidate.md) -- [2026-09-08-static-like-inputs: Make static Like inputs reflect ordinary backend conversion](2026-09-08-static-like-inputs.md) -- [2026-09-08-static-tree-containers: Give ordinary Tree consumers a useful static type](2026-09-08-static-tree-containers.md) -- [2026-09-08-union-transactions: Roll back failed native union alternatives](2026-09-08-union-transactions.md) -- [2026-09-08-validation-lifetime: Scope validation state to the check that owns it](2026-09-08-validation-lifetime.md) -- [2026-09-10-ownership-transfer: Restore bearshape after transfer to beartype](2026-09-10-ownership-transfer.md) -- [2026-10-11-audit-followup: Close the combined candidate audit in focused changes](2026-10-11-audit-followup.md) -- [2026-10-11-converter-validation: Reject malformed custom Like converter results](2026-10-11-converter-validation.md) -- [2026-10-11-dtype-normalization: Normalize builtin dtypes without retaining checked objects](2026-10-11-dtype-normalization.md) -- [2026-10-11-nested-value: Preserve scope in nested Value arithmetic](2026-10-11-nested-value.md) -- [2026-10-11-python311-beartype0231: Adopt Python 3.11 and beartype 0.23.1 coherently](2026-10-11-python311-beartype0231.md) -- [2026-10-11-release-integration: Integrate and verify the next bearshape candidate](2026-10-11-release-integration.md) -- [2026-10-11-release-pipeline: Validate immutable candidates and publish only reviewed artifacts](2026-10-11-release-pipeline.md) -- [2026-10-11-release-readiness: Prepare bearshape for Python 3.11 and released beartype](2026-10-11-release-readiness.md) -- [2026-10-11-shape-preparation: Prepare invariant shape traversal once per annotation](2026-10-11-shape-preparation.md) -- [2026-10-11-tree-ellipsis: Reject invalid Tree ellipsis syntax](2026-10-11-tree-ellipsis.md) -- [2026-10-11-union-ordinary-performance: Reduce ordinary checking overhead without weakening rollback](2026-10-11-union-ordinary-performance.md) -- [2026-10-11-union-scope-correctness: Preserve state across internal alias checks](2026-10-11-union-scope-correctness.md) -- [2026-10-11-variadic-broadcast: Broadcast custom array shapes without NumPy](2026-10-11-variadic-broadcast.md) diff --git a/pyproject.toml b/pyproject.toml index d691a58..c00844d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "bearshape" -version = "0.1.0rc1" +version = "0.1.0" description = "Elegant runtime shape and dtype checking for NumPy, JAX, PyTorch, and CuPy arrays — powered by beartype." readme = "README.md" license = "MIT" @@ -8,7 +8,7 @@ license-files = ["LICENSE"] authors = [{ name = "acecchini", email = "ale.cecchini.valette@gmail.com" }] requires-python = ">=3.11" dependencies = [ - "beartype>=0.23.1,<0.24", # Exact candidate tested in tox.toml + "beartype>=0.23.1,<0.24", "typing_extensions>=4.6", ] keywords = [ diff --git a/ruff.toml b/ruff.toml index 4a460e3..6e50f0a 100644 --- a/ruff.toml +++ b/ruff.toml @@ -173,16 +173,6 @@ parametrize-names-type = "csv" "N801", ] -"tools/upstream/test_*.py" = [ - # Explicit upstream integration regressions follow the same test conventions. - "ARG001", "INP001", "RUF029", "S101", -] - -"tools/upstream/benchmark_transactions.py" = [ - # Standalone benchmark script, not an importable package. - "INP001", -] - [format] docstring-code-format = true docstring-code-line-length = 100 diff --git a/tests/test_release.py b/tests/test_release.py deleted file mode 100644 index 9263837..0000000 --- a/tests/test_release.py +++ /dev/null @@ -1,337 +0,0 @@ -"""Publication identity checks against real disposable Git histories.""" - -# Synthetic repositories only; commands use argument lists, never a shell. - -from __future__ import annotations - -import json -import os -import runpy -import shutil -import subprocess -import sys -from collections.abc import Callable -from pathlib import Path -from typing import TypeAlias - -import pytest - -_SCRIPT = Path(__file__).resolve().parents[1] / "tools/check_release.py" -_RELEASE = runpy.run_path(str(_SCRIPT)) -resolve_release = _RELEASE["resolve_release"] -git_environment = _RELEASE["git_environment"] -Repository: TypeAlias = tuple[Path, Callable[..., str]] - - -def make_repository(tmp_path: Path) -> Repository: - git = shutil.which("git") - assert git is not None - environment = git_environment(git) - tmp_path.mkdir(exist_ok=True) - - def command(*args: str) -> str: - return subprocess.check_output( - [ - git, - "-c", - "user.name=Release test", - "-c", - "user.email=release@example.invalid", - *args, - ], - cwd=tmp_path, - env=environment, - text=True, - stderr=subprocess.PIPE, - ).strip() - - command("init", "-b", "main") - (tmp_path / "content").write_text("first\n") - command("add", "content") - command("commit", "-m", "Initial synthetic release") - command("update-ref", "refs/remotes/origin/main", "HEAD") - command("tag", "v0.1.0rc0") - return tmp_path, command - - -@pytest.fixture -def repository(tmp_path: Path) -> Repository: - return make_repository(tmp_path) - - -def resolve(repository: Repository, **overrides: object) -> dict[str, str]: - root, git = repository - options = { - "repository": root, - "version": "0.1.0rc0", - "requested_ref": "v0.1.0rc0", - "event_name": "workflow_dispatch", - "workflow_ref": "refs/tags/v0.1.0rc0", - "workflow_sha": git("rev-parse", "HEAD"), - "event": {}, - "publish": True, - } - options.update(overrides) - return resolve_release(**options) - - -def published_event(version: str, *, prerelease: bool, draft: bool = False) -> dict: - return { - "action": "published", - "release": {"tag_name": f"v{version}", "prerelease": prerelease, "draft": draft}, - } - - -def test_candidate_tag_resolves_to_immutable_commit(repository: Repository) -> None: - _, git = repository - assert resolve(repository) == { - "sha": git("rev-parse", "HEAD"), - "version": "0.1.0rc0", - "publish": "true", - } - - -@pytest.mark.parametrize("version,prerelease", [("0.1.0rc0", True), ("0.1.0", False)]) -def test_release_event_requires_matching_prerelease_status( - repository: Repository, version: str, prerelease: bool -) -> None: - _, git = repository - git("tag", "-f", f"v{version}") - assert ( - resolve( - repository, - version=version, - requested_ref=f"v{version}", - workflow_ref=f"refs/tags/v{version}", - event_name="release", - event=published_event(version, prerelease=prerelease), - publish=False, - )["publish"] - == "true" - ) - with pytest.raises(ValueError, match="prerelease status"): - resolve( - repository, - version=version, - requested_ref=f"v{version}", - workflow_ref=f"refs/tags/v{version}", - event_name="release", - event=published_event(version, prerelease=not prerelease), - ) - - -@pytest.mark.parametrize( - "ref", ["main", "refs/heads/main", "v0.1.0", "v0.1.0rc1", "v0.1.0rc0\nevil"] -) -def test_arbitrary_ref_cannot_publish(repository: Repository, ref: str) -> None: - with pytest.raises(ValueError, match="exact version tag"): - resolve(repository, requested_ref=ref) - - -@pytest.mark.parametrize( - "version", ["01.1.0", "0.1.0+local", "0.1.0.dev0", "0.1.0.post1"] -) -def test_non_release_version_is_rejected(repository: Repository, version: str) -> None: - with pytest.raises(ValueError, match="Release version"): - resolve(repository, version=version, requested_ref=f"v{version}") - - -def test_missing_tag_is_rejected(repository: Repository) -> None: - with pytest.raises(subprocess.CalledProcessError): - resolve( - repository, - version="0.1.0rc1", - requested_ref="v0.1.0rc1", - workflow_ref="refs/tags/v0.1.0rc1", - ) - - -def test_tag_must_identify_checked_out_commit(repository: Repository) -> None: - root, git = repository - (root / "content").write_text("second\n") - git("commit", "-am", "Another synthetic commit") - git("update-ref", "refs/remotes/origin/main", "HEAD") - with pytest.raises(ValueError, match="checked-out commit"): - resolve(repository) - - -def test_release_commit_must_already_be_on_main(repository: Repository) -> None: - root, git = repository - (root / "content").write_text("unmerged\n") - git("commit", "-am", "Unmerged synthetic candidate") - git("tag", "v0.1.0rc1") - with pytest.raises(ValueError, match="main history"): - resolve( - repository, - version="0.1.0rc1", - requested_ref="v0.1.0rc1", - workflow_ref="refs/tags/v0.1.0rc1", - ) - - -def test_draft_release_cannot_publish(repository: Repository) -> None: - with pytest.raises(ValueError, match="non-draft"): - resolve( - repository, - event_name="release", - event=published_event("0.1.0rc0", prerelease=True, draft=True), - ) - - -def test_validation_only_dispatch_emits_nonpublishing_identity( - repository: Repository, -) -> None: - root, git = repository - event_path, output_path = root / "event.json", root / "output.txt" - event_path.write_text("{}") - environment = dict( - os.environ, - GITHUB_EVENT_PATH=str(event_path), - GITHUB_EVENT_NAME="workflow_dispatch", - GITHUB_REF="refs/heads/main", - GITHUB_WORKFLOW_SHA=git("rev-parse", "HEAD"), - GITHUB_OUTPUT=str(output_path), - PROJECT_VERSION="0.1.0rc0", - RELEASE_REF="main", - PUBLISH="false", - ) - result = subprocess.run( - [sys.executable, str(_SCRIPT)], - cwd=root, - env=environment, - check=True, - capture_output=True, - text=True, - ) - assert json.loads(result.stdout) == { - "sha": git("rev-parse", "HEAD"), - "version": "0.1.0rc0", - "publish": "false", - } - assert "publish=false\n" in output_path.read_text() - - -@pytest.mark.parametrize( - "override", - [{"workflow_ref": "refs/heads/main"}, {"workflow_sha": "0" * 40}], -) -def test_publication_workflow_must_match_candidate( - repository: Repository, override: dict[str, str] -) -> None: - with pytest.raises(ValueError, match="matching version tag and commit"): - resolve(repository, **override) - - -@pytest.mark.parametrize("variable", ["GIT_DIR", "GIT_WORK_TREE", "GIT_COMMON_DIR"]) -def test_release_identity_ignores_foreign_hook_repository( - repository: Repository, monkeypatch: pytest.MonkeyPatch, variable: str -) -> None: - root, git = repository - expected = git("rev-parse", "HEAD") - foreign = root / "foreign" - git("init", "-b", "foreign", str(foreign)) - git("-C", str(foreign), "commit", "--allow-empty", "-m", "Foreign history") - target = foreign if variable == "GIT_WORK_TREE" else foreign / ".git" - monkeypatch.setenv(variable, str(target)) - assert resolve(repository, workflow_sha=expected)["sha"] == expected - - -def test_synthetic_repositories_do_not_mutate_hook_owner( - repository: Repository, monkeypatch: pytest.MonkeyPatch -) -> None: - owner, git = repository - original_head = git("rev-parse", "HEAD") - config = owner / ".git/config" - original_config = config.read_bytes() - for key, path in { - "GIT_DIR": owner / ".git", - "GIT_COMMON_DIR": owner / ".git", - "GIT_WORK_TREE": owner, - "GIT_INDEX_FILE": owner / ".git/index", - }.items(): - monkeypatch.setenv(key, str(path)) - child, child_git = make_repository(owner / "child") - assert Path(child_git("rev-parse", "--show-toplevel")) == child.resolve() - assert config.read_bytes() == original_config - assert git("rev-parse", "HEAD") == original_head - - -_EVIDENCE = runpy.run_path(str(_SCRIPT.with_name("check_release_evidence.py"))) -verify_evidence = _EVIDENCE["verify_evidence"] - - -@pytest.fixture -def candidate_evidence(tmp_path: Path) -> tuple[dict[str, str], Path]: - import hashlib - - directory = tmp_path / "dist" - directory.mkdir() - evidence = { - "version": "0.1.0rc1", - "source_sha": "a" * 40, - "run_url": "https://github.com/beartype/bearshape/actions/runs/123", - "wheel": "bearshape-0.1.0rc1-py3-none-any.whl", - "sdist": "bearshape-0.1.0rc1.tar.gz", - } - for kind in ("wheel", "sdist"): - content = f"validated {kind}".encode() - (directory / evidence[kind]).write_bytes(content) - evidence[f"{kind}_sha256"] = hashlib.sha256(content).hexdigest() - return evidence, directory - - -def verify_candidate(evidence: dict[str, str], directory: Path) -> None: - verify_evidence( - evidence, - directory, - source_sha="a" * 40, - version="0.1.0rc1", - run_url="https://github.com/beartype/bearshape/actions/runs/123", - ) - - -def test_exact_validated_candidate_is_accepted(candidate_evidence: tuple) -> None: - verify_candidate(*candidate_evidence) - - -@pytest.mark.parametrize("key", ["source_sha", "version", "run_url"]) -def test_candidate_identity_cannot_be_substituted( - candidate_evidence: tuple, key: str -) -> None: - evidence, directory = candidate_evidence - evidence[key] = "different" - with pytest.raises(ValueError, match=key): - verify_candidate(evidence, directory) - - -@pytest.mark.parametrize("kind", ["wheel", "sdist"]) -def test_changed_archive_is_rejected(candidate_evidence: tuple, kind: str) -> None: - evidence, directory = candidate_evidence - (directory / evidence[kind]).write_bytes(b"different bytes") - with pytest.raises(ValueError, match="hash differs"): - verify_candidate(evidence, directory) - - -@pytest.mark.parametrize("change", ["missing", "extra", "unsafe", "swapped", "symlink"]) -def test_only_expected_regular_archives_can_publish( - candidate_evidence: tuple, change: str -) -> None: - evidence, directory = candidate_evidence - if change == "missing": - (directory / evidence["sdist"]).unlink() - elif change == "extra": - (directory / "unreviewed.whl").write_bytes(b"extra") - elif change == "unsafe": - evidence["wheel"] = "../" + evidence["wheel"] - elif change == "swapped": - evidence["wheel"], evidence["sdist"] = evidence["sdist"], evidence["wheel"] - else: - wheel = directory / evidence["wheel"] - target = directory.parent / "outside.whl" - wheel.rename(target) - try: - wheel.symlink_to(target) - except OSError: - pytest.skip("Creating symlinks requires privileges on this platform") - with pytest.raises(ValueError, match="canonical|exactly|regular|hash"): - verify_candidate(evidence, directory) diff --git a/tests/test_runtime_preflight.py b/tests/test_runtime_preflight.py index f0ae5d0..05f411c 100644 --- a/tests/test_runtime_preflight.py +++ b/tests/test_runtime_preflight.py @@ -1,4 +1,4 @@ -"""The dependency canary cannot weaken exact release preflight validation.""" +"""The runtime preflight accepts exactly the declared beartype range.""" import importlib.metadata import runpy @@ -12,40 +12,32 @@ @pytest.mark.parametrize( - "version, compatible, accepted", + "version, accepted", [ - ("0.23.1", False, True), - ("0.23.2", False, False), - ("0.23.2", True, True), - ("0.22.9", True, False), - ("0.24.0", True, False), - ("0.24.0rc1", True, False), + ("0.23.1", True), + ("0.23.2", True), + ("0.22.9", False), + ("0.24.0", False), + ("0.24.0rc1", False), ], ) def test_beartype_preflight_policy( - monkeypatch: pytest.MonkeyPatch, version: str, *, compatible: bool, accepted: bool + monkeypatch: pytest.MonkeyPatch, version: str, *, accepted: bool ) -> None: monkeypatch.setattr( importlib.metadata, "requires", lambda _name: ["beartype>=0.23.1,<0.24"] ) check = _MODULE["_require_beartype_version"] if accepted: - check(version, latest_compatible=compatible) + check(version) else: with pytest.raises(SystemExit, match="beartype"): - check(version, latest_compatible=compatible) + check(version) -def test_canary_reads_installed_dependency_contract( +def test_preflight_requires_dependency_metadata( monkeypatch: pytest.MonkeyPatch, ) -> None: - monkeypatch.setattr( - importlib.metadata, "requires", lambda _name: ["beartype>=0.24,<0.25"] - ) - _MODULE["_require_beartype_version"]("0.24.1", latest_compatible=True) - - -def test_canary_requires_dependency_metadata(monkeypatch: pytest.MonkeyPatch) -> None: monkeypatch.setattr(importlib.metadata, "requires", lambda _name: None) with pytest.raises(SystemExit, match="beartype"): - _MODULE["_require_beartype_version"]("0.23.1", latest_compatible=True) + _MODULE["_require_beartype_version"]("0.23.1") diff --git a/tools/README.md b/tools/README.md index a1bd814..a384aff 100644 --- a/tools/README.md +++ b/tools/README.md @@ -1,25 +1,16 @@ # Repository validation tools -Run these tools from the repository root with the locked uv environment unless -an isolated consumer is specified. `CONTRIBUTING.md` owns the routine workflow; -`AGENTS.md` owns agent instructions. These are repository tools, not public -bearshape APIs or an additional agent framework. +Run these tools from the repository root with the locked uv environment. +`CONTRIBUTING.md` owns the routine workflow. These are repository tools, not +public bearshape APIs. ## Environment and static checks -`uv run --locked python tools/validate_runtime.py cpu` verifies exact beartype -0.23.1, all four expected CPU backends and a CPU-only Torch build. It prints -versions and import paths. A backend tox name, such as `py311-bt0231-numpy22`, -selects its expected backend. This is a CPU preflight, not a CUDA or full -behavioral test. - -Only the separate dependency canary uses `--latest-compatible`, which checks -beartype against the installed bearshape metadata. The default still enforces -exact 0.23.1; do not pass the canary flag to release acceptance. Nightly -upgrades only runtime/backend packages in its disposable lock, keeps the -maintained checker versions, runs runtime and all four consumers, and uploads -the resolved lock, versions, source SHA and results. Canary failures need -review; they do not silently update the committed lock or authorize release. +`uv run --locked python tools/validate_runtime.py cpu` checks that the installed +beartype satisfies bearshape's declared range, that the expected CPU backends +import, and that Torch is a CPU-only build. It prints versions and import paths. +A backend tox name, such as `py311-bt0231-numpy22`, selects its expected +backend. `uv run --locked python tools/validate_tox_env.py py311-bt0231-numpy22` checks the factor vocabulary. It does not prove that a dependency combination is @@ -57,97 +48,13 @@ group. It writes `build/bearshape_tour--executed.ipynb`; it does not edit the source notebook or rely on saved outputs. CI runs both Python endpoints. -## Release distributions - -Build the sdist first, then its wheel as described in `CONTRIBUTING.md`. - -```bash -uv run --locked python tools/check_distribution.py \ - dist/bearshape-0.1.0rc1-py3-none-any.whl dist/bearshape-0.1.0rc1.tar.gz -uv run --locked python tools/check_installed.py \ - dist/bearshape-0.1.0rc1-py3-none-any.whl dist/bearshape-0.1.0rc1.tar.gz \ - --python 3.11 -``` - -Use the actual project version in filenames. `check_distribution.py` reads both -archives, verifies metadata/license/typing markers and matching package files, -and prints SHA256 hashes. It does not install or execute the package. - -`check_installed.py` validates the pair, exports dependencies from the archive's -own lockfile, creates a temporary environment and installs the wheel normally -with exact beartype. It runs copied runtime and four-checker tests outside the -checkout with no `src` directory, then removes the temporary environment. It -requires uv, dependency access and the requested managed Python. Repeat at -Python 3.14. This is a CPU consumer check; CuPy is tested separately on CUDA. - -`smoke_minimal.py` requires a fresh venv containing only the normally installed -wheel and declared runtime dependencies. Run its Python with `-I` and the -absolute script path, as in the shared workflow. It checks root import -isolation, custom-array parameters/returns and module origin. Do not run it in -the normal development venv: installed optional backends must cause it to fail. - -`check_release.py` is the release workflow's identity check, not a standalone -publisher. It reads `PROJECT_VERSION`, `RELEASE_REF`, `PUBLISH` and GitHub -event, ref, workflow-SHA and output variables from `pypi.yml`. It verifies -canonical version/tag/history and event consistency for publication. Its Git -subprocesses clear hook-local repository variables. Test it through -`uv run --locked pytest tests/test_release.py -q`; the tests create disposable -real Git histories. Validation-only dispatch, publication and environment -requirements are documented in `CONTRIBUTING.md`. - -## Open upstream integration and performance +## Runtime performance ```bash -uv run --locked python tools/probe_union.py uv run --locked python tools/benchmark_runtime.py --calls 10000 --repeats 5 ``` -`tools/upstream/README.md` records the refreshed local upstream proposal and its -integration suite. The protocol is absent from published 0.23.1. - -`probe_union.py` is a standalone release-blocker reproducer. With released -beartype 0.23.1 it prints versions and fails on a valid native composite-union -call: a failed alternative leaves a dimension binding behind. This failure is -expected evidence of an unresolved defect, not a passing test or xfail. To -evaluate an actual later upstream candidate, install it and bearshape normally -in a separate environment and invoke the probe there. Do not change the -development lock merely to try an upstream revision. A future fix must pass -broader positive/negative, nested, return, async and lifetime regression -coverage before support is claimed. - -`benchmark_runtime.py` requires NumPy and optree as well as bearshape/beartype. -It reports versions, origins and repeated timings for strict/Like/Value/context, -nested, tree and diagnostic paths. It also exercises expensive list conversion. -Compare normal installs with matched Python/backend versions on the same idle -host. Results are observations, not a portable performance guarantee or CI -threshold. Keep benchmark outputs outside the tracked package. - -## Release evidence - -`check_release_evidence.py record` creates a manifest only after archive -integrity checks. `verify` checks the exact source/version/run identity, -canonical filenames and SHA256 bytes, rejecting missing/extra files and -symlinks. The release workflow uses verification immediately before upload and -never rebuilds in the publisher. See the -[release runbook](../docs/maintainers/releasing.md) for commands, approval -prerequisites and recovery. Candidate validation also requires the full native -union probe and integration suite on both Python endpoints; a failure blocks -publication even when baseline CI passes. - -## Runtime performance - -`tools/benchmark_runtime.py` records raw samples, medians, ranges, versions and -module origins. It covers native controls, strict/Like/Value, nested calls, -plain/composite/Value Trees, multi-axis and variadic shapes, dtype extraction, -casting, diagnostics, decoration and array/Tree validator construction. Compare -normally installed wheels with identical dependencies on the same idle host and -interpreter; do not run validation concurrently. Retain both artifact hashes. -Timings are evidence, not a CI threshold. The -[October audit comparison](evidence/2026-10-11-audit-performance/README.md) -records the corrected baseline and optimized candidate separately from the -unchanged upstream proposal. - -The -[remaining optimization comparison](evidence/2026-10-11-remaining-optimization/README.md) -separates dtype and shape preparation, records their combination, and includes -first-use costs, root-only consumers and ordinary beartype overhead. +`benchmark_runtime.py` requires NumPy and optree. It reports versions, origins +and repeated timings for strict, Like, Value, nested, Tree and diagnostic paths. +Compare runs on the same idle host and interpreter; timings are not a CI +threshold. diff --git a/tools/check_distribution.py b/tools/check_distribution.py deleted file mode 100644 index 01d8133..0000000 --- a/tools/check_distribution.py +++ /dev/null @@ -1,148 +0,0 @@ -"""Verify the wheel and source archive that will be released. - -Usage: python tools/check_distribution.py package.whl package.tar.gz -""" - -from __future__ import annotations - -import hashlib -import json -import sys -import tarfile -import zipfile -from email.parser import BytesParser -from pathlib import Path - -SOURCE_INPUTS = { - "LICENSE", - "README.md", - "CHANGELOG.md", - "CONTRIBUTING.md", - "pyproject.toml", - "uv.lock", - "pytest.toml", - "tox.toml", - "ty.toml", - "ruff.toml", - "tools/check_distribution.py", - "tools/check_installed.py", - "tools/check_release.py", - "tools/validate_runtime.py", - "tools/validate_tox_env.py", - "tests/conftest.py", - "tests/test_numpy.py", - "tests/test_tree.py", - "tests/test_typecheck.py", - "tests/typing/check_imports.py", - "tests/typing_negative/invalid_calls.py", -} - - -def _read_source(sdist: Path, prefix: str) -> dict[str, bytes]: - source_files: dict[str, bytes] = {} - with tarfile.open(sdist, "r:gz") as archive: - for member in archive.getmembers(): - if not member.isfile(): - continue - if not member.name.startswith(prefix): - msg = f"Source archive member has the wrong release prefix: {member.name}" - raise ValueError(msg) - stream = archive.extractfile(member) - if stream is None: - msg = f"Cannot read source archive member: {member.name}" - raise ValueError(msg) - source_files[member.name.removeprefix(prefix)] = stream.read() - return source_files - - -def check_distribution(wheel: Path, sdist: Path) -> dict[str, str]: - with zipfile.ZipFile(wheel) as archive: - wheel_files = { - name: archive.read(name) for name in archive.namelist() if not name.endswith("/") - } - metadata_paths = [ - name for name in wheel_files if name.endswith(".dist-info/METADATA") - ] - if len(metadata_paths) != 1: - msg = "Wheel must contain exactly one distribution metadata file" - raise ValueError(msg) - metadata_path = metadata_paths[0] - metadata = BytesParser().parsebytes(wheel_files[metadata_path]) - if metadata["Name"] != "bearshape" or metadata["License-Expression"] != "MIT": - msg = "Wheel must declare bearshape and the MIT license expression" - raise ValueError(msg) - if metadata.get_all("License-File") != ["LICENSE"]: - msg = "Wheel metadata must declare License-File: LICENSE" - raise ValueError(msg) - license_path = metadata_path.removesuffix("METADATA") + "licenses/LICENSE" - license_text = (Path(__file__).resolve().parents[1] / "LICENSE").read_bytes() - if wheel_files.get(license_path) != license_text: - msg = "Wheel must contain the complete repository LICENSE text" - raise ValueError(msg) - version = metadata["Version"] - if not version: - msg = "Wheel must declare a version" - raise ValueError(msg) - prefix = f"bearshape-{version}/" - source_files = _read_source(sdist, prefix) - if missing := SOURCE_INPUTS - source_files.keys(): - msg = f"Source archive is missing downstream inputs: {sorted(missing)}" - raise ValueError(msg) - source_metadata = BytesParser().parsebytes(source_files["PKG-INFO"]) - for field in ( - "Name", - "Version", - "License-Expression", - "License-File", - "Requires-Python", - "Requires-Dist", - ): - if source_metadata.get_all(field) != metadata.get_all(field): - msg = f"Wheel and source metadata disagree on {field}" - raise ValueError(msg) - if source_files["LICENSE"] != license_text: - msg = "Source archive must contain the complete repository LICENSE text" - raise ValueError(msg) - wheel_package = { - name: content - for name, content in wheel_files.items() - if name.startswith("bearshape/") - } - source_package = { - name.removeprefix("src/"): content - for name, content in source_files.items() - if name.startswith("src/bearshape/") - } - if not wheel_package or "bearshape/py.typed" not in wheel_package: - msg = "Wheel must contain the package and its py.typed marker" - raise ValueError(msg) - if wheel_package != source_package: - msg = "Wheel package contents differ from the source archive" - raise ValueError(msg) - for name in (*wheel_files, *source_files): - if any( - part in {"__pycache__", ".venv", ".tox", ".git", "site"} - for part in Path(name).parts - ) or name.endswith((".pyc", ".pyo")): - msg = f"Distribution contains a generated or private file: {name}" - raise ValueError(msg) - return { - "version": version, - "wheel": wheel.name, - "wheel_sha256": hashlib.sha256(wheel.read_bytes()).hexdigest(), - "sdist": sdist.name, - "sdist_sha256": hashlib.sha256(sdist.read_bytes()).hexdigest(), - } - - -def main() -> None: - if len(sys.argv) != 3: - sys.exit("usage: check_distribution.py package.whl package.tar.gz") - json.dump( - check_distribution(Path(sys.argv[1]), Path(sys.argv[2])), sys.stdout, indent=2 - ) - sys.stdout.write("\n") - - -if __name__ == "__main__": - main() diff --git a/tools/check_docs.py b/tools/check_docs.py index dc8ee7a..89628d6 100644 --- a/tools/check_docs.py +++ b/tools/check_docs.py @@ -11,7 +11,6 @@ ROOT = Path(__file__).resolve().parents[1] TABLE_ROWS = { - "maintainers/production-readiness": [10, 12, 18, 11, 12], "api/index": [8], "api/bearshape": [5, 3], "features/claw": [3], diff --git a/tools/check_installed.py b/tools/check_installed.py deleted file mode 100644 index 3ff14cf..0000000 --- a/tools/check_installed.py +++ /dev/null @@ -1,152 +0,0 @@ -"""Normally install a candidate wheel and test consumers outside the checkout.""" - -# Command driver: argument lists only, never a shell. -# ruff: file-ignore[suspicious-subprocess-import, subprocess-without-shell-equals-true] - -from __future__ import annotations - -import argparse -import json -import os -import shutil -import subprocess -import sys -import tarfile -import tempfile -from pathlib import Path - -from check_distribution import check_distribution - -_CONFIGS = {"pyproject.toml", "pytest.toml", "ty.toml", "uv.lock"} -_ORIGIN_CHECK = """ -import importlib.metadata -import json -import pathlib -import sys -import bearshape -import beartype -origin = pathlib.Path(bearshape.__file__).resolve() -assert origin.is_relative_to(pathlib.Path(sys.prefix).resolve()), origin -assert beartype.__version__ == '0.23.1', beartype.__version__ -metadata = importlib.metadata.distribution('bearshape') -direct = json.loads(metadata.read_text('direct_url.json') or '{}') -assert not direct.get('dir_info', {}).get('editable'), direct -print(json.dumps({'python': sys.version, 'bearshape': bearshape.__version__, - 'beartype': beartype.__version__, 'module': str(origin)}, indent=2)) -""" - - -def _copy_consumers(sdist: Path, destination: Path) -> None: - prefix = sdist.name.removesuffix(".tar.gz") + "/" - with tarfile.open(sdist, "r:gz") as archive: - for member in archive.getmembers(): - name = member.name.removeprefix(prefix) - if not member.isfile() or not ( - name.startswith(("tests/", "tools/")) or name in _CONFIGS - ): - continue - target = (destination / name).resolve() - if not target.is_relative_to(destination): - message = f"Invalid consumer archive path: {member.name}" - raise ValueError(message) - stream = archive.extractfile(member) - if stream is None: - message = f"Cannot read consumer file: {member.name}" - raise ValueError(message) - target.parent.mkdir(parents=True, exist_ok=True) - target.write_bytes(stream.read()) - - -def main() -> None: - parser = argparse.ArgumentParser(description=__doc__) - parser.add_argument("wheel", type=Path) - parser.add_argument("sdist", type=Path) - parser.add_argument("--python", required=True, help="Consumer Python version") - args = parser.parse_args() - uv = shutil.which("uv") - if uv is None: - parser.error("uv is required to create the isolated consumer environment") - wheel, sdist = args.wheel.resolve(), args.sdist.resolve() - evidence = check_distribution(wheel, sdist) - json.dump(evidence, sys.stdout, indent=2) - sys.stdout.write("\n") - sys.stdout.flush() - environment = dict(os.environ, UV_TORCH_BACKEND="cpu") - for key in ("PYTHONPATH", "PYTHONHOME", "TOX_ENV_NAME"): - environment.pop(key, None) - - with tempfile.TemporaryDirectory(prefix="bearshape-installed-") as temporary: - consumer = Path(temporary).resolve() - _copy_consumers(sdist, consumer) - requirements = consumer / "requirements.txt" - subprocess.run( - [ - uv, - "export", - "--locked", - "--no-default-groups", - "--group", - "optional", - "--group", - "static", - "--group", - "test", - "--no-emit-project", - "--output-file", - str(requirements), - ], - check=True, - cwd=consumer, - env=environment, - stdout=subprocess.DEVNULL, - ) - venv = consumer / ".venv" - subprocess.run( - [uv, "venv", "--python", args.python, str(venv)], - check=True, - cwd=consumer, - env=environment, - ) - python = venv / ("Scripts/python.exe" if os.name == "nt" else "bin/python") - subprocess.run( - [uv, "pip", "sync", "--python", str(python), str(requirements)], - check=True, - cwd=consumer, - env=environment, - ) - subprocess.run( - [ - uv, - "pip", - "install", - "--python", - str(python), - str(wheel), - "beartype==0.23.1", - ], - check=True, - cwd=consumer, - env=environment, - ) - subprocess.run( - [str(python), "-I", "-c", _ORIGIN_CHECK], - check=True, - cwd=consumer, - env=environment, - ) - subprocess.run( - [str(python), "-I", "tools/validate_runtime.py", "cpu"], - check=True, - cwd=consumer, - env=environment, - ) - subprocess.run( - [str(python), "-I", "-m", "pytest", "tests/", "--installed-package", "-n", "4"], - check=True, - cwd=consumer, - env=environment, - ) - - -if __name__ == "__main__": - main() diff --git a/tools/check_release.py b/tools/check_release.py deleted file mode 100644 index bffe487..0000000 --- a/tools/check_release.py +++ /dev/null @@ -1,115 +0,0 @@ -"""Resolve release identity before allowing artifact validation or publication.""" - -# Git commands use argument lists and never a shell. -# ruff: file-ignore[suspicious-subprocess-import, subprocess-without-shell-equals-true] - -from __future__ import annotations - -import json -import os -import re -import shutil -import subprocess -import sys -from pathlib import Path - -_VERSION = re.compile( - r"(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:(a|b|rc)(0|[1-9]\d*))?" -) - - -def git_environment(git: str) -> dict[str, str]: - """Clear hook-local Git variables before addressing an explicit repository.""" - local_names = subprocess.check_output( - [git, "rev-parse", "--local-env-vars"], text=True - ).splitlines() - return {key: value for key, value in os.environ.items() if key not in local_names} - - -def resolve_release( - *, - repository: Path, - version: str, - requested_ref: str, - event_name: str, - workflow_ref: str, - workflow_sha: str, - event: dict, - publish: bool, -) -> dict[str, str]: - """Reject publication unless version, tag, ancestry and event agree.""" - match = _VERSION.fullmatch(version) - if match is None: - message = f"Release version must be X.Y.Z with an optional a/b/rc suffix: {version}" - raise ValueError(message) - if event_name not in {"release", "workflow_dispatch"}: - message = f"Unsupported release event: {event_name}" - raise ValueError(message) - git = shutil.which("git") - if git is None: - message = "git is required to resolve the release commit" - raise RuntimeError(message) - - environment = git_environment(git) - - def revision(ref: str) -> str: - return subprocess.check_output( - [git, "rev-parse", "--verify", ref], cwd=repository, env=environment, text=True - ).strip() - - commit = revision("HEAD^{commit}") - if event_name == "release": - release = event["release"] - if event["action"] != "published" or release["draft"]: - message = "Only a published, non-draft GitHub release can publish" - raise ValueError(message) - if requested_ref != release["tag_name"]: - message = "Requested ref differs from the published release tag" - raise ValueError(message) - if release["prerelease"] != (match.group(4) is not None): - message = "GitHub prerelease status differs from the package version" - raise ValueError(message) - publish = True - - if publish: - if requested_ref != f"v{version}": - message = f"Publication requires the exact version tag v{version}" - raise ValueError(message) - if workflow_ref != f"refs/tags/{requested_ref}" or workflow_sha != commit: - message = "Publication workflow must run from the matching version tag and commit" - raise ValueError(message) - if revision(f"refs/tags/{requested_ref}^{{commit}}") != commit: - message = "Release tag does not identify the checked-out commit" - raise ValueError(message) - ancestry = subprocess.run( - [git, "merge-base", "--is-ancestor", commit, "refs/remotes/origin/main"], - cwd=repository, - env=environment, - check=False, - ) - if ancestry.returncode == 1: - message = "Release commit must already belong to origin/main history" - raise ValueError(message) - ancestry.check_returncode() - return {"sha": commit, "version": version, "publish": str(publish).lower()} - - -def main() -> None: - event = json.loads(Path(os.environ["GITHUB_EVENT_PATH"]).read_text(encoding="utf-8")) - result = resolve_release( - repository=Path.cwd(), - version=os.environ["PROJECT_VERSION"], - requested_ref=os.environ["RELEASE_REF"], - event_name=os.environ["GITHUB_EVENT_NAME"], - workflow_ref=os.environ["GITHUB_REF"], - workflow_sha=os.environ["GITHUB_WORKFLOW_SHA"], - event=event, - publish=os.environ["PUBLISH"] == "true", - ) - sys.stdout.write(json.dumps(result, indent=2) + "\n") - with Path(os.environ["GITHUB_OUTPUT"]).open("a", encoding="utf-8") as output: - output.writelines(f"{name}={value}\n" for name, value in result.items()) - - -if __name__ == "__main__": - main() diff --git a/tools/check_release_evidence.py b/tools/check_release_evidence.py deleted file mode 100644 index 21de6c7..0000000 --- a/tools/check_release_evidence.py +++ /dev/null @@ -1,83 +0,0 @@ -"""Record or verify the exact archives, source and workflow of a candidate.""" - -from __future__ import annotations - -import argparse -import hashlib -import json -import re -import sys -from pathlib import Path - - -def verify_evidence( - evidence: dict[str, str], - directory: Path, - *, - source_sha: str, - version: str, - run_url: str, -) -> None: - """Reject different identities, extra files, unsafe names or changed bytes.""" - if re.fullmatch(r"[0-9a-f]{40}", source_sha) is None: - message = "Source identity must be a full commit SHA" - raise ValueError(message) - expected = {"source_sha": source_sha, "version": version, "run_url": run_url} - for key, value in expected.items(): - if evidence.get(key) != value: - message = f"Release evidence {key} differs from this validation run" - raise ValueError(message) - canonical = { - "wheel": f"bearshape-{version}-py3-none-any.whl", - "sdist": f"bearshape-{version}.tar.gz", - } - if any(evidence.get(kind) != name for kind, name in canonical.items()): - message = "Release evidence must name the canonical wheel and source archive" - raise ValueError(message) - if {path.name for path in directory.iterdir()} != set(canonical.values()): - message = "Distribution directory must contain exactly the two validated archives" - raise ValueError(message) - for kind in ("wheel", "sdist"): - path = directory / evidence[kind] - if path.is_symlink() or not path.is_file(): - message = f"Release archive must be a regular file: {path.name}" - raise ValueError(message) - digest = hashlib.sha256(path.read_bytes()).hexdigest() - if evidence.get(f"{kind}_sha256") != digest: - message = f"Release archive hash differs from validated evidence: {path.name}" - raise ValueError(message) - - -def main() -> None: - parser = argparse.ArgumentParser(description=__doc__) - parser.add_argument("mode", choices=("record", "verify")) - parser.add_argument("manifest", type=Path) - parser.add_argument("directory", type=Path) - parser.add_argument("--source-sha", required=True) - parser.add_argument("--version", required=True) - parser.add_argument("--run-url", required=True) - args = parser.parse_args() - if args.mode == "record": - from check_distribution import check_distribution - - evidence = check_distribution( - args.directory / f"bearshape-{args.version}-py3-none-any.whl", - args.directory / f"bearshape-{args.version}.tar.gz", - ) - evidence.update(source_sha=args.source_sha, run_url=args.run_url) - else: - evidence = json.loads(args.manifest.read_text(encoding="utf-8")) - verify_evidence( - evidence, - args.directory, - source_sha=args.source_sha, - version=args.version, - run_url=args.run_url, - ) - if args.mode == "record": - args.manifest.write_text(json.dumps(evidence, indent=2) + "\n", encoding="utf-8") - sys.stdout.write(json.dumps(evidence, indent=2) + "\n") - - -if __name__ == "__main__": - main() diff --git a/tools/check_upstream_proposal.py b/tools/check_upstream_proposal.py deleted file mode 100644 index 60c6d38..0000000 --- a/tools/check_upstream_proposal.py +++ /dev/null @@ -1,161 +0,0 @@ -"""Build and validate reviewed upstream patches without changing the lock.""" - -# All subprocesses use argument lists, never a shell. -# ruff: file-ignore[suspicious-subprocess-import, subprocess-without-shell-equals-true] - -from __future__ import annotations - -import argparse -import hashlib -import json -import os -import shutil -import subprocess -import sys -from pathlib import Path - -from check_installed import _copy_consumers -from check_release import git_environment - -ROOT = Path(__file__).resolve().parents[1] -PROPOSAL = ROOT / "tools" / "upstream" - - -ORIGIN_CHECK = ( - "import beartype,bearshape,pathlib,sys; " - "print(sys.version); " - "print(beartype.__file__); print(bearshape.__file__); " - "assert all(pathlib.Path(m.__file__).resolve().is_relative_to(" - "pathlib.Path(sys.prefix).resolve()) for m in (beartype,bearshape)); " - "from beartype.plug import get_hint_check_scope; " - "assert get_hint_check_scope() is None" -) - - -def _apply_patches( - source: Path, git: str, environment: dict[str, str], parser: argparse.ArgumentParser -) -> dict: - manifest = json.loads((PROPOSAL / "patches" / "series.json").read_text()) - head = subprocess.check_output( - [git, "rev-parse", "HEAD"], cwd=source, env=environment, text=True - ).strip() - dirty = subprocess.check_output( - [git, "status", "--porcelain"], cwd=source, env=environment, text=True - ) - if head != manifest["base_commit"] or dirty: - parser.error("upstream source must be clean at the manifest base commit") - for entry in manifest["patches"]: - patch = PROPOSAL / "patches" / entry["file"] - if patch.parent != PROPOSAL / "patches" or patch.suffix != ".patch": - parser.error("patch must name a file directly in the patches directory") - if hashlib.sha256(patch.read_bytes()).hexdigest() != entry["sha256"]: - parser.error(f"patch digest differs: {patch.name}") - subprocess.run( - [git, "apply", "--check", str(patch)], cwd=source, env=environment, check=True - ) - subprocess.run([git, "apply", str(patch)], cwd=source, env=environment, check=True) - return manifest - - -def main() -> None: - parser = argparse.ArgumentParser(description=__doc__) - parser.add_argument("--upstream-source", type=Path, required=True) - parser.add_argument("--output", type=Path, required=True) - parser.add_argument("--python", required=True) - args = parser.parse_args() - uv, git = shutil.which("uv"), shutil.which("git") - if uv is None or git is None: - parser.error("uv and git are required") - args.upstream_source = args.upstream_source.resolve() - output = args.output.resolve() - output.mkdir(parents=True, exist_ok=False) - environment = git_environment(git) - for key in ("PYTHONPATH", "PYTHONHOME", "TOX_ENV_NAME"): - environment.pop(key, None) - environment["UV_TORCH_BACKEND"] = "cpu" - commands = [] - - def run(command: list[str], cwd: Path = output) -> None: - commands.append({"command": command, "cwd": str(cwd)}) - (output / "commands.json").write_text(json.dumps(commands, indent=2) + "\n") - subprocess.run(command, cwd=cwd, env=environment, check=True) - - manifest = _apply_patches(args.upstream_source, git, environment, parser) - dist = output / "dist" - run([uv, "build", "--wheel", "--out-dir", str(dist), str(args.upstream_source)]) - run([uv, "build", "--sdist", "--out-dir", str(dist), str(ROOT)]) - sdist = next(dist.glob("bearshape-*.tar.gz")) - run([uv, "build", "--wheel", "--out-dir", str(dist), str(sdist)]) - consumer = output / "consumer" - consumer.mkdir() - _copy_consumers(sdist, consumer) - requirements = output / "requirements.txt" - run( - [ - uv, - "export", - "--locked", - "--no-hashes", - "--no-emit-project", - "--no-emit-package", - "beartype", - "--output-file", - str(requirements), - ], - consumer, - ) - run([uv, "venv", str(output / "venv"), "--python", args.python]) - python = str( - output / "venv" / ("Scripts/python.exe" if os.name == "nt" else "bin/python") - ) - run([ - uv, - "pip", - "install", - "--python", - python, - "-r", - str(requirements), - *map(str, sorted(dist.glob("*.whl"))), - ]) - run([python, "-I", "-c", ORIGIN_CHECK]) - protocol = consumer / "tools" / "upstream" / "protocol" - protocol.mkdir() - for test in (args.upstream_source / "beartype_test/a00_unit/a40_api/plug").glob( - "test_plug*.py" - ): - if test.name != "test_plughintable.py": - shutil.copyfile(test, protocol / test.name) - run([python, "-I", "tools/validate_runtime.py", "cpu"], consumer) - run([python, "-I", "tools/probe_union.py"], consumer) - run( - [ - python, - "-I", - "-m", - "pytest", - "tests/", - "tools/upstream/", - "--installed-package", - "-n", - "auto", - ], - consumer, - ) - evidence = { - "base_commit": manifest["base_commit"], - "patches": manifest["patches"], - "artifacts": { - file.name: hashlib.sha256(file.read_bytes()).hexdigest() - for file in sorted(dist.iterdir()) - }, - "status": "passed", - "published_dependency": False, - } - (output / "evidence.json").write_text(json.dumps(evidence, indent=2) + "\n") - json.dump(evidence, sys.stdout, indent=2) - sys.stdout.write("\n") - - -if __name__ == "__main__": - main() diff --git a/tools/evidence/2026-10-11-audit-performance/README.md b/tools/evidence/2026-10-11-audit-performance/README.md deleted file mode 100644 index a5ac803..0000000 --- a/tools/evidence/2026-10-11-audit-performance/README.md +++ /dev/null @@ -1,77 +0,0 @@ -# Audit follow-up performance evidence - -Compare corrected bearshape source `1e17a96f9969cb4121042cf1bcdd4406182dec94` -with the scope/Tree optimization at `1991deabe05180f54616aa42a36940d40dedc1e5`. -Both retain all six audit correctness fixes. `identity.json` pins both -sdist-derived wheels and the unchanged published/proposal beartype wheels. - -Each side is normally installed in a separate fresh venv on the same macOS arm64 -host, with CPython 3.11.15 or 3.14.5, NumPy 2.4.6, optree 0.19.1 and -typing_extensions 4.16.0. Run each environment's interpreter from outside the -package source with `-I tools/benchmark_runtime.py`: proposal comparisons use -`--calls 20000 --repeats 9`; published-baseline comparisons use -`--calls 10000 --repeats 7`. Use the same script revision on both sides. -Benchmarks run sequentially without validation jobs; order is before/after on -3.11 and after/before on 3.14. Raw JSON retains every sample and actual per-case -call counts; expensive cases use the script's smaller counts. - -All values below are median microseconds per call. Tree input/return cases visit -all leaves; composite Tree measures its input only. Validator construction is an -internal cold-construction measurement, not the cached public subscript path. -Decoration repeatedly creates a new function with an existing annotation. - -| Dependency | Python | Case | Before | After | -| ---------- | ------ | -------------------------- | ------- | ------- | -| Release | 3.11 | `native/3` | 0.094 | 0.093 | -| Release | 3.11 | `strict/3` | 13.430 | 5.591 | -| Release | 3.11 | `like/3` | 6.897 | 2.980 | -| Release | 3.11 | `value/3` | 10.713 | 10.133 | -| Release | 3.11 | `tree/100` | 804.141 | 313.363 | -| Release | 3.11 | `tree-value/100` | 889.923 | 394.958 | -| Release | 3.11 | `tree-composite/100` | 415.658 | 306.292 | -| Release | 3.11 | `decorate_array` | 112.223 | 112.510 | -| Release | 3.11 | `construct_tree_validator` | 56.451 | 1.370 | -| Release | 3.14 | `native/3` | 0.095 | 0.092 | -| Release | 3.14 | `strict/3` | 13.533 | 5.144 | -| Release | 3.14 | `like/3` | 7.085 | 2.825 | -| Release | 3.14 | `value/3` | 9.389 | 9.451 | -| Release | 3.14 | `tree/100` | 733.520 | 309.102 | -| Release | 3.14 | `tree-value/100` | 834.209 | 405.564 | -| Release | 3.14 | `tree-composite/100` | 406.239 | 282.342 | -| Release | 3.14 | `decorate_array` | 124.872 | 119.103 | -| Release | 3.14 | `construct_tree_validator` | 63.068 | 1.413 | -| Proposal | 3.11 | `native/3` | 0.079 | 0.084 | -| Proposal | 3.11 | `strict/3` | 8.642 | 4.829 | -| Proposal | 3.11 | `like/3` | 5.975 | 2.678 | -| Proposal | 3.11 | `value/3` | 8.062 | 8.293 | -| Proposal | 3.11 | `tree/100` | 626.475 | 310.339 | -| Proposal | 3.11 | `tree-value/100` | 706.763 | 391.792 | -| Proposal | 3.11 | `tree-composite/100` | 439.645 | 388.694 | -| Proposal | 3.11 | `decorate_array` | 112.953 | 114.098 | -| Proposal | 3.11 | `construct_tree_validator` | 56.978 | 1.382 | -| Proposal | 3.14 | `native/3` | 0.091 | 0.115 | -| Proposal | 3.14 | `strict/3` | 8.968 | 4.968 | -| Proposal | 3.14 | `like/3` | 6.356 | 2.771 | -| Proposal | 3.14 | `value/3` | 8.396 | 8.566 | -| Proposal | 3.14 | `tree/100` | 643.599 | 312.491 | -| Proposal | 3.14 | `tree-value/100` | 740.058 | 405.044 | -| Proposal | 3.14 | `tree-composite/100` | 444.329 | 386.472 | -| Proposal | 3.14 | `decorate_array` | 120.344 | 119.809 | -| Proposal | 3.14 | `construct_tree_validator` | 61.549 | 1.413 | - -Strict checks improve by about 44–62%; 100-leaf Tree input/return checks improve -by about 50–61% in these runs. Array size does not materially change strict -metadata checking; conversion still scales with input size. Ordinary beartype -controls remain sub-microsecond and vary between runs. This PR does not change -beartype code or claim zero overhead for the separate upstream proposal. -Value-only calls are broadly similar, including approximately 2–3% higher -medians in the proposal comparison. These are local measurements without a CI -timing threshold or a guarantee for other hardware/workloads. - -The profile identified argument binding and repeated leaf context discovery. -Regression guards now reject scope binding for annotations without Value and -require at least 202 snapshots for a 100-leaf input/return. Generic leaves -retain the owned public wrapper; mutable shape/dtype metadata and independent -nested calls are exercised. Dtype normalization remains a measurable cost. No -dtype or checked-value cache was added: custom properties must stay fresh, and -the measured scope improvements do not require additional cache ownership rules. diff --git a/tools/evidence/2026-10-11-audit-performance/benchmark-matched-after311.json b/tools/evidence/2026-10-11-audit-performance/benchmark-matched-after311.json deleted file mode 100644 index 42b26e1..0000000 --- a/tools/evidence/2026-10-11-audit-performance/benchmark-matched-after311.json +++ /dev/null @@ -1,352 +0,0 @@ -{ - "python": "3.11.15 (main, May 10 2026, 19:23:07) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit", - "machine": "arm64", - "bearshape_origin": "/private/tmp/audit-bench-after311/lib/python3.11/site-packages/bearshape/__init__.py", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6", - "optree": "0.19.1" - }, - "results": [ - { - "case": "bare/3", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 0.017064598796423525, 0.016804150072857738, 0.01668545010033995, - 0.016747899644542485, 0.016779149882495403, 0.016972949379123747, - 0.017137499526143074, 0.016906250675674528, 0.017231250240001827 - ], - "median_us": 0.016906250675674528, - "min_us": 0.01668545010033995, - "max_us": 0.017231250240001827 - }, - { - "case": "native/3", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 0.08172289963113144, 0.08213750115828589, 0.08427710126852617, - 0.0847917006467469, 0.07962085073813796, 0.08222914912039414, - 0.0836666498798877, 0.08432294998783618, 0.08444164996035397 - ], - "median_us": 0.0836666498798877, - "min_us": 0.07962085073813796, - "max_us": 0.0847917006467469 - }, - { - "case": "strict/3", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 4.91799794981489, 5.100854150077794, 4.810004201135598, - 4.818562501168344, 4.810597898904234, 4.836531249748077, - 4.835820849984884, 4.828762500255834, 4.812404149561189 - ], - "median_us": 4.828762500255834, - "min_us": 4.810004201135598, - "max_us": 5.100854150077794 - }, - { - "case": "explicit/3", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 6.153004149382468, 6.147302100725938, 6.157604200416245, - 6.115929150837474, 6.128716649254784, 6.136233349388931, - 6.153429149708245, 6.163450000167359, 6.180995800241362 - ], - "median_us": 6.153004149382468, - "min_us": 6.115929150837474, - "max_us": 6.180995800241362 - }, - { - "case": "like/3", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 2.6751833502203226, 2.6692270490457304, 2.6915270995232277, - 2.677531249355525, 2.6930895503028296, 2.6772708501084708, - 2.6784187502926216, 2.669172899913974, 2.6801020998391323 - ], - "median_us": 2.677531249355525, - "min_us": 2.669172899913974, - "max_us": 2.6930895503028296 - }, - { - "case": "nested/3", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 11.2060333500267, 11.270881250675302, 11.302106249786448, - 11.251056249602698, 11.215795850148425, 11.211062500660773, - 11.162702098954469, 11.175514549540821, 11.367477099702228 - ], - "median_us": 11.215795850148425, - "min_us": 11.162702098954469, - "max_us": 11.367477099702228 - }, - { - "case": "value/3", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 8.990325000195298, 8.290193750872277, 8.238914600224234, - 8.256789548613597, 8.293018750555348, 8.296739601064473, - 8.26278330059722, 8.308966649929062, 8.295452099991962 - ], - "median_us": 8.293018750555348, - "min_us": 8.238914600224234, - "max_us": 8.990325000195298 - }, - { - "case": "like-sequence/3", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 3.201485400495585, 3.245937499741558, 3.1711583491414785, - 3.2299395999871194, 3.1799271004274487, 3.165479199378751, - 3.315408350317739, 3.184931250871159, 3.187512500153389 - ], - "median_us": 3.187512500153389, - "min_us": 3.165479199378751, - "max_us": 3.315408350317739 - }, - { - "case": "diagnostic/3", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 72.560083004646, 71.3224170031026, 71.12962499377318, 70.78445900697261, - 71.29187500686385, 70.90816699201241, 70.46437502140179, - 70.94216599944048, 71.37829199200496 - ], - "median_us": 71.12962499377318, - "min_us": 70.46437502140179, - "max_us": 72.560083004646 - }, - { - "case": "bare/1000000", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 0.01797084987629205, 0.01696459949016571, 0.018533349793870002, - 0.017216648848261684, 0.01689375058049336, 0.016783300088718534, - 0.016706249152775854, 0.016691650671418756, 0.017370849673170596 - ], - "median_us": 0.01696459949016571, - "min_us": 0.016691650671418756, - "max_us": 0.018533349793870002 - }, - { - "case": "native/1000000", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 0.08294169965665787, 0.08501874981448054, 0.08559164998587221, - 0.0852083001518622, 0.08450830064248294, 0.07933960005175322, - 0.08159579883795232, 0.08354165038326755, 0.08380415092688054 - ], - "median_us": 0.08380415092688054, - "min_us": 0.07933960005175322, - "max_us": 0.08559164998587221 - }, - { - "case": "strict/1000000", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 4.840883349243086, 4.830700000457, 4.824089600879233, 4.812081249838229, - 4.8327374999644235, 4.820297900005244, 4.828662499494385, - 4.957754148927052, 4.914237500634044 - ], - "median_us": 4.830700000457, - "min_us": 4.812081249838229, - "max_us": 4.957754148927052 - }, - { - "case": "explicit/1000000", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 6.149387500772718, 6.227970850886777, 6.178483349503949, - 6.164181249914691, 6.138854150776751, 6.099666650698055, - 6.100781248824205, 6.230337500164751, 6.142214599822182 - ], - "median_us": 6.149387500772718, - "min_us": 6.099666650698055, - "max_us": 6.230337500164751 - }, - { - "case": "like/1000000", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 2.6852354509173892, 2.6751895507914014, 2.687529200920835, - 2.669452100235503, 2.675172949966509, 2.6601687510265037, - 2.659058349672705, 2.6699562498833984, 2.7768353989813477 - ], - "median_us": 2.675172949966509, - "min_us": 2.659058349672705, - "max_us": 2.7768353989813477 - }, - { - "case": "nested/1000000", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 11.294454149901867, 11.295237499871291, 11.291947950667236, - 11.278202050016262, 11.21802915004082, 11.24087500065798, - 11.233502099639736, 11.24948334909277, 11.234599999443162 - ], - "median_us": 11.24948334909277, - "min_us": 11.21802915004082, - "max_us": 11.295237499871291 - }, - { - "case": "value/1000000", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 8.36130625102669, 8.815956251055468, 8.326495849178173, - 8.309843749157153, 8.292843749222811, 8.313552050094586, - 8.308347899583168, 8.295362499484327, 8.270199999969918 - ], - "median_us": 8.309843749157153, - "min_us": 8.270199999969918, - "max_us": 8.815956251055468 - }, - { - "case": "like-sequence/1000000", - "calls_per_repeat": 5, - "repeats": 9, - "samples_us": [ - 11585.475003812462, 11295.608198270202, 11256.64160354063, - 11264.516599476337, 11253.66659834981, 11270.166601752862, - 11463.666602503508, 11378.366604913026, 11500.84999972023 - ], - "median_us": 11295.608198270202, - "min_us": 11253.66659834981, - "max_us": 11585.475003812462 - }, - { - "case": "diagnostic/1000000", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 79.40683301421814, 78.35191700723954, 77.55912499851547, - 78.0227079812903, 77.8239160135854, 77.8304580016993, 78.4627920074854, - 78.01858300808817, 77.75645799119957 - ], - "median_us": 78.01858300808817, - "min_us": 77.55912499851547, - "max_us": 79.40683301421814 - }, - { - "case": "tree/1", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 7.420987500518095, 7.382691699604038, 7.386291649891064, - 7.403633299691137, 7.376456250494812, 7.421979200444184, - 7.388127100421116, 7.398404148989357, 7.3917978996178135 - ], - "median_us": 7.3917978996178135, - "min_us": 7.376456250494812, - "max_us": 7.421979200444184 - }, - { - "case": "tree-value/1", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 13.192029150377493, 13.20411460037576, 13.268385449191555, - 13.210375000198837, 13.209120849205647, 13.170266650558915, - 13.188181250006892, 13.365731250087265, 13.352752050559502 - ], - "median_us": 13.209120849205647, - "min_us": 13.170266650558915, - "max_us": 13.365731250087265 - }, - { - "case": "tree-composite/1", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 10.556843750237022, 10.472543750074692, 10.483574999670964, - 10.481635401083622, 10.44539584981976, 10.449241699825507, - 10.466514600557275, 10.716822899121325, 10.503320849966258 - ], - "median_us": 10.481635401083622, - "min_us": 10.44539584981976, - "max_us": 10.716822899121325 - }, - { - "case": "tree/100", - "calls_per_repeat": 200, - "repeats": 9, - "samples_us": [ - 315.30395499430597, 313.0287499516271, 310.3391650074627, - 313.3774999878369, 313.93000012030825, 308.8097900035791, - 308.25103996903636, 308.37041995255277, 308.3860450715292 - ], - "median_us": 310.3391650074627, - "min_us": 308.25103996903636, - "max_us": 315.30395499430597 - }, - { - "case": "tree-value/100", - "calls_per_repeat": 200, - "repeats": 9, - "samples_us": [ - 391.886665020138, 390.58291498804465, 389.71895512077026, - 391.79166487883776, 391.0558350617066, 398.803330026567, - 393.1245850981213, 390.879165061051, 392.7204151113983 - ], - "median_us": 391.79166487883776, - "min_us": 389.71895512077026, - "max_us": 398.803330026567 - }, - { - "case": "tree-composite/100", - "calls_per_repeat": 200, - "repeats": 9, - "samples_us": [ - 389.7500000311993, 386.2302099878434, 388.0560399556998, - 390.50146006047726, 390.40771007421426, 387.27603998268023, - 388.85145491803996, 388.6943749967031, 388.56354003655724 - ], - "median_us": 388.6943749967031, - "min_us": 386.2302099878434, - "max_us": 390.50146006047726 - }, - { - "case": "decorate_array", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 115.32441701274365, 127.6770830154419, 115.55724998470396, - 114.69887499697506, 114.09820799599402, 113.78687497926876, - 113.77408300177194, 113.76758400001563, 114.02450001332909 - ], - "median_us": 114.09820799599402, - "min_us": 113.76758400001563, - "max_us": 127.6770830154419 - }, - { - "case": "construct_tree_validator", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 1.3990419975016266, 1.3354170077946037, 1.3282499858178198, - 1.3650410110130906, 1.382332993671298, 1.4016659988556057, - 1.4208749926183373, 1.4176249969750643, 1.3662500132340938 - ], - "median_us": 1.382332993671298, - "min_us": 1.3282499858178198, - "max_us": 1.4208749926183373 - } - ] -} diff --git a/tools/evidence/2026-10-11-audit-performance/benchmark-matched-after314.json b/tools/evidence/2026-10-11-audit-performance/benchmark-matched-after314.json deleted file mode 100644 index 4b7fca6..0000000 --- a/tools/evidence/2026-10-11-audit-performance/benchmark-matched-after314.json +++ /dev/null @@ -1,352 +0,0 @@ -{ - "python": "3.14.5 (main, May 10 2026, 19:20:57) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit-Mach-O", - "machine": "arm64", - "bearshape_origin": "/private/tmp/audit-bench-after314/lib/python3.14/site-packages/bearshape/__init__.py", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6", - "optree": "0.19.1" - }, - "results": [ - { - "case": "bare/3", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 0.026450000586919487, 0.025502100470475852, 0.025437500153202564, - 0.02363124949624762, 0.023058350780047476, 0.02313539880560711, - 0.023010399308986962, 0.023335400328505784, 0.022987500415183604 - ], - "median_us": 0.023335400328505784, - "min_us": 0.022987500415183604, - "max_us": 0.026450000586919487 - }, - { - "case": "native/3", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 0.12467915075831115, 0.12432084913598374, 0.1186166497063823, - 0.11484165006550029, 0.11435000051278621, 0.11513749923324212, - 0.1094332998036407, 0.10780000011436641, 0.10817709990078583 - ], - "median_us": 0.11484165006550029, - "min_us": 0.10780000011436641, - "max_us": 0.12467915075831115 - }, - { - "case": "strict/3", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 5.011341649515089, 4.79252500081202, 4.793116649670992, - 5.158279150782619, 5.056262499419972, 4.968306250520982, - 5.10556459921645, 4.877018750994466, 4.809293750440702 - ], - "median_us": 4.968306250520982, - "min_us": 4.79252500081202, - "max_us": 5.158279150782619 - }, - { - "case": "explicit/3", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 6.34651459986344, 6.391877100395504, 6.3439916499191895, - 6.320510449586436, 6.448635450215079, 6.456139600777533, - 6.421704150852747, 6.342437501007225, 6.364904200017918 - ], - "median_us": 6.364904200017918, - "min_us": 6.320510449586436, - "max_us": 6.456139600777533 - }, - { - "case": "like/3", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 2.9303521005203947, 2.7530895997188054, 2.757037499395665, - 2.749964599206578, 2.7559187496080995, 2.789783349726349, - 2.7978958503808826, 2.771300000313204, 2.7900728993699886 - ], - "median_us": 2.771300000313204, - "min_us": 2.749964599206578, - "max_us": 2.9303521005203947 - }, - { - "case": "nested/3", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 11.47777500009397, 11.442727100802585, 11.450812499970198, - 11.444022950308863, 11.436916700040456, 11.416820799058769, - 11.446068750228733, 11.414760400657542, 11.481372950947843 - ], - "median_us": 11.444022950308863, - "min_us": 11.414760400657542, - "max_us": 11.481372950947843 - }, - { - "case": "value/3", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 8.566404150042217, 8.542804150783923, 8.537220800644718, - 8.556985449104104, 8.551037500728853, 8.573352049279492, - 8.590962500602473, 8.569031249498948, 8.571391650184523 - ], - "median_us": 8.566404150042217, - "min_us": 8.537220800644718, - "max_us": 8.590962500602473 - }, - { - "case": "like-sequence/3", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 3.4192520994110964, 3.4237457992276177, 3.392314550001174, - 3.4049437497742474, 3.4055083509883843, 3.401418750581797, - 3.3930333505850285, 3.3995312493061647, 3.4059771001921035 - ], - "median_us": 3.4049437497742474, - "min_us": 3.392314550001174, - "max_us": 3.4237457992276177 - }, - { - "case": "diagnostic/3", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 66.73099999898113, 65.34391699824482, 65.0948749971576, - 65.45970801380463, 64.97725000372157, 64.88374999025837, 70.22362499265, - 66.45341700641438, 65.8736249897629 - ], - "median_us": 65.45970801380463, - "min_us": 64.88374999025837, - "max_us": 70.22362499265 - }, - { - "case": "bare/1000000", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 0.016097900515887886, 0.016120850341394544, 0.01588334998814389, - 0.01606044970685616, 0.016650000179652125, 0.017141649732366204, - 0.01713124947855249, 0.01705210015643388, 0.017043750267475843 - ], - "median_us": 0.016650000179652125, - "min_us": 0.01588334998814389, - "max_us": 0.017141649732366204 - }, - { - "case": "native/1000000", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 0.09082079923246056, 0.09112920088227838, 0.09152920101769269, - 0.08794374880380929, 0.08831455052131787, 0.0913625000976026, - 0.09203329973388463, 0.09204789967043325, 0.09137710003415123 - ], - "median_us": 0.0913625000976026, - "min_us": 0.08794374880380929, - "max_us": 0.09204789967043325 - }, - { - "case": "strict/1000000", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 4.887508349202108, 4.900483349047136, 4.909983350080438, - 4.8867000004975125, 4.937714600237086, 4.964687500614673, - 4.8953770994558, 4.873362500802614, 4.8579895999864675 - ], - "median_us": 4.8953770994558, - "min_us": 4.8579895999864675, - "max_us": 4.964687500614673 - }, - { - "case": "explicit/1000000", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 6.321970850694925, 6.303639549878426, 6.384018748940434, - 6.325177100370638, 6.350327099789865, 6.319577099930029, - 6.324543750088196, 6.295837499783374, 6.315187500149477 - ], - "median_us": 6.321970850694925, - "min_us": 6.295837499783374, - "max_us": 6.384018748940434 - }, - { - "case": "like/1000000", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 2.8080853997380473, 2.7920375010580756, 2.795320849691052, - 2.7992000002996065, 2.791781250562053, 2.8193770500365645, - 2.8161812500911765, 2.817695800331421, 2.8093957997043617 - ], - "median_us": 2.8080853997380473, - "min_us": 2.791781250562053, - "max_us": 2.8193770500365645 - }, - { - "case": "nested/1000000", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 11.446008349594194, 11.458037499687634, 11.440697900252417, - 11.419077099708375, 11.46717919909861, 11.519058349949773, - 11.514772949158214, 11.576470799627714, 11.613450000004377 - ], - "median_us": 11.46717919909861, - "min_us": 11.419077099708375, - "max_us": 11.613450000004377 - }, - { - "case": "value/1000000", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 8.521841651236173, 8.522872949833982, 8.548718750535045, - 8.564331250090618, 8.527385399793275, 8.590218749304768, - 8.557254150218796, 8.571650000521913, 8.54785835108487 - ], - "median_us": 8.548718750535045, - "min_us": 8.521841651236173, - "max_us": 8.590218749304768 - }, - { - "case": "like-sequence/1000000", - "calls_per_repeat": 5, - "repeats": 9, - "samples_us": [ - 12312.70840507932, 12042.400002246723, 11962.87500206381, - 11991.633399156854, 11844.64999823831, 12080.22499922663, - 11936.575005529448, 11977.36660251394, 11893.208202673122 - ], - "median_us": 11977.36660251394, - "min_us": 11844.64999823831, - "max_us": 12312.70840507932 - }, - { - "case": "diagnostic/1000000", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 74.0202919987496, 73.43670798582025, 72.44233298115432, - 74.43658300326206, 72.62074999744073, 72.0759590039961, - 72.77200001408346, 72.24425001186319, 71.93487498443574 - ], - "median_us": 72.62074999744073, - "min_us": 71.93487498443574, - "max_us": 74.43658300326206 - }, - { - "case": "tree/1", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 7.423345849383622, 7.389020849950612, 7.398127049964387, - 7.387706248846371, 7.393764550215565, 7.352645850914996, - 7.377552099933382, 7.378554200113285, 7.383727098931558 - ], - "median_us": 7.387706248846371, - "min_us": 7.352645850914996, - "max_us": 7.423345849383622 - }, - { - "case": "tree-value/1", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 13.523591648845468, 13.566383349825628, 13.512583350529894, - 13.491293750121258, 13.554539599863347, 15.687420849280898, - 13.608893750642892, 13.669947900052648, 13.596104150929023 - ], - "median_us": 13.566383349825628, - "min_us": 13.491293750121258, - "max_us": 15.687420849280898 - }, - { - "case": "tree-composite/1", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 11.057860399887431, 10.873408299812581, 10.899477048951667, - 10.957227100152522, 10.932227100420278, 10.879429148917552, - 11.047222949855495, 10.870858299313113, 10.873947948857676 - ], - "median_us": 10.899477048951667, - "min_us": 10.870858299313113, - "max_us": 11.057860399887431 - }, - { - "case": "tree/100", - "calls_per_repeat": 200, - "repeats": 9, - "samples_us": [ - 311.54000011156313, 311.38541497057304, 311.37896003201604, - 316.5729150350671, 313.00250004278496, 312.4906249286141, - 312.60500007192604, 312.6352099934593, 311.93374990834855 - ], - "median_us": 312.4906249286141, - "min_us": 311.37896003201604, - "max_us": 316.5729150350671 - }, - { - "case": "tree-value/100", - "calls_per_repeat": 200, - "repeats": 9, - "samples_us": [ - 404.6187500352971, 405.9629200492054, 402.4122949340381, - 405.21666494896635, 405.743335140869, 404.08625005511567, - 402.4789549293928, 406.211249937769, 405.0441649451386 - ], - "median_us": 405.0441649451386, - "min_us": 402.4122949340381, - "max_us": 406.211249937769 - }, - { - "case": "tree-composite/100", - "calls_per_repeat": 200, - "repeats": 9, - "samples_us": [ - 386.19479004410096, 386.3735400955193, 387.2787499858532, - 386.1554201284889, 385.8814599516336, 386.76270996802486, - 386.4716649695765, 387.7704199112486, 387.91729501099326 - ], - "median_us": 386.4716649695765, - "min_us": 385.8814599516336, - "max_us": 387.91729501099326 - }, - { - "case": "decorate_array", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 121.47237500175834, 120.03933402593248, 119.93524999707006, - 119.39199999324046, 119.80891600251198, 119.61912497645244, - 119.61270900792442, 119.62641699938104, 120.36212501698174 - ], - "median_us": 119.80891600251198, - "min_us": 119.39199999324046, - "max_us": 121.47237500175834 - }, - { - "case": "construct_tree_validator", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 1.3965829857625067, 1.438833016436547, 1.4604590251110494, - 1.369333011098206, 1.362332986900583, 1.3830419920850545, - 1.4126249880064279, 1.4268749800976366, 1.430749980499968 - ], - "median_us": 1.4126249880064279, - "min_us": 1.362332986900583, - "max_us": 1.4604590251110494 - } - ] -} diff --git a/tools/evidence/2026-10-11-audit-performance/benchmark-matched-before311.json b/tools/evidence/2026-10-11-audit-performance/benchmark-matched-before311.json deleted file mode 100644 index bd45c6c..0000000 --- a/tools/evidence/2026-10-11-audit-performance/benchmark-matched-before311.json +++ /dev/null @@ -1,352 +0,0 @@ -{ - "python": "3.11.15 (main, May 10 2026, 19:23:07) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit", - "machine": "arm64", - "bearshape_origin": "/private/tmp/audit-bench-before311/lib/python3.11/site-packages/bearshape/__init__.py", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6", - "optree": "0.19.1" - }, - "results": [ - { - "case": "bare/3", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 0.0168478989508003, 0.016935401072259992, 0.01666249881964177, - 0.01694375096121803, 0.01703335001366213, 0.016879200120456517, - 0.01681040012044832, 0.01720000000204891, 0.017025000124704093 - ], - "median_us": 0.016935401072259992, - "min_us": 0.01666249881964177, - "max_us": 0.01720000000204891 - }, - { - "case": "native/3", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 0.0788541990914382, 0.07913959998404607, 0.08458334923489019, - 0.07766250055283308, 0.07739165012026206, 0.07755209953757003, - 0.07743540045339614, 0.07917084876680747, 0.07925204990897328 - ], - "median_us": 0.0788541990914382, - "min_us": 0.07739165012026206, - "max_us": 0.08458334923489019 - }, - { - "case": "strict/3", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 8.647772899712436, 8.62657084944658, 8.59973960032221, 8.58012294920627, - 8.599231249536388, 8.642174999113195, 8.95205624983646, - 8.642433349450585, 8.813056249346118 - ], - "median_us": 8.642174999113195, - "min_us": 8.58012294920627, - "max_us": 8.95205624983646 - }, - { - "case": "explicit/3", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 7.153766650299076, 7.131837500492111, 7.124612500774674, - 7.110491651110351, 7.109024999954272, 7.172414599335752, - 7.122289550898131, 7.117956251022406, 7.167037500767037 - ], - "median_us": 7.124612500774674, - "min_us": 7.109024999954272, - "max_us": 7.172414599335752 - }, - { - "case": "like/3", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 5.974689598951954, 6.014568750106264, 6.012170799658634, - 5.965049999940675, 5.948885450197849, 5.930195850669406, - 6.021579151274636, 6.075147949741222, 5.970356251054909 - ], - "median_us": 5.974689598951954, - "min_us": 5.930195850669406, - "max_us": 6.075147949741222 - }, - { - "case": "nested/3", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 16.202693749801256, 16.236518749792594, 16.15302705031354, - 16.165629150054883, 16.168852100963704, 16.357097899890505, - 16.244595850002952, 16.63493960077176, 16.347512499487493 - ], - "median_us": 16.236518749792594, - "min_us": 16.15302705031354, - "max_us": 16.63493960077176 - }, - { - "case": "value/3", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 8.061741648998577, 8.167872948979493, 8.064456250576768, - 8.035566699982155, 8.03272289922461, 8.024860400473699, - 8.066035449155606, 8.10066250123782, 8.02744169923244 - ], - "median_us": 8.061741648998577, - "min_us": 8.024860400473699, - "max_us": 8.167872948979493 - }, - { - "case": "like-sequence/3", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 6.476483300502878, 6.464181249612011, 6.47469375107903, - 6.471341650467366, 6.471372899250127, 6.511795849655755, - 6.522872899950016, 6.511033351125661, 6.502910400740802 - ], - "median_us": 6.476483300502878, - "min_us": 6.464181249612011, - "max_us": 6.522872899950016 - }, - { - "case": "diagnostic/3", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 81.53450000099838, 79.93295902269892, 79.88645799923688, - 80.42091599781998, 80.13737501460128, 80.85145897348411, - 80.22066598641686, 80.22570898174308, 79.65083298040554 - ], - "median_us": 80.22066598641686, - "min_us": 79.65083298040554, - "max_us": 81.53450000099838 - }, - { - "case": "bare/1000000", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 0.016622900147922337, 0.016341650916729122, 0.018050000653602183, - 0.0171583000337705, 0.017174999811686575, 0.017825000395532697, - 0.019014599092770368, 0.016581249656155705, 0.016495800809934735 - ], - "median_us": 0.0171583000337705, - "min_us": 0.016341650916729122, - "max_us": 0.019014599092770368 - }, - { - "case": "native/1000000", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 0.07893125002738088, 0.08209164952859282, 0.08208960061892867, - 0.08391040028072894, 0.08586040057707578, 0.08436459902441129, - 0.08503334975102916, 0.08389374997932464, 0.08356665057362989 - ], - "median_us": 0.08389374997932464, - "min_us": 0.07893125002738088, - "max_us": 0.08586040057707578 - }, - { - "case": "strict/1000000", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 8.786881249397993, 8.7459812493762, 8.649687499564607, - 8.650189598847646, 8.67282084946055, 8.639891649363562, - 8.632752099947538, 8.662062500661705, 8.608366650878452 - ], - "median_us": 8.650189598847646, - "min_us": 8.608366650878452, - "max_us": 8.786881249397993 - }, - { - "case": "explicit/1000000", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 7.131039550586138, 7.123466700431891, 7.118185400031507, - 7.123447900812607, 7.139868750527967, 7.130710450292099, - 7.1357666500261985, 7.136766650364734, 7.177160399442073 - ], - "median_us": 7.131039550586138, - "min_us": 7.118185400031507, - "max_us": 7.177160399442073 - }, - { - "case": "like/1000000", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 5.97931459924439, 5.970481249096338, 5.9929125010967255, - 5.990175000624731, 5.969308350177016, 5.969947899575345, - 5.987941699277144, 6.008533349086065, 6.005272899346892 - ], - "median_us": 5.987941699277144, - "min_us": 5.969308350177016, - "max_us": 6.008533349086065 - }, - { - "case": "nested/1000000", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 16.332664599758573, 16.51538125006482, 16.366327050491236, - 16.314362500270363, 16.28333955013659, 16.29941665014485, - 16.3168229511939, 16.238960399641655, 16.491758299525827 - ], - "median_us": 16.3168229511939, - "min_us": 16.238960399641655, - "max_us": 16.51538125006482 - }, - { - "case": "value/1000000", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 8.091402098943945, 8.084112498909235, 8.05662500060862, - 8.143260401266161, 8.13591874903068, 8.089149999432266, - 8.08391250029672, 8.105139550752938, 8.232260450313333 - ], - "median_us": 8.091402098943945, - "min_us": 8.05662500060862, - "max_us": 8.232260450313333 - }, - { - "case": "like-sequence/1000000", - "calls_per_repeat": 5, - "repeats": 9, - "samples_us": [ - 11235.341802239418, 11142.38320151344, 11177.249997854233, - 11140.650004381314, 11096.058203838766, 11084.258399205282, - 11083.62500090152, 11099.26679637283, 11124.333197949454 - ], - "median_us": 11124.333197949454, - "min_us": 11083.62500090152, - "max_us": 11235.341802239418 - }, - { - "case": "diagnostic/1000000", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 88.68954100762494, 86.78187502664514, 86.71199998934753, - 85.99570801015943, 86.1694999912288, 86.31529100239277, - 86.21766697615385, 85.5924170173239, 86.09950001118705 - ], - "median_us": 86.21766697615385, - "min_us": 85.5924170173239, - "max_us": 88.68954100762494 - }, - { - "case": "tree/1", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 15.90040000010049, 15.860427099687513, 15.902693750103936, - 16.0053458501352, 16.23386664869031, 15.876410399505403, - 15.896974998759106, 15.927210399240721, 15.93793329957407 - ], - "median_us": 15.902693750103936, - "min_us": 15.860427099687513, - "max_us": 16.23386664869031 - }, - { - "case": "tree-value/1", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 17.6305354500073, 17.43577084998833, 17.39603750029346, - 17.382868750428315, 17.38351460080594, 17.35578124935273, - 17.34409584896639, 17.3167958506383, 17.33919170073932 - ], - "median_us": 17.382868750428315, - "min_us": 17.3167958506383, - "max_us": 17.6305354500073 - }, - { - "case": "tree-composite/1", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 10.916114599967841, 10.880060448835138, 10.971222899388522, - 10.947075000149198, 10.944572949665599, 10.91575835016556, - 10.934720801014919, 10.914372900151648, 10.918574999959674 - ], - "median_us": 10.918574999959674, - "min_us": 10.880060448835138, - "max_us": 10.971222899388522 - }, - { - "case": "tree/100", - "calls_per_repeat": 200, - "repeats": 9, - "samples_us": [ - 625.995625014184, 624.5731249509845, 623.6835398885887, - 626.4752050628886, 634.2966649390291, 626.8543750047684, - 630.831250018673, 627.5308350450359, 625.0033300602809 - ], - "median_us": 626.4752050628886, - "min_us": 623.6835398885887, - "max_us": 634.2966649390291 - }, - { - "case": "tree-value/100", - "calls_per_repeat": 200, - "repeats": 9, - "samples_us": [ - 707.8377099242061, 715.3204148926307, 706.7629149241839, - 711.032709950814, 709.0412499383092, 706.5039599547163, - 706.0425000963733, 704.7631249588449, 704.2202050797641 - ], - "median_us": 706.7629149241839, - "min_us": 704.2202050797641, - "max_us": 715.3204148926307 - }, - { - "case": "tree-composite/100", - "calls_per_repeat": 200, - "repeats": 9, - "samples_us": [ - 439.01124998228624, 445.0056250789203, 439.5249999652151, - 440.83645509090275, 439.5293749985285, 439.00354503421113, - 439.6447949693538, 441.25854488811456, 444.9699999531731 - ], - "median_us": 439.6447949693538, - "min_us": 439.00354503421113, - "max_us": 445.0056250789203 - }, - { - "case": "decorate_array", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 115.42537499917671, 112.95308300759643, 113.327458006097, - 112.44450000231154, 113.13687500660308, 112.37024998990819, - 112.7601659973152, 112.81550000421703, 116.44541699206457 - ], - "median_us": 112.95308300759643, - "min_us": 112.37024998990819, - "max_us": 116.44541699206457 - }, - { - "case": "construct_tree_validator", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 57.50108300708234, 56.84879099135287, 57.02629199367948, - 57.0003749744501, 56.731457996647805, 56.97804200462997, - 56.95395902148448, 57.030958007089794, 56.647541001439095 - ], - "median_us": 56.97804200462997, - "min_us": 56.647541001439095, - "max_us": 57.50108300708234 - } - ] -} diff --git a/tools/evidence/2026-10-11-audit-performance/benchmark-matched-before314.json b/tools/evidence/2026-10-11-audit-performance/benchmark-matched-before314.json deleted file mode 100644 index d01a4b5..0000000 --- a/tools/evidence/2026-10-11-audit-performance/benchmark-matched-before314.json +++ /dev/null @@ -1,352 +0,0 @@ -{ - "python": "3.14.5 (main, May 10 2026, 19:20:57) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit-Mach-O", - "machine": "arm64", - "bearshape_origin": "/private/tmp/audit-bench-before314/lib/python3.14/site-packages/bearshape/__init__.py", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6", - "optree": "0.19.1" - }, - "results": [ - { - "case": "bare/3", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 0.017431248852517456, 0.017320849292445928, 0.016702049470040947, - 0.01737289858283475, 0.017187499906867743, 0.01708960044197738, - 0.017193749954458326, 0.017466649296693504, 0.017383349768351763 - ], - "median_us": 0.017320849292445928, - "min_us": 0.016702049470040947, - "max_us": 0.017466649296693504 - }, - { - "case": "native/3", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 0.09258749923901632, 0.0918853998882696, 0.08631669916212559, - 0.08992079965537414, 0.09135000000242144, 0.09135000000242144, - 0.0915229000383988, 0.09071040112758055, 0.08917500090319663 - ], - "median_us": 0.09135000000242144, - "min_us": 0.08631669916212559, - "max_us": 0.09258749923901632 - }, - { - "case": "strict/3", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 8.989449999353383, 8.951737500319723, 9.026754200749565, - 9.147158300038427, 8.957579199341126, 8.968329199706204, - 9.058793750591576, 8.949808350007515, 8.952339600364212 - ], - "median_us": 8.968329199706204, - "min_us": 8.949808350007515, - "max_us": 9.147158300038427 - }, - { - "case": "explicit/3", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 7.434406250831671, 7.397154200589284, 7.462860400846694, - 7.469447949551977, 7.451297898660414, 7.486804149812087, - 7.498083350947127, 7.474635400285479, 7.445077098964248 - ], - "median_us": 7.462860400846694, - "min_us": 7.397154200589284, - "max_us": 7.498083350947127 - }, - { - "case": "like/3", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 6.33158540003933, 6.32998124929145, 6.365235449629836, - 6.3559833011822775, 6.359485400025733, 6.362147949403152, - 6.389293749816716, 6.3535353998304345, 6.349847899400629 - ], - "median_us": 6.3559833011822775, - "min_us": 6.32998124929145, - "max_us": 6.389293749816716 - }, - { - "case": "nested/3", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 16.974604201095644, 16.94747084984556, 16.921327100135386, - 17.224066650669556, 16.952297899115365, 16.95610000024317, - 17.133977050252724, 16.991160399629734, 16.91894169925945 - ], - "median_us": 16.95610000024317, - "min_us": 16.91894169925945, - "max_us": 17.224066650669556 - }, - { - "case": "value/3", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 8.349918748717755, 8.349150000140071, 8.458333300950471, - 8.433583349687979, 8.396152099885512, 8.403233349963557, - 8.388060401193798, 8.384591650974471, 8.414141650428064 - ], - "median_us": 8.396152099885512, - "min_us": 8.349150000140071, - "max_us": 8.458333300950471 - }, - { - "case": "like-sequence/3", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 7.131879149528686, 7.092162499611732, 7.121289549104404, - 7.085254149569664, 7.082216651178896, 7.05683330015745, - 7.060922900564037, 7.061779200739693, 7.070235400169622 - ], - "median_us": 7.082216651178896, - "min_us": 7.05683330015745, - "max_us": 7.131879149528686 - }, - { - "case": "diagnostic/3", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 78.06112497928552, 76.3025829801336, 76.19575000717305, - 76.34154200786725, 76.41837498522364, 76.18654100224376, - 76.74870899063535, 76.50620900676586, 77.45954199344851 - ], - "median_us": 76.41837498522364, - "min_us": 76.18654100224376, - "max_us": 78.06112497928552 - }, - { - "case": "bare/1000000", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 0.01620834955247119, 0.015793749480508268, 0.01624790020287037, - 0.016352100647054613, 0.016387499636039138, 0.016558299830649048, - 0.016645849973428994, 0.016720849089324474, 0.016908299585338682 - ], - "median_us": 0.016387499636039138, - "min_us": 0.015793749480508268, - "max_us": 0.016908299585338682 - }, - { - "case": "native/1000000", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 0.09279374935431406, 0.0924937499803491, 0.08928750030463561, - 0.08872289909049869, 0.09311454923590645, 0.09227914997609332, - 0.09279585065087304, 0.09372295025968924, 0.08848540019243956 - ], - "median_us": 0.0924937499803491, - "min_us": 0.08848540019243956, - "max_us": 0.09372295025968924 - }, - { - "case": "strict/1000000", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 9.107804199447855, 9.114887499890756, 9.09195415006252, 9.1039645994897, - 9.096560400212184, 9.089958349068183, 9.099539599264972, - 9.088449999399018, 9.114031249191612 - ], - "median_us": 9.099539599264972, - "min_us": 9.088449999399018, - "max_us": 9.114887499890756 - }, - { - "case": "explicit/1000000", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 7.35577919986099, 7.365510398813058, 7.362979149911553, - 7.371552099357359, 7.355927099706605, 7.377983350306749, - 7.359437500417698, 7.363597900257446, 7.376050000311807 - ], - "median_us": 7.363597900257446, - "min_us": 7.35577919986099, - "max_us": 7.377983350306749 - }, - { - "case": "like/1000000", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 6.711691649979912, 6.38043125072727, 6.423997899401002, - 6.403283299005125, 6.401410400576424, 6.4077520510181785, - 6.4491249999264255, 6.467964600597043, 6.445795801118948 - ], - "median_us": 6.423997899401002, - "min_us": 6.38043125072727, - "max_us": 6.711691649979912 - }, - { - "case": "nested/1000000", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 17.112510399601888, 17.095079200225882, 17.0521166495746, - 17.05564585136017, 17.081170850724448, 17.22758959949715, - 17.13644999981625, 17.16280624968931, 17.27644169877749 - ], - "median_us": 17.112510399601888, - "min_us": 17.0521166495746, - "max_us": 17.27644169877749 - }, - { - "case": "value/1000000", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 8.528510449104942, 8.516960449924227, 8.508643749519251, - 8.520454149402212, 8.544239550246857, 8.454335450369399, - 8.539429149823263, 8.48696250031935, 8.486814599018544 - ], - "median_us": 8.516960449924227, - "min_us": 8.454335450369399, - "max_us": 8.544239550246857 - }, - { - "case": "like-sequence/1000000", - "calls_per_repeat": 5, - "repeats": 9, - "samples_us": [ - 12257.033202331513, 11839.150002924725, 11938.933201599866, - 12132.41660152562, 12324.766797246411, 12314.033199800178, - 11987.133201910183, 12110.80839857459, 12039.55000382848 - ], - "median_us": 12110.80839857459, - "min_us": 11839.150002924725, - "max_us": 12324.766797246411 - }, - { - "case": "diagnostic/1000000", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 84.95054201921448, 83.53299999726005, 83.07287501520477, - 83.57366599375382, 85.52283301833086, 88.37191699421965, - 83.6342909897212, 83.69891700567678, 83.17849997547455 - ], - "median_us": 83.6342909897212, - "min_us": 83.07287501520477, - "max_us": 88.37191699421965 - }, - { - "case": "tree/1", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 16.532008349895477, 16.50759579933947, 16.57307915011188, - 16.92502080113627, 16.6133478996926, 17.04175834893249, - 16.56384164962219, 16.640091649605893, 16.544527099176776 - ], - "median_us": 16.57307915011188, - "min_us": 16.50759579933947, - "max_us": 17.04175834893249 - }, - { - "case": "tree-value/1", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 18.150741649151314, 18.155514600221068, 18.160512499161996, - 18.150881250039674, 18.243597949913237, 18.147491650597658, - 18.18597499950556, 18.206512500182725, 18.166550000023562 - ], - "median_us": 18.160512499161996, - "min_us": 18.147491650597658, - "max_us": 18.243597949913237 - }, - { - "case": "tree-composite/1", - "calls_per_repeat": 20000, - "repeats": 9, - "samples_us": [ - 11.488256249867845, 11.470306249975692, 11.472012499871198, - 11.4693437499227, 11.592218749865424, 11.478735400305595, - 11.4940833489527, 11.490608350140974, 11.474391649244353 - ], - "median_us": 11.478735400305595, - "min_us": 11.4693437499227, - "max_us": 11.592218749865424 - }, - { - "case": "tree/100", - "calls_per_repeat": 200, - "repeats": 9, - "samples_us": [ - 643.851875065593, 643.5993750346825, 641.9393749092706, - 642.092290072469, 640.6635399616789, 640.9870850620791, - 645.9364549664315, 644.8895849462133, 646.8335399404168 - ], - "median_us": 643.5993750346825, - "min_us": 640.6635399616789, - "max_us": 646.8335399404168 - }, - { - "case": "tree-value/100", - "calls_per_repeat": 200, - "repeats": 9, - "samples_us": [ - 753.6439600517042, 746.2158350972459, 744.17354495381, - 739.9018750584219, 738.7577100598719, 743.3299999684095, - 740.0581249385141, 738.3556250715628, 736.7281250481028 - ], - "median_us": 740.0581249385141, - "min_us": 736.7281250481028, - "max_us": 753.6439600517042 - }, - { - "case": "tree-composite/100", - "calls_per_repeat": 200, - "repeats": 9, - "samples_us": [ - 445.33271007821895, 455.2843749115709, 444.2693750024773, - 442.44457996683195, 444.87874998594634, 444.3291650386527, - 446.7020848824177, 443.4285400202498, 443.32291508908384 - ], - "median_us": 444.3291650386527, - "min_us": 442.44457996683195, - "max_us": 455.2843749115709 - }, - { - "case": "decorate_array", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 122.31104099191725, 120.87483398499899, 121.0466250195168, - 120.34433300141245, 120.10808300692588, 119.76704199332744, - 119.8307920130901, 120.07016700226814, 121.36554199969396 - ], - "median_us": 120.34433300141245, - "min_us": 119.76704199332744, - "max_us": 122.31104099191725 - }, - { - "case": "construct_tree_validator", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 63.28570799087174, 61.81416701292619, 61.549375008326024, - 61.44412499270402, 61.32216699188575, 61.41133402707055, - 61.48637499427423, 61.787790997186676, 63.17283399403095 - ], - "median_us": 61.549375008326024, - "min_us": 61.32216699188575, - "max_us": 63.28570799087174 - } - ] -} diff --git a/tools/evidence/2026-10-11-audit-performance/benchmark-released-after311.json b/tools/evidence/2026-10-11-audit-performance/benchmark-released-after311.json deleted file mode 100644 index 04bfe48..0000000 --- a/tools/evidence/2026-10-11-audit-performance/benchmark-released-after311.json +++ /dev/null @@ -1,351 +0,0 @@ -{ - "python": "3.11.15 (main, May 10 2026, 19:23:07) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit", - "machine": "arm64", - "bearshape_origin": "/private/tmp/audit-released-after311/lib/python3.11/site-packages/bearshape/__init__.py", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6", - "optree": "0.19.1" - }, - "results": [ - { - "case": "bare/3", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 0.020683399634435773, 0.020612499793060124, 0.020962502458132803, - 0.020866701379418373, 0.021691698930226266, 0.02068330068141222, - 0.020241699530743062 - ], - "median_us": 0.020683399634435773, - "min_us": 0.020241699530743062, - "max_us": 0.021691698930226266 - }, - { - "case": "native/3", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 0.09576249867677689, 0.09266250126529485, 0.09332500048913062, - 0.09337080118712038, 0.09286250278819352, 0.09228750132024288, - 0.0905291992239654 - ], - "median_us": 0.09286250278819352, - "min_us": 0.0905291992239654, - "max_us": 0.09576249867677689 - }, - { - "case": "strict/3", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 5.761195800732821, 5.595733301015571, 5.598537498735823, - 5.572283299989067, 5.571054099709727, 5.591450000065379, - 5.565254099201411 - ], - "median_us": 5.591450000065379, - "min_us": 5.565254099201411, - "max_us": 5.761195800732821 - }, - { - "case": "explicit/3", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 7.027216599090025, 7.019529101671651, 7.043245798558928, - 6.964004097972065, 6.894095800817013, 6.930649999412708, - 6.885066701215692 - ], - "median_us": 6.964004097972065, - "min_us": 6.885066701215692, - "max_us": 7.043245798558928 - }, - { - "case": "like/3", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 2.979783300543204, 2.987208400736563, 2.958291699178517, - 2.996058398275636, 2.977070800261572, 2.971887498279102, - 2.9871792008634657 - ], - "median_us": 2.979783300543204, - "min_us": 2.958291699178517, - "max_us": 2.996058398275636 - }, - { - "case": "nested/3", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 14.441037498181686, 14.459908299613744, 14.468604198191315, - 14.444529201136902, 14.557608400355093, 14.469483299762942, - 14.551937498617917 - ], - "median_us": 14.468604198191315, - "min_us": 14.441037498181686, - "max_us": 14.557608400355093 - }, - { - "case": "value/3", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 10.025779201532714, 10.020941699622199, 10.352062500896864, - 10.20054170221556, 10.228854199522175, 10.062158398795873, - 10.13273749849759 - ], - "median_us": 10.13273749849759, - "min_us": 10.020941699622199, - "max_us": 10.352062500896864 - }, - { - "case": "like-sequence/3", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 3.5040999995544553, 3.4641540987649933, 3.5067332995822653, - 3.46377499809023, 3.444804099854082, 3.448308299994096, - 3.5859374998835847 - ], - "median_us": 3.4641540987649933, - "min_us": 3.444804099854082, - "max_us": 3.5859374998835847 - }, - { - "case": "diagnostic/3", - "calls_per_repeat": 1000, - "repeats": 7, - "samples_us": [ - 71.27920800121501, 70.88754200958647, 65.93925002380274, - 65.92645900673233, 66.09924999065697, 65.87204200332053, - 65.38116600131616 - ], - "median_us": 65.93925002380274, - "min_us": 65.38116600131616, - "max_us": 71.27920800121501 - }, - { - "case": "bare/1000000", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 0.017387501429766417, 0.017333400319330394, 0.017350001144222915, - 0.01737500133458525, 0.01739579893182963, 0.01761250023264438, - 0.01775840064510703 - ], - "median_us": 0.017387501429766417, - "min_us": 0.017333400319330394, - "max_us": 0.01775840064510703 - }, - { - "case": "native/1000000", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 0.0799917004769668, 0.08136249962262809, 0.08110830094665289, - 0.08128329936880618, 0.08099999977275729, 0.0827083014883101, - 0.07692499784752727 - ], - "median_us": 0.08110830094665289, - "min_us": 0.07692499784752727, - "max_us": 0.0827083014883101 - }, - { - "case": "strict/1000000", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 5.565891598234884, 5.533620799542405, 5.529670801479369, - 5.568900000071153, 5.536575001315214, 5.562883298262022, - 5.5714999994961545 - ], - "median_us": 5.562883298262022, - "min_us": 5.529670801479369, - "max_us": 5.5714999994961545 - }, - { - "case": "explicit/1000000", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 6.9855500012636185, 6.9509875000221655, 6.973004198516719, - 6.95883329899516, 7.0462791016325355, 7.033791701542214, - 6.971995800267905 - ], - "median_us": 6.973004198516719, - "min_us": 6.9509875000221655, - "max_us": 7.0462791016325355 - }, - { - "case": "like/1000000", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 2.971670898841694, 2.9641500004800037, 2.9718791018240154, - 2.9743250022875145, 2.9711584007600322, 3.005554198171012, - 3.0197541986126453 - ], - "median_us": 2.9718791018240154, - "min_us": 2.9641500004800037, - "max_us": 3.0197541986126453 - }, - { - "case": "nested/1000000", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 14.51953330251854, 14.56522920052521, 14.52801669947803, - 14.473254201584496, 14.523579200613312, 14.478974998928607, - 14.50207089947071 - ], - "median_us": 14.51953330251854, - "min_us": 14.473254201584496, - "max_us": 14.56522920052521 - }, - { - "case": "value/1000000", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 9.999479100224562, 10.041041698423214, 10.074516598251648, - 10.161254199920222, 10.153300000820309, 10.205145800136961, - 10.26653750159312 - ], - "median_us": 10.153300000820309, - "min_us": 9.999479100224562, - "max_us": 10.26653750159312 - }, - { - "case": "like-sequence/1000000", - "calls_per_repeat": 5, - "repeats": 7, - "samples_us": [ - 11661.366804037243, 11746.591597329825, 11448.783398373052, - 11702.275002608076, 11677.716602571309, 11589.050001930445, - 11662.849999265745 - ], - "median_us": 11662.849999265745, - "min_us": 11448.783398373052, - "max_us": 11746.591597329825 - }, - { - "case": "diagnostic/1000000", - "calls_per_repeat": 1000, - "repeats": 7, - "samples_us": [ - 73.94754199776798, 72.94283399824053, 72.62937500490807, - 72.64779100660235, 73.1708749954123, 73.53508399683051, 74.0958749956917 - ], - "median_us": 73.1708749954123, - "min_us": 72.62937500490807, - "max_us": 74.0958749956917 - }, - { - "case": "tree/1", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 8.19093750033062, 8.211358400876634, 8.258166600717232, - 8.240045799175277, 8.118845900753513, 8.155020797858015, - 8.129862498026341 - ], - "median_us": 8.19093750033062, - "min_us": 8.118845900753513, - "max_us": 8.258166600717232 - }, - { - "case": "tree-value/1", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 18.715495901415125, 18.41692079906352, 18.390287499642, - 18.368145800195634, 18.41040000144858, 18.335062501137145, - 18.37275420257356 - ], - "median_us": 18.390287499642, - "min_us": 18.335062501137145, - "max_us": 18.715495901415125 - }, - { - "case": "tree-composite/1", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 10.306770898750983, 10.311833399464376, 10.439983400283381, - 10.374837499693967, 10.332691701478325, 10.342387499986216, - 10.328629199648276 - ], - "median_us": 10.332691701478325, - "min_us": 10.306770898750983, - "max_us": 10.439983400283381 - }, - { - "case": "tree/100", - "calls_per_repeat": 100, - "repeats": 7, - "samples_us": [ - 317.698750004638, 313.69959004223347, 311.04833993595093, - 311.92875001579523, 323.5516700078733, 313.362919841893, - 312.47083010384813 - ], - "median_us": 313.362919841893, - "min_us": 311.04833993595093, - "max_us": 323.5516700078733 - }, - { - "case": "tree-value/100", - "calls_per_repeat": 100, - "repeats": 7, - "samples_us": [ - 393.852079869248, 396.5424999478273, 390.2833300526254, - 394.9579197796993, 393.63124989904463, 397.22499990602955, - 397.3670900450088 - ], - "median_us": 394.9579197796993, - "min_us": 390.2833300526254, - "max_us": 397.3670900450088 - }, - { - "case": "tree-composite/100", - "calls_per_repeat": 100, - "repeats": 7, - "samples_us": [ - 305.687089858111, 305.5395800038241, 306.29249988123775, - 308.02708002738655, 307.6029202202335, 307.8991701477207, - 305.690829991363 - ], - "median_us": 306.29249988123775, - "min_us": 305.5395800038241, - "max_us": 308.02708002738655 - }, - { - "case": "decorate_array", - "calls_per_repeat": 1000, - "repeats": 7, - "samples_us": [ - 113.87050000485033, 112.41524998331442, 112.99358299584128, - 113.13708301167935, 111.931708001066, 112.22491698572412, - 112.50995899899863 - ], - "median_us": 112.50995899899863, - "min_us": 111.931708001066, - "max_us": 113.87050000485033 - }, - { - "case": "construct_tree_validator", - "calls_per_repeat": 1000, - "repeats": 7, - "samples_us": [ - 1.397167012328282, 1.312042004428804, 1.3150000013411045, - 1.3629160239361227, 1.3700840063393116, 1.3778749853372574, - 1.3797080027870834 - ], - "median_us": 1.3700840063393116, - "min_us": 1.312042004428804, - "max_us": 1.397167012328282 - } - ] -} diff --git a/tools/evidence/2026-10-11-audit-performance/benchmark-released-after314.json b/tools/evidence/2026-10-11-audit-performance/benchmark-released-after314.json deleted file mode 100644 index cf9c698..0000000 --- a/tools/evidence/2026-10-11-audit-performance/benchmark-released-after314.json +++ /dev/null @@ -1,351 +0,0 @@ -{ - "python": "3.14.5 (main, May 10 2026, 19:20:57) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit-Mach-O", - "machine": "arm64", - "bearshape_origin": "/private/tmp/audit-released-after314/lib/python3.14/site-packages/bearshape/__init__.py", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6", - "optree": "0.19.1" - }, - "results": [ - { - "case": "bare/3", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 0.019366698688827455, 0.018470798386260867, 0.017787498654797673, - 0.018529201042838395, 0.018208299297839403, 0.018575001740828156, - 0.019116702605970204 - ], - "median_us": 0.018529201042838395, - "min_us": 0.017787498654797673, - "max_us": 0.019366698688827455 - }, - { - "case": "native/3", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 0.09402499999850988, 0.09185420058201998, 0.09171669953502715, - 0.09412909857928753, 0.09239579958375543, 0.09172089921776205, - 0.09199159976560622 - ], - "median_us": 0.09199159976560622, - "min_us": 0.09171669953502715, - "max_us": 0.09412909857928753 - }, - { - "case": "strict/3", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 5.216049999580719, 5.134579099831171, 5.134866700973362, - 5.149283300852403, 5.1487416989402846, 5.144170799758285, - 5.142654100200161 - ], - "median_us": 5.144170799758285, - "min_us": 5.134579099831171, - "max_us": 5.216049999580719 - }, - { - "case": "explicit/3", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 6.693341699428856, 6.694195800810121, 6.683941598748788, - 6.672316699405201, 6.702958399546333, 6.698470798437484, - 6.693645898485556 - ], - "median_us": 6.693645898485556, - "min_us": 6.672316699405201, - "max_us": 6.702958399546333 - }, - { - "case": "like/3", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 2.8200750006362796, 2.8199916996527463, 2.8264249995118007, - 2.8271499992115423, 2.81382079992909, 2.8303916013101116, - 2.8245167020941153 - ], - "median_us": 2.8245167020941153, - "min_us": 2.81382079992909, - "max_us": 2.8303916013101116 - }, - { - "case": "nested/3", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 13.417941698571667, 13.38312090083491, 13.404579198686406, - 13.402075000340119, 13.417008399846964, 13.445524999406189, - 13.443133400869556 - ], - "median_us": 13.417008399846964, - "min_us": 13.38312090083491, - "max_us": 13.445524999406189 - }, - { - "case": "value/3", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 9.451270799036138, 9.422454200102948, 9.418041599565186, - 9.446500000194646, 9.635933299432509, 9.537024999735877, - 9.50054999848362 - ], - "median_us": 9.451270799036138, - "min_us": 9.418041599565186, - "max_us": 9.635933299432509 - }, - { - "case": "like-sequence/3", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 3.547316699405201, 3.5347333003301173, 3.5302333999425173, - 3.5527707979781553, 3.498520900029689, 3.539462501066737, - 3.48893339978531 - ], - "median_us": 3.5347333003301173, - "min_us": 3.48893339978531, - "max_us": 3.5527707979781553 - }, - { - "case": "diagnostic/3", - "calls_per_repeat": 1000, - "repeats": 7, - "samples_us": [ - 60.30400001327507, 58.72950001503341, 58.446250011911616, - 58.57854199712165, 58.81654200493358, 58.74899998889305, - 58.39854199439287 - ], - "median_us": 58.72950001503341, - "min_us": 58.39854199439287, - "max_us": 60.30400001327507 - }, - { - "case": "bare/1000000", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 0.016299998969770968, 0.01622079871594906, 0.01710000215098262, - 0.01907499972730875, 0.016895800945349038, 0.016624998534098268, - 0.015533401165157557 - ], - "median_us": 0.016624998534098268, - "min_us": 0.015533401165157557, - "max_us": 0.01907499972730875 - }, - { - "case": "native/1000000", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 0.08170829969458282, 0.08253339910879731, 0.08548329933546484, - 0.08546669851057231, 0.08666669891681522, 0.08653750119265169, - 0.08639169973321259 - ], - "median_us": 0.08548329933546484, - "min_us": 0.08170829969458282, - "max_us": 0.08666669891681522 - }, - { - "case": "strict/1000000", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 5.18035409913864, 5.172108398983255, 5.153129101381637, - 5.176608302281238, 5.171933298697695, 5.1813208003295586, - 5.195741599891335 - ], - "median_us": 5.176608302281238, - "min_us": 5.153129101381637, - "max_us": 5.195741599891335 - }, - { - "case": "explicit/1000000", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 6.779287499375641, 6.800945900613442, 6.778304200270213, - 6.7846457997802645, 6.78354169940576, 6.728491600370035, - 6.729400000767782 - ], - "median_us": 6.779287499375641, - "min_us": 6.728491600370035, - "max_us": 6.800945900613442 - }, - { - "case": "like/1000000", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 2.876354200998321, 2.8512416989542544, 2.859112498117611, - 2.8372166998451576, 2.866516698850319, 2.8496667015133426, - 2.853458299068734 - ], - "median_us": 2.853458299068734, - "min_us": 2.8372166998451576, - "max_us": 2.876354200998321 - }, - { - "case": "nested/1000000", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 13.563162498758174, 13.581454099039547, 13.580433299648575, - 13.537487501162104, 13.532562501495704, 13.584258398623206, - 13.549166699522175 - ], - "median_us": 13.563162498758174, - "min_us": 13.532562501495704, - "max_us": 13.584258398623206 - }, - { - "case": "value/1000000", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 9.521537498221733, 9.534020800492726, 9.518929201294668, - 9.522570800618269, 9.5392167015234, 9.535520800272934, 9.547237498918548 - ], - "median_us": 9.534020800492726, - "min_us": 9.518929201294668, - "max_us": 9.547237498918548 - }, - { - "case": "like-sequence/1000000", - "calls_per_repeat": 5, - "repeats": 7, - "samples_us": [ - 12734.750000527129, 11959.383403882384, 11879.499995848164, - 11997.708200942725, 12006.308400304988, 12029.799999436364, - 12039.500003447756 - ], - "median_us": 12006.308400304988, - "min_us": 11879.499995848164, - "max_us": 12734.750000527129 - }, - { - "case": "diagnostic/1000000", - "calls_per_repeat": 1000, - "repeats": 7, - "samples_us": [ - 67.23779201274738, 65.4366250091698, 65.85554199409671, - 65.95958300749771, 66.15299999248236, 65.92024999554269, - 65.72358298581094 - ], - "median_us": 65.92024999554269, - "min_us": 65.4366250091698, - "max_us": 67.23779201274738 - }, - { - "case": "tree/1", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 7.800391601631418, 7.739774999208748, 7.732362498063594, - 7.7583709004102275, 7.756058301310986, 7.756820900249295, - 7.938608402037062 - ], - "median_us": 7.756820900249295, - "min_us": 7.732362498063594, - "max_us": 7.938608402037062 - }, - { - "case": "tree-value/1", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 18.812837498262525, 18.72230829903856, 19.028549999347888, - 18.85501250217203, 18.59503329906147, 18.618870800128207, - 18.624683399684727 - ], - "median_us": 18.72230829903856, - "min_us": 18.59503329906147, - "max_us": 19.028549999347888 - }, - { - "case": "tree-composite/1", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 10.476724998443387, 10.422529201605357, 10.450604200013913, - 10.422333297901787, 10.490479200962, 10.466870802338235, - 10.465595801360905 - ], - "median_us": 10.465595801360905, - "min_us": 10.422333297901787, - "max_us": 10.490479200962 - }, - { - "case": "tree/100", - "calls_per_repeat": 100, - "repeats": 7, - "samples_us": [ - 313.02416988182813, 308.21457999991253, 310.871250112541, - 305.6024998659268, 308.5924999322742, 309.10208995919675, - 309.53167006373405 - ], - "median_us": 309.10208995919675, - "min_us": 305.6024998659268, - "max_us": 313.02416988182813 - }, - { - "case": "tree-value/100", - "calls_per_repeat": 100, - "repeats": 7, - "samples_us": [ - 405.6054199463688, 405.5750000406988, 404.43999983835965, - 409.79540994158015, 405.4324998287484, 403.9362500770949, - 405.56374995503575 - ], - "median_us": 405.56374995503575, - "min_us": 403.9362500770949, - "max_us": 409.79540994158015 - }, - { - "case": "tree-composite/100", - "calls_per_repeat": 100, - "repeats": 7, - "samples_us": [ - 282.7233399148099, 283.8737500132993, 280.83834011340514, - 283.68790983222425, 281.31416998803616, 280.48999985912815, - 282.342080026865 - ], - "median_us": 282.342080026865, - "min_us": 280.48999985912815, - "max_us": 283.8737500132993 - }, - { - "case": "decorate_array", - "calls_per_repeat": 1000, - "repeats": 7, - "samples_us": [ - 119.99674999970011, 119.78816700866446, 118.6880829918664, - 118.6691670154687, 119.10262500168756, 119.3145829893183, - 118.73258301056921 - ], - "median_us": 119.10262500168756, - "min_us": 118.6691670154687, - "max_us": 119.99674999970011 - }, - { - "case": "construct_tree_validator", - "calls_per_repeat": 1000, - "repeats": 7, - "samples_us": [ - 1.3691250060219318, 1.4070420002099127, 1.4125830202829093, - 1.435499987564981, 1.4352499856613576, 1.355834014248103, - 1.436959020793438 - ], - "median_us": 1.4125830202829093, - "min_us": 1.355834014248103, - "max_us": 1.436959020793438 - } - ] -} diff --git a/tools/evidence/2026-10-11-audit-performance/benchmark-released-before311.json b/tools/evidence/2026-10-11-audit-performance/benchmark-released-before311.json deleted file mode 100644 index 8ab96ff..0000000 --- a/tools/evidence/2026-10-11-audit-performance/benchmark-released-before311.json +++ /dev/null @@ -1,350 +0,0 @@ -{ - "python": "3.11.15 (main, May 10 2026, 19:23:07) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit", - "machine": "arm64", - "bearshape_origin": "/private/tmp/audit-released-before311/lib/python3.11/site-packages/bearshape/__init__.py", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6", - "optree": "0.19.1" - }, - "results": [ - { - "case": "bare/3", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 0.02011669857893139, 0.0200167007278651, 0.020079201203770936, - 0.020104198483750224, 0.020112498896196485, 0.020325000514276326, - 0.020379101624712348 - ], - "median_us": 0.020112498896196485, - "min_us": 0.0200167007278651, - "max_us": 0.020379101624712348 - }, - { - "case": "native/3", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 0.09232500160578638, 0.09183329821098596, 0.09431249927729368, - 0.0946875021327287, 0.09594590228516608, 0.09487500065006316, - 0.09220000065397471 - ], - "median_us": 0.09431249927729368, - "min_us": 0.09183329821098596, - "max_us": 0.09594590228516608 - }, - { - "case": "strict/3", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 13.56702079938259, 13.429916702443734, 13.622212500195019, - 13.431162500637583, 13.424304098589346, 13.289408400305547, - 13.355408300412819 - ], - "median_us": 13.429916702443734, - "min_us": 13.289408400305547, - "max_us": 13.622212500195019 - }, - { - "case": "explicit/3", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 9.141383299720474, 9.1232749982737, 9.116837498731911, 9.12159160070587, - 9.157945800689049, 9.118687501177192, 9.123933300725184 - ], - "median_us": 9.1232749982737, - "min_us": 9.116837498731911, - "max_us": 9.157945800689049 - }, - { - "case": "like/3", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 7.139783300226554, 6.89412500069011, 6.899066700134426, - 6.8918250006390736, 6.896704199607484, 6.851808298961259, - 7.022770799812861 - ], - "median_us": 6.896704199607484, - "min_us": 6.851808298961259, - "max_us": 7.139783300226554 - }, - { - "case": "nested/3", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 26.764241699129343, 26.51366250065621, 26.505241700215265, - 26.74770419835113, 27.43888330005575, 27.99966669990681, - 27.830124998581596 - ], - "median_us": 26.764241699129343, - "min_us": 26.505241700215265, - "max_us": 27.99966669990681 - }, - { - "case": "value/3", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 10.712545900605619, 10.65027909935452, 10.817683301866055, - 10.767433300497942, 11.01085830014199, 10.699862500769086, - 10.64376670110505 - ], - "median_us": 10.712545900605619, - "min_us": 10.64376670110505, - "max_us": 11.01085830014199 - }, - { - "case": "like-sequence/3", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 7.926912498078309, 7.905745797324926, 7.810754197998904, - 7.61880419740919, 7.525029202224687, 7.467437500599772, - 7.455975000630133 - ], - "median_us": 7.61880419740919, - "min_us": 7.455975000630133, - "max_us": 7.926912498078309 - }, - { - "case": "diagnostic/3", - "calls_per_repeat": 1000, - "repeats": 7, - "samples_us": [ - 88.62316599697806, 88.82620799704455, 88.36591697763652, - 88.42083299532533, 88.3430420071818, 87.86741702351719, - 88.09416700387374 - ], - "median_us": 88.36591697763652, - "min_us": 87.86741702351719, - "max_us": 88.82620799704455 - }, - { - "case": "bare/1000000", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 0.017600000137463212, 0.017541699344292283, 0.017633300740271807, - 0.017520799883641303, 0.017600000137463212, 0.01749160001054406, - 0.01752499956637621 - ], - "median_us": 0.017541699344292283, - "min_us": 0.01749160001054406, - "max_us": 0.017633300740271807 - }, - { - "case": "native/1000000", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 0.08167919877450913, 0.08236250141635537, 0.08331669960170984, - 0.08311669807881117, 0.08521249983459711, 0.08571250073146075, - 0.08512089843861759 - ], - "median_us": 0.08331669960170984, - "min_us": 0.08167919877450913, - "max_us": 0.08571250073146075 - }, - { - "case": "strict/1000000", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 13.528391701402143, 13.48240000079386, 13.414241702412255, - 13.452979200519621, 13.399258302524686, 13.373412500368431, - 13.395745898014866 - ], - "median_us": 13.414241702412255, - "min_us": 13.373412500368431, - "max_us": 13.528391701402143 - }, - { - "case": "explicit/1000000", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 9.281854098662734, 9.307216698653065, 9.249908299534582, - 9.311612500459887, 9.2380417016102, 9.234800000558607, 9.238162499968894 - ], - "median_us": 9.249908299534582, - "min_us": 9.234800000558607, - "max_us": 9.311612500459887 - }, - { - "case": "like/1000000", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 6.9529957982013, 6.927291699685156, 6.958445798954926, - 6.939479100401513, 6.956504198024049, 6.954566700733267, - 6.942029201309197 - ], - "median_us": 6.9529957982013, - "min_us": 6.927291699685156, - "max_us": 6.958445798954926 - }, - { - "case": "nested/1000000", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 26.97460420022253, 26.924312498886138, 26.993245899211615, - 27.020612501655705, 26.960641698678955, 27.05879579880275, - 27.077254198957235 - ], - "median_us": 26.993245899211615, - "min_us": 26.924312498886138, - "max_us": 27.077254198957235 - }, - { - "case": "value/1000000", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 10.294808298931457, 10.258674999931827, 10.311666599591263, - 10.301266601891257, 10.312966699711978, 10.33642079855781, - 10.338437501923181 - ], - "median_us": 10.311666599591263, - "min_us": 10.258674999931827, - "max_us": 10.338437501923181 - }, - { - "case": "like-sequence/1000000", - "calls_per_repeat": 5, - "repeats": 7, - "samples_us": [ - 11804.466601461172, 11600.991594605148, 11579.041602090001, - 12829.208403127268, 11902.500002179295, 11425.083200447261, - 11683.508194983006 - ], - "median_us": 11683.508194983006, - "min_us": 11425.083200447261, - "max_us": 12829.208403127268 - }, - { - "case": "diagnostic/1000000", - "calls_per_repeat": 1000, - "repeats": 7, - "samples_us": [ - 100.47279100399464, 94.64145798119716, 94.15712501504458, - 94.49545800453052, 94.3452920182608, 94.34429099201225, - 94.24891701200977 - ], - "median_us": 94.3452920182608, - "min_us": 94.15712501504458, - "max_us": 100.47279100399464 - }, - { - "case": "tree/1", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 22.49234999762848, 22.439095898880623, 22.61739580135327, - 22.720516700064763, 22.561624998343177, 22.532075000344776, - 22.85576249996666 - ], - "median_us": 22.561624998343177, - "min_us": 22.439095898880623, - "max_us": 22.85576249996666 - }, - { - "case": "tree-value/1", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 24.847095800214447, 24.78037920081988, 24.73069590050727, - 24.803808398428373, 25.085066599422134, 24.878483300562948, - 24.825125001370907 - ], - "median_us": 24.825125001370907, - "min_us": 24.73069590050727, - "max_us": 25.085066599422134 - }, - { - "case": "tree-composite/1", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 11.516449999180622, 11.468666698783636, 11.469749998650514, - 11.460104101570323, 11.462333399686031, 11.670837498968467, - 11.717495799530298 - ], - "median_us": 11.469749998650514, - "min_us": 11.460104101570323, - "max_us": 11.717495799530298 - }, - { - "case": "tree/100", - "calls_per_repeat": 100, - "repeats": 7, - "samples_us": [ - 813.2804199703969, 829.1316698887385, 802.2441700450145, - 806.6195799619891, 804.1412499733269, 803.6637501209043, - 799.979169969447 - ], - "median_us": 804.1412499733269, - "min_us": 799.979169969447, - "max_us": 829.1316698887385 - }, - { - "case": "tree-value/100", - "calls_per_repeat": 100, - "repeats": 7, - "samples_us": [ - 890.1450000121258, 885.8170799794607, 889.9233298143372, - 887.6520799822174, 889.4229200086556, 896.6150000924245, - 898.2900000410154 - ], - "median_us": 889.9233298143372, - "min_us": 885.8170799794607, - "max_us": 898.2900000410154 - }, - { - "case": "tree-composite/100", - "calls_per_repeat": 100, - "repeats": 7, - "samples_us": [ - 409.02625012677163, 410.68000020459294, 411.0833298182115, - 415.6583300209604, 425.2137499861419, 438.8020798796788, - 423.07374998927116 - ], - "median_us": 415.6583300209604, - "min_us": 409.02625012677163, - "max_us": 438.8020798796788 - }, - { - "case": "decorate_array", - "calls_per_repeat": 1000, - "repeats": 7, - "samples_us": [ - 115.51249999320135, 113.17425000015646, 111.88500002026558, - 112.8074580046814, 112.16049999347888, 112.11333301616833, - 112.22329098382033 - ], - "median_us": 112.22329098382033, - "min_us": 111.88500002026558, - "max_us": 115.51249999320135 - }, - { - "case": "construct_tree_validator", - "calls_per_repeat": 1000, - "repeats": 7, - "samples_us": [ - 56.41558300703764, 56.70087502221577, 56.63941698730923, - 56.21304200030863, 56.45079200621694, 56.49662500945851, - 55.91524997726083 - ], - "median_us": 56.45079200621694, - "min_us": 55.91524997726083, - "max_us": 56.70087502221577 - } - ] -} diff --git a/tools/evidence/2026-10-11-audit-performance/benchmark-released-before314.json b/tools/evidence/2026-10-11-audit-performance/benchmark-released-before314.json deleted file mode 100644 index 50013d0..0000000 --- a/tools/evidence/2026-10-11-audit-performance/benchmark-released-before314.json +++ /dev/null @@ -1,350 +0,0 @@ -{ - "python": "3.14.5 (main, May 10 2026, 19:20:57) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit-Mach-O", - "machine": "arm64", - "bearshape_origin": "/private/tmp/audit-released-before314/lib/python3.14/site-packages/bearshape/__init__.py", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6", - "optree": "0.19.1" - }, - "results": [ - { - "case": "bare/3", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 0.01890840067062527, 0.019062499632127583, 0.01862090139184147, - 0.018795797950588167, 0.01842500059865415, 0.0184584001544863, - 0.01859579933807254 - ], - "median_us": 0.01862090139184147, - "min_us": 0.01842500059865415, - "max_us": 0.019062499632127583 - }, - { - "case": "native/3", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 0.0974374997895211, 0.09992079867515713, 0.09721670066937804, - 0.09542919870000333, 0.09404169977642596, 0.09429579949937761, - 0.09457079868298024 - ], - "median_us": 0.09542919870000333, - "min_us": 0.09404169977642596, - "max_us": 0.09992079867515713 - }, - { - "case": "strict/3", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 13.712341600330546, 13.558016699971631, 13.576283300062642, - 13.532816601218656, 13.469008399988525, 13.430974999209866, - 13.524308399064466 - ], - "median_us": 13.532816601218656, - "min_us": 13.430974999209866, - "max_us": 13.712341600330546 - }, - { - "case": "explicit/3", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 8.244345799903385, 8.2238833012525, 8.19864579825662, 8.187929200357758, - 8.178995799971744, 8.196616699569859, 8.183541698963381 - ], - "median_us": 8.196616699569859, - "min_us": 8.178995799971744, - "max_us": 8.244345799903385 - }, - { - "case": "like/3", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 7.088149999617599, 7.084620901150629, 7.088062501861714, - 7.063441700302064, 7.071220900979824, 7.079116700333543, - 7.089395899674855 - ], - "median_us": 7.084620901150629, - "min_us": 7.063441700302064, - "max_us": 7.089395899674855 - }, - { - "case": "nested/3", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 25.46718750090804, 25.402533300803043, 25.427745797787793, - 25.456575001589954, 25.601662500412203, 25.467754100100137, - 25.48177080170717 - ], - "median_us": 25.46718750090804, - "min_us": 25.402533300803043, - "max_us": 25.601662500412203 - }, - { - "case": "value/3", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 9.397741698194295, 9.384799998952076, 9.391424999921583, - 9.384712498285808, 9.388629099703394, 9.417270799167454, - 9.35898749739863 - ], - "median_us": 9.388629099703394, - "min_us": 9.35898749739863, - "max_us": 9.417270799167454 - }, - { - "case": "like-sequence/3", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 7.803129201056436, 7.781912499922328, 7.757699998910539, - 7.820133300265297, 7.7927582984557375, 7.764654100174084, - 7.769008298055269 - ], - "median_us": 7.781912499922328, - "min_us": 7.757699998910539, - "max_us": 7.820133300265297 - }, - { - "case": "diagnostic/3", - "calls_per_repeat": 1000, - "repeats": 7, - "samples_us": [ - 85.50645801005885, 84.45066699641757, 83.9732080057729, - 84.3801659939345, 83.86316598625854, 84.4224999891594, 84.02712500537746 - ], - "median_us": 84.3801659939345, - "min_us": 83.86316598625854, - "max_us": 85.50645801005885 - }, - { - "case": "bare/1000000", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 0.016312499064952135, 0.01622500130906701, 0.017045799177139997, - 0.01755419943947345, 0.017275000573135912, 0.01722919987514615, - 0.01732079836074263 - ], - "median_us": 0.01722919987514615, - "min_us": 0.01622500130906701, - "max_us": 0.01755419943947345 - }, - { - "case": "native/1000000", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 0.08720000041648746, 0.09253750031348318, 0.09036250121425837, - 0.08521669951733202, 0.08763330115471035, 0.08880000095814466, - 0.08900410030037165 - ], - "median_us": 0.08880000095814466, - "min_us": 0.08521669951733202, - "max_us": 0.09253750031348318 - }, - { - "case": "strict/1000000", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 13.585525000235066, 13.823274997412227, 13.637333299266174, - 13.664699997752905, 13.602920799166895, 13.516891698236577, - 13.565424998523667 - ], - "median_us": 13.602920799166895, - "min_us": 13.516891698236577, - "max_us": 13.823274997412227 - }, - { - "case": "explicit/1000000", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 8.465287499711849, 8.417449999251403, 8.422291700844653, - 8.357658301247284, 8.433825001702644, 8.392183401156217, - 8.399516600184143 - ], - "median_us": 8.417449999251403, - "min_us": 8.357658301247284, - "max_us": 8.465287499711849 - }, - { - "case": "like/1000000", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 7.111183300730772, 7.286204100819305, 7.098433299688622, - 7.144154098932631, 7.0746874989708886, 7.091949999448843, - 7.112966699060053 - ], - "median_us": 7.111183300730772, - "min_us": 7.0746874989708886, - "max_us": 7.286204100819305 - }, - { - "case": "nested/1000000", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 25.567116599995643, 25.447987497318536, 25.531916701584123, - 25.48497090174351, 25.413395900977775, 25.474016700172797, - 25.440295800217427 - ], - "median_us": 25.474016700172797, - "min_us": 25.413395900977775, - "max_us": 25.567116599995643 - }, - { - "case": "value/1000000", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 9.491104100015946, 9.434841701295227, 9.44218750228174, - 9.410887499689125, 9.414729199488647, 9.432320899213664, - 9.415291700861417 - ], - "median_us": 9.432320899213664, - "min_us": 9.410887499689125, - "max_us": 9.491104100015946 - }, - { - "case": "like-sequence/1000000", - "calls_per_repeat": 5, - "repeats": 7, - "samples_us": [ - 11987.249995581806, 11548.516596667469, 11621.56659993343, - 11451.458401279524, 11526.62499807775, 11461.583198979497, - 11557.66659649089 - ], - "median_us": 11548.516596667469, - "min_us": 11451.458401279524, - "max_us": 11987.249995581806 - }, - { - "case": "diagnostic/1000000", - "calls_per_repeat": 1000, - "repeats": 7, - "samples_us": [ - 92.45150000788271, 91.15474999998696, 91.51100000599399, - 94.38158298144117, 92.35212500789203, 92.31129198451526, - 92.21158400760032 - ], - "median_us": 92.31129198451526, - "min_us": 91.15474999998696, - "max_us": 94.38158298144117 - }, - { - "case": "tree/1", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 22.127199999522418, 22.005145900766365, 22.03131660062354, - 21.973766598966904, 21.98232079972513, 21.95358749886509, - 21.955679199891165 - ], - "median_us": 21.98232079972513, - "min_us": 21.95358749886509, - "max_us": 22.127199999522418 - }, - { - "case": "tree-value/1", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 24.022337497444823, 24.061700000311248, 24.01034170179628, - 24.006329200346954, 29.090916700079106, 25.423654200858437, - 25.121399998897687 - ], - "median_us": 24.061700000311248, - "min_us": 24.006329200346954, - "max_us": 29.090916700079106 - }, - { - "case": "tree-composite/1", - "calls_per_repeat": 10000, - "repeats": 7, - "samples_us": [ - 11.321191702154465, 11.280445897136815, 11.350224999478087, - 11.280129200895317, 11.316804101807065, 14.493874998879619, - 12.110187497455627 - ], - "median_us": 11.321191702154465, - "min_us": 11.280129200895317, - "max_us": 14.493874998879619 - }, - { - "case": "tree/100", - "calls_per_repeat": 100, - "repeats": 7, - "samples_us": [ - 733.5204200353473, 728.9366700570099, 878.9912500651553, - 777.9487501829863, 725.005829881411, 728.2391699845903, - 738.9674999285489 - ], - "median_us": 733.5204200353473, - "min_us": 725.005829881411, - "max_us": 878.9912500651553 - }, - { - "case": "tree-value/100", - "calls_per_repeat": 100, - "repeats": 7, - "samples_us": [ - 834.2087498749606, 860.1804199861363, 846.5441601583734, - 812.8995800507255, 812.6658399123698, 812.7029100432992, - 838.4204201865941 - ], - "median_us": 834.2087498749606, - "min_us": 812.6658399123698, - "max_us": 860.1804199861363 - }, - { - "case": "tree-composite/100", - "calls_per_repeat": 100, - "repeats": 7, - "samples_us": [ - 398.80124997580424, 444.8091599624604, 500.4829101380892, - 476.7045899643563, 406.2387498561293, 389.31666989810765, - 378.0470899073407 - ], - "median_us": 406.2387498561293, - "min_us": 378.0470899073407, - "max_us": 500.4829101380892 - }, - { - "case": "decorate_array", - "calls_per_repeat": 1000, - "repeats": 7, - "samples_us": [ - 130.1097910036333, 156.42420799122192, 154.63787500630133, - 124.8715830151923, 122.34004199854098, 121.07724999077618, - 121.02608400164172 - ], - "median_us": 124.8715830151923, - "min_us": 121.02608400164172, - "max_us": 156.42420799122192 - }, - { - "case": "construct_tree_validator", - "calls_per_repeat": 1000, - "repeats": 7, - "samples_us": [ - 61.93199998233467, 63.06750001385808, 80.50404200912453, - 68.95537502714433, 64.98220801586285, 61.91350001608953, - 62.434208986815065 - ], - "median_us": 63.06750001385808, - "min_us": 61.91350001608953, - "max_us": 80.50404200912453 - } - ] -} diff --git a/tools/evidence/2026-10-11-audit-performance/identity.json b/tools/evidence/2026-10-11-audit-performance/identity.json deleted file mode 100644 index 1f74036..0000000 --- a/tools/evidence/2026-10-11-audit-performance/identity.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "source_commits": { - "correctness": "1e17a96f9969cb4121042cf1bcdd4406182dec94", - "optimized": "1991deabe05180f54616aa42a36940d40dedc1e5" - }, - "sha256": { - "correctness-dist/bearshape-0.1.0rc1.tar.gz": "14c3191b78a5de7c36be131ce0ce31201f530e43cf59df3cd68e410adb484efe", - "correctness-dist/.gitignore": "684888c0ebb17f374298b65ee2807526c066094c701bcc7ebbe1c1095f494fc1", - "correctness-dist/bearshape-0.1.0rc1-py3-none-any.whl": "30c137c09d5b44daf66f2cb29e7157de2789a50dadb9c14d33ce3eabd48e4f92", - "optimized-dist/bearshape-0.1.0rc1.tar.gz": "5e01df1a903e22d0d4c384813af3018aa48581b3ccd63bd1778007baa96b2b97", - "optimized-dist/.gitignore": "684888c0ebb17f374298b65ee2807526c066094c701bcc7ebbe1c1095f494fc1", - "optimized-dist/bearshape-0.1.0rc1-py3-none-any.whl": "1e0bf25f4ad018d661d28b84a9136ade8f4f809a5c54c745a213c22d52284897", - "beartype/released": "4461b4dc57e3fdd6c8a8464b22cf118002eea107c33e9fef651c69068ab3cce3", - "beartype/optimized311/dist": "0580ede1fe87229728b42674d45fb8c32ce09a7e348f962cc2741304ef2f10d8" - }, - "runtime_script_commit": "1991deabe05180f54616aa42a36940d40dedc1e5" -} diff --git a/tools/evidence/2026-10-11-remaining-optimization/3.11-hook-lookup-alternatives.json b/tools/evidence/2026-10-11-remaining-optimization/3.11-hook-lookup-alternatives.json deleted file mode 100644 index dbc52f8..0000000 --- a/tools/evidence/2026-10-11-remaining-optimization/3.11-hook-lookup-alternatives.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "python": "3.11.15 (main, May 10 2026, 19:23:07) [Clang 22.1.3 ]", - "calls": 1000000, - "repeats": 9, - "statements": { - "current_getattr": "getattr(Plain, '__beartype_state__', None)", - "weak_map_get": "weak_map.get(Plain)", - "guarded_weak_set": "type(Plain) is type and Plain in weak_set" - }, - "results": [ - { - "case": "current_getattr", - "samples_ns": [ - 65.43379201320931, 60.09654200170189, 60.46416598837823, - 59.48291698587127, 60.05929099046625, 58.85575001593679, - 61.02308302070014, 60.6926670006942, 60.724458016920835 - ], - "median_ns": 60.46416598837823 - }, - { - "case": "weak_map_get", - "samples_ns": [ - 40.581417008070275, 40.63525001402013, 40.71345800184645, - 40.68824998103082, 41.135832987492904, 41.06537500047125, - 40.76845900272019, 40.724624996073544, 41.851375019177794 - ], - "median_ns": 40.724624996073544 - }, - { - "case": "guarded_weak_set", - "samples_ns": [ - 57.587207993492484, 56.94766700617038, 57.126458996208385, - 57.45333299273625, 56.55291702714749, 56.67087499750778, - 56.944417010527104, 56.89741700189188, 56.89454200910404 - ], - "median_ns": 56.944417010527104 - } - ] -} diff --git a/tools/evidence/2026-10-11-remaining-optimization/3.11-proposal-combined.json b/tools/evidence/2026-10-11-remaining-optimization/3.11-proposal-combined.json deleted file mode 100644 index 0512925..0000000 --- a/tools/evidence/2026-10-11-remaining-optimization/3.11-proposal-combined.json +++ /dev/null @@ -1,430 +0,0 @@ -{ - "python": "3.11.15 (main, May 10 2026, 19:23:07) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit", - "machine": "arm64", - "bearshape_origin": "/private/tmp/remaining-bench-combined-proposal-3.11/lib/python3.11/site-packages/bearshape/__init__.py", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6", - "optree": "0.19.1" - }, - "results": [ - { - "case": "bare/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.01700000138953328, 0.016774999676272273, 0.017324998043477535, - 0.018525001360103488, 0.017958402168005705, 0.01785819767974317, - 0.017675000708550215, 0.01828339882194996, 0.017941801343113184 - ], - "median_us": 0.01785819767974317, - "min_us": 0.016774999676272273, - "max_us": 0.018525001360103488 - }, - { - "case": "native/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.08493320201523602, 0.0794916006270796, 0.08290000259876251, - 0.08509159670211375, 0.08235839777626097, 0.0836166029330343, - 0.08375839679501951, 0.08337500039488077, 0.08277500164695084 - ], - "median_us": 0.08337500039488077, - "min_us": 0.0794916006270796, - "max_us": 0.08509159670211375 - }, - { - "case": "strict/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 3.264883201336488, 3.2731667975895107, 3.240258200094104, - 3.248666605213657, 3.266008396167308, 3.2487167976796627, - 3.2823583984281868, 3.2527667994145304, 3.249291598331183 - ], - "median_us": 3.2527667994145304, - "min_us": 3.240258200094104, - "max_us": 3.2823583984281868 - }, - { - "case": "explicit/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 4.5205250033177435, 4.516350000631064, 4.572400002507493, - 4.513291601324454, 4.513933201087639, 4.5003000006545335, - 4.5104334014467895, 4.479000001447275, 4.525149997789413 - ], - "median_us": 4.513933201087639, - "min_us": 4.479000001447275, - "max_us": 4.572400002507493 - }, - { - "case": "like/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 1.8531500012613833, 1.8507750006392598, 1.8507668050006032, - 1.836716802790761, 1.8639082030858845, 1.8621166003867984, - 1.8496583972591907, 1.8556583963800222, 1.8614081956911832 - ], - "median_us": 1.8531500012613833, - "min_us": 1.836716802790761, - "max_us": 1.8639082030858845 - }, - { - "case": "nested/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 7.911275001242757, 7.917275000363588, 7.89504999993369, - 7.918474997859448, 7.886458397842944, 7.8877000021748245, - 7.963533198926598, 7.892583397915587, 7.911849999800324 - ], - "median_us": 7.911275001242757, - "min_us": 7.886458397842944, - "max_us": 7.963533198926598 - }, - { - "case": "value/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 6.638599996222183, 6.620641797780991, 6.704016600269824, - 6.6423668002244085, 6.657258403720334, 6.646158400690183, - 6.6640833974815905, 6.613108201418072, 6.6307750006671995 - ], - "median_us": 6.6423668002244085, - "min_us": 6.613108201418072, - "max_us": 6.704016600269824 - }, - { - "case": "like-sequence/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.271866600494832, 2.276016800897196, 2.2891416039783508, - 2.2406915959436446, 2.2640583978500217, 2.2940166003536433, - 2.29817500221543, 2.2828334011137486, 2.2816083976067603 - ], - "median_us": 2.2816083976067603, - "min_us": 2.2406915959436446, - "max_us": 2.29817500221543 - }, - { - "case": "diagnostic/3", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 69.30966698564589, 68.38700000662357, 68.01958300638944, - 68.14820799627341, 68.43541699345224, 67.98033299855888, - 67.54387498949654, 68.08295799419284, 68.27449999400415 - ], - "median_us": 68.14820799627341, - "min_us": 67.54387498949654, - "max_us": 69.30966698564589 - }, - { - "case": "bare/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.016816600691527128, 0.016549997963011265, 0.016674998914822936, - 0.016633199993520975, 0.016533199232071638, 0.016500003403052688, - 0.016383198089897633, 0.01648320467211306, 0.016891804989427328 - ], - "median_us": 0.016549997963011265, - "min_us": 0.016383198089897633, - "max_us": 0.016891804989427328 - }, - { - "case": "native/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.08517499663867056, 0.08574160165153444, 0.08691659895703197, - 0.0862250046338886, 0.08415000047534704, 0.08315839804708958, - 0.08384159882552922, 0.08597499690949917, 0.08533340296708047 - ], - "median_us": 0.08533340296708047, - "min_us": 0.08315839804708958, - "max_us": 0.08691659895703197 - }, - { - "case": "strict/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 3.733608202310279, 3.3684666035696864, 3.278983198106289, - 3.2435665954835713, 3.3281583979260176, 3.310791600961238, - 3.2622916041873395, 3.2548582006711513, 3.2672165951225907 - ], - "median_us": 3.278983198106289, - "min_us": 3.2435665954835713, - "max_us": 3.733608202310279 - }, - { - "case": "explicit/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 4.532058403128758, 4.577049997169524, 4.582224995829165, - 4.514258401468396, 4.568250000011176, 4.587208398152143, - 4.517933400347829, 4.5294582028873265, 4.5294749957975 - ], - "median_us": 4.532058403128758, - "min_us": 4.514258401468396, - "max_us": 4.587208398152143 - }, - { - "case": "like/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 1.8591916013974696, 1.8542499979957938, 1.8566249986179173, - 1.9977418007329106, 1.865983399329707, 1.840858196374029, - 1.8756250035949051, 1.8582082004286349, 1.8467749992851168 - ], - "median_us": 1.8582082004286349, - "min_us": 1.840858196374029, - "max_us": 1.9977418007329106 - }, - { - "case": "nested/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 8.016224997118115, 7.957308198092505, 8.101216796785593, - 7.970516802743077, 8.058458205778152, 8.007641800213605, - 7.958308199886233, 8.083083195379004, 7.982575002824888 - ], - "median_us": 8.007641800213605, - "min_us": 7.957308198092505, - "max_us": 8.101216796785593 - }, - { - "case": "value/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 6.629225000506267, 6.652133399620652, 6.636691797757521, - 6.754249997902662, 6.673133396543562, 6.8073750007897615, - 6.619566603330895, 6.663216598099098, 6.630191794829443 - ], - "median_us": 6.652133399620652, - "min_us": 6.619566603330895, - "max_us": 6.8073750007897615 - }, - { - "case": "like-sequence/1000000", - "calls_per_repeat": 5, - "repeats": 9, - "samples_us": [ - 11779.491801280528, 11714.541597757488, 11808.79999883473, - 11742.62500135228, 11818.241799483076, 11714.016599580646, - 11679.333401843905, 11629.08339756541, 11652.758403215557 - ], - "median_us": 11714.541597757488, - "min_us": 11629.08339756541, - "max_us": 11818.241799483076 - }, - { - "case": "diagnostic/1000000", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 75.36687501124106, 73.86037497781217, 73.99679199443199, - 73.9384169864934, 73.70474998606369, 73.66558301146142, - 74.0582500002347, 74.12649999605492, 74.30141599616036 - ], - "median_us": 73.99679199443199, - "min_us": 73.66558301146142, - "max_us": 75.36687501124106 - }, - { - "case": "tree/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 5.772783199790865, 5.8011499990243465, 5.949091596994549, - 5.791400000452995, 5.84424160188064, 5.772649997379631, - 5.84110839990899, 8.540291601093486, 7.848283200291917 - ], - "median_us": 5.84110839990899, - "min_us": 5.772649997379631, - "max_us": 8.540291601093486 - }, - { - "case": "tree-value/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 11.849500000244007, 11.653358401963487, 11.73694179742597, - 11.57850839663297, 11.616758396849036, 11.534766800468788, - 11.65011660195887, 11.55656659975648, 11.54964180313982 - ], - "median_us": 11.616758396849036, - "min_us": 11.534766800468788, - "max_us": 11.849500000244007 - }, - { - "case": "tree-composite/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 9.82698340085335, 9.564008400775492, 9.903641598066315, - 15.395008400082588, 14.038558199536055, 14.9635583977215, - 14.817891601705924, 13.024191797012463, 10.248283197870478 - ], - "median_us": 13.024191797012463, - "min_us": 9.564008400775492, - "max_us": 15.395008400082588 - }, - { - "case": "tree/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 160.62500013504177, 158.40834006667137, 159.5849997829646, - 158.07249990757555, 158.74499978963286, 159.30332010611892, - 159.514180268161, 158.07082003448159, 168.56333997566253 - ], - "median_us": 159.30332010611892, - "min_us": 158.07082003448159, - "max_us": 168.56333997566253 - }, - { - "case": "tree-value/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 234.92666019592434, 231.72581975813955, 232.2366600856185, - 228.42834005132318, 231.11084010452032, 228.3483202336356, - 227.45999973267317, 230.11499957647175, 232.1166603360325 - ], - "median_us": 231.11084010452032, - "min_us": 227.45999973267317, - "max_us": 234.92666019592434 - }, - { - "case": "tree-composite/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 330.49834019038826, 309.0083203278482, 309.4683401286602, - 310.77499967068434, 313.0299999611452, 309.0599999995902, - 323.84834019467235, 335.76499961782247, 309.86249970737845 - ], - "median_us": 310.77499967068434, - "min_us": 309.0083203278482, - "max_us": 335.76499961782247 - }, - { - "case": "multiaxis", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 4.959591600345448, 4.835066804662347, 4.828049999196082, - 4.822891601361334, 4.85293340170756, 4.802749998634681, - 4.785350000020117, 4.769449995364994, 4.770708398427814 - ], - "median_us": 4.822891601361334, - "min_us": 4.769449995364994, - "max_us": 4.959591600345448 - }, - { - "case": "variadic", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 4.977250000229105, 5.009074998088181, 4.970733396476135, - 4.978349996963516, 4.951308399904519, 4.9591168004553765, - 4.952541599050164, 4.950825002742931, 4.986016603652388 - ], - "median_us": 4.970733396476135, - "min_us": 4.950825002742931, - "max_us": 5.009074998088181 - }, - { - "case": "like-cast", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.2049665974918753, 2.2767084010411054, 2.217499999096617, - 2.590399998007342, 2.222033397993073, 2.494708396261558, - 2.4106834025587887, 2.7783250028733164, 2.379333198769018 - ], - "median_us": 2.379333198769018, - "min_us": 2.2049665974918753, - "max_us": 2.7783250028733164 - }, - { - "case": "extract-dtype", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.0679834047332406, 0.06798339891247451, 0.07815840071998537, - 0.08929159957915545, 0.08249999955296516, 0.0879583996720612, - 0.0892582000233233, 0.0845499977003783, 0.08536659879609942 - ], - "median_us": 0.0845499977003783, - "min_us": 0.06798339891247451, - "max_us": 0.08929159957915545 - }, - { - "case": "match-dtype", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.14908339944668114, 0.15229160198941827, 0.15457500121556222, - 0.1492082024924457, 0.1522416016086936, 0.11657499708235264, - 0.11515839723870158, 0.11494180071167648, 0.11528339819051325 - ], - "median_us": 0.14908339944668114, - "min_us": 0.11494180071167648, - "max_us": 0.15457500121556222 - }, - { - "case": "decorate_array", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 130.8699589862954, 120.07574999006465, 137.76554199284874, - 143.8768339867238, 127.01216698042117, 125.40470800013281, - 126.05120899388567, 120.37399999098852, 119.74370799725875 - ], - "median_us": 126.05120899388567, - "min_us": 119.74370799725875, - "max_us": 143.8768339867238 - }, - { - "case": "construct_tree_validator", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 1.3958750059828162, 1.4309589751064777, 1.3462089991662651, - 1.4220000011846423, 1.4168329944368452, 1.425041991751641, - 1.4093749923631549, 1.4038750086911023, 1.4360419881995767 - ], - "median_us": 1.4168329944368452, - "min_us": 1.3462089991662651, - "max_us": 1.4360419881995767 - }, - { - "case": "construct_array_validator", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 0.5927919992245734, 0.5689590179827064, 0.5785000103060156, - 0.5863330152351409, 0.5858340009581298, 0.5991669895593077, - 0.606291025178507, 0.6015829858370125, 0.6003330054227263 - ], - "median_us": 0.5927919992245734, - "min_us": 0.5689590179827064, - "max_us": 0.606291025178507 - } - ] -} diff --git a/tools/evidence/2026-10-11-remaining-optimization/3.11-proposal-dtype.json b/tools/evidence/2026-10-11-remaining-optimization/3.11-proposal-dtype.json deleted file mode 100644 index 15d86d8..0000000 --- a/tools/evidence/2026-10-11-remaining-optimization/3.11-proposal-dtype.json +++ /dev/null @@ -1,430 +0,0 @@ -{ - "python": "3.11.15 (main, May 10 2026, 19:23:07) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit", - "machine": "arm64", - "bearshape_origin": "/private/tmp/remaining-bench-dtype-proposal-3.11/lib/python3.11/site-packages/bearshape/__init__.py", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6", - "optree": "0.19.1" - }, - "results": [ - { - "case": "bare/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.017150002531707287, 0.017008197028189898, 0.01685839961282909, - 0.016650004545226693, 0.016325002070516348, 0.016183400293812156, - 0.016258395044133067, 0.016799999866634607, 0.016883201897144318 - ], - "median_us": 0.016799999866634607, - "min_us": 0.016183400293812156, - "max_us": 0.017150002531707287 - }, - { - "case": "native/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.0819500011857599, 0.08261660113930702, 0.08386659901589155, - 0.08739180047996342, 0.08834159816615283, 0.08640000014565885, - 0.08808340062387288, 0.08659160230308771, 0.08543340372852981 - ], - "median_us": 0.08640000014565885, - "min_us": 0.0819500011857599, - "max_us": 0.08834159816615283 - }, - { - "case": "strict/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 3.402466798434034, 3.408483200473711, 3.390091599430889, - 3.4289165982045233, 3.4408084000460804, 3.4343084029387683, - 3.3844165969640017, 3.389966598479077, 3.3994916011579335 - ], - "median_us": 3.402466798434034, - "min_us": 3.3844165969640017, - "max_us": 3.4408084000460804 - }, - { - "case": "explicit/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 4.683241801103577, 4.700141598004848, 4.680391604779288, - 4.675558203598484, 4.672649997519329, 4.671383398817852, - 4.693033400690183, 4.644775000633672, 4.777666600421071 - ], - "median_us": 4.680391604779288, - "min_us": 4.644775000633672, - "max_us": 4.777666600421071 - }, - { - "case": "like/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 1.9983000005595386, 1.9643831998109818, 1.9388250017073005, - 1.937724999152124, 1.9556584011297673, 1.9737916009034961, - 1.935408404096961, 1.9268331991042942, 1.9436499977018684 - ], - "median_us": 1.9436499977018684, - "min_us": 1.9268331991042942, - "max_us": 1.9983000005595386 - }, - { - "case": "nested/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 8.373358403332531, 8.277008397271857, 8.25311680091545, - 8.437950001098216, 8.479108201572672, 8.491124998545274, - 8.478533400921151, 8.52546680252999, 8.475183404516429 - ], - "median_us": 8.475183404516429, - "min_us": 8.25311680091545, - "max_us": 8.52546680252999 - }, - { - "case": "value/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 6.979166797827929, 6.916341604664922, 6.862308399286121, - 6.905741599621251, 6.882166600553319, 6.782591599039733, - 6.781733396928757, 6.82535000378266, 6.834708398673683 - ], - "median_us": 6.862308399286121, - "min_us": 6.781733396928757, - "max_us": 6.979166797827929 - }, - { - "case": "like-sequence/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.3915418016258627, 2.4101666000206023, 2.347366599133238, - 2.382700005546212, 2.673291595419869, 2.5987165980041027, - 2.3789583996403962, 2.3526999983005226, 2.699233399471268 - ], - "median_us": 2.3915418016258627, - "min_us": 2.347366599133238, - "max_us": 2.699233399471268 - }, - { - "case": "diagnostic/3", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 94.01437500491738, 81.67920800042339, 70.4388750018552, - 69.33125000796281, 68.65649999235757, 68.06424999376759, - 68.41424998128787, 67.8329580114223, 67.9582080047112 - ], - "median_us": 68.65649999235757, - "min_us": 67.8329580114223, - "max_us": 94.01437500491738 - }, - { - "case": "bare/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.017166597535833716, 0.017125002341344953, 0.01787500223144889, - 0.017975002992898226, 0.017883401596918702, 0.01793340197764337, - 0.01788339577615261, 0.017991603817790747, 0.01788339577615261 - ], - "median_us": 0.01788339577615261, - "min_us": 0.017125002341344953, - "max_us": 0.017991603817790747 - }, - { - "case": "native/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.0854915997479111, 0.08763319929130375, 0.0860750034917146, - 0.09256660123355687, 0.08716679876670241, 0.08409160072915256, - 0.08422500104643404, 0.08554160012863576, 0.0870083982590586 - ], - "median_us": 0.0860750034917146, - "min_us": 0.08409160072915256, - "max_us": 0.09256660123355687 - }, - { - "case": "strict/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 3.4081665973644704, 3.393683402100578, 3.376033197855577, - 3.4026666020508856, 3.361600002972409, 3.5293916007503867, - 3.4998668008483946, 3.4453831962309778, 3.444483398925513 - ], - "median_us": 3.4081665973644704, - "min_us": 3.361600002972409, - "max_us": 3.5293916007503867 - }, - { - "case": "explicit/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 4.746199998771772, 4.701966600259766, 4.767416598042473, - 4.756866802927107, 4.7544750035740435, 4.628041799878702, - 4.626724997069687, 4.623883403837681, 4.590216802898794 - ], - "median_us": 4.701966600259766, - "min_us": 4.590216802898794, - "max_us": 4.767416598042473 - }, - { - "case": "like/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 1.9136334012728184, 1.9057666009757668, 1.9200081995222718, - 1.912191603332758, 1.9092166039627045, 1.9143084005918354, - 1.9156833994202316, 1.9476833986118436, 1.950283400947228 - ], - "median_us": 1.9143084005918354, - "min_us": 1.9057666009757668, - "max_us": 1.950283400947228 - }, - { - "case": "nested/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 8.672025002306327, 8.288058202015236, 8.221591595793143, - 8.248741796705872, 8.202366600744426, 8.205833396641538, - 8.242825005436316, 8.221758203580976, 8.420299994759262 - ], - "median_us": 8.242825005436316, - "min_us": 8.202366600744426, - "max_us": 8.672025002306327 - }, - { - "case": "value/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 7.038033404387534, 7.220291596604511, 6.782575004035607, - 6.747108203126118, 7.087633403716609, 7.082283199997619, - 6.937899999320507, 6.898033403558657, 7.710858399514109 - ], - "median_us": 7.038033404387534, - "min_us": 6.747108203126118, - "max_us": 7.710858399514109 - }, - { - "case": "like-sequence/1000000", - "calls_per_repeat": 5, - "repeats": 9, - "samples_us": [ - 12002.499995287508, 11653.749999823049, 11687.324999365956, - 11561.700003221631, 11500.566598260775, 11505.716800456867, - 11478.324997005984, 11424.033396178856, 11539.483396336436 - ], - "median_us": 11539.483396336436, - "min_us": 11424.033396178856, - "max_us": 12002.499995287508 - }, - { - "case": "diagnostic/1000000", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 75.78666598419659, 74.38495801761746, 76.55749999685213, - 73.94754199776798, 74.58866699016653, 74.40258300630376, - 76.26162498490885, 74.01537499390543, 76.0745000152383 - ], - "median_us": 74.58866699016653, - "min_us": 73.94754199776798, - "max_us": 76.55749999685213 - }, - { - "case": "tree/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 5.985566601157188, 6.053766602417454, 6.052133202319965, - 6.018908397527412, 6.008341599954292, 5.987258401000872, - 6.0345417994540185, 5.998050002381206, 6.025949999457225 - ], - "median_us": 6.018908397527412, - "min_us": 5.985566601157188, - "max_us": 6.053766602417454 - }, - { - "case": "tree-value/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 11.839308397611603, 11.810433195205405, 11.766941600944847, - 11.811974999727681, 11.78879159851931, 11.821566597791389, - 11.94071660283953, 11.955366603797302, 11.908466595923528 - ], - "median_us": 11.821566597791389, - "min_us": 11.766941600944847, - "max_us": 11.955366603797302 - }, - { - "case": "tree-composite/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 9.79325840016827, 9.78135839686729, 9.79078320087865, 9.782216604799032, - 9.786824998445809, 9.766199998557568, 9.736150002572685, - 9.70227500074543, 10.357750003458932 - ], - "median_us": 9.782216604799032, - "min_us": 9.70227500074543, - "max_us": 10.357750003458932 - }, - { - "case": "tree/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 173.6116799293086, 169.45249983109534, 169.18249952141196, - 168.09083987027407, 169.84749992843717, 169.52416044659913, - 170.23333988618106, 167.65918000601232, 168.55499998200685 - ], - "median_us": 169.45249983109534, - "min_us": 167.65918000601232, - "max_us": 173.6116799293086 - }, - { - "case": "tree-value/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 247.76083999313414, 244.30167977698147, 245.89081993326545, - 244.67000039294362, 242.39499995019287, 242.54249990917742, - 245.1266598654911, 240.7225000206381, 242.68581997603178 - ], - "median_us": 244.30167977698147, - "min_us": 240.7225000206381, - "max_us": 247.76083999313414 - }, - { - "case": "tree-composite/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 320.2424995834008, 327.6366600766778, 318.07499995920807, - 315.9049997339025, 315.41000003926456, 315.2924997266382, - 316.14668027032167, 315.47833990771323, 322.5350001594052 - ], - "median_us": 316.14668027032167, - "min_us": 315.2924997266382, - "max_us": 327.6366600766778 - }, - { - "case": "multiaxis", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 5.233516596490517, 5.141300003742799, 5.144125001970679, - 5.0928332027979195, 5.260008404729888, 5.156300001544878, - 5.1688749983441085, 5.161133396904916, 5.110966798383743 - ], - "median_us": 5.156300001544878, - "min_us": 5.0928332027979195, - "max_us": 5.260008404729888 - }, - { - "case": "variadic", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 5.5007666000165045, 5.409225000767037, 5.371216597268358, - 5.362941598286852, 5.336116801481694, 5.388308200053871, - 5.394583399174735, 5.367691797437146, 5.432475003181025 - ], - "median_us": 5.388308200053871, - "min_us": 5.336116801481694, - "max_us": 5.5007666000165045 - }, - { - "case": "like-cast", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.21410840167664, 2.3161084041930735, 2.1784499986097217, - 2.1554749982897192, 2.1949665970169008, 2.1789750026073307, - 2.171816601185128, 2.1974833973217756, 2.150991599773988 - ], - "median_us": 2.1789750026073307, - "min_us": 2.150991599773988, - "max_us": 2.3161084041930735 - }, - { - "case": "extract-dtype", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.06426679901778698, 0.06704180268570781, 0.06581679917871952, - 0.06533319829031825, 0.06741660181432962, 0.06950839888304472, - 0.06693319883197546, 0.06903340108692646, 0.06867499905638397 - ], - "median_us": 0.06704180268570781, - "min_us": 0.06426679901778698, - "max_us": 0.06950839888304472 - }, - { - "case": "match-dtype", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.11748340330086648, 0.11664159828796983, 0.11780839995481074, - 0.11744999792426825, 0.11654160334728658, 0.11905839783139527, - 0.11848320136778057, 0.11894999770447612, 0.11899179662577808 - ], - "median_us": 0.11780839995481074, - "min_us": 0.11654160334728658, - "max_us": 0.11905839783139527 - }, - { - "case": "decorate_array", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 120.0384590192698, 121.16420900565572, 124.02883300092071, - 122.46233300538734, 119.41404099343345, 121.84725000406615, - 121.12850000266917, 121.21841698535718, 120.87062501814216 - ], - "median_us": 121.16420900565572, - "min_us": 119.41404099343345, - "max_us": 124.02883300092071 - }, - { - "case": "construct_tree_validator", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 1.3667089806403965, 1.400834007654339, 1.3920830097049475, - 1.4004580152686685, 1.406915980624035, 1.3967080158181489, - 1.4031250029802322, 1.434500009054318, 1.4140000275801867 - ], - "median_us": 1.400834007654339, - "min_us": 1.3667089806403965, - "max_us": 1.434500009054318 - }, - { - "case": "construct_array_validator", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 0.4979590012226254, 0.4895830061286688, 0.48816698836162686, - 0.48658301238901913, 0.486832985188812, 0.49012500676326454, - 0.5219579907134175, 0.47870801063254476, 0.4632500058505684 - ], - "median_us": 0.48816698836162686, - "min_us": 0.4632500058505684, - "max_us": 0.5219579907134175 - } - ] -} diff --git a/tools/evidence/2026-10-11-remaining-optimization/3.11-proposal-main.json b/tools/evidence/2026-10-11-remaining-optimization/3.11-proposal-main.json deleted file mode 100644 index 92965ff..0000000 --- a/tools/evidence/2026-10-11-remaining-optimization/3.11-proposal-main.json +++ /dev/null @@ -1,430 +0,0 @@ -{ - "python": "3.11.15 (main, May 10 2026, 19:23:07) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit", - "machine": "arm64", - "bearshape_origin": "/private/tmp/remaining-bench-main-proposal-3.11/lib/python3.11/site-packages/bearshape/__init__.py", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6", - "optree": "0.19.1" - }, - "results": [ - { - "case": "bare/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.01870840205810964, 0.01844159560278058, 0.018450000789016485, - 0.018441601423546672, 0.018766598077490926, 0.018558400915935636, - 0.017991597997024655, 0.01842500059865415, 0.018375000217929482 - ], - "median_us": 0.018441601423546672, - "min_us": 0.017991597997024655, - "max_us": 0.018766598077490926 - }, - { - "case": "native/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.08370000286959112, 0.08339160121977329, 0.08339160121977329, - 0.08261660113930702, 0.08305840310640633, 0.08328340481966734, - 0.08309160475619137, 0.08293339633382857, 0.08345820242539048 - ], - "median_us": 0.08328340481966734, - "min_us": 0.08261660113930702, - "max_us": 0.08370000286959112 - }, - { - "case": "strict/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 5.068808398209512, 5.083916604053229, 5.052916798740625, - 5.0458415993489325, 5.048608197830617, 5.069091601762921, - 5.088933400111273, 5.077483400236815, 5.026375001762062 - ], - "median_us": 5.068808398209512, - "min_us": 5.026375001762062, - "max_us": 5.088933400111273 - }, - { - "case": "explicit/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 6.3930081960279495, 6.380433397134766, 6.357433396624401, - 6.33833339670673, 6.367408199002966, 6.914166803471744, - 6.344875000650063, 6.311024999013171, 7.963724998990074 - ], - "median_us": 6.367408199002966, - "min_us": 6.311024999013171, - "max_us": 7.963724998990074 - }, - { - "case": "like/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 3.210991801461205, 2.7949250012170523, 2.7683750027790666, - 2.7983915992081165, 2.7732665999792516, 2.7951084019150585, - 2.778533403761685, 2.7638168015982956, 2.773783402517438 - ], - "median_us": 2.778533403761685, - "min_us": 2.7638168015982956, - "max_us": 3.210991801461205 - }, - { - "case": "nested/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 11.615324998274446, 11.601900000823662, 11.649258399847895, - 11.777258198708296, 12.361133401282132, 11.669416801305488, - 11.678316799225286, 11.672983400058001, 12.557183200260624 - ], - "median_us": 11.672983400058001, - "min_us": 11.601900000823662, - "max_us": 12.557183200260624 - }, - { - "case": "value/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 11.964458401780576, 9.477891796268523, 8.621683402452618, - 8.613091800361872, 8.481849997770041, 8.525783399818465, - 8.54174160049297, 8.532800001557916, 8.528691600076854 - ], - "median_us": 8.54174160049297, - "min_us": 8.481849997770041, - "max_us": 11.964458401780576 - }, - { - "case": "like-sequence/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 3.348183201160282, 3.321783395949751, 3.3085000002756715, - 3.3140000014100224, 3.3051415986847132, 3.2969416002742946, - 3.2870083989109844, 3.288041800260544, 3.2955250004306436 - ], - "median_us": 3.3051415986847132, - "min_us": 3.2870083989109844, - "max_us": 3.348183201160282 - }, - { - "case": "diagnostic/3", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 77.47370802098885, 78.08804197702557, 76.81366600445472, - 76.67075001518242, 76.61583399749361, 78.7359590176493, 76.000875007594, - 81.5206250117626, 78.11249999213032 - ], - "median_us": 77.47370802098885, - "min_us": 76.000875007594, - "max_us": 81.5206250117626 - }, - { - "case": "bare/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.018500001169741154, 0.018450000789016485, 0.01860000193119049, - 0.019283400615677238, 0.01817499869503081, 0.01796659780666232, - 0.01795000280253589, 0.01796659780666232, 0.01787500223144889 - ], - "median_us": 0.01817499869503081, - "min_us": 0.01787500223144889, - "max_us": 0.019283400615677238 - }, - { - "case": "native/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.08211679523810744, 0.08215000270865858, 0.08211659733206034, - 0.08159159915521741, 0.08191659580916166, 0.08175840484909713, - 0.08052499615587294, 0.08025839924812317, 0.0823081994894892 - ], - "median_us": 0.08191659580916166, - "min_us": 0.08025839924812317, - "max_us": 0.0823081994894892 - }, - { - "case": "strict/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 4.971633397508413, 4.995841800700873, 4.988508200040087, - 4.9468918005004525, 5.16867499682121, 5.022683402057737, - 5.043724999995902, 4.992241598665714, 5.007833399577066 - ], - "median_us": 4.995841800700873, - "min_us": 4.9468918005004525, - "max_us": 5.16867499682121 - }, - { - "case": "explicit/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 6.419833400286734, 6.375975004630163, 6.2945084006059915, - 6.296708399895579, 8.359883399680257, 8.651566598564386, - 6.283608399098739, 6.4227666007354856, 6.316058401716873 - ], - "median_us": 6.375975004630163, - "min_us": 6.283608399098739, - "max_us": 8.651566598564386 - }, - { - "case": "like/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.784208400407806, 2.7673332020640373, 2.7729083958547562, - 2.8000749996863306, 2.7919667947571725, 2.7636666025500745, - 2.7702500054147094, 2.7789250016212463, 2.7528667997103184 - ], - "median_us": 2.7729083958547562, - "min_us": 2.7528667997103184, - "max_us": 2.8000749996863306 - }, - { - "case": "nested/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 11.623041599523276, 11.764825001591817, 11.815758200827986, - 11.858150002080947, 11.951424996368587, 11.651516798883677, - 11.727049999171868, 11.563291604397818, 11.428924999199808 - ], - "median_us": 11.727049999171868, - "min_us": 11.428924999199808, - "max_us": 11.951424996368587 - }, - { - "case": "value/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 8.501899999100715, 8.553066599415615, 8.600349997868761, - 8.53654999518767, 8.548133203294128, 8.50473340251483, - 8.453941595507786, 8.470166602637619, 8.458358200732619 - ], - "median_us": 8.50473340251483, - "min_us": 8.453941595507786, - "max_us": 8.600349997868761 - }, - { - "case": "like-sequence/1000000", - "calls_per_repeat": 5, - "repeats": 9, - "samples_us": [ - 11982.22499806434, 11834.975000238046, 11884.233402088284, - 11899.849999463186, 11948.45840218477, 11897.78340049088, - 11968.53339788504, 11960.450001060963, 11919.291800586507 - ], - "median_us": 11919.291800586507, - "min_us": 11834.975000238046, - "max_us": 11982.22499806434 - }, - { - "case": "diagnostic/1000000", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 80.85783300339244, 79.56250000279397, 79.72154201706871, - 79.58987500751391, 79.85333300894126, 81.6787910007406, - 80.07391600403935, 79.67562499106862, 80.05804099957459 - ], - "median_us": 79.85333300894126, - "min_us": 79.56250000279397, - "max_us": 81.6787910007406 - }, - { - "case": "tree/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 7.711483398452401, 7.707350002601743, 7.653258397476748, - 7.93389180325903, 7.928933197399601, 7.9196250007953495, - 7.942700001876801, 7.941116602160037, 7.991041603963822 - ], - "median_us": 7.928933197399601, - "min_us": 7.653258397476748, - "max_us": 7.991041603963822 - }, - { - "case": "tree-value/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 14.286941598402336, 14.370266802143306, 14.869383396580815, - 14.395450003212318, 14.457241800846532, 13.832116598496214, - 14.006016595521942, 14.067958400119096, 13.832083198940381 - ], - "median_us": 14.286941598402336, - "min_us": 13.832083198940381, - "max_us": 14.869383396580815 - }, - { - "case": "tree-composite/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 10.991574998479337, 11.019833397585899, 10.85350820212625, - 10.859916597837582, 11.004116799449548, 10.87180839967914, - 10.844450001604855, 10.808975005056709, 10.944750002818182 - ], - "median_us": 10.87180839967914, - "min_us": 10.808975005056709, - "max_us": 11.019833397585899 - }, - { - "case": "tree/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 321.0383199620992, 314.7658397210762, 314.9716800544411, - 318.24750010855496, 317.3033200437203, 317.0308395056054, - 312.7391799353063, 315.05833962000906, 316.6841802885756 - ], - "median_us": 316.6841802885756, - "min_us": 312.7391799353063, - "max_us": 321.0383199620992 - }, - { - "case": "tree-value/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 394.40999971702695, 396.4350000023842, 397.07250020001084, - 393.99167988449335, 396.5383203467354, 396.78332046605647, - 392.2366601182148, 396.8749998603016, 395.91000007931143 - ], - "median_us": 396.4350000023842, - "min_us": 392.2366601182148, - "max_us": 397.07250020001084 - }, - { - "case": "tree-composite/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 396.75834006629884, 401.11665963195264, 398.879999993369, - 395.75165952555835, 399.40917980857193, 394.382500089705, - 396.3366599055007, 395.42582002468407, 394.6858400013298 - ], - "median_us": 396.3366599055007, - "min_us": 394.382500089705, - "max_us": 401.11665963195264 - }, - { - "case": "multiaxis", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 6.693966797320172, 6.835716601926833, 6.872391601791605, - 6.912633398314938, 6.916416599415243, 6.91290819668211, - 6.850374996429309, 6.914308195700869, 6.896733399480581 - ], - "median_us": 6.896733399480581, - "min_us": 6.693966797320172, - "max_us": 6.916416599415243 - }, - { - "case": "variadic", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 7.154749997425824, 6.9407249975483865, 6.943133397726342, - 6.953066599089652, 6.950474996119738, 6.963766599074006, - 6.909291597548872, 6.905699998605996, 6.883308402029797 - ], - "median_us": 6.943133397726342, - "min_us": 6.883308402029797, - "max_us": 7.154749997425824 - }, - { - "case": "like-cast", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.9923834023065865, 3.012058400781825, 2.974600001471117, - 2.992775000166148, 2.9978084028698504, 2.98159999656491, - 2.9640918015502393, 2.9874833999201655, 3.0183166032657027 - ], - "median_us": 2.9923834023065865, - "min_us": 2.9640918015502393, - "max_us": 3.0183166032657027 - }, - { - "case": "extract-dtype", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.7413915998768061, 0.726858398411423, 0.7420417969115078, - 0.7323082012590021, 0.7311834022402763, 0.7374250038992614, - 0.7278331962879747, 0.7255916018038988, 0.7197165978141129 - ], - "median_us": 0.7311834022402763, - "min_us": 0.7197165978141129, - "max_us": 0.7420417969115078 - }, - { - "case": "match-dtype", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.7811165996827185, 0.7949582010041922, 0.7879249984398484, - 0.7902749988716096, 0.7944916025735438, 0.7720083987805992, - 0.7878165983129293, 0.787566602230072, 0.7882915961090475 - ], - "median_us": 0.7879249984398484, - "min_us": 0.7720083987805992, - "max_us": 0.7949582010041922 - }, - { - "case": "decorate_array", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 117.8073330083862, 117.96208401210606, 119.46812499081716, - 117.57570900954306, 121.90741702215746, 129.1530419839546, - 123.0307089863345, 119.88145898794755, 118.68725001113489 - ], - "median_us": 119.46812499081716, - "min_us": 117.57570900954306, - "max_us": 129.1530419839546 - }, - { - "case": "construct_tree_validator", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 1.3949580024927855, 1.4167090121190995, 1.422125002136454, - 1.407707983162254, 1.4103749999776483, 1.3245829904917628, - 1.3687500031664968, 1.4063330017961562, 1.4142910076770931 - ], - "median_us": 1.407707983162254, - "min_us": 1.3245829904917628, - "max_us": 1.422125002136454 - }, - { - "case": "construct_array_validator", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 0.4971669986844063, 0.49295800272375345, 0.4895410093013197, - 0.4917499900329858, 0.4953750176355243, 0.4867499810643494, - 0.4852919955737889, 0.509667006554082, 0.4592090263031423 - ], - "median_us": 0.4917499900329858, - "min_us": 0.4592090263031423, - "max_us": 0.509667006554082 - } - ] -} diff --git a/tools/evidence/2026-10-11-remaining-optimization/3.11-proposal-ordinary.json b/tools/evidence/2026-10-11-remaining-optimization/3.11-proposal-ordinary.json deleted file mode 100644 index 9db7fca..0000000 --- a/tools/evidence/2026-10-11-remaining-optimization/3.11-proposal-ordinary.json +++ /dev/null @@ -1,189 +0,0 @@ -{ - "python": "3.11.15 (main, May 10 2026, 19:23:07) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6" - }, - "calls": 10000, - "repeats": 9, - "results": [ - { - "case": "native", - "correct": true, - "first_call_us": 1.042, - "median_us": 0.09938750008586794, - "samples_us": [ - 0.09969999955501407, 0.09923329926095903, 0.09938750008586794, - 0.09929579973686486, 0.0991458015050739, 0.09942920005414635, - 0.09943750046659261, 0.0995083013549447, 0.09933750261552632 - ] - }, - { - "case": "forward-resolved-stateless", - "correct": true, - "first_call_us": 42.875, - "median_us": 0.7553500006906688, - "samples_us": [ - 0.7711084006587043, 0.7939834002172574, 0.7793249998940155, - 0.7412582985125482, 0.7335625006817281, 0.7602291007060558, - 0.7553500006906688, 0.7435167004587129, 0.7372791005764157 - ] - }, - { - "case": "forward-unselected", - "correct": true, - "first_call_us": 2.417, - "median_us": 0.0880667008459568, - "samples_us": [ - 0.08862079994287342, 0.0883166998391971, 0.0880292005604133, - 0.0880667008459568, 0.08779999916441739, 0.08733749855309725, - 0.08858340152073652, 0.08692080155014992, 0.08819999929983169 - ] - }, - { - "case": "forward-nested-stateless", - "correct": true, - "first_call_us": 17.959, - "median_us": 0.7928165985504165, - "samples_us": [ - 0.8012375008547679, 0.8624542009783909, 0.7914832996902987, - 0.8004417002666742, 0.8025249990168959, 0.7888791005825624, - 0.7893208006862551, 0.7928165985504165, 0.7821417006198317 - ] - }, - { - "case": "forward-tuple", - "correct": true, - "first_call_us": 112.292, - "median_us": 0.17037499928846955, - "samples_us": [ - 0.17113329959101975, 0.17036250210367143, 0.170883399550803, - 0.16957919870037585, 0.17037499928846955, 0.16872500127647072, - 0.16956670151557773, 0.17178329871967435, 0.17159589915536344 - ] - }, - { - "case": "forward-mapping", - "correct": true, - "first_call_us": 107.083, - "median_us": 0.19677090167533606, - "samples_us": [ - 0.19638749945443124, 0.19899579929187894, 0.19677090167533606, - 0.19714590162038803, 0.20048329897690564, 0.19397499854676425, - 0.1959582994459197, 0.19737920083571225, 0.19544579845387489 - ] - }, - { - "case": "forward-nested-lists", - "correct": true, - "first_call_us": 85.625, - "median_us": 0.22129999997559935, - "samples_us": [ - 0.22298340045381337, 0.2206082979682833, 0.22266670130193233, - 0.22381249873433262, 0.2254291990539059, 0.21566670038737357, - 0.2208374993642792, 0.22129999997559935, 0.2211209008237347 - ] - }, - { - "case": "plugin-leaf", - "correct": true, - "first_call_us": 10.167, - "median_us": 0.5834915995365009, - "samples_us": [ - 0.5769582989159971, 0.5834915995365009, 0.5854291986906901, - 0.6015250022755936, 0.5794625001726672, 0.5529166985070333, - 0.5649500002618879, 0.5861666984856129, 0.6054666999261826 - ] - }, - { - "case": "plugin-union-second", - "correct": true, - "first_call_us": 9.75, - "median_us": 1.0304166993591934, - "samples_us": [ - 1.0401457984698936, 1.0304166993591934, 1.022674998966977, - 1.0216666996711865, 1.0262375028105453, 1.0176000010687858, - 1.0544917022343725, 1.0497249983018264, 1.1140040995087475 - ] - }, - { - "case": "strict", - "correct": true, - "first_call_us": 155.667, - "median_us": 3.3601958013605326, - "samples_us": [ - 3.6598875012714416, 3.294562501832843, 3.2789832999696955, - 3.3089375006966293, 3.3601958013605326, 3.5132457996951416, - 3.4601541003212333, 3.502491698600352, 3.3046374999685213 - ] - }, - { - "case": "explicit", - "correct": true, - "first_call_us": 28.709, - "median_us": 4.6672166005009785, - "samples_us": [ - 4.619629099033773, 4.751574998954311, 4.733254198799841, - 4.865612499997951, 4.657175001921132, 4.8856542009161785, - 4.6672166005009785, 4.569612498744391, 4.664633300853893 - ] - }, - { - "case": "union-first", - "correct": true, - "first_call_us": 18.292, - "median_us": 4.493875001207925, - "samples_us": [ - 4.6274624997749925, 4.493875001207925, 4.462583301938139, - 4.492120799841359, 4.459025000687689, 4.457866700249724, - 4.7098540992010385, 4.705495800590143, 4.576366700348444 - ] - }, - { - "case": "union-second", - "correct": true, - "first_call_us": 14.709, - "median_us": 6.444341700989753, - "samples_us": [ - 6.5003416006220505, 6.4056458009872586, 6.42095000075642, - 6.444341700989753, 9.772095800144598, 9.481999999843538, - 6.521983299171552, 6.443120801122859, 6.376645801356062 - ] - }, - { - "case": "union-explicit-second", - "correct": true, - "first_call_us": 31.75, - "median_us": 7.930808301898651, - "samples_us": [ - 8.629475001362152, 7.994450000114739, 7.94886669900734, - 7.930808301898651, 7.876962501904927, 7.905683299759403, - 7.8536042012274265, 7.97555829922203, 7.848395899054594 - ] - }, - { - "case": "union-all-failed", - "correct": true, - "first_call_us": 152.208, - "median_us": 5.854633299168199, - "samples_us": [ - 5.864754100912251, 5.854937501135282, 5.871587499859743, - 5.849983298685402, 5.850554199423641, 5.854633299168199, - 5.851866598823108, 5.849391600349918, 6.0022374993423 - ] - }, - { - "case": "union-nested", - "correct": true, - "first_call_us": 535.25, - "median_us": 7.830900000408292, - "samples_us": [ - 8.078975000535138, 7.786470800056122, 7.812345799175091, - 9.936537500470877, 9.201679201214574, 7.841700001154095, - 7.798958400962874, 7.830900000408292, 7.791795799857937 - ] - } - ] -} diff --git a/tools/evidence/2026-10-11-remaining-optimization/3.11-proposal-shape.json b/tools/evidence/2026-10-11-remaining-optimization/3.11-proposal-shape.json deleted file mode 100644 index d0fea4e..0000000 --- a/tools/evidence/2026-10-11-remaining-optimization/3.11-proposal-shape.json +++ /dev/null @@ -1,430 +0,0 @@ -{ - "python": "3.11.15 (main, May 10 2026, 19:23:07) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit", - "machine": "arm64", - "bearshape_origin": "/private/tmp/remaining-bench-shape-proposal-3.11/lib/python3.11/site-packages/bearshape/__init__.py", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6", - "optree": "0.19.1" - }, - "results": [ - { - "case": "bare/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.01689159544184804, 0.016383203910663724, 0.01646659802645445, - 0.016716797836124897, 0.016666599549353123, 0.016766798216849566, - 0.016774999676272273, 0.016483396757394075, 0.017091602785512805 - ], - "median_us": 0.016716797836124897, - "min_us": 0.016383203910663724, - "max_us": 0.017091602785512805 - }, - { - "case": "native/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.08135840180329978, 0.08434159681200981, 0.08459180244244635, - 0.08627499919384718, 0.08455839706584811, 0.0875165977049619, - 0.08520000264979899, 0.08435840136371553, 0.08482499979436398 - ], - "median_us": 0.08459180244244635, - "min_us": 0.08135840180329978, - "max_us": 0.0875165977049619 - }, - { - "case": "strict/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 4.899025004124269, 4.843025002628565, 4.870483401464298, - 4.898883402347565, 4.883500002324581, 4.852633399423212, - 4.886383202392608, 4.880549997324124, 4.8737584031187 - ], - "median_us": 4.880549997324124, - "min_us": 4.843025002628565, - "max_us": 4.899025004124269 - }, - { - "case": "explicit/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 6.252508395118639, 6.203750002896413, 6.221691804239526, - 6.232475000433624, 6.210333202034235, 6.186474999412894, - 6.194025004515424, 6.204049999359995, 6.22312500490807 - ], - "median_us": 6.210333202034235, - "min_us": 6.186474999412894, - "max_us": 6.252508395118639 - }, - { - "case": "like/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.7146584005095065, 2.732916595414281, 2.6970082020852715, - 2.7167083986569196, 2.707824995741248, 2.7434333984274417, - 2.7124916028697044, 2.66084159957245, 2.6871833950281143 - ], - "median_us": 2.7124916028697044, - "min_us": 2.66084159957245, - "max_us": 2.7434333984274417 - }, - { - "case": "nested/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 11.267974996007979, 11.24276680056937, 11.21429160120897, - 11.279691604431719, 11.201966798398644, 11.30051679792814, - 11.28118319902569, 11.30560000310652, 11.309266596799716 - ], - "median_us": 11.279691604431719, - "min_us": 11.201966798398644, - "max_us": 11.309266596799716 - }, - { - "case": "value/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 8.397583197802305, 8.338600001297891, 8.379133400740102, - 8.362641604617238, 8.333875000244007, 8.322825003415346, - 8.357283403165638, 8.34330819780007, 8.375716797308996 - ], - "median_us": 8.357283403165638, - "min_us": 8.322825003415346, - "max_us": 8.397583197802305 - }, - { - "case": "like-sequence/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 3.265716595342383, 3.2224000024143606, 3.2144918048288673, - 3.2376250019297004, 3.253366600256413, 3.1854750006459653, - 3.2066333980765194, 3.2232915982604027, 3.2127583981491625 - ], - "median_us": 3.2224000024143606, - "min_us": 3.1854750006459653, - "max_us": 3.265716595342383 - }, - { - "case": "diagnostic/3", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 73.98816698696464, 72.73325001006015, 73.02566600264981, - 72.51779100624844, 72.66358300694264, 73.09016698854975, - 73.07666700216942, 72.63129099737853, 72.80712501960807 - ], - "median_us": 72.80712501960807, - "min_us": 72.51779100624844, - "max_us": 73.98816698696464 - }, - { - "case": "bare/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.017233198741450906, 0.017041602404788136, 0.01685839961282909, - 0.016975001199170947, 0.017766596283763647, 0.017858401406556368, - 0.01784159685485065, 0.017783400835469365, 0.01754160039126873 - ], - "median_us": 0.01754160039126873, - "min_us": 0.01685839961282909, - "max_us": 0.017858401406556368 - }, - { - "case": "native/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.08596680127084255, 0.0857166014611721, 0.08588340133428574, - 0.08549999911338091, 0.08525000303052366, 0.0860749976709485, - 0.08602499729022384, 0.08716679876670241, 0.0857916020322591 - ], - "median_us": 0.08588340133428574, - "min_us": 0.08525000303052366, - "max_us": 0.08716679876670241 - }, - { - "case": "strict/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 4.841175000183284, 4.829958197660744, 4.872774996329099, - 4.8124166030902416, 4.875908402027562, 4.824650002410635, - 4.847991600399837, 4.842849995475262, 4.856358200777322 - ], - "median_us": 4.842849995475262, - "min_us": 4.8124166030902416, - "max_us": 4.875908402027562 - }, - { - "case": "explicit/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 6.19534999714233, 6.188399996608496, 6.231341598322615, - 6.178383401129395, 6.201916799182072, 6.141475000185892, - 6.176241603679955, 6.183833401883021, 6.1663499975111336 - ], - "median_us": 6.183833401883021, - "min_us": 6.141475000185892, - "max_us": 6.231341598322615 - }, - { - "case": "like/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.739374997327104, 2.694524999242276, 2.687199995853007, - 2.694641798734665, 2.723758399952203, 2.6931915956083685, - 2.704808203270659, 2.673441596562043, 2.6872250018641353 - ], - "median_us": 2.694524999242276, - "min_us": 2.673441596562043, - "max_us": 2.739374997327104 - }, - { - "case": "nested/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 11.316808400442824, 11.262433201773092, 11.60595000255853, - 11.811974999727681, 11.475624999729916, 11.235941597260535, - 11.287799995625392, 11.311066598864272, 11.270275001879781 - ], - "median_us": 11.311066598864272, - "min_us": 11.235941597260535, - "max_us": 11.811974999727681 - }, - { - "case": "value/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 8.347583399154246, 8.32537499954924, 8.361208200221881, - 8.308708399999887, 8.353516599163413, 8.412958402186632, - 8.60860840184614, 8.42244999948889, 8.402125001884997 - ], - "median_us": 8.361208200221881, - "min_us": 8.308708399999887, - "max_us": 8.60860840184614 - }, - { - "case": "like-sequence/1000000", - "calls_per_repeat": 5, - "repeats": 9, - "samples_us": [ - 11464.24159524031, 11374.441598309204, 11251.700000138953, - 11341.041600098833, 11305.808194447309, 11220.708396285772, - 11266.799998702481, 11322.616797406226, 11278.583394596353 - ], - "median_us": 11305.808194447309, - "min_us": 11220.708396285772, - "max_us": 11464.24159524031 - }, - { - "case": "diagnostic/1000000", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 80.81629098160192, 79.3984170013573, 79.96020797872916, - 78.81012500729412, 79.1239159880206, 79.1034169960767, - 78.88979199924506, 78.84983299300075, 80.55479198810644 - ], - "median_us": 79.1239159880206, - "min_us": 78.81012500729412, - "max_us": 80.81629098160192 - }, - { - "case": "tree/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 7.5098915956914425, 7.657166797434911, 7.514083402929828, - 7.465391600271687, 7.459683401975781, 7.5057415990158916, - 7.475641602650285, 7.479333400260657, 7.470900000771508 - ], - "median_us": 7.479333400260657, - "min_us": 7.459683401975781, - "max_us": 7.657166797434911 - }, - { - "case": "tree-value/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 13.441391801461577, 13.454566802829504, 13.480375002836809, - 13.533349998760968, 13.447425002232194, 13.928516797022894, - 13.584641797933728, 13.480325002456084, 14.138416602509096 - ], - "median_us": 13.480375002836809, - "min_us": 13.441391801461577, - "max_us": 14.138416602509096 - }, - { - "case": "tree-composite/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 10.852958401665092, 10.893008403945714, 10.867275000782683, - 10.958958399714902, 10.787691600853577, 10.670374997425824, - 10.941749997437, 10.725041799014434, 10.65867500146851 - ], - "median_us": 10.852958401665092, - "min_us": 10.65867500146851, - "max_us": 10.958958399714902 - }, - { - "case": "tree/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 308.54668002575636, 302.77834041044116, 305.690000532195, - 304.6033199643716, 306.44249985925853, 304.9666597507894, - 307.35500040464103, 307.51832004170865, 307.50331992749125 - ], - "median_us": 306.44249985925853, - "min_us": 302.77834041044116, - "max_us": 308.54668002575636 - }, - { - "case": "tree-value/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 388.85499991010875, 387.00416043866426, 384.2733398778364, - 383.5583198815584, 381.2791802920401, 383.80833982955664, - 383.2158399745822, 379.37417975626886, 381.71416032128036 - ], - "median_us": 383.5583198815584, - "min_us": 379.37417975626886, - "max_us": 388.85499991010875 - }, - { - "case": "tree-composite/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 393.2308399816975, 393.10584019403905, 395.198340411298, - 389.6799997892231, 398.7116599455476, 406.37666010297835, - 516.2858398398384, 393.641660339199, 402.64166018459946 - ], - "median_us": 395.198340411298, - "min_us": 389.6799997892231, - "max_us": 516.2858398398384 - }, - { - "case": "multiaxis", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 6.412725005066022, 6.401641800766811, 6.402366800466552, - 6.423225003527477, 6.408166798064485, 6.397600000491366, - 9.2264918028377, 9.69292499939911, 8.215641602873802 - ], - "median_us": 6.412725005066022, - "min_us": 6.397600000491366, - "max_us": 9.69292499939911 - }, - { - "case": "variadic", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 8.623466599965468, 7.115541596431285, 6.634166598087177, - 6.654416600940749, 6.625208398327231, 6.583458202658221, - 6.571333401370794, 6.549591798102483, 6.607666600029916 - ], - "median_us": 6.625208398327231, - "min_us": 6.549591798102483, - "max_us": 8.623466599965468 - }, - { - "case": "like-cast", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.945400000317022, 2.950308402068913, 2.9748165979981422, - 2.9223249992355704, 2.9524499957915395, 2.932441601296887, - 2.96245840145275, 2.9129416041541845, 2.92981659877114 - ], - "median_us": 2.945400000317022, - "min_us": 2.9129416041541845, - "max_us": 2.9748165979981422 - }, - { - "case": "extract-dtype", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.7298415992408991, 0.7108082005288452, 0.7234500022605062, - 0.7281418016646057, 0.7255250005982816, 0.7298415992408991, - 0.7081918010953814, 0.7278334000147879, 0.7319666037801653 - ], - "median_us": 0.7278334000147879, - "min_us": 0.7081918010953814, - "max_us": 0.7319666037801653 - }, - { - "case": "match-dtype", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.7896331953816116, 0.8079666004050523, 0.7880333985667676, - 0.7971333980094641, 0.8086415997240692, 0.7885000028181821, - 0.8037499967031181, 0.784616603050381, 0.7950417988467962 - ], - "median_us": 0.7950417988467962, - "min_us": 0.784616603050381, - "max_us": 0.8086415997240692 - }, - { - "case": "decorate_array", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 118.49279201123863, 117.61200000182725, 116.40945798717439, - 119.00491701089777, 116.48079098085873, 116.1477499990724, - 117.18854200444184, 116.88191699795425, 117.25912499241531 - ], - "median_us": 117.18854200444184, - "min_us": 116.1477499990724, - "max_us": 119.00491701089777 - }, - { - "case": "construct_tree_validator", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 1.3397919829003513, 1.3624170096591115, 1.3965830148663372, - 1.4049579913262278, 1.4098749961704016, 1.4142079744488, - 1.4345420058816671, 1.3329999928828329, 1.3724580057896674 - ], - "median_us": 1.3965830148663372, - "min_us": 1.3329999928828329, - "max_us": 1.4345420058816671 - }, - { - "case": "construct_array_validator", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 0.6002919981256127, 0.6082500040065497, 0.6057919817976654, - 0.6067499925848097, 0.6084170017857105, 0.6028749921824783, - 0.6024170143064111, 0.6032910023350269, 0.6048749783076346 - ], - "median_us": 0.6048749783076346, - "min_us": 0.6002919981256127, - "max_us": 0.6084170017857105 - } - ] -} diff --git a/tools/evidence/2026-10-11-remaining-optimization/3.11-released-combined.json b/tools/evidence/2026-10-11-remaining-optimization/3.11-released-combined.json deleted file mode 100644 index c79f461..0000000 --- a/tools/evidence/2026-10-11-remaining-optimization/3.11-released-combined.json +++ /dev/null @@ -1,430 +0,0 @@ -{ - "python": "3.11.15 (main, May 10 2026, 19:23:07) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit", - "machine": "arm64", - "bearshape_origin": "/private/tmp/remaining-bench-combined-released-3.11/lib/python3.11/site-packages/bearshape/__init__.py", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6", - "optree": "0.19.1" - }, - "results": [ - { - "case": "bare/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.018516596173867583, 0.018008402548730373, 0.01795000280253589, - 0.018091598758473992, 0.01775840064510703, 0.01776660210452974, - 0.017800001660361886, 0.017850002041086555, 0.01784160267561674 - ], - "median_us": 0.017850002041086555, - "min_us": 0.01775840064510703, - "max_us": 0.018516596173867583 - }, - { - "case": "native/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.08503340068273246, 0.08376679616048932, 0.0834000005852431, - 0.08394999895244837, 0.08388339774683118, 0.08395839831791818, - 0.08408340509049594, 0.08406679844483733, 0.08393339812755585 - ], - "median_us": 0.08394999895244837, - "min_us": 0.0834000005852431, - "max_us": 0.08503340068273246 - }, - { - "case": "strict/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 4.142775002401322, 4.132983402814716, 4.567683394998312, - 4.37261660117656, 4.2003083974123, 4.154208401450887, 4.978841601405293, - 4.128624999430031, 4.548733402043581 - ], - "median_us": 4.2003083974123, - "min_us": 4.128624999430031, - "max_us": 4.978841601405293 - }, - { - "case": "explicit/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 5.397891602478921, 5.337166599929333, 5.436025001108646, - 5.456741800298914, 5.510616599349305, 5.357691604876891, - 5.356383399339393, 6.123108399333432, 5.313466797815636 - ], - "median_us": 5.397891602478921, - "min_us": 5.313466797815636, - "max_us": 6.123108399333432 - }, - { - "case": "like/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.196716598700732, 2.192266599740833, 2.2054167988244444, - 2.203291596379131, 2.1834000013768673, 2.1743084012996405, - 2.1819999965373427, 2.1810334001202136, 2.172349998727441 - ], - "median_us": 2.1834000013768673, - "min_us": 2.172349998727441, - "max_us": 2.2054167988244444 - }, - { - "case": "nested/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 11.39516660477966, 11.46003320463933, 11.525383399566635, - 11.946549999993294, 11.392241599969566, 11.402474995702505, - 11.353583401069045, 11.546708195237443, 11.391275003552437 - ], - "median_us": 11.402474995702505, - "min_us": 11.353583401069045, - "max_us": 11.946549999993294 - }, - { - "case": "value/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 8.391749998554587, 8.569208398694173, 8.465458400314674, - 8.507274999283254, 8.499491604743525, 8.684441598597914, - 8.472108200658113, 8.470025000860915, 8.451916597550735 - ], - "median_us": 8.472108200658113, - "min_us": 8.391749998554587, - "max_us": 8.684441598597914 - }, - { - "case": "like-sequence/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.648875000886619, 3.9726999995764345, 3.0524166009854525, - 2.6541750004980713, 2.646291599376127, 2.6202249980997294, - 2.6068500010296702, 2.5934500037692487, 2.593033399898559 - ], - "median_us": 2.646291599376127, - "min_us": 2.593033399898559, - "max_us": 3.9726999995764345 - }, - { - "case": "diagnostic/3", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 63.84279200574383, 63.443791994359344, 63.44154101680033, - 63.313124992419034, 68.67404200602323, 66.67033300618641, - 66.27695800852962, 68.8369590207003, 66.90520801930688 - ], - "median_us": 66.27695800852962, - "min_us": 63.313124992419034, - "max_us": 68.8369590207003 - }, - { - "case": "bare/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.01835839939303696, 0.01820820034481585, 0.018308399012312293, - 0.018266600091010332, 0.0184584001544863, 0.017983198631554842, - 0.01900839852169156, 0.018258404452353716, 0.01814159913919866 - ], - "median_us": 0.018266600091010332, - "min_us": 0.017983198631554842, - "max_us": 0.01900839852169156 - }, - { - "case": "native/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.08584160241298378, 0.08480839896947145, 0.08489180472679436, - 0.09054180118255317, 0.08480840479023755, 0.08401680388487875, - 0.0827500014565885, 0.08444999693892896, 0.08290840196423233 - ], - "median_us": 0.08480839896947145, - "min_us": 0.0827500014565885, - "max_us": 0.09054180118255317 - }, - { - "case": "strict/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 4.072900000028312, 4.323733400087804, 4.061724996427074, - 4.008166602579877, 4.00929159950465, 3.9990915975067765, - 4.0076584031339735, 3.9961749978829175, 4.043524997541681 - ], - "median_us": 4.00929159950465, - "min_us": 3.9961749978829175, - "max_us": 4.323733400087804 - }, - { - "case": "explicit/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 5.344416596926749, 5.337025003973395, 5.389733402989805, - 5.367316800402477, 5.389416799880564, 5.358633399009705, - 5.358383397106081, 5.377025000052527, 5.396000004839152 - ], - "median_us": 5.367316800402477, - "min_us": 5.337025003973395, - "max_us": 5.396000004839152 - }, - { - "case": "like/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.2168915951624513, 2.1919333958067, 2.1878332016058266, - 2.225683396682143, 2.1976666001137346, 2.2177082020789385, - 2.196575002744794, 2.1874915983062238, 2.202966599725187 - ], - "median_us": 2.1976666001137346, - "min_us": 2.1874915983062238, - "max_us": 2.225683396682143 - }, - { - "case": "nested/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 11.420449998695403, 11.404283402953297, 11.414983397116885, - 11.48013339843601, 11.556858400581405, 14.98111659893766, - 12.225675000809133, 11.782608198700473, 11.7743665992748 - ], - "median_us": 11.556858400581405, - "min_us": 11.404283402953297, - "max_us": 14.98111659893766 - }, - { - "case": "value/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 8.860349998576567, 8.828875003382564, 9.991658199578524, - 8.507525001186877, 8.540275000268593, 8.784833404934034, - 8.591324998997152, 8.73145000077784, 8.72747499961406 - ], - "median_us": 8.73145000077784, - "min_us": 8.507525001186877, - "max_us": 9.991658199578524 - }, - { - "case": "like-sequence/1000000", - "calls_per_repeat": 5, - "repeats": 9, - "samples_us": [ - 11854.10000034608, 11771.600000793114, 11702.066601719707, - 12701.933400239795, 11827.62500247918, 11706.533399410546, - 11833.51679937914, 11710.375000257045, 11924.341798294336 - ], - "median_us": 11827.62500247918, - "min_us": 11702.066601719707, - "max_us": 12701.933400239795 - }, - { - "case": "diagnostic/1000000", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 72.84666699706577, 71.82549999561161, 70.93591598095372, - 71.52208301704377, 71.41583401244134, 70.98920800490305, - 72.66958299442194, 71.48004201008007, 70.77404198935255 - ], - "median_us": 71.48004201008007, - "min_us": 70.77404198935255, - "max_us": 72.84666699706577 - }, - { - "case": "tree/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 6.68229180155322, 6.655116600450128, 6.673608400160447, - 6.707391602685675, 6.647791597060859, 7.418075000168756, - 8.848949999082834, 6.638783402740955, 6.668891804292798 - ], - "median_us": 6.673608400160447, - "min_us": 6.638783402740955, - "max_us": 8.848949999082834 - }, - { - "case": "tree-value/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 17.129066796042025, 17.153741599759087, 17.340883397264406, - 17.12139160372317, 16.986783198080957, 16.992200003005564, - 17.86155000445433, 17.106733395485207, 17.257158196298406 - ], - "median_us": 17.129066796042025, - "min_us": 16.986783198080957, - "max_us": 17.86155000445433 - }, - { - "case": "tree-composite/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 9.985841601155698, 9.658983198460191, 9.631191601511091, - 9.618350001983345, 9.684583399211988, 10.180141602177173, - 9.667641797568649, 9.790800005430356, 9.71766659640707 - ], - "median_us": 9.684583399211988, - "min_us": 9.618350001983345, - "max_us": 10.180141602177173 - }, - { - "case": "tree/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 159.599999897182, 160.05084034986794, 160.42666044086218, - 160.7391599100083, 159.87750026397407, 160.1149997441098, - 158.83583982940763, 159.36250041704625, 159.7074995515868 - ], - "median_us": 159.87750026397407, - "min_us": 158.83583982940763, - "max_us": 160.7391599100083 - }, - { - "case": "tree-value/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 244.06165990512818, 239.64000050909817, 240.00334029551595, - 239.24499982967973, 238.24417963624, 240.26416009292006, - 242.90499975904822, 241.9525000732392, 245.54834002628922 - ], - "median_us": 240.26416009292006, - "min_us": 238.24417963624, - "max_us": 245.54834002628922 - }, - { - "case": "tree-composite/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 230.5025001987815, 228.93749992363155, 229.64666015468538, - 226.96416010148823, 227.71832009311765, 227.06418007146567, - 228.4874999895692, 228.31915994174778, 232.76582011021674 - ], - "median_us": 228.4874999895692, - "min_us": 226.96416010148823, - "max_us": 232.76582011021674 - }, - { - "case": "multiaxis", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 5.639516800874844, 5.613899999298155, 5.617974995402619, - 5.5958418000955135, 5.625133198918775, 5.613924999488518, - 5.628024996258318, 5.581200000597164, 7.235008402494714 - ], - "median_us": 5.617974995402619, - "min_us": 5.581200000597164, - "max_us": 7.235008402494714 - }, - { - "case": "variadic", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 6.637274997774512, 5.878783197840676, 5.825341597665101, - 5.836950003867969, 5.847341602202505, 5.876616598106921, - 5.881466798018664, 5.917249998310581, 5.8876083989162 - ], - "median_us": 5.878783197840676, - "min_us": 5.825341597665101, - "max_us": 6.637274997774512 - }, - { - "case": "like-cast", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.5331667973659933, 2.467041800264269, 2.457516797585413, - 2.4415583990048617, 2.4626415979582816, 2.4457834020722657, - 2.4490750045515597, 2.443758398294449, 2.4393334053456783 - ], - "median_us": 2.4490750045515597, - "min_us": 2.4393334053456783, - "max_us": 2.5331667973659933 - }, - { - "case": "extract-dtype", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.07189160096459091, 0.06866659969091415, 0.07046679966151714, - 0.06918319850228727, 0.06932499818503857, 0.0692084024194628, - 0.06969159585423768, 0.07023320067673922, 0.06998319877311587 - ], - "median_us": 0.06969159585423768, - "min_us": 0.06866659969091415, - "max_us": 0.07189160096459091 - }, - { - "case": "match-dtype", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.11877499637193978, 0.11819180217571557, 0.11903340346179903, - 0.1195168006233871, 0.1236500043887645, 0.11989999911747873, - 0.11952499626204371, 0.11984159937128425, 0.12016660184599459 - ], - "median_us": 0.11952499626204371, - "min_us": 0.11819180217571557, - "max_us": 0.1236500043887645 - }, - { - "case": "decorate_array", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 123.07970799156465, 122.35466699348763, 122.07366697839461, - 121.95220802095719, 122.39512501400895, 121.73879201873206, - 120.01849999069236, 119.23179199220613, 120.97595899831504 - ], - "median_us": 121.95220802095719, - "min_us": 119.23179199220613, - "max_us": 123.07970799156465 - }, - { - "case": "construct_tree_validator", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 1.4153750089462847, 1.4102910063229501, 1.3927079853601754, - 1.4106250018812716, 1.4157090045046061, 1.3964999816380441, - 1.4212090172804892, 1.4088329917285591, 1.4147500041872263 - ], - "median_us": 1.4106250018812716, - "min_us": 1.3927079853601754, - "max_us": 1.4212090172804892 - }, - { - "case": "construct_array_validator", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 0.6456660048570484, 0.633834017207846, 0.6324999849312007, - 0.6311250035651028, 0.6405840103980154, 0.6379169935826212, - 0.6267499993555248, 0.6326250149868429, 0.6336249934975058 - ], - "median_us": 0.6336249934975058, - "min_us": 0.6267499993555248, - "max_us": 0.6456660048570484 - } - ] -} diff --git a/tools/evidence/2026-10-11-remaining-optimization/3.11-released-dtype.json b/tools/evidence/2026-10-11-remaining-optimization/3.11-released-dtype.json deleted file mode 100644 index 9fe43af..0000000 --- a/tools/evidence/2026-10-11-remaining-optimization/3.11-released-dtype.json +++ /dev/null @@ -1,430 +0,0 @@ -{ - "python": "3.11.15 (main, May 10 2026, 19:23:07) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit", - "machine": "arm64", - "bearshape_origin": "/private/tmp/remaining-bench-dtype-released-3.11/lib/python3.11/site-packages/bearshape/__init__.py", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6", - "optree": "0.19.1" - }, - "results": [ - { - "case": "bare/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.018583203200250864, 0.017358403420075774, 0.01720819855108857, - 0.017300003673881292, 0.017041800310835242, 0.01640000264160335, - 0.01622500130906701, 0.01620840048417449, 0.016425002831965685 - ], - "median_us": 0.017041800310835242, - "min_us": 0.01620840048417449, - "max_us": 0.018583203200250864 - }, - { - "case": "native/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.08058340172283351, 0.08136660326272249, 0.08113340009003878, - 0.08029160089790821, 0.07881679921410978, 0.07838340243324637, - 0.08284999639727175, 0.08082499844022095, 0.07953339954838157 - ], - "median_us": 0.08058340172283351, - "min_us": 0.07838340243324637, - "max_us": 0.08284999639727175 - }, - { - "case": "strict/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 4.004816600354388, 4.040758399059996, 4.019841802073643, - 3.9841833990067244, 4.007308400468901, 3.9888500003144145, - 4.024449997814372, 3.99967500125058, 3.957874997286126 - ], - "median_us": 4.004816600354388, - "min_us": 3.957874997286126, - "max_us": 4.040758399059996 - }, - { - "case": "explicit/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 5.4049166035838425, 5.367608199594542, 5.400299996836111, - 5.396124999970198, 5.428191600367427, 5.338166595902294, - 5.411249998724088, 5.341483204392716, 5.385016597574577 - ], - "median_us": 5.396124999970198, - "min_us": 5.338166595902294, - "max_us": 5.428191600367427 - }, - { - "case": "like/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.1738583978731185, 2.1544250019360334, 2.163966599619016, - 2.193875005468726, 2.2061249997932464, 2.1660500031430274, - 2.1720249962527305, 2.1633916010614485, 2.1640666003804654 - ], - "median_us": 2.1660500031430274, - "min_us": 2.1544250019360334, - "max_us": 2.2061249997932464 - }, - { - "case": "nested/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 11.312933400040492, 11.328358197351918, 11.309766600606963, - 11.383883201051503, 11.321124999085441, 11.405283201020211, - 11.313891602912918, 11.283583199838176, 11.440724995918572 - ], - "median_us": 11.321124999085441, - "min_us": 11.283583199838176, - "max_us": 11.440724995918572 - }, - { - "case": "value/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 8.455333398887888, 8.92547499970533, 8.952824998414144, - 8.706250000977889, 8.664333401247859, 9.101708402158692, - 8.513625001069158, 8.566241600783542, 8.480341598624364 - ], - "median_us": 8.664333401247859, - "min_us": 8.455333398887888, - "max_us": 9.101708402158692 - }, - { - "case": "like-sequence/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.639224997255951, 2.6383165968582034, 2.6513250020798296, - 2.6697915978729725, 2.6232165982946754, 2.585624996572733, - 2.6395166001748294, 2.591608400689438, 2.5746081955730915 - ], - "median_us": 2.6383165968582034, - "min_us": 2.5746081955730915, - "max_us": 2.6697915978729725 - }, - { - "case": "diagnostic/3", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 61.708208988420665, 60.310083004878834, 60.23741600802168, - 60.28412500745617, 60.46433301526122, 60.033541987650096, - 60.28854101896286, 60.62133301747963, 60.732249985449016 - ], - "median_us": 60.310083004878834, - "min_us": 60.033541987650096, - "max_us": 61.708208988420665 - }, - { - "case": "bare/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.017399998614564538, 0.01713320380076766, 0.017149996710941195, - 0.01676660031080246, 0.016658403910696507, 0.01669999910518527, - 0.016691803466528654, 0.017041596584022045, 0.01717500272206962 - ], - "median_us": 0.017041596584022045, - "min_us": 0.016658403910696507, - "max_us": 0.017399998614564538 - }, - { - "case": "native/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.07763340254314244, 0.07689999765716493, 0.07645839941687882, - 0.07763340254314244, 0.0783334020525217, 0.0794083985965699, - 0.07947499980218709, 0.07939999923110008, 0.08082499844022095 - ], - "median_us": 0.0783334020525217, - "min_us": 0.07645839941687882, - "max_us": 0.08082499844022095 - }, - { - "case": "strict/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 3.9618917973712087, 4.018691601231694, 3.9703499991446733, - 3.9669500023592263, 4.03223320026882, 4.007808398455381, - 3.9746833965182304, 3.9532915980089456, 3.9699750021100044 - ], - "median_us": 3.9703499991446733, - "min_us": 3.9532915980089456, - "max_us": 4.03223320026882 - }, - { - "case": "explicit/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 5.411791801452637, 5.453250004211441, 5.3872333955951035, - 5.419649998657405, 5.400891602039337, 5.394875002093613, - 5.428074998781085, 5.410050001228228, 5.386991798877716 - ], - "median_us": 5.410050001228228, - "min_us": 5.386991798877716, - "max_us": 5.453250004211441 - }, - { - "case": "like/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.1791418024804443, 2.1549332013819367, 2.1562415990047157, - 2.1674334013368934, 2.168191800592467, 2.1452250017318875, - 2.1586499991826713, 2.1565416012890637, 2.1584165981039405 - ], - "median_us": 2.1584165981039405, - "min_us": 2.1452250017318875, - "max_us": 2.1791418024804443 - }, - { - "case": "nested/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 11.393658199813217, 11.476875003427267, 11.457316600717604, - 11.673758400138468, 11.498683399986476, 11.381808400619775, - 11.391025001648813, 11.396850005257875, 11.350691795814782 - ], - "median_us": 11.396850005257875, - "min_us": 11.350691795814782, - "max_us": 11.673758400138468 - }, - { - "case": "value/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 8.42549160006456, 8.37314180098474, 8.408624998992309, - 8.424241602187976, 8.44549160101451, 8.439158397959545, - 8.39261679793708, 8.421233401168138, 8.381741598714143 - ], - "median_us": 8.421233401168138, - "min_us": 8.37314180098474, - "max_us": 8.44549160101451 - }, - { - "case": "like-sequence/1000000", - "calls_per_repeat": 5, - "repeats": 9, - "samples_us": [ - 11564.53340081498, 11510.008398909122, 11431.525001535192, - 11556.758201913908, 11470.724997343495, 11469.741800101474, - 11505.708401091397, 11502.633203053847, 11439.666798105463 - ], - "median_us": 11502.633203053847, - "min_us": 11431.525001535192, - "max_us": 11564.53340081498 - }, - { - "case": "diagnostic/1000000", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 68.1889170082286, 67.85329099511728, 71.11183399683796, - 70.68549998803064, 67.78437498724088, 66.68404201627709, - 66.57149997772649, 67.06183298956603, 67.76295800227672 - ], - "median_us": 67.78437498724088, - "min_us": 66.57149997772649, - "max_us": 71.11183399683796 - }, - { - "case": "tree/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 6.474416796118021, 6.505066604586318, 6.472100003156811, - 6.481341604376212, 6.483325001318008, 6.450549996225163, - 6.502108398126438, 6.459816597634926, 6.450308399507776 - ], - "median_us": 6.474416796118021, - "min_us": 6.450308399507776, - "max_us": 6.505066604586318 - }, - { - "case": "tree-value/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 16.44491659826599, 16.491058404790238, 16.490775003330782, - 16.95762500166893, 16.68073339969851, 16.446466802153736, - 16.494475002400577, 16.397908399812877, 16.489108197856694 - ], - "median_us": 16.490775003330782, - "min_us": 16.397908399812877, - "max_us": 16.95762500166893 - }, - { - "case": "tree-composite/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 9.397141798399389, 9.359816595679149, 9.406299999682233, - 9.399500000290573, 9.725683397846296, 12.433299998519942, - 13.522983400616795, 9.757283399812877, 9.562566794920713 - ], - "median_us": 9.562566794920713, - "min_us": 9.359816595679149, - "max_us": 13.522983400616795 - }, - { - "case": "tree/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 165.8016798319295, 166.4408197393641, 167.19750012271106, - 166.7924999492243, 165.2141602244228, 169.3974999943748, - 170.06583977490664, 166.30333964712918, 166.35916021186858 - ], - "median_us": 166.4408197393641, - "min_us": 165.2141602244228, - "max_us": 170.06583977490664 - }, - { - "case": "tree-value/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 248.5700004035607, 243.35666035767645, 245.25916029233485, - 241.167499916628, 243.05749975610524, 241.7766599683091, - 244.85250003635883, 239.2833400517702, 241.06834025587887 - ], - "median_us": 243.05749975610524, - "min_us": 239.2833400517702, - "max_us": 248.5700004035607 - }, - { - "case": "tree-composite/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 227.39665990229696, 228.60833967570215, 225.88249994441867, - 225.4216797882691, 225.1491800416261, 229.19166018255055, - 227.82750020269305, 226.58666013740003, 224.65583984740078 - ], - "median_us": 226.58666013740003, - "min_us": 224.65583984740078, - "max_us": 229.19166018255055 - }, - { - "case": "multiaxis", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 5.684491596184671, 5.703050002921373, 5.717058398295194, - 5.6670167949050665, 5.690475000301376, 5.703000002540648, - 5.910958402091637, 5.750300001818687, 5.762575002154335 - ], - "median_us": 5.703050002921373, - "min_us": 5.6670167949050665, - "max_us": 5.910958402091637 - }, - { - "case": "variadic", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 5.983658402692527, 5.936758202733472, 5.945275002159178, - 5.8620168012566864, 5.926841596374288, 5.9395083982963115, - 5.907333199866116, 5.867066601058468, 5.934308399446309 - ], - "median_us": 5.934308399446309, - "min_us": 5.8620168012566864, - "max_us": 5.983658402692527 - }, - { - "case": "like-cast", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.3705750005319715, 2.3983834020327777, 2.402958198217675, - 2.42374999797903, 2.372691797791049, 2.3668000008910894, - 2.3813000007066876, 2.41168339853175, 2.4152167956344783 - ], - "median_us": 2.3983834020327777, - "min_us": 2.3668000008910894, - "max_us": 2.42374999797903 - }, - { - "case": "extract-dtype", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.06616679602302611, 0.06543319905176759, 0.06485820049419999, - 0.06360840052366257, 0.06239159847609699, 0.06415840471163392, - 0.06445840117521584, 0.06340820109471679, 0.06553339771926403 - ], - "median_us": 0.06445840117521584, - "min_us": 0.06239159847609699, - "max_us": 0.06616679602302611 - }, - { - "case": "match-dtype", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.11576660326682031, 0.11599159915931523, 0.11761679779738188, - 0.11716659646481276, 0.11820000363513827, 0.11754999868571758, - 0.11876659700646996, 0.11735840234905481, 0.1204581989441067 - ], - "median_us": 0.11754999868571758, - "min_us": 0.11576660326682031, - "max_us": 0.1204581989441067 - }, - { - "case": "decorate_array", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 115.92320798081346, 116.90391701995395, 116.49508299888112, - 120.27908299933188, 119.21341600827873, 114.69175000092946, - 114.90191600751132, 115.20595898036845, 114.00787500315346 - ], - "median_us": 115.92320798081346, - "min_us": 114.00787500315346, - "max_us": 120.27908299933188 - }, - { - "case": "construct_tree_validator", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 1.359084009891376, 1.3935419847257435, 1.400000008288771, - 1.4115829835645854, 1.3844580098520964, 1.3565419940277934, - 1.3705829915124923, 1.3901249913033098, 1.4065409777686 - ], - "median_us": 1.3901249913033098, - "min_us": 1.3565419940277934, - "max_us": 1.4115829835645854 - }, - { - "case": "construct_array_validator", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 0.49504099297337234, 0.5003749975003302, 0.4865409864578396, - 0.4978329816367477, 0.4927499976474792, 0.4831670084968209, - 0.507416989421472, 0.464374985313043, 0.45862499973736703 - ], - "median_us": 0.4927499976474792, - "min_us": 0.45862499973736703, - "max_us": 0.507416989421472 - } - ] -} diff --git a/tools/evidence/2026-10-11-remaining-optimization/3.11-released-main.json b/tools/evidence/2026-10-11-remaining-optimization/3.11-released-main.json deleted file mode 100644 index 6ccf499..0000000 --- a/tools/evidence/2026-10-11-remaining-optimization/3.11-released-main.json +++ /dev/null @@ -1,430 +0,0 @@ -{ - "python": "3.11.15 (main, May 10 2026, 19:23:07) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit", - "machine": "arm64", - "bearshape_origin": "/private/tmp/remaining-bench-main-released-3.11/lib/python3.11/site-packages/bearshape/__init__.py", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6", - "optree": "0.19.1" - }, - "results": [ - { - "case": "bare/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.017058197408914566, 0.016975001199170947, 0.016816600691527128, - 0.016583397518843412, 0.016274995869025588, 0.016375002451241016, - 0.016325002070516348, 0.01657500397413969, 0.01661680289544165 - ], - "median_us": 0.016583397518843412, - "min_us": 0.016274995869025588, - "max_us": 0.017058197408914566 - }, - { - "case": "native/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.08044160204008222, 0.08296659798361361, 0.07989180157892406, - 0.07950840517878532, 0.0811499950941652, 0.08140000281855464, - 0.0857081962749362, 0.08697500452399254, 0.08609999786131084 - ], - "median_us": 0.08140000281855464, - "min_us": 0.07950840517878532, - "max_us": 0.08697500452399254 - }, - { - "case": "strict/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 5.516999994870275, 5.556408199481666, 5.475924996426329, - 5.51448340411298, 5.503225000575185, 5.5065999971702695, - 5.524016602430493, 5.50539999967441, 5.530891596572474 - ], - "median_us": 5.51448340411298, - "min_us": 5.475924996426329, - "max_us": 5.556408199481666 - }, - { - "case": "explicit/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 6.906650000018999, 6.890316802309826, 6.856191600672901, - 6.894316599937156, 6.844158400781453, 6.891208200249821, - 6.832049996592104, 6.910791801055893, 6.957500003045425 - ], - "median_us": 6.891208200249821, - "min_us": 6.832049996592104, - "max_us": 6.957500003045425 - }, - { - "case": "like/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.9952334007248282, 2.9988499998580664, 2.9749915993306786, - 3.002933203242719, 2.950266603147611, 3.0120499955955893, - 3.1731750001199543, 3.1188915949314833, 3.0324999999720603 - ], - "median_us": 3.002933203242719, - "min_us": 2.950266603147611, - "max_us": 3.1731750001199543 - }, - { - "case": "nested/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 14.46510839741677, 14.452650002203882, 14.572374999988824, - 14.952883397927508, 14.738983195275068, 14.648100000340492, - 14.801558398175985, 15.687566599808633, 14.986258395947516 - ], - "median_us": 14.738983195275068, - "min_us": 14.452650002203882, - "max_us": 15.687566599808633 - }, - { - "case": "value/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 10.072358400793746, 10.03950840095058, 10.251975001301616, - 10.161033197073266, 10.077399999136105, 10.055716603528708, - 10.019583202665672, 10.26692499872297, 10.211149998940527 - ], - "median_us": 10.077399999136105, - "min_us": 10.019583202665672, - "max_us": 10.26692499872297 - }, - { - "case": "like-sequence/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 3.451924998080358, 3.4586749970912933, 3.43954999698326, - 3.4683500009123236, 3.4919500001706183, 3.4420667972881347, - 3.4586581983603537, 3.450458397855982, 3.417416597949341 - ], - "median_us": 3.451924998080358, - "min_us": 3.417416597949341, - "max_us": 3.4919500001706183 - }, - { - "case": "diagnostic/3", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 66.27945799846202, 66.24833299429156, 65.16670799464919, - 65.00837500789203, 65.12845901306719, 64.89954100106843, - 65.12374998419546, 65.14120899373665, 65.3142920054961 - ], - "median_us": 65.14120899373665, - "min_us": 64.89954100106843, - "max_us": 66.27945799846202 - }, - { - "case": "bare/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.016649998724460602, 0.01734999823383987, 0.016649998724460602, - 0.017200002912431955, 0.016558397328481078, 0.016866601072251797, - 0.01669999910518527, 0.01683320151641965, 0.0165749981533736 - ], - "median_us": 0.01669999910518527, - "min_us": 0.016558397328481078, - "max_us": 0.01734999823383987 - }, - { - "case": "native/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.08130840142257512, 0.08258339948952198, 0.08213339606299996, - 0.08232500404119492, 0.08441680110991001, 0.08355000172741711, - 0.08421659586019814, 0.0841166009195149, 0.08398339850828052 - ], - "median_us": 0.08355000172741711, - "min_us": 0.08130840142257512, - "max_us": 0.08441680110991001 - }, - { - "case": "strict/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 5.554675002349541, 5.58708340395242, 5.576183198718354, - 5.558474996360019, 5.581791797885671, 5.5288415984250605, - 5.537458200706169, 5.598950001876801, 5.5956167983822525 - ], - "median_us": 5.576183198718354, - "min_us": 5.5288415984250605, - "max_us": 5.598950001876801 - }, - { - "case": "explicit/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 6.936741597019136, 6.972133403178304, 6.895908404840156, - 6.951350002782419, 6.933249998837709, 6.918991595739499, - 6.909650005400181, 6.94097499945201, 6.977800000458956 - ], - "median_us": 6.936741597019136, - "min_us": 6.895908404840156, - "max_us": 6.977800000458956 - }, - { - "case": "like/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.990416600368917, 2.9665083973668516, 2.9865583986975253, - 2.9714499949477613, 2.9586334014311433, 2.964433399029076, - 2.9988499998580664, 3.0047081992961466, 2.9767833999358118 - ], - "median_us": 2.9767833999358118, - "min_us": 2.9586334014311433, - "max_us": 3.0047081992961466 - }, - { - "case": "nested/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 14.426941599231213, 14.465341798495501, 14.42626680363901, - 14.512208400992677, 14.43333339993842, 14.936666801804677, - 14.559974998701364, 14.51984160230495, 14.47097499622032 - ], - "median_us": 14.47097499622032, - "min_us": 14.42626680363901, - "max_us": 14.936666801804677 - }, - { - "case": "value/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 9.953258204041049, 10.031675000209361, 9.986325004138052, - 9.989716799464077, 9.938199998578057, 9.893799998098984, - 9.974216599948704, 9.954349999316037, 10.073833400383592 - ], - "median_us": 9.974216599948704, - "min_us": 9.893799998098984, - "max_us": 10.073833400383592 - }, - { - "case": "like-sequence/1000000", - "calls_per_repeat": 5, - "repeats": 9, - "samples_us": [ - 11622.275004629046, 11521.433398593217, 11689.775000559166, - 11573.4416001942, 11611.075000837445, 11449.800000991672, - 11435.891600558534, 11515.974998474121, 11471.583403181285 - ], - "median_us": 11521.433398593217, - "min_us": 11435.891600558534, - "max_us": 11689.775000559166 - }, - { - "case": "diagnostic/1000000", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 73.26616600039415, 77.74845798849128, 73.56058299774304, - 71.88991701696068, 72.3158750042785, 72.39362501422875, 71.818374999566, - 71.84370799222961, 72.47804198414087 - ], - "median_us": 72.39362501422875, - "min_us": 71.818374999566, - "max_us": 77.74845798849128 - }, - { - "case": "tree/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 8.206374995643273, 8.153741800924763, 8.103166602086276, - 8.137674996396527, 8.140983403427526, 8.200416603358462, - 8.163949998561293, 8.153016603318974, 8.116033399710432 - ], - "median_us": 8.153016603318974, - "min_us": 8.103166602086276, - "max_us": 8.206374995643273 - }, - { - "case": "tree-value/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 18.45816660206765, 18.434591800905764, 18.423866597004235, - 18.384708400117233, 18.37848339928314, 18.387549999170005, - 18.47249160055071, 18.881349998991936, 19.31357500143349 - ], - "median_us": 18.434591800905764, - "min_us": 18.37848339928314, - "max_us": 19.31357500143349 - }, - { - "case": "tree-composite/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 10.999950004043058, 10.393500002101064, 10.388275003060699, - 10.37921659881249, 10.368650004966184, 10.49510840093717, - 10.376433399505913, 10.52800840116106, 10.37122500129044 - ], - "median_us": 10.388275003060699, - "min_us": 10.368650004966184, - "max_us": 10.999950004043058 - }, - { - "case": "tree/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 311.6691595641896, 315.2658400358632, 307.74249986279756, - 316.01582013536245, 310.55000028572977, 312.50166008248925, - 306.78250011987984, 308.84166015312076, 309.5641598338261 - ], - "median_us": 310.55000028572977, - "min_us": 306.78250011987984, - "max_us": 316.01582013536245 - }, - { - "case": "tree-value/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 396.3608405319974, 395.0108401477337, 391.3325001485646, - 394.42584034986794, 391.10584009904414, 395.0183396227658, - 398.6474999692291, 422.8125000372529, 405.45667987316847 - ], - "median_us": 395.0183396227658, - "min_us": 391.10584009904414, - "max_us": 422.8125000372529 - }, - { - "case": "tree-composite/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 310.0241598440334, 305.82915991544724, 303.9866598555818, - 306.1899996828288, 299.8641802696511, 304.47249999269843, - 309.2916600871831, 307.00582021381706, 305.27831986546516 - ], - "median_us": 305.82915991544724, - "min_us": 299.8641802696511, - "max_us": 310.0241598440334 - }, - { - "case": "multiaxis", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 7.342091598547995, 7.427458395250142, 7.344516599550843, - 7.297266600653529, 7.236191601259634, 7.272200001170859, - 7.315933401696384, 7.23188339616172, 7.260100002167746 - ], - "median_us": 7.297266600653529, - "min_us": 7.23188339616172, - "max_us": 7.427458395250142 - }, - { - "case": "variadic", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 7.541291799861938, 7.49541679979302, 7.588725001551211, - 7.525458402233198, 7.5149665994104, 7.519100001081824, - 7.498933398164809, 7.520608202321455, 7.495624996954575 - ], - "median_us": 7.519100001081824, - "min_us": 7.49541679979302, - "max_us": 7.588725001551211 - }, - { - "case": "like-cast", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 3.232441801810637, 3.265633399132639, 3.265866602305323, - 3.19912499981001, 3.251033404376358, 3.21614159620367, - 3.2175416010431945, 3.2866165973246098, 3.214116598246619 - ], - "median_us": 3.232441801810637, - "min_us": 3.19912499981001, - "max_us": 3.2866165973246098 - }, - { - "case": "extract-dtype", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.7347000006120652, 0.7445667986758053, 0.7479082036297768, - 0.7089249964337796, 0.7945082033984363, 0.7391832012217492, - 0.7332750014029443, 0.7189166033640504, 0.72794160223566 - ], - "median_us": 0.7347000006120652, - "min_us": 0.7089249964337796, - "max_us": 0.7945082033984363 - }, - { - "case": "match-dtype", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.7662499963771552, 0.8103833999484777, 0.7785499969031662, - 0.7776500016916543, 0.7955499982926995, 0.7847749977372587, - 0.7972249994054437, 0.7859749952331185, 0.7746166025754064 - ], - "median_us": 0.7847749977372587, - "min_us": 0.7662499963771552, - "max_us": 0.8103833999484777 - }, - { - "case": "decorate_array", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 113.55741700390354, 112.8657499793917, 112.35158299678005, - 112.5613339827396, 113.55466599343345, 112.7953749964945, - 112.43870900943875, 112.97695900429972, 113.62654101685621 - ], - "median_us": 112.8657499793917, - "min_us": 112.35158299678005, - "max_us": 113.62654101685621 - }, - { - "case": "construct_tree_validator", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 1.334125001449138, 1.3441669871099293, 1.3535000034607947, - 1.385582989314571, 1.3813750119879842, 1.413041987689212, - 1.323292002780363, 1.324082986684516, 1.3512090081349015 - ], - "median_us": 1.3512090081349015, - "min_us": 1.323292002780363, - "max_us": 1.413041987689212 - }, - { - "case": "construct_array_validator", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 0.48187500215135515, 0.4788750084117055, 0.48020799295045435, - 0.4813339910469949, 0.48374998732469976, 0.4894580051768571, - 0.4913329903502017, 0.48762501683086157, 0.48974997480399907 - ], - "median_us": 0.48374998732469976, - "min_us": 0.4788750084117055, - "max_us": 0.4913329903502017 - } - ] -} diff --git a/tools/evidence/2026-10-11-remaining-optimization/3.11-released-ordinary.json b/tools/evidence/2026-10-11-remaining-optimization/3.11-released-ordinary.json deleted file mode 100644 index ac32614..0000000 --- a/tools/evidence/2026-10-11-remaining-optimization/3.11-released-ordinary.json +++ /dev/null @@ -1,159 +0,0 @@ -{ - "python": "3.11.15 (main, May 10 2026, 19:23:07) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6" - }, - "calls": 10000, - "repeats": 9, - "results": [ - { - "case": "native", - "correct": true, - "first_call_us": 1.125, - "median_us": 0.10006249940488487, - "samples_us": [ - 0.1000124990241602, 0.09936249989550561, 0.09894999966491014, - 0.10168750013690442, 0.10197499941568822, 0.101816700771451, - 0.10126249981112778, 0.10006249940488487, 0.09880000143311918 - ] - }, - { - "case": "forward-resolved-stateless", - "correct": true, - "first_call_us": 65.125, - "median_us": 0.7108000019798055, - "samples_us": [ - 0.739587499992922, 0.6997832999331877, 0.7077457994455472, - 0.7124166004359722, 0.7119874993804842, 0.698987499345094, - 0.7052416010992602, 0.7108000019798055, 0.7155958010116592 - ] - }, - { - "case": "forward-unselected", - "correct": true, - "first_call_us": 2.0, - "median_us": 0.0887166999746114, - "samples_us": [ - 0.0887166999746114, 0.08879579836502671, 0.091758300550282, - 0.08978750265669078, 0.08748749969527125, 0.08847500139381737, - 0.08835829794406891, 0.08785829995758832, 0.08937910024542361 - ] - }, - { - "case": "forward-nested-stateless", - "correct": true, - "first_call_us": 23.125, - "median_us": 0.7632916007423773, - "samples_us": [ - 0.7823583000572398, 0.7608291023643687, 0.7594041991978884, - 0.7576167001388967, 0.7632916007423773, 0.7465209026122466, - 0.8221124997362494, 0.9230208990629762, 0.8506458019837737 - ] - }, - { - "case": "forward-tuple", - "correct": true, - "first_call_us": 20.125, - "median_us": 0.7266749977134168, - "samples_us": [ - 0.730462500359863, 0.7292458001757041, 0.7247375004226342, - 0.7336832990404218, 0.7251499977428466, 0.7229208014905453, - 0.7266749977134168, 0.724725000327453, 0.7298790995264426 - ] - }, - { - "case": "forward-mapping", - "correct": true, - "first_call_us": 18.0, - "median_us": 0.7481250009732321, - "samples_us": [ - 0.7461417000740767, 0.7565290987258777, 0.7482999993953854, - 0.7539916987298056, 0.7481250009732321, 0.7486292015528306, - 0.7411083002807572, 0.7390332990325987, 0.7437207998009399 - ] - }, - { - "case": "forward-nested-lists", - "correct": true, - "first_call_us": 16.833, - "median_us": 0.7713707978837192, - "samples_us": [ - 0.7704124989686534, 0.7713707978837192, 0.7694833009736612, - 0.7719832996372133, 0.7691624981816858, 0.7733083009952679, - 0.7723416987573728, 0.7692749990383163, 0.7724625000264496 - ] - }, - { - "case": "plugin-leaf", - "correct": true, - "first_call_us": 5.0, - "median_us": 0.15421249845530838, - "samples_us": [ - 0.15533329860772938, 0.15432910004165024, 0.15617920143995434, - 0.15469999925699085, 0.1532167021650821, 0.15397079987451434, - 0.15421249845530838, 0.15392499917652458, 0.15380000113509595 - ] - }, - { - "case": "plugin-union-second", - "correct": false, - "reason": "Plugin union retained rejected state" - }, - { - "case": "strict", - "correct": true, - "first_call_us": 84.208, - "median_us": 4.059304200927727, - "samples_us": [ - 4.031145898625255, 3.9910249994136393, 4.059304200927727, - 4.047045801416971, 4.063437500735745, 4.101004099356942, - 4.060345797915943, 4.055395800969563, 4.086762500810437 - ] - }, - { - "case": "explicit", - "correct": true, - "first_call_us": 35.833, - "median_us": 5.500366701744497, - "samples_us": [ - 5.528800000320189, 6.3283750001573935, 5.85737910005264, - 5.491104201064445, 5.528708398924209, 5.481995901209302, - 5.497941598878242, 5.4711250006221235, 5.500366701744497 - ] - }, - { - "case": "union-first", - "correct": true, - "first_call_us": 10.458, - "median_us": 4.137391698895954, - "samples_us": [ - 4.12651659862604, 4.122624997398816, 4.137391698895954, - 4.173887500655837, 4.130379197886214, 4.137762502068654, - 4.180691600777209, 4.179029201623052, 4.134116700151935 - ] - }, - { - "case": "union-second", - "correct": false, - "reason": "Function __main__.union() parameter _last=\"array([1., 1., 1.], dtype=float32)\" violates type hint , as dimension 'N' expected 2 but got 3." - }, - { - "case": "union-explicit-second", - "correct": false, - "reason": "Function __main__.union_explicit() parameter _last=\"array([1., 1., 1.], dtype=float32)\" violates type hint , as dimension 'N' expected 2 but got 3." - }, - { - "case": "union-all-failed", - "correct": false, - "reason": "Failed union retained state" - }, - { - "case": "union-nested", - "correct": false, - "reason": "Nested union retained rejected state" - } - ] -} diff --git a/tools/evidence/2026-10-11-remaining-optimization/3.11-released-shape.json b/tools/evidence/2026-10-11-remaining-optimization/3.11-released-shape.json deleted file mode 100644 index bc3c5ef..0000000 --- a/tools/evidence/2026-10-11-remaining-optimization/3.11-released-shape.json +++ /dev/null @@ -1,430 +0,0 @@ -{ - "python": "3.11.15 (main, May 10 2026, 19:23:07) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit", - "machine": "arm64", - "bearshape_origin": "/private/tmp/remaining-bench-shape-released-3.11/lib/python3.11/site-packages/bearshape/__init__.py", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6", - "optree": "0.19.1" - }, - "results": [ - { - "case": "bare/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.018149998504668474, 0.017891800962388515, 0.018716597696766257, - 0.017750001279637218, 0.01726679620333016, 0.01787500223144889, - 0.017383397789672017, 0.01738319988362491, 0.017216597916558385 - ], - "median_us": 0.017750001279637218, - "min_us": 0.017216597916558385, - "max_us": 0.018716597696766257 - }, - { - "case": "native/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.08060000254772604, 0.08002499816939235, 0.0815831997897476, - 0.08256660075858235, 0.08224159828387201, 0.08355000172741711, - 0.0836834020446986, 0.08374180179089308, 0.0862916000187397 - ], - "median_us": 0.08256660075858235, - "min_us": 0.08002499816939235, - "max_us": 0.0862916000187397 - }, - { - "case": "strict/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 5.495074996724725, 5.506208399310708, 5.482316797133535, - 5.526958400150761, 5.508649995317683, 5.507458397187293, - 5.51261660293676, 5.54450000054203, 5.4896666028071195 - ], - "median_us": 5.507458397187293, - "min_us": 5.482316797133535, - "max_us": 5.54450000054203 - }, - { - "case": "explicit/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 6.942108401563019, 6.957816600333899, 7.30517499614507, - 7.237583404639736, 7.225141598610207, 7.262083399109542, - 7.192216801922768, 7.286141603253782, 6.938908400479704 - ], - "median_us": 7.225141598610207, - "min_us": 6.938908400479704, - "max_us": 7.30517499614507 - }, - { - "case": "like/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.913116803392768, 2.9574332002084702, 2.902675000950694, - 2.9527999984566122, 2.9464000021107495, 2.962975000264123, - 2.9791499953716993, 2.9793084017001092, 2.941791800549254 - ], - "median_us": 2.9527999984566122, - "min_us": 2.902675000950694, - "max_us": 2.9793084017001092 - }, - { - "case": "nested/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 14.348791597876698, 14.440174994524568, 14.433724997797981, - 15.12758340104483, 14.427283400436863, 14.3835750001017, - 14.354833401739597, 14.390733203617856, 14.938691596034914 - ], - "median_us": 14.427283400436863, - "min_us": 14.348791597876698, - "max_us": 15.12758340104483 - }, - { - "case": "value/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 10.279799997806549, 10.188324999762699, 10.140966798644513, - 10.317616601241753, 10.090983402915299, 10.113908199127764, - 10.145166597794741, 11.0661834012717, 10.130116797517985 - ], - "median_us": 10.145166597794741, - "min_us": 10.090983402915299, - "max_us": 11.0661834012717 - }, - { - "case": "like-sequence/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 3.504474996589124, 3.6038250022102147, 3.586583200376481, - 3.591099998448044, 3.5304083954542875, 3.571174998069182, - 3.5061500035226345, 3.5484666004776955, 3.542566596297547 - ], - "median_us": 3.5484666004776955, - "min_us": 3.504474996589124, - "max_us": 3.6038250022102147 - }, - { - "case": "diagnostic/3", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 71.07208299566992, 69.83391699031927, 69.50558300013654, - 70.35541700315662, 69.88112500403076, 69.97962499735877, - 71.92966600996442, 70.787750009913, 69.9099580233451 - ], - "median_us": 69.97962499735877, - "min_us": 69.50558300013654, - "max_us": 71.92966600996442 - }, - { - "case": "bare/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.018608401296660304, 0.01844159560278058, 0.018366798758506775, - 0.01849160180427134, 0.01879159826785326, 0.018516601994633675, - 0.01874159788712859, 0.01884160446934402, 0.01894999877549708 - ], - "median_us": 0.018608401296660304, - "min_us": 0.018366798758506775, - "max_us": 0.01894999877549708 - }, - { - "case": "native/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.08437499636784196, 0.0834667996969074, 0.0834000005852431, - 0.08449999731965363, 0.08554999949410558, 0.085350003791973, - 0.08450819877907634, 0.08460839744657278, 0.08521659765392542 - ], - "median_us": 0.08450819877907634, - "min_us": 0.0834000005852431, - "max_us": 0.08554999949410558 - }, - { - "case": "strict/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 5.641408200608566, 5.624033400090411, 5.606433399952948, - 5.616308201570064, 5.639991600764915, 5.648191599175334, - 5.7291081990115345, 5.685641599120572, 5.65874160383828 - ], - "median_us": 5.641408200608566, - "min_us": 5.606433399952948, - "max_us": 5.7291081990115345 - }, - { - "case": "explicit/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 7.178258203202859, 7.086433400399983, 7.348808401729912, - 7.217108400072902, 7.13360839872621, 7.164749997900799, - 7.182116602780297, 7.1436833997722715, 7.063066598493606 - ], - "median_us": 7.164749997900799, - "min_us": 7.063066598493606, - "max_us": 7.348808401729912 - }, - { - "case": "like/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 3.0515666003338993, 3.0471915961243212, 3.078383201500401, - 3.0520749976858497, 3.058299998519942, 3.0511584016494453, - 3.0338415992446244, 3.0606833985075355, 3.066083398880437 - ], - "median_us": 3.0520749976858497, - "min_us": 3.0338415992446244, - "max_us": 3.078383201500401 - }, - { - "case": "nested/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 16.040899994550273, 18.75200819922611, 17.290316603612155, - 15.411649999441579, 16.703000001143664, 14.922625001054257, - 14.770883397432044, 14.679141802480444, 15.464724996127188 - ], - "median_us": 15.464724996127188, - "min_us": 14.679141802480444, - "max_us": 18.75200819922611 - }, - { - "case": "value/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 11.439691804116592, 10.57380840065889, 10.47649160027504, - 10.471049998886883, 10.537375003332272, 10.30722499708645, - 12.67359180492349, 10.2928584034089, 10.428775002947077 - ], - "median_us": 10.47649160027504, - "min_us": 10.2928584034089, - "max_us": 12.67359180492349 - }, - { - "case": "like-sequence/1000000", - "calls_per_repeat": 5, - "repeats": 9, - "samples_us": [ - 11920.274997828528, 11969.491600757465, 11695.925000822172, - 11612.55000042729, 11426.358204334974, 11410.56659980677, - 11169.458401855081, 11553.908401401713, 12473.549996502697 - ], - "median_us": 11612.55000042729, - "min_us": 11169.458401855081, - "max_us": 12473.549996502697 - }, - { - "case": "diagnostic/1000000", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 85.74350000708364, 88.30337499966845, 80.40070798597299, - 76.56349998433143, 82.46233401587233, 76.48845799849369, - 76.82354099233635, 76.78570799180306, 77.08341701072641 - ], - "median_us": 77.08341701072641, - "min_us": 76.48845799849369, - "max_us": 88.30337499966845 - }, - { - "case": "tree/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 8.383600000524893, 8.383799996227026, 8.358266804134473, - 8.384599996497855, 8.29236659919843, 8.312133199069649, - 8.321099996101111, 8.442924998234957, 8.327266800915822 - ], - "median_us": 8.358266804134473, - "min_us": 8.29236659919843, - "max_us": 8.442924998234957 - }, - { - "case": "tree-value/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 19.031958398409188, 19.150716601870954, 19.079666800098494, - 20.432083401829004, 19.044291804311797, 19.580950000090525, - 19.15620819781907, 19.189274997916073, 19.060166599228978 - ], - "median_us": 19.150716601870954, - "min_us": 19.031958398409188, - "max_us": 20.432083401829004 - }, - { - "case": "tree-composite/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 10.620916803600267, 10.705049999523908, 10.637499997392297, - 10.583941597724333, 10.54910839884542, 10.581375000765547, - 10.692550003295764, 10.584500001277775, 10.615658201277256 - ], - "median_us": 10.615658201277256, - "min_us": 10.54910839884542, - "max_us": 10.705049999523908 - }, - { - "case": "tree/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 313.1399996345863, 310.49081997480243, 307.8183199977502, - 309.8124999087304, 311.50083988904953, 309.5024998765439, - 310.15084008686244, 312.2166602406651, 308.84165957104415 - ], - "median_us": 310.15084008686244, - "min_us": 307.8183199977502, - "max_us": 313.1399996345863 - }, - { - "case": "tree-value/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 395.3624999849126, 393.20249983575195, 395.7766602979973, - 394.04665993060917, 395.4391600564122, 403.10500015038997, - 401.36333962436765, 400.06165974773467, 397.4841599119827 - ], - "median_us": 395.7766602979973, - "min_us": 393.20249983575195, - "max_us": 403.10500015038997 - }, - { - "case": "tree-composite/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 310.945839737542, 310.75166014488786, 310.85749971680343, - 309.5391596434638, 309.6541599370539, 310.9308402054012, - 307.37249995581806, 307.909999974072, 307.08500009495765 - ], - "median_us": 309.6541599370539, - "min_us": 307.08500009495765, - "max_us": 310.945839737542 - }, - { - "case": "multiaxis", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 7.326108397683129, 7.238108396995813, 7.256800000322983, - 7.2875750018283725, 7.293399999616668, 7.268599997041747, - 7.271058397600427, 7.280466600786895, 10.195891803596169 - ], - "median_us": 7.280466600786895, - "min_us": 7.238108396995813, - "max_us": 10.195891803596169 - }, - { - "case": "variadic", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 7.797266804846004, 7.54352500080131, 7.554483396233991, - 7.639599998947233, 7.734783197520301, 7.67486680415459, - 7.601983402855694, 7.821808400331065, 7.4930418049916625 - ], - "median_us": 7.639599998947233, - "min_us": 7.4930418049916625, - "max_us": 7.821808400331065 - }, - { - "case": "like-cast", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 3.7271250039339066, 3.438658401137218, 3.3394167956430465, - 3.3296499983407557, 3.307241597212851, 3.3403500041458756, - 3.321075002895668, 3.2996000023558736, 3.3066665986552835 - ], - "median_us": 3.3296499983407557, - "min_us": 3.2996000023558736, - "max_us": 3.7271250039339066 - }, - { - "case": "extract-dtype", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.7586750027257949, 0.7529916008934379, 0.7527333975303918, - 0.7577334006782621, 0.75149160111323, 0.7265418011229485, - 0.7272915972862393, 0.7305418024770916, 0.7220334024168551 - ], - "median_us": 0.75149160111323, - "min_us": 0.7220334024168551, - "max_us": 0.7586750027257949 - }, - { - "case": "match-dtype", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.8297499967738986, 0.8328415977302939, 0.8294917992316186, - 0.8254165994003415, 0.8285082003567368, 0.8005416020751, - 0.8007665979675949, 0.7918583985883743, 0.7845584012102336 - ], - "median_us": 0.8254165994003415, - "min_us": 0.7845584012102336, - "max_us": 0.8328415977302939 - }, - { - "case": "decorate_array", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 120.26683299336582, 119.78679199819453, 119.59699998260476, - 120.056374988053, 120.21066699526273, 123.96204101969488, - 118.7377090100199, 120.55912500363775, 120.05549998139031 - ], - "median_us": 120.056374988053, - "min_us": 118.7377090100199, - "max_us": 123.96204101969488 - }, - { - "case": "construct_tree_validator", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 1.4287089870776981, 1.4239170122891665, 1.4178749988786876, - 1.4216659765224904, 1.4363749942276627, 1.4125409943517298, - 1.409125019563362, 1.4223339967429638, 1.4131249918136746 - ], - "median_us": 1.4216659765224904, - "min_us": 1.409125019563362, - "max_us": 1.4363749942276627 - }, - { - "case": "construct_array_validator", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 0.6187499966472387, 0.6141669873613864, 0.6125420040916651, - 0.6383330037351698, 0.6155000010039657, 0.614999997196719, - 0.6135420117061585, 0.6143749924376607, 0.6137909949757159 - ], - "median_us": 0.6143749924376607, - "min_us": 0.6125420040916651, - "max_us": 0.6383330037351698 - } - ] -} diff --git a/tools/evidence/2026-10-11-remaining-optimization/3.11-root-combined.json b/tools/evidence/2026-10-11-remaining-optimization/3.11-root-combined.json deleted file mode 100644 index 0148c10..0000000 --- a/tools/evidence/2026-10-11-remaining-optimization/3.11-root-combined.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "python": "3.11.15 (main, May 10 2026, 19:23:07) [Clang 22.1.3 ]", - "calls": 20000, - "repeats": 9, - "results": [ - { - "case": "custom-extract", - "samples_us": [ - 0.0645250009256415, 0.06326250004349276, 0.06301874964265153, - 0.06360834959195927, 0.06293955084402114, 0.06551874976139516, - 0.06654794997302815, 0.06481039890786633, 0.06545210053445771 - ], - "median_us": 0.0645250009256415 - }, - { - "case": "custom-strict", - "samples_us": [ - 3.97649375081528, 3.9548041502712294, 3.960902050312143, - 3.95844165032031, 3.946231250301935, 3.94416664930759, - 3.950035449815914, 3.941385399957653, 3.9491687493864447 - ], - "median_us": 3.950035449815914 - } - ] -} diff --git a/tools/evidence/2026-10-11-remaining-optimization/3.11-root-dtype.json b/tools/evidence/2026-10-11-remaining-optimization/3.11-root-dtype.json deleted file mode 100644 index c8189fc..0000000 --- a/tools/evidence/2026-10-11-remaining-optimization/3.11-root-dtype.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "python": "3.11.15 (main, May 10 2026, 19:23:07) [Clang 22.1.3 ]", - "calls": 20000, - "repeats": 9, - "results": [ - { - "case": "custom-extract", - "samples_us": [ - 0.060125000891275704, 0.061004149029031396, 0.06185414968058467, - 0.061833350628148764, 0.06179170013638213, 0.06261874950723723, - 0.06394585070665926, 0.061758300580549985, 0.0617666490143165 - ], - "median_us": 0.06179170013638213 - }, - { - "case": "custom-strict", - "samples_us": [ - 4.053985449718311, 4.041481249441858, 4.033535400230903, - 4.145760399114806, 4.092006249993574, 4.0258792010718025, - 4.0136708004865795, 4.0285791488713585, 3.998466650955379 - ], - "median_us": 4.033535400230903 - } - ] -} diff --git a/tools/evidence/2026-10-11-remaining-optimization/3.11-root-main.json b/tools/evidence/2026-10-11-remaining-optimization/3.11-root-main.json deleted file mode 100644 index f01ef80..0000000 --- a/tools/evidence/2026-10-11-remaining-optimization/3.11-root-main.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "python": "3.11.15 (main, May 10 2026, 19:23:07) [Clang 22.1.3 ]", - "calls": 20000, - "repeats": 9, - "results": [ - { - "case": "custom-extract", - "samples_us": [ - 0.10010624973801896, 0.09277290082536638, 0.09735420026117936, - 0.09808960021473467, 0.09832499927142635, 0.09889790089800954, - 0.10050210112240165, 0.09910000080708414, 0.09863540035439655 - ], - "median_us": 0.09863540035439655 - }, - { - "case": "custom-strict", - "samples_us": [ - 4.1384145501069725, 4.133624999667518, 4.14836665004259, - 4.117877100361511, 4.13588124938542, 4.127693749614991, - 4.118310450576246, 4.215162499167491, 4.109856250579469 - ], - "median_us": 4.133624999667518 - } - ] -} diff --git a/tools/evidence/2026-10-11-remaining-optimization/3.11-root-shape.json b/tools/evidence/2026-10-11-remaining-optimization/3.11-root-shape.json deleted file mode 100644 index 9a9986f..0000000 --- a/tools/evidence/2026-10-11-remaining-optimization/3.11-root-shape.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "python": "3.11.15 (main, May 10 2026, 19:23:07) [Clang 22.1.3 ]", - "calls": 20000, - "repeats": 9, - "results": [ - { - "case": "custom-extract", - "samples_us": [ - 0.09484374895691872, 0.0975978997303173, 0.09764584974618629, - 0.09612084977561608, 0.09697500063339248, 0.09454374958295375, - 0.094972898659762, 0.09469585056649521, 0.09521044994471595 - ], - "median_us": 0.09521044994471595 - }, - { - "case": "custom-strict", - "samples_us": [ - 4.033456249453593, 4.003441699023824, 4.025700000056531, - 4.01940420124447, 4.00742499914486, 3.984493750613183, - 4.000006249407306, 4.0129708009772, 4.005241648701485 - ], - "median_us": 4.00742499914486 - } - ] -} diff --git a/tools/evidence/2026-10-11-remaining-optimization/3.14-hook-lookup-alternatives.json b/tools/evidence/2026-10-11-remaining-optimization/3.14-hook-lookup-alternatives.json deleted file mode 100644 index 1a591d9..0000000 --- a/tools/evidence/2026-10-11-remaining-optimization/3.14-hook-lookup-alternatives.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "python": "3.14.5 (main, May 10 2026, 19:20:57) [Clang 22.1.3 ]", - "calls": 1000000, - "repeats": 9, - "statements": { - "current_getattr": "getattr(Plain, '__beartype_state__', None)", - "weak_map_get": "weak_map.get(Plain)", - "guarded_weak_set": "type(Plain) is type and Plain in weak_set" - }, - "results": [ - { - "case": "current_getattr", - "samples_ns": [ - 13.12866699299775, 12.837166985264048, 12.944458023412153, - 13.219166023191065, 12.883415998658165, 13.010249997023493, - 13.017542019952089, 12.916000006953254, 12.923125002998859 - ], - "median_ns": 12.944458023412153 - }, - { - "case": "weak_map_get", - "samples_ns": [ - 41.94816600647755, 41.79016698617488, 41.02820801199414, - 40.84470801171847, 42.24362500826828, 41.36591698625125, - 40.943333005998284, 41.058083006646484, 41.10679199220613 - ], - "median_ns": 41.10679199220613 - }, - { - "case": "guarded_weak_set", - "samples_ns": [ - 53.78958399523981, 53.65870799869299, 53.79295800230466, - 53.46533301053569, 53.67337501957081, 53.4106669947505, - 53.57837499468587, 55.451624997658655, 57.48670801403932 - ], - "median_ns": 53.67337501957081 - } - ] -} diff --git a/tools/evidence/2026-10-11-remaining-optimization/3.14-proposal-combined.json b/tools/evidence/2026-10-11-remaining-optimization/3.14-proposal-combined.json deleted file mode 100644 index 1d7a061..0000000 --- a/tools/evidence/2026-10-11-remaining-optimization/3.14-proposal-combined.json +++ /dev/null @@ -1,430 +0,0 @@ -{ - "python": "3.14.5 (main, May 10 2026, 19:20:57) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit-Mach-O", - "machine": "arm64", - "bearshape_origin": "/private/tmp/remaining-bench-combined-proposal-3.14/lib/python3.14/site-packages/bearshape/__init__.py", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6", - "optree": "0.19.1" - }, - "results": [ - { - "case": "bare/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.01736659905873239, 0.017316796584054828, 0.01719159772619605, - 0.017324998043477535, 0.01754160039126873, 0.01694999518804252, - 0.01700000138953328, 0.016891799168661237, 0.01698340056464076 - ], - "median_us": 0.01719159772619605, - "min_us": 0.016891799168661237, - "max_us": 0.01754160039126873 - }, - { - "case": "native/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.09147499804385006, 0.0903417996596545, 0.09076659916900098, - 0.09152499842457473, 0.09060820448212326, 0.09079999872483313, - 0.09026660118252039, 0.0901999999769032, 0.09230839787051082 - ], - "median_us": 0.09076659916900098, - "min_us": 0.0901999999769032, - "max_us": 0.09230839787051082 - }, - { - "case": "strict/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 3.373416600516066, 3.345041797729209, 3.331991599407047, - 3.32833340507932, 3.313308401266113, 3.3266418031416833, - 3.332966601010412, 3.3892833977006376, 4.8905499977990985 - ], - "median_us": 3.332966601010412, - "min_us": 3.313308401266113, - "max_us": 4.8905499977990985 - }, - { - "case": "explicit/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 4.931308404775336, 4.7462500049732625, 4.849291604477912, - 4.824124998413026, 4.750158201204613, 4.725191596662626, - 4.715850000502542, 4.745516600087285, 4.695841600187123 - ], - "median_us": 4.7462500049732625, - "min_us": 4.695841600187123, - "max_us": 4.931308404775336 - }, - { - "case": "like/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 1.9477166002616286, 1.9440666015725583, 1.9389834022149444, - 1.9510750018525869, 1.9451418018434197, 1.9881083979271352, - 1.9729918043594807, 1.9630499999038875, 1.9746332021895796 - ], - "median_us": 1.9510750018525869, - "min_us": 1.9389834022149444, - "max_us": 1.9881083979271352 - }, - { - "case": "nested/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 8.247758401557803, 8.19709999486804, 8.2286250020843, 8.241208404069766, - 8.21197500335984, 8.205533202271909, 8.254866604693234, - 8.212558401282877, 8.216816803906113 - ], - "median_us": 8.216816803906113, - "min_us": 8.19709999486804, - "max_us": 8.254866604693234 - }, - { - "case": "value/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 6.978808395797387, 6.833883200306445, 6.878116604639217, - 6.961441598832607, 6.9348165998235345, 6.947983399732038, - 6.908549997024238, 6.90153319737874, 6.913741800235584 - ], - "median_us": 6.913741800235584, - "min_us": 6.833883200306445, - "max_us": 6.978808395797387 - }, - { - "case": "like-sequence/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.4353832006454468, 2.4520331993699074, 2.4369332008063793, - 2.428233396494761, 2.439983398653567, 2.4240665952675045, - 2.42603340302594, 2.4225083994679153, 2.4832415976561606 - ], - "median_us": 2.4353832006454468, - "min_us": 2.4225083994679153, - "max_us": 2.4832415976561606 - }, - { - "case": "diagnostic/3", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 64.15479199495167, 64.52299997908995, 64.6807920129504, - 66.88362499698997, 67.20862499787472, 65.36154198693112, - 63.470833003520966, 64.3144579953514, 78.13058298779652 - ], - "median_us": 64.6807920129504, - "min_us": 63.470833003520966, - "max_us": 78.13058298779652 - }, - { - "case": "bare/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.01747499918565154, 0.01705000177025795, 0.01657500397413969, - 0.017008400755003095, 0.01680839923210442, 0.016841600881889462, - 0.016858201706781983, 0.01685840543359518, 0.01673340448178351 - ], - "median_us": 0.016858201706781983, - "min_us": 0.01657500397413969, - "max_us": 0.01747499918565154 - }, - { - "case": "native/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.09695839835330844, 0.0916499993763864, 0.09217500337399542, - 0.09180000051856041, 0.09154159924946725, 0.092149997362867, - 0.0923000043258071, 0.0915084034204483, 0.09276659693568945 - ], - "median_us": 0.092149997362867, - "min_us": 0.0915084034204483, - "max_us": 0.09695839835330844 - }, - { - "case": "strict/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 3.3931333979126066, 3.3847583981696516, 3.3761249971576035, - 3.368624998256564, 3.3621084003243595, 3.4155665955040604, - 3.4039417980238795, 3.36848339647986, 3.3782499958761036 - ], - "median_us": 3.3782499958761036, - "min_us": 3.3621084003243595, - "max_us": 3.4155665955040604 - }, - { - "case": "explicit/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 4.770308401202783, 4.752033401746303, 4.766633198596537, - 4.764366801828146, 4.794558399589732, 4.771200002869591, - 4.754383198451251, 4.766183404717594, 4.787608399055898 - ], - "median_us": 4.766633198596537, - "min_us": 4.752033401746303, - "max_us": 4.794558399589732 - }, - { - "case": "like/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 1.9957331998739392, 1.9812499987892807, 1.9697832001838833, - 1.9861415959894657, 1.9826833973638713, 1.9815582025330514, - 1.9752668042201549, 1.964866800699383, 1.9707916013430804 - ], - "median_us": 1.9812499987892807, - "min_us": 1.964866800699383, - "max_us": 1.9957331998739392 - }, - { - "case": "nested/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 8.271116600371897, 8.283758402103558, 8.329258195590228, - 8.292283397167921, 8.299733197782189, 8.291158400243148, - 8.259441598784178, 8.309508196543902, 8.273908199043944 - ], - "median_us": 8.291158400243148, - "min_us": 8.259441598784178, - "max_us": 8.329258195590228 - }, - { - "case": "value/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 7.03694160329178, 6.931500002974644, 6.985450000502169, - 6.958258402300999, 6.987091799965128, 6.963058398105204, - 6.954608403611928, 6.952283199643716, 6.959149998147041 - ], - "median_us": 6.959149998147041, - "min_us": 6.931500002974644, - "max_us": 7.03694160329178 - }, - { - "case": "like-sequence/1000000", - "calls_per_repeat": 5, - "repeats": 9, - "samples_us": [ - 12571.733398362994, 12526.975001674145, 12446.750001981854, - 12159.650004468858, 12218.6915948987, 12011.499999789521, - 12773.641798412427, 12416.658399160951, 12486.458197236061 - ], - "median_us": 12446.750001981854, - "min_us": 12011.499999789521, - "max_us": 12773.641798412427 - }, - { - "case": "diagnostic/1000000", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 71.9045419828035, 71.38174999272451, 73.13266702112742, - 72.28941598441452, 70.45812500291504, 74.87987499916926, - 72.26504199206829, 70.42029200238176, 70.55604201741517 - ], - "median_us": 71.9045419828035, - "min_us": 70.42029200238176, - "max_us": 74.87987499916926 - }, - { - "case": "tree/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 5.915450002066791, 6.072574999416247, 5.864125001244247, - 5.8037999959196895, 5.895199999213219, 5.934475001413375, - 5.893666599877179, 5.896325001958758, 6.159691599896178 - ], - "median_us": 5.896325001958758, - "min_us": 5.8037999959196895, - "max_us": 6.159691599896178 - }, - { - "case": "tree-value/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 12.084891798440367, 11.97635839926079, 11.976074997801334, - 11.926491599297151, 12.033041595714167, 11.896833399077877, - 11.981725000077859, 11.996325000654906, 12.185883399797603 - ], - "median_us": 11.981725000077859, - "min_us": 11.896833399077877, - "max_us": 12.185883399797603 - }, - { - "case": "tree-composite/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 10.256600001594052, 10.301733401138335, 10.353508399566635, - 10.2778167987708, 10.203758400166407, 10.242941597243771, - 10.252524999668822, 11.44185839802958, 10.160141601227224 - ], - "median_us": 10.256600001594052, - "min_us": 10.160141601227224, - "max_us": 11.44185839802958 - }, - { - "case": "tree/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 160.474160220474, 161.00165958050638, 160.95915983896703, - 161.39168001245707, 162.84666024148464, 162.1149998391047, - 160.8033402590081, 160.13333981391042, 159.97999988030642 - ], - "median_us": 160.95915983896703, - "min_us": 159.97999988030642, - "max_us": 162.84666024148464 - }, - { - "case": "tree-value/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 249.00668009649962, 247.48665979132056, 244.21250040177256, - 247.84000008367002, 245.19250029698014, 244.32916019577533, - 245.68499997258186, 246.6483402531594, 249.82416012790054 - ], - "median_us": 246.6483402531594, - "min_us": 244.21250040177256, - "max_us": 249.82416012790054 - }, - { - "case": "tree-composite/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 317.96331983059645, 318.7758201966062, 321.91167993005365, - 317.73668015375733, 315.7983400160447, 314.27665962837636, - 318.2599996216595, 367.84583993721753, 318.9008199842647 - ], - "median_us": 318.2599996216595, - "min_us": 314.27665962837636, - "max_us": 367.84583993721753 - }, - { - "case": "multiaxis", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 5.095325002912432, 5.037508200621232, 5.0142584019340575, - 5.072708398802206, 4.972008400363848, 4.940724995685741, - 4.926108400104567, 4.8949581978376955, 4.899966600351036 - ], - "median_us": 4.972008400363848, - "min_us": 4.8949581978376955, - "max_us": 5.095325002912432 - }, - { - "case": "variadic", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 5.199016799451783, 5.258125002728775, 5.251758202211931, - 5.204091599443927, 5.234516796190292, 5.214191600680351, - 5.271583201829344, 5.252525000832975, 5.226916598621756 - ], - "median_us": 5.234516796190292, - "min_us": 5.199016799451783, - "max_us": 5.271583201829344 - }, - { - "case": "like-cast", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.185874996939674, 2.2010000015143305, 2.215983404312283, - 2.2246583946980536, 2.1931499999482185, 2.2177500010002404, - 2.162183402106166, 2.1857749961782247, 2.2134584025479853 - ], - "median_us": 2.2010000015143305, - "min_us": 2.162183402106166, - "max_us": 2.2246583946980536 - }, - { - "case": "extract-dtype", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.06904160254634917, 0.06690840236842632, 0.0676081981509924, - 0.06736660143360496, 0.06818340043537319, 0.06772499764338136, - 0.06730000022798777, 0.06814179942011833, 0.0676081981509924 - ], - "median_us": 0.0676081981509924, - "min_us": 0.06690840236842632, - "max_us": 0.06904160254634917 - }, - { - "case": "match-dtype", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.11419160291552544, 0.10929160052910447, 0.10924999951384962, - 0.11103340075351298, 0.11479160166345537, 0.11206659837625921, - 0.10565000120550394, 0.10567500139586627, 0.10847499943338335 - ], - "median_us": 0.10929160052910447, - "min_us": 0.10565000120550394, - "max_us": 0.11479160166345537 - }, - { - "case": "decorate_array", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 125.6312089972198, 124.05708397272974, 123.58791698352434, - 124.23633300932124, 127.06262501887977, 130.2699579973705, - 124.2185419832822, 125.7634999928996, 125.88095798855647 - ], - "median_us": 125.6312089972198, - "min_us": 123.58791698352434, - "max_us": 130.2699579973705 - }, - { - "case": "construct_tree_validator", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 1.4493750059045851, 1.4419580111280084, 1.4481249963864684, - 1.4396249898709357, 1.484792010160163, 1.393500017002225, - 1.4422079839278013, 1.4799580094404519, 1.4742499915882945 - ], - "median_us": 1.4481249963864684, - "min_us": 1.393500017002225, - "max_us": 1.484792010160163 - }, - { - "case": "construct_array_validator", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 0.6339579995255917, 0.6452079978771508, 0.6420419958885759, - 0.6340419931802899, 0.6535410066135228, 0.6409589841496199, - 0.6480000156443566, 0.6447090127039701, 0.6416249962057918 - ], - "median_us": 0.6420419958885759, - "min_us": 0.6339579995255917, - "max_us": 0.6535410066135228 - } - ] -} diff --git a/tools/evidence/2026-10-11-remaining-optimization/3.14-proposal-dtype.json b/tools/evidence/2026-10-11-remaining-optimization/3.14-proposal-dtype.json deleted file mode 100644 index ce17fcb..0000000 --- a/tools/evidence/2026-10-11-remaining-optimization/3.14-proposal-dtype.json +++ /dev/null @@ -1,430 +0,0 @@ -{ - "python": "3.14.5 (main, May 10 2026, 19:20:57) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit-Mach-O", - "machine": "arm64", - "bearshape_origin": "/private/tmp/remaining-bench-dtype-proposal-3.14/lib/python3.14/site-packages/bearshape/__init__.py", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6", - "optree": "0.19.1" - }, - "results": [ - { - "case": "bare/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.0176666013430804, 0.017374998424202204, 0.017583201406523585, - 0.017266598297283053, 0.017341598868370056, 0.017675000708550215, - 0.017583201406523585, 0.017516600200906396, 0.01741659943945706 - ], - "median_us": 0.017516600200906396, - "min_us": 0.017266598297283053, - "max_us": 0.017675000708550215 - }, - { - "case": "native/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.09220839710906148, 0.09209159761667252, 0.09177500032819808, - 0.09213339653797448, 0.09185840026475489, 0.09167499956674874, - 0.09147499804385006, 0.09061659802682698, 0.09197500185109675 - ], - "median_us": 0.09185840026475489, - "min_us": 0.09061659802682698, - "max_us": 0.09220839710906148 - }, - { - "case": "strict/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 3.5406833980232477, 3.532641800120473, 3.5400916007347405, - 3.5322083975188434, 3.534475003834814, 3.5487668006680906, - 3.5358999972231686, 3.552366601070389, 3.507325000828132 - ], - "median_us": 3.5358999972231686, - "min_us": 3.507325000828132, - "max_us": 3.552366601070389 - }, - { - "case": "explicit/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 4.958450002595782, 4.914016800466925, 5.297366599552333, - 4.7700249997433275, 4.785391595214605, 4.745608399389312, - 4.750308400252834, 4.780241596745327, 4.727733397157863 - ], - "median_us": 4.780241596745327, - "min_us": 4.727733397157863, - "max_us": 5.297366599552333 - }, - { - "case": "like/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 1.9810334022622555, 2.026541600935161, 1.9769250007811934, - 1.9882081949617714, 1.9981165998615324, 1.9719168019946665, - 1.989499997580424, 2.012200001627207, 2.006508404156193 - ], - "median_us": 1.989499997580424, - "min_us": 1.9719168019946665, - "max_us": 2.026541600935161 - }, - { - "case": "nested/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 8.374791604001075, 8.320674998685718, 8.307158399838954, - 8.32526659942232, 8.550858398666605, 8.310108399018645, - 8.34849159582518, 8.287233201554045, 8.320866600843146 - ], - "median_us": 8.320866600843146, - "min_us": 8.287233201554045, - "max_us": 8.550858398666605 - }, - { - "case": "value/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 6.928441597847268, 6.974766601342708, 6.921399995917454, - 6.931433401769027, 6.927575002191588, 6.847683200612664, - 6.900741800200194, 6.8341834004968405, 6.913758401060477 - ], - "median_us": 6.921399995917454, - "min_us": 6.8341834004968405, - "max_us": 6.974766601342708 - }, - { - "case": "like-sequence/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.4968584009911865, 2.448199997888878, 2.4668833997566253, - 2.4757334031164646, 2.4660165945533663, 2.4259834026452154, - 2.5024665985256433, 2.493016596417874, 2.5137831980828196 - ], - "median_us": 2.4757334031164646, - "min_us": 2.4259834026452154, - "max_us": 2.5137831980828196 - }, - { - "case": "diagnostic/3", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 66.11395801883191, 65.84458399447612, 64.86570899141952, - 64.73254199954681, 64.88770901341923, 64.78079201770015, - 63.62195801921189, 64.17774999863468, 64.01462497888133 - ], - "median_us": 64.78079201770015, - "min_us": 63.62195801921189, - "max_us": 66.11395801883191 - }, - { - "case": "bare/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.01779159647412598, 0.017275003483518958, 0.017058401135727763, - 0.01710839569568634, 0.017183402087539434, 0.017600000137463212, - 0.017258396837860346, 0.017358397599309683, 0.017291802214458585 - ], - "median_us": 0.017275003483518958, - "min_us": 0.017058401135727763, - "max_us": 0.01779159647412598 - }, - { - "case": "native/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.09188320254907012, 0.09142500348389149, 0.09087499929592013, - 0.09081659954972565, 0.09111679974012077, 0.09199180058203638, - 0.09090840467251837, 0.09129180107265711, 0.09086659993045032 - ], - "median_us": 0.09111679974012077, - "min_us": 0.09081659954972565, - "max_us": 0.09199180058203638 - }, - { - "case": "strict/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 3.5261499986518174, 3.5187916015274823, 3.493108198745176, - 3.509116597706452, 3.4607334004249424, 3.555475000757724, - 3.5493582021445036, 3.5487668006680906, 3.4608750022016466 - ], - "median_us": 3.5187916015274823, - "min_us": 3.4607334004249424, - "max_us": 3.555475000757724 - }, - { - "case": "explicit/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 4.911658196942881, 4.885108402231708, 4.904608201468363, - 4.90165000082925, 4.906300001312047, 4.91584159899503, - 4.894791601691395, 4.898041801061481, 4.97067499672994 - ], - "median_us": 4.904608201468363, - "min_us": 4.885108402231708, - "max_us": 4.97067499672994 - }, - { - "case": "like/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.0317999995313585, 2.0525832020211965, 2.021808398421854, - 2.0267918007448316, 2.050216600764543, 2.0260665973182768, - 1.9992084009572864, 1.9985750026535243, 1.9938500015996397 - ], - "median_us": 2.0260665973182768, - "min_us": 1.9938500015996397, - "max_us": 2.0525832020211965 - }, - { - "case": "nested/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 8.500516600906849, 8.49810839863494, 8.466233202489093, - 8.473158197011799, 8.500508399447426, 8.498916600365192, - 8.478941599605605, 8.46013340051286, 8.486925001488999 - ], - "median_us": 8.486925001488999, - "min_us": 8.46013340051286, - "max_us": 8.500516600906849 - }, - { - "case": "value/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 6.965825002407655, 6.935341598000377, 6.963716598693281, - 6.961183401290327, 6.902483198791742, 6.93764160387218, - 6.941650004591793, 6.915125000523403, 7.071749999886379 - ], - "median_us": 6.941650004591793, - "min_us": 6.902483198791742, - "max_us": 7.071749999886379 - }, - { - "case": "like-sequence/1000000", - "calls_per_repeat": 5, - "repeats": 9, - "samples_us": [ - 12532.349996035919, 11774.991598213091, 11918.43319684267, - 11950.891598826274, 12051.558401435614, 12007.274996722117, - 12108.391796937212, 12173.699995037168, 12086.52500063181 - ], - "median_us": 12051.558401435614, - "min_us": 11774.991598213091, - "max_us": 12532.349996035919 - }, - { - "case": "diagnostic/1000000", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 69.2644999944605, 67.83566600643098, 67.53587501589209, - 67.54375001764856, 68.0268750002142, 71.75845801248215, - 71.99145801132545, 69.73462499445304, 67.95641701319255 - ], - "median_us": 68.0268750002142, - "min_us": 67.53587501589209, - "max_us": 71.99145801132545 - }, - { - "case": "tree/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 5.80189999891445, 5.811666796216741, 5.761141795665026, - 5.736891599372029, 5.8178165985737, 5.821391800418496, - 5.819625000003725, 5.756824999116361, 5.796191800618544 - ], - "median_us": 5.80189999891445, - "min_us": 5.736891599372029, - "max_us": 5.821391800418496 - }, - { - "case": "tree-value/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 11.719708400778472, 11.796549998689443, 11.738008400425315, - 11.720241798320785, 11.732191598275676, 11.717250000219792, - 11.700299999210984, 11.702933203196153, 11.677208199398592 - ], - "median_us": 11.719708400778472, - "min_us": 11.677208199398592, - "max_us": 11.796549998689443 - }, - { - "case": "tree-composite/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 9.939066600054502, 9.933691599871963, 9.925916604697704, - 9.928650001529604, 9.97731660027057, 9.996083402074873, - 9.95155000127852, 9.959341597277671, 9.95427499874495 - ], - "median_us": 9.95155000127852, - "min_us": 9.925916604697704, - "max_us": 9.996083402074873 - }, - { - "case": "tree/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 170.28250033035874, 168.69000042788684, 169.53500045929104, - 169.2374999402091, 173.16000012215227, 172.37668042071164, - 171.19000025559217, 170.06915993988514, 170.6725003896281 - ], - "median_us": 170.28250033035874, - "min_us": 168.69000042788684, - "max_us": 173.16000012215227 - }, - { - "case": "tree-value/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 257.68166000489146, 258.7033197050914, 257.70000007469207, - 254.11250011529773, 254.6816796530038, 255.61583985108882, - 257.78250012081116, 257.4150002328679, 255.96165971364826 - ], - "median_us": 257.4150002328679, - "min_us": 254.11250011529773, - "max_us": 258.7033197050914 - }, - { - "case": "tree-composite/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 313.8608200242743, 310.38250017445534, 315.21583965513855, - 312.338339863345, 326.47582003846765, 326.72583998646587, - 315.2849996695295, 313.8008201494813, 310.9474998200312 - ], - "median_us": 313.8608200242743, - "min_us": 310.38250017445534, - "max_us": 326.72583998646587 - }, - { - "case": "multiaxis", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 5.317291599931195, 5.247733404394239, 5.3335500007960945, - 5.279841599985957, 5.464608402689919, 5.302641598973423, - 5.286866595270112, 5.319225002313033, 5.279891600366682 - ], - "median_us": 5.302641598973423, - "min_us": 5.247733404394239, - "max_us": 5.464608402689919 - }, - { - "case": "variadic", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 5.51254180027172, 5.526624998310581, 5.489058198872954, - 5.530549999093637, 5.46934999874793, 5.506024998612702, - 5.488725000759587, 5.566408397862688, 5.536341603146866 - ], - "median_us": 5.51254180027172, - "min_us": 5.46934999874793, - "max_us": 5.566408397862688 - }, - { - "case": "like-cast", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.2456749982666224, 2.229200000874698, 2.2210333961993456, - 2.2666916018351912, 2.2408084012567997, 2.220266603399068, - 2.2413667989894748, 2.244991803308949, 2.2312749992124736 - ], - "median_us": 2.2408084012567997, - "min_us": 2.220266603399068, - "max_us": 2.2666916018351912 - }, - { - "case": "extract-dtype", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.068116799229756, 0.06297500221990049, 0.06289180018939078, - 0.06291680037975311, 0.06419179844669998, 0.06593340076506138, - 0.06655820179730654, 0.06738340016454458, 0.06679159705527127 - ], - "median_us": 0.06593340076506138, - "min_us": 0.06289180018939078, - "max_us": 0.068116799229756 - }, - { - "case": "match-dtype", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.11045840219594538, 0.10864159557968378, 0.10900000343099236, - 0.10822499752976, 0.10827499791048467, 0.10774999973364174, - 0.10879160254262388, 0.1085166004486382, 0.10957499616779387 - ], - "median_us": 0.10864159557968378, - "min_us": 0.10774999973364174, - "max_us": 0.11045840219594538 - }, - { - "case": "decorate_array", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 124.45370902423747, 122.93870901339687, 122.3779579740949, - 122.19462500070222, 121.7464170185849, 121.42733301152475, - 121.78620899794623, 126.02833300479688, 123.24779201298952 - ], - "median_us": 122.3779579740949, - "min_us": 121.42733301152475, - "max_us": 126.02833300479688 - }, - { - "case": "construct_tree_validator", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 1.4563330041710287, 1.480750011978671, 1.4845409896224737, - 1.4884580159559846, 1.4541669806931168, 1.3633329945150763, - 1.3957920018583536, 1.4364169910550117, 1.4505000144708902 - ], - "median_us": 1.4541669806931168, - "min_us": 1.3633329945150763, - "max_us": 1.4884580159559846 - }, - { - "case": "construct_array_validator", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 0.5075420194771141, 0.4983750113751739, 0.49641699297353625, - 0.4895000020042062, 0.4972080059815198, 0.4963749961461872, - 0.5227499932516366, 0.5202920001465827, 0.5057079833932221 - ], - "median_us": 0.4983750113751739, - "min_us": 0.4895000020042062, - "max_us": 0.5227499932516366 - } - ] -} diff --git a/tools/evidence/2026-10-11-remaining-optimization/3.14-proposal-main.json b/tools/evidence/2026-10-11-remaining-optimization/3.14-proposal-main.json deleted file mode 100644 index a961583..0000000 --- a/tools/evidence/2026-10-11-remaining-optimization/3.14-proposal-main.json +++ /dev/null @@ -1,430 +0,0 @@ -{ - "python": "3.14.5 (main, May 10 2026, 19:20:57) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit-Mach-O", - "machine": "arm64", - "bearshape_origin": "/private/tmp/remaining-bench-main-proposal-3.14/lib/python3.14/site-packages/bearshape/__init__.py", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6", - "optree": "0.19.1" - }, - "results": [ - { - "case": "bare/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.016599998343735933, 0.016350002260878682, 0.016216799849644303, - 0.01706660259515047, 0.0171584018971771, 0.017066800501197577, - 0.01704999594949186, 0.01720840227790177, 0.017149996710941195 - ], - "median_us": 0.01706660259515047, - "min_us": 0.016216799849644303, - "max_us": 0.01720840227790177 - }, - { - "case": "native/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.0927999964915216, 0.09192500147037208, 0.0920081976801157, - 0.09290000307373703, 0.0927999964915216, 0.09235820034518838, - 0.09199159685522318, 0.09260000078938901, 0.09209159761667252 - ], - "median_us": 0.09235820034518838, - "min_us": 0.09192500147037208, - "max_us": 0.09290000307373703 - }, - { - "case": "strict/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 4.948699998203665, 4.901249997783452, 4.921066598035395, - 4.934899997897446, 4.916425002738833, 5.717983201611787, - 5.117216799408197, 4.965150001225993, 4.950275004375726 - ], - "median_us": 4.948699998203665, - "min_us": 4.901249997783452, - "max_us": 5.717983201611787 - }, - { - "case": "explicit/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 6.393458397360519, 6.363866600440815, 6.371116597438231, - 6.306125002447516, 6.340691598597914, 6.285283400211483, - 6.331050000153482, 6.33977500256151, 6.357658200431615 - ], - "median_us": 6.340691598597914, - "min_us": 6.285283400211483, - "max_us": 6.393458397360519 - }, - { - "case": "like/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.7967084024567157, 2.822633198229596, 2.8016416006721556, - 2.8234834026079625, 2.830641600303352, 2.8555250028148293, - 2.812391601037234, 2.825283200945705, 2.8246750007383525 - ], - "median_us": 2.8234834026079625, - "min_us": 2.7967084024567157, - "max_us": 2.8555250028148293 - }, - { - "case": "nested/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 11.813925002934411, 11.742049996973947, 11.752366600558162, - 11.78690840024501, 11.788608197821304, 11.755808198358864, - 11.757358198519796, 11.815975001081824, 11.72565000015311 - ], - "median_us": 11.757358198519796, - "min_us": 11.72565000015311, - "max_us": 11.815975001081824 - }, - { - "case": "value/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 8.723075001034886, 8.647516596829519, 8.645300002535805, - 8.648600004380569, 8.599458396201953, 8.604374999413267, - 8.609174995217472, 8.592741604661569, 8.667383197462186 - ], - "median_us": 8.645300002535805, - "min_us": 8.592741604661569, - "max_us": 8.723075001034886 - }, - { - "case": "like-sequence/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 3.52361659752205, 3.5071916005108505, 3.492375003406778, - 3.4964333986863494, 3.522541595157236, 3.7270917964633554, - 3.5313831991516054, 3.52149159880355, 3.545791801298037 - ], - "median_us": 3.522541595157236, - "min_us": 3.492375003406778, - "max_us": 3.7270917964633554 - }, - { - "case": "diagnostic/3", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 68.75249999575317, 67.22000002628192, 66.7282500071451, - 67.18108401400968, 67.13129201671109, 67.13304098229855, - 67.20437502372079, 66.87604199396446, 67.21137501881458 - ], - "median_us": 67.18108401400968, - "min_us": 66.7282500071451, - "max_us": 68.75249999575317 - }, - { - "case": "bare/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.016208196757361293, 0.016141601372510195, 0.016250001499429345, - 0.01709179487079382, 0.016866601072251797, 0.017033203039318323, - 0.017041596584022045, 0.017125002341344953, 0.01695820246823132 - ], - "median_us": 0.01695820246823132, - "min_us": 0.016141601372510195, - "max_us": 0.017125002341344953 - }, - { - "case": "native/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.09348319726996124, 0.09269160218536854, 0.09226679685525596, - 0.09199999622069299, 0.09168340475298464, 0.09182499488815665, - 0.09350820328108966, 0.0923667976167053, 0.09702499955892563 - ], - "median_us": 0.0923667976167053, - "min_us": 0.09168340475298464, - "max_us": 0.09702499955892563 - }, - { - "case": "strict/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 4.9302499974146485, 4.924674995709211, 4.924691602354869, - 4.95645820046775, 4.916375002358109, 5.245791800552979, - 4.976216598879546, 4.975966602796689, 4.952491604490206 - ], - "median_us": 4.952491604490206, - "min_us": 4.916375002358109, - "max_us": 5.245791800552979 - }, - { - "case": "explicit/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 6.4042999991215765, 6.378216797020286, 6.374574999790639, - 6.394841801375151, 6.3282249961048365, 6.3908084004651755, - 6.374241795856506, 6.40830000047572, 6.384225003421307 - ], - "median_us": 6.384225003421307, - "min_us": 6.3282249961048365, - "max_us": 6.40830000047572 - }, - { - "case": "like/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.8228000039234757, 2.8275249991565943, 2.8074750036466867, - 2.867608400993049, 2.817975002108142, 2.841933205490932, - 2.800308197038248, 2.8612417983822525, 2.8391750005539507 - ], - "median_us": 2.8275249991565943, - "min_us": 2.800308197038248, - "max_us": 2.867608400993049 - }, - { - "case": "nested/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 11.626891599735245, 11.631200002739206, 11.616541596595198, - 11.572800000431016, 11.60948320175521, 11.559400003170595, - 11.535108200041577, 11.58844159799628, 11.528158199507743 - ], - "median_us": 11.58844159799628, - "min_us": 11.528158199507743, - "max_us": 11.631200002739206 - }, - { - "case": "value/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 8.572383195860311, 8.584050001809373, 8.531966799637303, - 9.080991597147658, 8.84657499846071, 11.592499999096617, - 11.69242499745451, 8.729641599347815, 8.65792499971576 - ], - "median_us": 8.729641599347815, - "min_us": 8.531966799637303, - "max_us": 11.69242499745451 - }, - { - "case": "like-sequence/1000000", - "calls_per_repeat": 5, - "repeats": 9, - "samples_us": [ - 12558.350001927465, 12226.974999066442, 12094.041600357741, - 11949.86660266295, 12343.091604998335, 12468.258402077481, - 12430.391600355506, 11914.475000230595, 11704.183195251971 - ], - "median_us": 12226.974999066442, - "min_us": 11704.183195251971, - "max_us": 12558.350001927465 - }, - { - "case": "diagnostic/1000000", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 75.85479199769907, 73.44883400946856, 75.19320800201967, - 74.62549998308532, 75.15712501481175, 73.719208012335, - 73.81533397710882, 73.5655409807805, 73.40766699053347 - ], - "median_us": 73.81533397710882, - "min_us": 73.40766699053347, - "max_us": 75.85479199769907 - }, - { - "case": "tree/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 7.499599998118356, 7.482433196855709, 7.4850333970971406, - 7.4616333993617445, 7.4957249977160245, 7.472641597269103, - 7.406600000103936, 7.472533395048231, 7.508350000716746 - ], - "median_us": 7.482433196855709, - "min_us": 7.406600000103936, - "max_us": 7.508350000716746 - }, - { - "case": "tree-value/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 13.566816598176956, 13.438499998301268, 14.107266598148271, - 14.297441794769838, 14.100758399581537, 15.364833403145894, - 16.48129160166718, 13.711766601772979, 13.71998320100829 - ], - "median_us": 14.100758399581537, - "min_us": 13.438499998301268, - "max_us": 16.48129160166718 - }, - { - "case": "tree-composite/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 11.016933398786932, 10.964833403704688, 11.015508399577811, - 10.916091600665823, 10.93573319958523, 10.921383404638618, - 11.012825003126636, 10.92237500124611, 10.902308201184496 - ], - "median_us": 10.93573319958523, - "min_us": 10.902308201184496, - "max_us": 11.016933398786932 - }, - { - "case": "tree/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 314.61415986996144, 312.32665991410613, 317.4191800644621, - 313.9250003732741, 312.0516595663503, 311.1908200662583, - 316.7699999175966, 316.0583198769018, 323.2591599225998 - ], - "median_us": 314.61415986996144, - "min_us": 311.1908200662583, - "max_us": 323.2591599225998 - }, - { - "case": "tree-value/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 593.2733399095014, 605.7841604342684, 587.2274999273941, - 528.9400002220646, 413.03416015580297, 406.0941800707951, - 409.5966601744294, 401.8691595410928, 404.7683399403468 - ], - "median_us": 413.03416015580297, - "min_us": 401.8691595410928, - "max_us": 605.7841604342684 - }, - { - "case": "tree-composite/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 395.7691602408886, 396.4908403577283, 393.61834002193063, - 394.90832015872, 393.10250023845583, 395.91250009834766, - 390.8050002064556, 394.70165967941284, 393.2974999770522 - ], - "median_us": 394.70165967941284, - "min_us": 390.8050002064556, - "max_us": 396.4908403577283 - }, - { - "case": "multiaxis", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 6.929191603558138, 6.920025002909824, 6.928591796895489, - 6.967624998651445, 6.945424998411909, 6.9245418009813875, - 6.939883198356256, 6.930508400546387, 7.026624999707565 - ], - "median_us": 6.930508400546387, - "min_us": 6.920025002909824, - "max_us": 7.026624999707565 - }, - { - "case": "variadic", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 7.118841598276049, 7.104166597127914, 7.098850002512336, - 7.063375000143424, 7.097158400574699, 7.062533200951293, - 7.081274996744469, 7.1165834029670805, 7.083250000141561 - ], - "median_us": 7.097158400574699, - "min_us": 7.062533200951293, - "max_us": 7.118841598276049 - }, - { - "case": "like-cast", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 3.2593749987427145, 3.2445418008137494, 3.2420250005088747, - 3.257041599135846, 3.2504082017112523, 3.206158196553588, - 3.2249832001980394, 3.2477250031661242, 3.2037166005466133 - ], - "median_us": 3.2445418008137494, - "min_us": 3.2037166005466133, - "max_us": 3.2593749987427145 - }, - { - "case": "extract-dtype", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.7090249971952289, 0.6891417957376689, 0.6841166003141552, - 0.7034250011201948, 0.68475820007734, 0.7010666013229638, - 0.6969083973672241, 0.6839167966973037, 0.6977499986533076 - ], - "median_us": 0.6969083973672241, - "min_us": 0.6839167966973037, - "max_us": 0.7090249971952289 - }, - { - "case": "match-dtype", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.7718583976384252, 0.7609583961311728, 0.7736916013527662, - 0.7622416014783084, 0.7711665995884687, 0.770075002219528, - 0.7578834018204361, 0.7746916031464934, 0.763041595928371 - ], - "median_us": 0.770075002219528, - "min_us": 0.7578834018204361, - "max_us": 0.7746916031464934 - }, - { - "case": "decorate_array", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 131.27841701498255, 131.85775000602007, 132.08091698470525, - 123.8379169953987, 124.21295899548568, 123.57429202529602, - 126.6521250072401, 124.94791598874144, 124.65891701867804 - ], - "median_us": 124.94791598874144, - "min_us": 123.57429202529602, - "max_us": 132.08091698470525 - }, - { - "case": "construct_tree_validator", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 1.443124987417832, 1.4797920011915267, 1.5250419965013862, - 1.4549579937011003, 1.4741249906364828, 1.4882500108797103, - 1.4375419996213168, 1.4599999994970858, 1.4712910051457584 - ], - "median_us": 1.4712910051457584, - "min_us": 1.4375419996213168, - "max_us": 1.5250419965013862 - }, - { - "case": "construct_array_validator", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 0.5181250162422657, 0.5067079910077155, 0.509290985064581, - 0.5048750026617199, 0.5167089984752238, 0.512166996486485, - 0.5143749876879156, 0.5097079847473651, 0.5118330009281635 - ], - "median_us": 0.5118330009281635, - "min_us": 0.5048750026617199, - "max_us": 0.5181250162422657 - } - ] -} diff --git a/tools/evidence/2026-10-11-remaining-optimization/3.14-proposal-ordinary.json b/tools/evidence/2026-10-11-remaining-optimization/3.14-proposal-ordinary.json deleted file mode 100644 index 4fd9f24..0000000 --- a/tools/evidence/2026-10-11-remaining-optimization/3.14-proposal-ordinary.json +++ /dev/null @@ -1,189 +0,0 @@ -{ - "python": "3.14.5 (main, May 10 2026, 19:20:57) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit-Mach-O", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6" - }, - "calls": 10000, - "repeats": 9, - "results": [ - { - "case": "native", - "correct": true, - "first_call_us": 0.916, - "median_us": 0.09447500051464885, - "samples_us": [ - 0.09257909841835499, 0.09355840156786144, 0.09308750159107149, - 0.0945459003560245, 0.09447500051464885, 0.09457500127609819, - 0.09518330043647438, 0.09428749908693135, 0.0951916998019442 - ] - }, - { - "case": "forward-resolved-stateless", - "correct": true, - "first_call_us": 25.084, - "median_us": 0.5016083014197648, - "samples_us": [ - 0.49759579997044057, 0.5016083014197648, 0.5023333971621469, - 0.5031833017710596, 0.5414416984422132, 0.49582080100663006, - 0.49609589914325625, 0.500662499689497, 0.5074707994936034 - ] - }, - { - "case": "forward-unselected", - "correct": true, - "first_call_us": 3.125, - "median_us": 0.09082499891519547, - "samples_us": [ - 0.09224999812431633, 0.09082499891519547, 0.09046670165844262, - 0.09143329807557166, 0.09147500095423311, 0.09362499986309558, - 0.08841249800752848, 0.08579170098528266, 0.08878330118022859 - ] - }, - { - "case": "forward-nested-stateless", - "correct": true, - "first_call_us": 14.416, - "median_us": 0.5564124992815778, - "samples_us": [ - 0.5622208991553634, 0.5564124992815778, 0.5605749989626929, - 0.5524000007426366, 0.5580374971032143, 0.5532915994990617, - 0.5559207987971604, 0.5567915999563411, 0.5499999999301508 - ] - }, - { - "case": "forward-tuple", - "correct": true, - "first_call_us": 75.75, - "median_us": 0.1748165988828987, - "samples_us": [ - 0.1742499996908009, 0.17415409965906292, 0.1748165988828987, - 0.1787790999514982, 0.17210000078193843, 0.1722958986647427, - 0.17657499993219972, 0.17709170060697943, 0.17487499862909317 - ] - }, - { - "case": "forward-mapping", - "correct": true, - "first_call_us": 77.166, - "median_us": 0.21998749871272594, - "samples_us": [ - 0.21660839847754687, 0.22979159839451313, 0.21998749871272594, - 0.21587919909507036, 0.2224541996838525, 0.2248208998935297, - 0.23387499968521297, 0.21789579768665135, 0.2153625013306737 - ] - }, - { - "case": "forward-nested-lists", - "correct": true, - "first_call_us": 135.916, - "median_us": 0.24292499874718487, - "samples_us": [ - 0.25844589981716126, 0.24292499874718487, 0.2419582975562662, - 0.2615542005514726, 0.2311167016159743, 0.24039590207394212, - 0.2425166981993243, 0.24497499980498105, 0.2468499995302409 - ] - }, - { - "case": "plugin-leaf", - "correct": true, - "first_call_us": 17.75, - "median_us": 0.5352833977667615, - "samples_us": [ - 0.5388208024669439, 0.5283040984068066, 0.5390292004449293, - 0.5347791011445224, 0.5330542015144601, 0.5352833977667615, - 0.5407541990280151, 0.522404199000448, 0.5388707999372855 - ] - }, - { - "case": "plugin-union-second", - "correct": true, - "first_call_us": 10.959, - "median_us": 0.939812499564141, - "samples_us": [ - 0.939812499564141, 0.9432500024558976, 0.9385125013068318, - 0.9374542016303167, 0.9420708025572821, 0.9423333016457036, - 0.9279500023694709, 0.938224999117665, 0.9400874987477437 - ] - }, - { - "case": "strict", - "correct": true, - "first_call_us": 93.375, - "median_us": 3.3132666983874515, - "samples_us": [ - 3.3343999995850027, 3.3132666983874515, 3.292549998150207, - 3.302950001670979, 3.3177250006701797, 3.3235208014957607, - 3.3054416009690613, 3.3509166998555884, 3.303391599911265 - ] - }, - { - "case": "explicit", - "correct": true, - "first_call_us": 35.667, - "median_us": 4.69515830045566, - "samples_us": [ - 4.688670800533146, 4.67257919954136, 4.702850000467151, - 4.708949997439049, 4.696124998736195, 4.671004202100448, - 4.69429999939166, 4.752541601192206, 4.69515830045566 - ] - }, - { - "case": "union-first", - "correct": true, - "first_call_us": 16.291, - "median_us": 4.469624999910593, - "samples_us": [ - 4.5638333016540855, 4.491562501061708, 4.5111792016541585, - 4.504083399660885, 4.469624999910593, 4.463662498164922, - 4.469599999720231, 4.448412501369603, 4.460724999080412 - ] - }, - { - "case": "union-second", - "correct": true, - "first_call_us": 14.916, - "median_us": 6.282995801302604, - "samples_us": [ - 6.305374999647029, 6.277179199969396, 6.2724499992327765, - 6.357712502358481, 6.282995801302604, 6.289491700590588, - 6.28910000086762, 6.25878749997355, 6.249683297937736 - ] - }, - { - "case": "union-explicit-second", - "correct": true, - "first_call_us": 30.417, - "median_us": 7.841420799377374, - "samples_us": [ - 7.841420799377374, 7.83837909984868, 7.822345898603089, - 7.8502749995095655, 7.797491701785475, 7.812858300167136, - 7.92565830051899, 8.432995798648335, 7.965800000238232 - ] - }, - { - "case": "union-all-failed", - "correct": true, - "first_call_us": 183.75, - "median_us": 6.527954101329669, - "samples_us": [ - 6.576491700252518, 6.525120901642367, 6.527954101329669, - 6.5264000004390255, 6.53631659806706, 6.553095899289474, - 6.539941599476151, 6.487158301752061, 6.494920901604928 - ] - }, - { - "case": "union-nested", - "correct": true, - "first_call_us": 621.209, - "median_us": 8.550450002076104, - "samples_us": [ - 8.45477499824483, 8.44408750126604, 8.59755419951398, 8.722054201643914, - 8.565008401637897, 8.623366701067425, 8.523287498974241, - 8.550450002076104, 8.531941700493917 - ] - } - ] -} diff --git a/tools/evidence/2026-10-11-remaining-optimization/3.14-proposal-shape.json b/tools/evidence/2026-10-11-remaining-optimization/3.14-proposal-shape.json deleted file mode 100644 index fc2be60..0000000 --- a/tools/evidence/2026-10-11-remaining-optimization/3.14-proposal-shape.json +++ /dev/null @@ -1,430 +0,0 @@ -{ - "python": "3.14.5 (main, May 10 2026, 19:20:57) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit-Mach-O", - "machine": "arm64", - "bearshape_origin": "/private/tmp/remaining-bench-shape-proposal-3.14/lib/python3.14/site-packages/bearshape/__init__.py", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6", - "optree": "0.19.1" - }, - "results": [ - { - "case": "bare/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.016391603276133537, 0.016125000547617674, 0.016108399722725153, - 0.015949999215081334, 0.015866599278524518, 0.01585839781910181, - 0.015958398580551147, 0.016425002831965685, 0.01613319618627429 - ], - "median_us": 0.016108399722725153, - "min_us": 0.01585839781910181, - "max_us": 0.016425002831965685 - }, - { - "case": "native/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.09344179998151958, 0.09125000215135515, 0.09424160234630108, - 0.09319160017184913, 0.0930915994103998, 0.09361660340800881, - 0.09472499950788915, 0.0926584005355835, 0.0939000048674643 - ], - "median_us": 0.09344179998151958, - "min_us": 0.09125000215135515, - "max_us": 0.09472499950788915 - }, - { - "case": "strict/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 4.831241600913927, 4.858883400447667, 4.789591598091647, - 4.799183399882168, 4.775216599227861, 4.77727500256151, - 4.7519334009848535, 4.782766802236438, 4.7345833969302475 - ], - "median_us": 4.782766802236438, - "min_us": 4.7345833969302475, - "max_us": 4.858883400447667 - }, - { - "case": "explicit/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 6.3143916020635515, 6.356333399889991, 6.356800004141405, - 6.300708401249722, 6.341516599059105, 6.34086659993045, - 6.493183196289465, 6.4592583978082985, 6.473149999510497 - ], - "median_us": 6.356333399889991, - "min_us": 6.300708401249722, - "max_us": 6.493183196289465 - }, - { - "case": "like/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.835941599914804, 2.826674998505041, 2.850974997272715, - 2.827424998395145, 2.8378749964758754, 2.839575003599748, - 2.830891596386209, 3.1525250000413507, 2.933074999600649 - ], - "median_us": 2.8378749964758754, - "min_us": 2.826674998505041, - "max_us": 3.1525250000413507 - }, - { - "case": "nested/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 11.578466597711667, 11.442341801011935, 11.472391802817583, - 11.361516802571714, 11.408083204878494, 11.262933199759573, - 11.316791595891118, 11.272108397679403, 11.248974996851757 - ], - "median_us": 11.361516802571714, - "min_us": 11.248974996851757, - "max_us": 11.578466597711667 - }, - { - "case": "value/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 8.603133202996105, 8.597766800085083, 8.584849996259436, - 8.586216601543128, 8.575224998639897, 8.595716598210856, - 8.586658397689462, 8.617908199084923, 8.56715000118129 - ], - "median_us": 8.586658397689462, - "min_us": 8.56715000118129, - "max_us": 8.617908199084923 - }, - { - "case": "like-sequence/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 3.3831165987066925, 3.3375417988281697, 3.359624999575317, - 3.3448082045651972, 3.3175499993376434, 3.346583404345438, - 3.3277167996857315, 3.4599750011693686, 3.4747415978927165 - ], - "median_us": 3.346583404345438, - "min_us": 3.3175499993376434, - "max_us": 3.4747415978927165 - }, - { - "case": "diagnostic/3", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 70.41512499563396, 66.82675000047311, 66.67754202499054, - 66.67258299421519, 66.51195898302831, 66.55087499530055, - 65.8042500144802, 66.32987500051968, 66.14887499017641 - ], - "median_us": 66.55087499530055, - "min_us": 65.8042500144802, - "max_us": 70.41512499563396 - }, - { - "case": "bare/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.0162916025146842, 0.016299996059387922, 0.016041600611060858, - 0.015966600039973855, 0.018800003454089165, 0.017316598678007722, - 0.018024997552856803, 0.017316604498773813, 0.016483396757394075 - ], - "median_us": 0.016483396757394075, - "min_us": 0.015966600039973855, - "max_us": 0.018800003454089165 - }, - { - "case": "native/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.08733340073376894, 0.0896250014193356, 0.09145000367425382, - 0.092374999076128, 0.09278319776058197, 0.0910665956325829, - 0.091366603737697, 0.09168339893221855, 0.09264999534934759 - ], - "median_us": 0.09145000367425382, - "min_us": 0.08733340073376894, - "max_us": 0.09278319776058197 - }, - { - "case": "strict/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 4.809033399214968, 4.787091800244525, 4.787624999880791, - 4.796233196975663, 4.799658403499052, 4.91829160018824, - 4.839316802099347, 4.824041604297236, 4.860066599212587 - ], - "median_us": 4.809033399214968, - "min_us": 4.787091800244525, - "max_us": 4.91829160018824 - }, - { - "case": "explicit/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 6.286608398659155, 6.333008396904916, 6.258600001456216, - 6.290024996269494, 6.301250000251457, 6.300733395619318, - 6.328666798071936, 6.3844499993138015, 6.309574999613687 - ], - "median_us": 6.301250000251457, - "min_us": 6.258600001456216, - "max_us": 6.3844499993138015 - }, - { - "case": "like/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.7637415973003954, 2.7241499978117645, 2.7269668004009873, - 2.763449994381517, 2.725741598987952, 2.7763749996665865, - 2.733658399665728, 2.752175001660362, 2.7745416038669646 - ], - "median_us": 2.752175001660362, - "min_us": 2.7241499978117645, - "max_us": 2.7763749996665865 - }, - { - "case": "nested/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 11.455791600747034, 11.44260840374045, 11.45445840083994, - 11.47425000090152, 11.46337499958463, 11.439050000626594, - 11.441375000867993, 11.424541601445526, 11.423224996542558 - ], - "median_us": 11.44260840374045, - "min_us": 11.423224996542558, - "max_us": 11.47425000090152 - }, - { - "case": "value/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 8.558833197457716, 8.55100839980878, 8.507258398458362, - 8.47865819814615, 8.515308203641325, 8.536349999485537, - 8.520241605583578, 8.735391800291836, 8.726874995045364 - ], - "median_us": 8.536349999485537, - "min_us": 8.47865819814615, - "max_us": 8.735391800291836 - }, - { - "case": "like-sequence/1000000", - "calls_per_repeat": 5, - "repeats": 9, - "samples_us": [ - 11935.483396518975, 11915.283399866894, 12214.325001696125, - 12154.633400496095, 12033.39159837924, 12206.300004618242, - 12034.708203282207, 11973.591597052291, 12180.824996903539 - ], - "median_us": 12034.708203282207, - "min_us": 11915.283399866894, - "max_us": 12214.325001696125 - }, - { - "case": "diagnostic/1000000", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 74.68504199641757, 73.38545899256133, 73.41204097610898, - 72.95483301277272, 73.59491600072943, 73.6201669787988, - 73.13508298830129, 72.93104199925438, 73.45604099100456 - ], - "median_us": 73.41204097610898, - "min_us": 72.93104199925438, - "max_us": 74.68504199641757 - }, - { - "case": "tree/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 7.317241601413116, 7.256341801257804, 7.237650000024587, - 7.291591801913455, 7.242216600570828, 7.234325003810227, - 7.226891594473273, 7.216183398850262, 7.262541598174721 - ], - "median_us": 7.242216600570828, - "min_us": 7.216183398850262, - "max_us": 7.317241601413116 - }, - { - "case": "tree-value/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 13.330858200788498, 13.33464159979485, 13.311616604914889, - 13.285108399577439, 13.277700002072379, 13.393675000406802, - 13.469341798918322, 13.86553340125829, 13.87354179751128 - ], - "median_us": 13.33464159979485, - "min_us": 13.277700002072379, - "max_us": 13.87354179751128 - }, - { - "case": "tree-composite/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 12.08946660044603, 11.30643340293318, 11.456600000383332, - 11.384941596770659, 11.419149994617328, 11.32683340110816, - 12.669266597367823, 11.215408402495086, 11.007425002753735 - ], - "median_us": 11.384941596770659, - "min_us": 11.007425002753735, - "max_us": 12.669266597367823 - }, - { - "case": "tree/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 299.0333398338407, 305.40581967215985, 305.2358399145305, - 308.29166003968567, 302.9299998888746, 301.28000013064593, - 301.0899998480454, 297.3483398091048, 300.7583401631564 - ], - "median_us": 301.28000013064593, - "min_us": 297.3483398091048, - "max_us": 308.29166003968567 - }, - { - "case": "tree-value/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 389.1058196313679, 398.00249971449375, 416.6441800771281, - 402.03665965236723, 392.6250000949949, 386.7266600718722, - 387.2574999695644, 387.8499998245388, 384.7491799388081 - ], - "median_us": 389.1058196313679, - "min_us": 384.7491799388081, - "max_us": 416.6441800771281 - }, - { - "case": "tree-composite/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 387.30750035028905, 387.25165999494493, 384.0300004230812, - 384.90334001835436, 383.7841597851366, 384.359160088934, - 385.32583974301815, 383.31917952746153, 386.0274999169633 - ], - "median_us": 384.90334001835436, - "min_us": 383.31917952746153, - "max_us": 387.30750035028905 - }, - { - "case": "multiaxis", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 6.501099996967241, 6.507958396105096, 6.516999995801598, - 6.46941660088487, 6.4740250003524125, 6.533116800710559, - 6.457091600168496, 6.486933201085776, 6.438674998935312 - ], - "median_us": 6.486933201085776, - "min_us": 6.438674998935312, - "max_us": 6.533116800710559 - }, - { - "case": "variadic", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 7.156675000442192, 6.963775004260242, 7.021258398890495, - 6.959625001763925, 6.916600000113249, 6.857158394996077, - 6.859416601946577, 6.838933401741087, 6.811458198353648 - ], - "median_us": 6.916600000113249, - "min_us": 6.811458198353648, - "max_us": 7.156675000442192 - }, - { - "case": "like-cast", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 3.1055831990670413, 3.0984750017523766, 3.1061834015417844, - 3.1007250014226884, 3.0986750032752752, 3.1649750017095357, - 3.1057249987497926, 3.131433197995648, 3.1742832041345537 - ], - "median_us": 3.1057249987497926, - "min_us": 3.0984750017523766, - "max_us": 3.1742832041345537 - }, - { - "case": "extract-dtype", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.7103833951987326, 0.7219750026706606, 0.7151750032790005, - 0.7150584016926587, 0.7115915999747813, 0.7150915975216776, - 0.7122165989130735, 0.7180750020779669, 0.7093334046658128 - ], - "median_us": 0.7150584016926587, - "min_us": 0.7093334046658128, - "max_us": 0.7219750026706606 - }, - { - "case": "match-dtype", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.7736500003375113, 0.7683250005356967, 0.7662667951080948, - 0.764983199769631, 0.75481659732759, 0.7720749999862164, - 0.7618165982421488, 0.7620749995112419, 0.759683403884992 - ], - "median_us": 0.764983199769631, - "min_us": 0.75481659732759, - "max_us": 0.7736500003375113 - }, - { - "case": "decorate_array", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 130.37254099617712, 131.92462499137037, 124.47700000484474, - 123.08816699078307, 123.5070000111591, 122.47000000206754, - 122.42654201691039, 123.87491698609665, 124.00787501246668 - ], - "median_us": 123.87491698609665, - "min_us": 122.42654201691039, - "max_us": 131.92462499137037 - }, - { - "case": "construct_tree_validator", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 1.4495420036837459, 1.4422919775824994, 1.4484170242212713, - 1.4404580288100988, 1.452249998692423, 1.4001250092405826, - 1.4486660074908286, 1.4509159955196083, 1.4575410168617964 - ], - "median_us": 1.4486660074908286, - "min_us": 1.4001250092405826, - "max_us": 1.4575410168617964 - }, - { - "case": "construct_array_validator", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 0.6497499998658895, 0.6343749992083758, 0.6347919988911599, - 0.6307500007096678, 0.6237089983187616, 0.6440409924834967, - 0.596541998675093, 0.5830419831909239, 0.582000007852912 - ], - "median_us": 0.6307500007096678, - "min_us": 0.582000007852912, - "max_us": 0.6497499998658895 - } - ] -} diff --git a/tools/evidence/2026-10-11-remaining-optimization/3.14-released-combined.json b/tools/evidence/2026-10-11-remaining-optimization/3.14-released-combined.json deleted file mode 100644 index 222c7ca..0000000 --- a/tools/evidence/2026-10-11-remaining-optimization/3.14-released-combined.json +++ /dev/null @@ -1,430 +0,0 @@ -{ - "python": "3.14.5 (main, May 10 2026, 19:20:57) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit-Mach-O", - "machine": "arm64", - "bearshape_origin": "/private/tmp/remaining-bench-combined-released-3.14/lib/python3.14/site-packages/bearshape/__init__.py", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6", - "optree": "0.19.1" - }, - "results": [ - { - "case": "bare/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.01823340426199138, 0.017783400835469365, 0.01754160039126873, - 0.017291598487645388, 0.017408200073987246, 0.017333199502900243, - 0.017399998614564538, 0.017166801262646914, 0.017216597916558385 - ], - "median_us": 0.017399998614564538, - "min_us": 0.017166801262646914, - "max_us": 0.01823340426199138 - }, - { - "case": "native/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.08930820040404797, 0.08858320070430636, 0.08827499696053565, - 0.0891166040673852, 0.08862499962560833, 0.08772499859333038, - 0.08822500240057707, 0.0879583996720612, 0.08820000221021473 - ], - "median_us": 0.08827499696053565, - "min_us": 0.08772499859333038, - "max_us": 0.08930820040404797 - }, - { - "case": "strict/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 3.623925003921613, 3.67077499977313, 3.633824997814372, - 3.634325001621619, 3.6058168043382466, 3.5993500030599535, - 3.616383404005319, 3.633683198131621, 3.585724998265505 - ], - "median_us": 3.623925003921613, - "min_us": 3.585724998265505, - "max_us": 3.67077499977313 - }, - { - "case": "explicit/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 4.947774996981025, 4.949641600251198, 4.9524915986694396, - 4.950058402027935, 4.931141604902223, 4.996458196546882, - 4.9190417979843915, 4.959008400328457, 4.960733198095113 - ], - "median_us": 4.950058402027935, - "min_us": 4.9190417979843915, - "max_us": 4.996458196546882 - }, - { - "case": "like/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.0366584009025246, 2.0338250033091754, 2.053566597169265, - 2.036866603884846, 2.0220083999447525, 2.040083397878334, - 2.0332583982963115, 2.0541500009130687, 2.0407333970069885 - ], - "median_us": 2.036866603884846, - "min_us": 2.0220083999447525, - "max_us": 2.0541500009130687 - }, - { - "case": "nested/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 10.09190840413794, 10.070099995937198, 10.079616599250585, - 10.068908397806808, 10.1491333974991, 10.130658198613673, - 10.102408402599394, 10.132925002835691, 10.072625003522262 - ], - "median_us": 10.09190840413794, - "min_us": 10.068908397806808, - "max_us": 10.1491333974991 - }, - { - "case": "value/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 7.6724417973309755, 7.661724998615682, 7.654708198970184, - 7.647099997848272, 7.696400000713766, 7.634591602254659, - 7.585791801102459, 7.619049999630079, 7.706416602013633 - ], - "median_us": 7.654708198970184, - "min_us": 7.585791801102459, - "max_us": 7.706416602013633 - }, - { - "case": "like-sequence/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.5323331996332854, 2.545433398336172, 2.524799999082461, - 2.5098750018514693, 2.5257834000512958, 2.5801166018936783, - 2.5137082033324987, 2.4825500033330172, 2.4732665973715484 - ], - "median_us": 2.524799999082461, - "min_us": 2.4732665973715484, - "max_us": 2.5801166018936783 - }, - { - "case": "diagnostic/3", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 55.269749980652705, 55.12116602039896, 53.96579101216048, - 54.11241602269001, 54.59145799977705, 54.90541597828269, - 54.18441598885693, 53.86562499916181, 54.42970900912769 - ], - "median_us": 54.42970900912769, - "min_us": 53.86562499916181, - "max_us": 55.269749980652705 - }, - { - "case": "bare/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.01680839923210442, 0.016499997582286596, 0.016708398470655084, - 0.017274997662752867, 0.017266604118049145, 0.017075001960620284, - 0.017166603356599808, 0.01704999594949186, 0.017075001960620284 - ], - "median_us": 0.017075001960620284, - "min_us": 0.016499997582286596, - "max_us": 0.017274997662752867 - }, - { - "case": "native/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.08798339986242354, 0.09420820279046893, 0.08523339638486505, - 0.08275840082205832, 0.08250820101238787, 0.08500000112690032, - 0.08610000368207693, 0.08728319662623107, 0.08753340225666761 - ], - "median_us": 0.08610000368207693, - "min_us": 0.08250820101238787, - "max_us": 0.09420820279046893 - }, - { - "case": "strict/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 3.619291604263708, 3.6290418007411063, 3.6078250035643578, - 3.6624083993956447, 3.6422665987629443, 4.636141599621624, - 3.672716801520437, 3.6938834004104137, 3.68089999537915 - ], - "median_us": 3.6624083993956447, - "min_us": 3.6078250035643578, - "max_us": 4.636141599621624 - }, - { - "case": "explicit/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 5.009216599864885, 5.0046833988744766, 5.0023666000925004, - 4.950058402027935, 5.098483397159725, 5.1002749998588115, - 4.986408201511949, 4.960500000743195, 4.966216598404571 - ], - "median_us": 5.0023666000925004, - "min_us": 4.950058402027935, - "max_us": 5.1002749998588115 - }, - { - "case": "like/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.052825002465397, 2.0658500026911497, 2.1771833999082446, - 2.053016802528873, 2.0835000032093376, 2.040275000035763, - 2.054175001103431, 2.0763081964105368, 2.05061660381034 - ], - "median_us": 2.054175001103431, - "min_us": 2.040275000035763, - "max_us": 2.1771833999082446 - }, - { - "case": "nested/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 10.116383200511336, 10.08881659945473, 10.206116596236825, - 10.12640839908272, 10.08833340019919, 10.100741597125307, - 10.128825000720099, 10.123916796874255, 10.086266597500071 - ], - "median_us": 10.116383200511336, - "min_us": 10.086266597500071, - "max_us": 10.206116596236825 - }, - { - "case": "value/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 7.5960334041155875, 7.604950002860278, 7.604866795009002, - 7.592383399605751, 7.597124995663762, 7.573683396913111, - 7.582475000526756, 7.612816599430516, 7.575824996456504 - ], - "median_us": 7.5960334041155875, - "min_us": 7.573683396913111, - "max_us": 7.612816599430516 - }, - { - "case": "like-sequence/1000000", - "calls_per_repeat": 5, - "repeats": 9, - "samples_us": [ - 12276.208202820271, 11697.508400538936, 11578.100000042468, - 11562.33319779858, 11856.575001729652, 11759.083403740078, - 11787.916597677395, 11637.32500281185, 11660.250002751127 - ], - "median_us": 11697.508400538936, - "min_us": 11562.33319779858, - "max_us": 12276.208202820271 - }, - { - "case": "diagnostic/1000000", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 61.913832993013784, 60.62545799068175, 59.98512500082143, - 60.452666017226875, 60.342415992636234, 60.472667013527825, - 60.2540840045549, 60.239250015001744, 60.059041978092864 - ], - "median_us": 60.342415992636234, - "min_us": 59.98512500082143, - "max_us": 61.913832993013784 - }, - { - "case": "tree/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 5.975008197128773, 5.972716800170019, 5.963116599014029, - 5.947133403969929, 5.960224999580532, 6.00577499717474, - 5.951849999837577, 6.201933202100918, 5.991291801910847 - ], - "median_us": 5.972716800170019, - "min_us": 5.947133403969929, - "max_us": 6.201933202100918 - }, - { - "case": "tree-value/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 16.728425002656877, 16.67555840103887, 16.63340000086464, - 16.60740000079386, 16.698249999899417, 16.64424159680493, - 16.67097500176169, 16.555416595656425, 16.74450840218924 - ], - "median_us": 16.67097500176169, - "min_us": 16.555416595656425, - "max_us": 16.74450840218924 - }, - { - "case": "tree-composite/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 9.43815820501186, 9.422991797327995, 9.380683401832357, - 9.432516596280038, 9.432766801910475, 9.389158198609948, - 9.37663340009749, 9.504275000654161, 9.427341801347211 - ], - "median_us": 9.427341801347211, - "min_us": 9.37663340009749, - "max_us": 9.504275000654161 - }, - { - "case": "tree/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 161.9358401512727, 157.91499987244606, 161.68749949429184, - 159.98749993741512, 163.3641601074487, 156.62916004657745, - 157.7974995598197, 160.2983201155439, 159.36581999994814 - ], - "median_us": 159.98749993741512, - "min_us": 156.62916004657745, - "max_us": 163.3641601074487 - }, - { - "case": "tree-value/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 251.40915997326374, 252.67250020988286, 251.72583991661668, - 250.3191604046151, 248.3008400304243, 250.9508398361504, - 254.51334018725902, 251.80167984217405, 265.48416004516184 - ], - "median_us": 251.72583991661668, - "min_us": 248.3008400304243, - "max_us": 265.48416004516184 - }, - { - "case": "tree-composite/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 210.89500049129128, 210.33249970059842, 208.56334012933075, - 205.79666015692055, 204.25581955350935, 206.74334024079144, - 222.8233200730756, 222.23332023713738, 219.46416003629565 - ], - "median_us": 210.33249970059842, - "min_us": 204.25581955350935, - "max_us": 222.8233200730756 - }, - { - "case": "multiaxis", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 5.4231834015809, 5.296624999027699, 5.287591798696667, - 5.767991597531363, 5.287758202757686, 5.217416596133262, - 5.224824999459088, 5.267966800602153, 5.190433404641226 - ], - "median_us": 5.287591798696667, - "min_us": 5.190433404641226, - "max_us": 5.767991597531363 - }, - { - "case": "variadic", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 5.574525002157316, 5.828308401396498, 5.619599996134639, - 5.51498340209946, 5.511383403791115, 5.516016605542973, - 5.534200003603473, 5.526400002418086, 5.603816796792671 - ], - "median_us": 5.534200003603473, - "min_us": 5.511383403791115, - "max_us": 5.828308401396498 - }, - { - "case": "like-cast", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.3794665990862995, 2.368716604541987, 2.2902333992533386, - 2.2574500006157905, 2.615574997616932, 2.3290415992960334, - 2.3060416046064347, 2.2977416054345667, 2.255158399930224 - ], - "median_us": 2.3060416046064347, - "min_us": 2.255158399930224, - "max_us": 2.615574997616932 - }, - { - "case": "extract-dtype", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.06788340397179127, 0.06999180186539888, 0.06932499818503857, - 0.06994159775786102, 0.06935000419616699, 0.068341800943017, - 0.06802499992772937, 0.06708319997414947, 0.06762500270269811 - ], - "median_us": 0.068341800943017, - "min_us": 0.06708319997414947, - "max_us": 0.06999180186539888 - }, - { - "case": "match-dtype", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.11072499910369515, 0.11114160297438502, 0.11124999728053808, - 0.1106166047975421, 0.11064160498790443, 0.11609159992076457, - 0.1124250004068017, 0.11500000255182385, 0.11453339830040932 - ], - "median_us": 0.11124999728053808, - "min_us": 0.1106166047975421, - "max_us": 0.11609159992076457 - }, - { - "case": "decorate_array", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 125.08454199996777, 120.94599998090416, 120.33029200392775, - 119.82995900325477, 119.7565000038594, 120.13383401790634, - 119.84987501637079, 119.69145899638534, 121.16249999962747 - ], - "median_us": 120.13383401790634, - "min_us": 119.69145899638534, - "max_us": 125.08454199996777 - }, - { - "case": "construct_tree_validator", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 1.4426250127144158, 1.392083999235183, 1.453208999009803, - 1.4593329979106784, 1.4603339950554073, 1.476000004913658, - 1.4643339964095503, 1.497374993050471, 1.4256249996833503 - ], - "median_us": 1.4593329979106784, - "min_us": 1.392083999235183, - "max_us": 1.497374993050471 - }, - { - "case": "construct_array_validator", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 0.6250000151339918, 0.6201670039445162, 0.6221669900696725, - 0.618582998868078, 0.6199589988682419, 0.6207500118762255, - 0.6311670003924519, 0.6231660081539303, 0.621834013145417 - ], - "median_us": 0.621834013145417, - "min_us": 0.618582998868078, - "max_us": 0.6311670003924519 - } - ] -} diff --git a/tools/evidence/2026-10-11-remaining-optimization/3.14-released-dtype.json b/tools/evidence/2026-10-11-remaining-optimization/3.14-released-dtype.json deleted file mode 100644 index ec937be..0000000 --- a/tools/evidence/2026-10-11-remaining-optimization/3.14-released-dtype.json +++ /dev/null @@ -1,430 +0,0 @@ -{ - "python": "3.14.5 (main, May 10 2026, 19:20:57) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit-Mach-O", - "machine": "arm64", - "bearshape_origin": "/private/tmp/remaining-bench-dtype-released-3.14/lib/python3.14/site-packages/bearshape/__init__.py", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6", - "optree": "0.19.1" - }, - "results": [ - { - "case": "bare/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.017658399883657694, 0.017516600200906396, 0.01749160001054406, - 0.017024995759129524, 0.017075001960620284, 0.01695820246823132, - 0.017324998043477535, 0.017491797916591167, 0.01734999823383987 - ], - "median_us": 0.01734999823383987, - "min_us": 0.01695820246823132, - "max_us": 0.017658399883657694 - }, - { - "case": "native/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.08885840070433915, 0.08725000079721212, 0.09005839820019901, - 0.08813340100459754, 0.08705819491297007, 0.08872500038705766, - 0.08746659732423723, 0.08829180151224136, 0.08714160067029297 - ], - "median_us": 0.08813340100459754, - "min_us": 0.08705819491297007, - "max_us": 0.09005839820019901 - }, - { - "case": "strict/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 3.8651084003504366, 3.792683396022767, 3.7697833962738514, - 3.7981833971571177, 3.772116801701486, 3.7867581995669752, - 3.7383750022854656, 3.7576749979052693, 3.773766598897055 - ], - "median_us": 3.773766598897055, - "min_us": 3.7383750022854656, - "max_us": 3.8651084003504366 - }, - { - "case": "explicit/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 5.116900004213676, 5.122349999146536, 5.05169999669306, - 5.107924999902025, 5.0379915977828205, 5.123291799100116, - 5.0478999968618155, 5.0722000014502555, 5.047866603126749 - ], - "median_us": 5.0722000014502555, - "min_us": 5.0379915977828205, - "max_us": 5.123291799100116 - }, - { - "case": "like/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.135516598355025, 2.1223083953373134, 2.1239916037302464, - 2.1553083963226527, 2.140766801312566, 2.1542417991440743, - 2.1147250023204833, 2.131033397745341, 2.1337416023015976 - ], - "median_us": 2.1337416023015976, - "min_us": 2.1147250023204833, - "max_us": 2.1553083963226527 - }, - { - "case": "nested/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 10.439425002550706, 10.4700418014545, 10.415583400754258, - 10.397966799791902, 10.4392416018527, 10.378449998097494, - 10.45040839817375, 10.440324997762218, 10.445824998896569 - ], - "median_us": 10.439425002550706, - "min_us": 10.378449998097494, - "max_us": 10.4700418014545 - }, - { - "case": "value/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 7.777500001247972, 7.717908202903345, 7.748474995605648, - 7.752925000386313, 7.819249999010935, 7.870299997739494, - 7.71473339991644, 7.759266800712794, 7.718166604172438 - ], - "median_us": 7.752925000386313, - "min_us": 7.71473339991644, - "max_us": 7.870299997739494 - }, - { - "case": "like-sequence/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.598483196925372, 2.6039584015961736, 2.595483197364956, - 2.570441598072648, 2.5638083985541016, 2.7748416003305465, - 2.6676250039599836, 2.6267416018527, 2.619308396242559 - ], - "median_us": 2.6039584015961736, - "min_us": 2.5638083985541016, - "max_us": 2.7748416003305465 - }, - { - "case": "diagnostic/3", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 55.09895799332298, 56.00725000840612, 53.877957980148494, - 53.63891599699855, 54.06637498526834, 53.73066701577045, - 53.572499979054555, 53.446166013600305, 53.41754201799631 - ], - "median_us": 53.73066701577045, - "min_us": 53.41754201799631, - "max_us": 56.00725000840612 - }, - { - "case": "bare/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.016783399041742086, 0.016341800801455975, 0.016158202197402716, - 0.017216597916558385, 0.01717500272206962, 0.01715839607641101, - 0.017275003483518958, 0.01726680202409625, 0.01891659921966493 - ], - "median_us": 0.01717500272206962, - "min_us": 0.016158202197402716, - "max_us": 0.01891659921966493 - }, - { - "case": "native/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.08823319803923368, 0.08651679963804781, 0.08655840065330267, - 0.08720820187591016, 0.08637499995529652, 0.08684999775141478, - 0.08697499870322645, 0.08726660162210464, 0.0875165977049619 - ], - "median_us": 0.08697499870322645, - "min_us": 0.08637499995529652, - "max_us": 0.08823319803923368 - }, - { - "case": "strict/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 3.8109000015538186, 3.820783394621685, 3.847775002941489, - 3.8066000037360936, 3.8084332016296685, 3.8332584023009986, - 3.8639083970338106, 3.840149997267872, 3.8488499994855374 - ], - "median_us": 3.8332584023009986, - "min_us": 3.8066000037360936, - "max_us": 3.8639083970338106 - }, - { - "case": "explicit/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 5.135316803352907, 5.136041803052649, 5.265774996951222, - 5.336158396676183, 5.12124159722589, 5.1224167982582, 5.133258400019258, - 5.100816598860547, 5.139391601551324 - ], - "median_us": 5.135316803352907, - "min_us": 5.100816598860547, - "max_us": 5.336158396676183 - }, - { - "case": "like/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.130999998189509, 2.1230168000329286, 2.137874998152256, - 2.127374999690801, 2.1315415971912444, 2.1630999981425703, - 2.1281333989463747, 2.1206916018854827, 2.122316602617502 - ], - "median_us": 2.1281333989463747, - "min_us": 2.1206916018854827, - "max_us": 2.1630999981425703 - }, - { - "case": "nested/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 10.475283395498991, 10.511883400613442, 10.443358396878466, - 10.479616798693314, 10.470874997554347, 10.46611659694463, - 10.703300003660843, 10.610666801221669, 10.704133403487504 - ], - "median_us": 10.479616798693314, - "min_us": 10.443358396878466, - "max_us": 10.704133403487504 - }, - { - "case": "value/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 7.896299997810274, 7.783149997703731, 7.77746660169214, - 7.796975004021078, 7.779474998824298, 7.744816801277921, - 7.790174998808652, 7.741058402461931, 7.996574998833239 - ], - "median_us": 7.783149997703731, - "min_us": 7.741058402461931, - "max_us": 7.996574998833239 - }, - { - "case": "like-sequence/1000000", - "calls_per_repeat": 5, - "repeats": 9, - "samples_us": [ - 12446.033401647583, 11684.274999424815, 11950.224998872727, - 11956.233199452981, 11906.358401756734, 11932.858399813995, - 11921.191599685699, 12058.033398352563, 11866.158398333937 - ], - "median_us": 11932.858399813995, - "min_us": 11684.274999424815, - "max_us": 12446.033401647583 - }, - { - "case": "diagnostic/1000000", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 62.34154201229103, 61.27558401203714, 60.92079100199044, - 61.01991701871157, 63.45358301769011, 63.79683400155045, - 61.17933298810385, 60.99749999702908, 61.03604199597612 - ], - "median_us": 61.17933298810385, - "min_us": 60.92079100199044, - "max_us": 63.79683400155045 - }, - { - "case": "tree/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 6.157741602510214, 6.214566598646343, 6.176258198684081, - 6.141650001518428, 6.154700001934543, 6.114458397496492, - 6.178091798210517, 6.112591602141038, 6.1476250004488975 - ], - "median_us": 6.154700001934543, - "min_us": 6.112591602141038, - "max_us": 6.214566598646343 - }, - { - "case": "tree-value/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 16.752324998378754, 16.650091600604355, 16.69730840367265, - 16.657325002597645, 16.585566801950336, 16.577483399305493, - 16.64160839864053, 16.632491600466892, 16.696341801434755 - ], - "median_us": 16.650091600604355, - "min_us": 16.577483399305493, - "max_us": 16.752324998378754 - }, - { - "case": "tree-composite/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 9.431883197976276, 9.39430000144057, 9.433175000594929, - 9.341125003993511, 9.3827250006143, 9.390291798627004, - 9.341041598236188, 9.36227499623783, 9.446100000059232 - ], - "median_us": 9.390291798627004, - "min_us": 9.341041598236188, - "max_us": 9.446100000059232 - }, - { - "case": "tree/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 174.29333995096385, 176.5458396403119, 171.7974996427074, - 174.0716799395159, 175.10167963337153, 172.93250013608485, - 176.58750002738088, 176.09584028832614, 171.19334021117538 - ], - "median_us": 174.29333995096385, - "min_us": 171.19334021117538, - "max_us": 176.58750002738088 - }, - { - "case": "tree-value/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 264.4175000023097, 269.32665961794555, 266.3991798181087, - 263.78665992524475, 266.1549998447299, 269.2083397414535, - 265.8374997554347, 264.0100003918633, 267.61916000396013 - ], - "median_us": 266.1549998447299, - "min_us": 263.78665992524475, - "max_us": 269.32665961794555 - }, - { - "case": "tree-composite/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 211.0591798555106, 215.30500031076372, 209.19915987178683, - 210.37334052380174, 209.89168027881533, 210.95581992994994, - 211.13082009833306, 213.45249959267676, 212.34999992884696 - ], - "median_us": 211.0591798555106, - "min_us": 209.19915987178683, - "max_us": 215.30500031076372 - }, - { - "case": "multiaxis", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 5.568274995312095, 5.632341798627749, 5.564716598019004, - 5.573374999221414, 5.564824998145923, 5.645800003549084, - 5.539624998345971, 5.5836500017903745, 5.554641596972942 - ], - "median_us": 5.568274995312095, - "min_us": 5.539624998345971, - "max_us": 5.645800003549084 - }, - { - "case": "variadic", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 5.842108197975904, 5.829983396688476, 5.872416601050645, - 5.850991600891575, 5.876208405243233, 5.842933198437095, - 5.814066604943946, 5.832816596375778, 5.8840334007982165 - ], - "median_us": 5.842933198437095, - "min_us": 5.814066604943946, - "max_us": 5.8840334007982165 - }, - { - "case": "like-cast", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.3564665985759348, 2.632058400195092, 2.4676250002812594, - 2.3861249967012554, 2.3634749988559633, 2.347533399006352, - 2.3473667970392853, 2.722633199300617, 2.3848249984439462 - ], - "median_us": 2.3848249984439462, - "min_us": 2.3473667970392853, - "max_us": 2.722633199300617 - }, - { - "case": "extract-dtype", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.06809160113334656, 0.06724160048179328, 0.06774159846827388, - 0.06763340206816792, 0.06744999554939568, 0.06683340179733932, - 0.06793320062570274, 0.06664999527856708, 0.0668168009724468 - ], - "median_us": 0.06744999554939568, - "min_us": 0.06664999527856708, - "max_us": 0.06809160113334656 - }, - { - "case": "match-dtype", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.10975840268656611, 0.10824159835465252, 0.10869179968722165, - 0.10795000125654042, 0.11613340466283262, 0.10780820157378912, - 0.11226679780520499, 0.11027500149793923, 0.10954159661196172 - ], - "median_us": 0.10954159661196172, - "min_us": 0.10780820157378912, - "max_us": 0.11613340466283262 - }, - { - "case": "decorate_array", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 121.60949999815784, 124.11670800065622, 120.56737500824966, - 120.19587500253692, 119.72845799755305, 119.8027920036111, - 119.16104101692326, 119.47100001270883, 122.46479201712646 - ], - "median_us": 120.19587500253692, - "min_us": 119.16104101692326, - "max_us": 124.11670800065622 - }, - { - "case": "construct_tree_validator", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 1.3711669889744371, 1.390707999235019, 1.423250010702759, - 1.4465409913100302, 1.4470839814748615, 1.4457910147029907, - 1.4846250123810023, 1.3860829931218177, 1.3915000017732382 - ], - "median_us": 1.423250010702759, - "min_us": 1.3711669889744371, - "max_us": 1.4846250123810023 - }, - { - "case": "construct_array_validator", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 0.509625009726733, 0.5120409769006073, 0.5103749863337725, - 0.5088330071885139, 0.49937498988583684, 0.49354200018569827, - 0.4967499990016222, 0.49837498227134347, 0.5082080024294555 - ], - "median_us": 0.5082080024294555, - "min_us": 0.49354200018569827, - "max_us": 0.5120409769006073 - } - ] -} diff --git a/tools/evidence/2026-10-11-remaining-optimization/3.14-released-main.json b/tools/evidence/2026-10-11-remaining-optimization/3.14-released-main.json deleted file mode 100644 index c0949fa..0000000 --- a/tools/evidence/2026-10-11-remaining-optimization/3.14-released-main.json +++ /dev/null @@ -1,430 +0,0 @@ -{ - "python": "3.14.5 (main, May 10 2026, 19:20:57) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit-Mach-O", - "machine": "arm64", - "bearshape_origin": "/private/tmp/remaining-bench-main-released-3.14/lib/python3.14/site-packages/bearshape/__init__.py", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6", - "optree": "0.19.1" - }, - "results": [ - { - "case": "bare/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.017183198360726237, 0.016141601372510195, 0.016041600611060858, - 0.015966803766787052, 0.01646659802645445, 0.016458198660984635, - 0.01713320380076766, 0.017041596584022045, 0.016300001880154014 - ], - "median_us": 0.016458198660984635, - "min_us": 0.015966803766787052, - "max_us": 0.017183198360726237 - }, - { - "case": "native/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.09103340562433004, 0.09040000149980187, 0.08968340116553009, - 0.09019160061143339, 0.0892584037501365, 0.09148340323008597, - 0.09001679718494415, 0.08931659976951778, 0.08994999807327986 - ], - "median_us": 0.09001679718494415, - "min_us": 0.0892584037501365, - "max_us": 0.09148340323008597 - }, - { - "case": "strict/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 5.321199999889359, 5.220091802766547, 5.219708202639595, - 5.249566800193861, 5.2284999983385205, 5.191741598537192, - 5.209650000324473, 5.1781833986751735, 5.226866801967844 - ], - "median_us": 5.220091802766547, - "min_us": 5.1781833986751735, - "max_us": 5.321199999889359 - }, - { - "case": "explicit/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 6.655524997040629, 6.643116602208465, 6.620041601127014, - 6.647691602120176, 6.690216599963605, 6.648083199979737, - 6.624366802861914, 6.623950001085177, 6.661133200395852 - ], - "median_us": 6.647691602120176, - "min_us": 6.620041601127014, - "max_us": 6.690216599963605 - }, - { - "case": "like/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.880808198824525, 2.8985915996599942, 2.9022500035353005, - 2.9485250008292496, 2.880141796777025, 2.9097166028805077, - 2.930683403974399, 2.925108402268961, 2.9240917996503413 - ], - "median_us": 2.9097166028805077, - "min_us": 2.880141796777025, - "max_us": 2.9485250008292496 - }, - { - "case": "nested/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 13.469941599760205, 13.424691796535626, 13.458024995634332, - 13.461500004632398, 13.43375820433721, 13.45151659916155, - 13.522416597697884, 13.433924998389557, 13.819050003075972 - ], - "median_us": 13.458024995634332, - "min_us": 13.424691796535626, - "max_us": 13.819050003075972 - }, - { - "case": "value/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 10.053958400385454, 9.563016594620422, 9.397241799160838, - 9.52231659903191, 9.409383195452392, 9.315924998372793, - 9.410691598895937, 9.974008199060336, 9.384824999142438 - ], - "median_us": 9.410691598895937, - "min_us": 9.315924998372793, - "max_us": 10.053958400385454 - }, - { - "case": "like-sequence/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 3.6377750046085566, 3.642283397493884, 3.71854180120863, - 3.6450000014156103, 3.719216596800834, 3.71879999875091, - 3.684233402600512, 3.6920165992341936, 3.7295832007657737 - ], - "median_us": 3.6920165992341936, - "min_us": 3.6377750046085566, - "max_us": 3.7295832007657737 - }, - { - "case": "diagnostic/3", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 63.48508401424624, 63.69866701425053, 61.71395900310017, - 62.065000005532056, 62.022750003961846, 62.213625002186745, - 61.78583297878504, 61.790957988705486, 63.3199580188375 - ], - "median_us": 62.065000005532056, - "min_us": 61.71395900310017, - "max_us": 63.69866701425053 - }, - { - "case": "bare/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.018333399202674627, 0.017908395966514945, 0.018433399964123964, - 0.0176666013430804, 0.017724995268508792, 0.01749160001054406, - 0.017466599820181727, 0.017341604689136147, 0.01731680240482092 - ], - "median_us": 0.0176666013430804, - "min_us": 0.01731680240482092, - "max_us": 0.018433399964123964 - }, - { - "case": "native/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.09013339877128601, 0.0896916026249528, 0.09044159669429064, - 0.08958340040408075, 0.09044159669429064, 0.08995840325951576, - 0.09054179536178708, 0.09050820372067392, 0.08965839515440166 - ], - "median_us": 0.09013339877128601, - "min_us": 0.08958340040408075, - "max_us": 0.09054179536178708 - }, - { - "case": "strict/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 5.310083401855081, 5.277858400950208, 5.247516802046448, - 5.296316597377881, 5.286808399250731, 5.301624996354803, - 5.301233404316008, 5.284991598455235, 5.366233398672193 - ], - "median_us": 5.296316597377881, - "min_us": 5.247516802046448, - "max_us": 5.366233398672193 - }, - { - "case": "explicit/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 6.969366600969806, 6.848966598045081, 6.876583397388458, - 6.789125001523644, 6.71942500048317, 6.787124997936189, - 6.780508201336488, 6.841433403315023, 6.748058396624401 - ], - "median_us": 6.789125001523644, - "min_us": 6.71942500048317, - "max_us": 6.969366600969806 - }, - { - "case": "like/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.891766797984019, 2.9183583974372596, 2.925024996511638, - 2.9816081980243325, 2.984283195110038, 2.9882333998102695, - 2.943641599267721, 3.0786333954893053, 3.2579334045294672 - ], - "median_us": 2.9816081980243325, - "min_us": 2.891766797984019, - "max_us": 3.2579334045294672 - }, - { - "case": "nested/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 14.658283401513472, 15.06357499747537, 14.014874998247251, - 15.233499999158084, 13.948608399368823, 15.70277499849908, - 14.645433198893443, 13.59089159523137, 13.583791599376127 - ], - "median_us": 14.645433198893443, - "min_us": 13.583791599376127, - "max_us": 15.70277499849908 - }, - { - "case": "value/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 9.566933399764821, 9.687983401818201, 9.654825000325218, - 10.014433396281675, 11.383783200290054, 9.637966600712389, - 9.546591795515269, 9.4049165956676, 10.0150250014849 - ], - "median_us": 9.654825000325218, - "min_us": 9.4049165956676, - "max_us": 11.383783200290054 - }, - { - "case": "like-sequence/1000000", - "calls_per_repeat": 5, - "repeats": 9, - "samples_us": [ - 12800.941802561283, 14267.491805367172, 13093.325000954792, - 12185.95840036869, 12546.26659792848, 12157.775001833215, - 14238.30819549039, 15297.5500037428, 12878.958403598517 - ], - "median_us": 12878.958403598517, - "min_us": 12157.775001833215, - "max_us": 15297.5500037428 - }, - { - "case": "diagnostic/1000000", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 72.48324999818578, 72.8698339953553, 78.30629200907424, - 69.65816600131802, 70.34874998498708, 68.38199999765493, - 68.6026250186842, 68.19737501791678, 68.65512498188764 - ], - "median_us": 69.65816600131802, - "min_us": 68.19737501791678, - "max_us": 78.30629200907424 - }, - { - "case": "tree/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 7.8333416022360325, 7.772674999432638, 7.813283399445936, - 7.876149995718151, 7.844699994893745, 7.873700000345707, - 7.897241599857807, 7.9463166010100394, 7.915433397283778 - ], - "median_us": 7.873700000345707, - "min_us": 7.772674999432638, - "max_us": 7.9463166010100394 - }, - { - "case": "tree-value/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 21.46226679906249, 19.909066596301273, 19.168233196251094, - 19.358983199344948, 19.198358204448596, 19.309941795654595, - 19.160908402409405, 19.1448331985157, 19.116766599472612 - ], - "median_us": 19.198358204448596, - "min_us": 19.116766599472612, - "max_us": 21.46226679906249 - }, - { - "case": "tree-composite/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 10.712008201517165, 10.627541597932577, 10.626450000563636, - 10.627424996346235, 10.64463320071809, 10.608166601741686, - 10.628158203326166, 10.60695819905959, 10.576700000092387 - ], - "median_us": 10.627424996346235, - "min_us": 10.576700000092387, - "max_us": 10.712008201517165 - }, - { - "case": "tree/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 314.83831990044564, 316.41666020732373, 317.0791600132361, - 315.51081978250295, 317.24250002298504, 316.334999515675, - 313.11583996284753, 315.2324998518452, 314.9408398894593 - ], - "median_us": 315.51081978250295, - "min_us": 313.11583996284753, - "max_us": 317.24250002298504 - }, - { - "case": "tree-value/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 412.1691599721089, 413.65584009326994, 415.1158395688981, - 416.4458398008719, 418.5458197025582, 414.65000016614795, - 416.66168021038175, 416.28418024629354, 414.8283402901143 - ], - "median_us": 415.1158395688981, - "min_us": 412.1691599721089, - "max_us": 418.5458197025582 - }, - { - "case": "tree-composite/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 291.64584004320204, 292.55834000650793, 291.64832027163357, - 289.8041595472023, 289.0566596761346, 289.9391599930823, - 324.51581966597587, 619.6183199062943, 360.12333992403 - ], - "median_us": 291.64832027163357, - "min_us": 289.0566596761346, - "max_us": 619.6183199062943 - }, - { - "case": "multiaxis", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 7.32504180050455, 7.318558404222131, 7.286833401303738, - 7.248949998756871, 7.286366599146277, 7.298733398783952, - 7.282808399759233, 7.281499996315688, 7.24284159950912 - ], - "median_us": 7.286366599146277, - "min_us": 7.24284159950912, - "max_us": 7.32504180050455 - }, - { - "case": "variadic", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 7.604983396595344, 7.622233399888501, 7.639791601104662, - 7.606950000626966, 7.637508399784565, 7.591791800223291, - 7.584391598356888, 7.581033400492743, 7.594800001243129 - ], - "median_us": 7.604983396595344, - "min_us": 7.581033400492743, - "max_us": 7.639791601104662 - }, - { - "case": "like-cast", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 3.363316599279642, 3.3682750014122576, 3.365425002994016, - 3.640108200488612, 3.5016333975363523, 3.3590084000024945, - 3.3802000049035996, 3.3444999950006604, 3.3741166000254452 - ], - "median_us": 3.3682750014122576, - "min_us": 3.3444999950006604, - "max_us": 3.640108200488612 - }, - { - "case": "extract-dtype", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.6977667973842472, 0.6944749969989061, 0.6851334008388221, - 0.6889581971336156, 0.6871999998111278, 0.6830500031355768, - 0.6835334002971649, 0.6804749951697886, 0.6850584002677351 - ], - "median_us": 0.6851334008388221, - "min_us": 0.6804749951697886, - "max_us": 0.6977667973842472 - }, - { - "case": "match-dtype", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.7500750012695789, 0.7498167979065329, 0.764908199198544, - 0.7470166019629687, 0.7501331972889602, 0.7454334001522511, - 0.7434418017510325, 0.7543165993411094, 0.7565081992652267 - ], - "median_us": 0.7500750012695789, - "min_us": 0.7434418017510325, - "max_us": 0.764908199198544 - }, - { - "case": "decorate_array", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 125.81120801041834, 124.80600000708364, 125.87641601567157, - 124.99574999674223, 125.12208300177008, 124.84058298286982, - 124.92262499290518, 125.00216698390432, 126.07158298487775 - ], - "median_us": 125.00216698390432, - "min_us": 124.80600000708364, - "max_us": 126.07158298487775 - }, - { - "case": "construct_tree_validator", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 1.4562089927494526, 1.4595410029869527, 1.4547909959219396, - 1.4562909782398492, 1.4584580203518271, 1.4535000082105398, - 1.4577920082956553, 1.4654580154456198, 1.4508750173263252 - ], - "median_us": 1.4562909782398492, - "min_us": 1.4508750173263252, - "max_us": 1.4654580154456198 - }, - { - "case": "construct_array_validator", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 0.5090000049676746, 0.5162500019650906, 0.5072499916423112, - 0.5100830167066306, 0.5086660094093531, 0.5108749901410192, - 0.5057920061517507, 0.5074590153526515, 0.5072089843451977 - ], - "median_us": 0.5086660094093531, - "min_us": 0.5057920061517507, - "max_us": 0.5162500019650906 - } - ] -} diff --git a/tools/evidence/2026-10-11-remaining-optimization/3.14-released-ordinary.json b/tools/evidence/2026-10-11-remaining-optimization/3.14-released-ordinary.json deleted file mode 100644 index b6e4c95..0000000 --- a/tools/evidence/2026-10-11-remaining-optimization/3.14-released-ordinary.json +++ /dev/null @@ -1,159 +0,0 @@ -{ - "python": "3.14.5 (main, May 10 2026, 19:20:57) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit-Mach-O", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6" - }, - "calls": 10000, - "repeats": 9, - "results": [ - { - "case": "native", - "correct": true, - "first_call_us": 1.25, - "median_us": 0.10609999881125987, - "samples_us": [ - 0.10609999881125987, 0.10739999997895211, 0.10714579839259386, - 0.10659589897841215, 0.10756250121630728, 0.10074159945361316, - 0.09871660149656236, 0.09856660035438836, 0.09855410025920719 - ] - }, - { - "case": "forward-resolved-stateless", - "correct": true, - "first_call_us": 41.458, - "median_us": 0.5150875018443912, - "samples_us": [ - 0.5166832997929305, 0.5078000016510487, 0.5040249990997836, - 0.5150875018443912, 0.5149917007656768, 0.5157833977136761, - 0.5140249995747581, 0.5188249982893467, 0.5256167001789436 - ] - }, - { - "case": "forward-unselected", - "correct": true, - "first_call_us": 3.959, - "median_us": 0.09891670197248459, - "samples_us": [ - 0.09891670197248459, 0.11032090114895254, 0.09873329836409539, - 0.09799590043257922, 0.0986624974757433, 0.09860409772954881, - 0.103087502066046, 0.10041249915957451, 0.10061660141218454 - ] - }, - { - "case": "forward-nested-stateless", - "correct": true, - "first_call_us": 29.416, - "median_us": 0.5852292000781745, - "samples_us": [ - 0.5831624992424622, 0.5862791003892198, 0.5923791992245242, - 0.5751624994445592, 0.577866702224128, 0.5852292000781745, - 0.5582416983088478, 0.7023750018561259, 0.7198917010100558 - ] - }, - { - "case": "forward-tuple", - "correct": true, - "first_call_us": 29.959, - "median_us": 0.517262500943616, - "samples_us": [ - 0.7290542009286582, 0.6167999992612749, 0.5243583989795297, - 0.517262500943616, 0.5186207999940962, 0.5170040996745229, - 0.513433400192298, 0.5146084004081786, 0.513637499534525 - ] - }, - { - "case": "forward-mapping", - "correct": true, - "first_call_us": 21.333, - "median_us": 0.5787250003777444, - "samples_us": [ - 0.583058298798278, 0.5839457997353747, 0.5819125013658777, - 0.5778958002338186, 0.5776124977273867, 0.5761707987403497, - 0.577562500257045, 0.580275000538677, 0.5787250003777444 - ] - }, - { - "case": "forward-nested-lists", - "correct": true, - "first_call_us": 19.084, - "median_us": 0.6025874987244606, - "samples_us": [ - 0.6104999978560954, 0.6025874987244606, 0.6037374987499788, - 0.6089875008910894, 0.5964999989373609, 0.5997542000841349, - 0.6032208999386057, 0.6022042012773454, 0.5998832988552749 - ] - }, - { - "case": "plugin-leaf", - "correct": true, - "first_call_us": 7.167, - "median_us": 0.16355830011889338, - "samples_us": [ - 0.16361250018235296, 0.16334579850081354, 0.1650833000894636, - 0.163162499666214, 0.16739580023568124, 0.16184590058401227, - 0.16355830011889338, 0.1629791979212314, 0.1657749991863966 - ] - }, - { - "case": "plugin-union-second", - "correct": false, - "reason": "Plugin union retained rejected state" - }, - { - "case": "strict", - "correct": true, - "first_call_us": 86.792, - "median_us": 3.621720799128525, - "samples_us": [ - 3.6488166981143877, 3.621720799128525, 3.558658398105763, - 3.6018207989400253, 3.5752458992647007, 3.588145802496001, - 3.6510333011392504, 3.6536875006277114, 3.633408300811425 - ] - }, - { - "case": "explicit", - "correct": true, - "first_call_us": 40.416, - "median_us": 5.01517080119811, - "samples_us": [ - 5.975225000292994, 5.006091701216064, 5.01517080119811, - 4.987708301632665, 5.042716601747088, 5.030150001402944, - 5.007079098140821, 5.02145409991499, 5.009679100476205 - ] - }, - { - "case": "union-first", - "correct": true, - "first_call_us": 12.709, - "median_us": 3.720387499197386, - "samples_us": [ - 3.7377000000560656, 3.702950000297278, 3.7180582992732525, - 3.743329201824963, 3.721316601149738, 3.720387499197386, - 3.693091601599008, 3.7295375019311905, 3.7105833005625755 - ] - }, - { - "case": "union-second", - "correct": false, - "reason": "Function __main__.union() parameter _last=\"array([1., 1., 1.], dtype=float32)\" violates type hint , as dimension 'N' expected 2 but got 3." - }, - { - "case": "union-explicit-second", - "correct": false, - "reason": "Function __main__.union_explicit() parameter _last=\"array([1., 1., 1.], dtype=float32)\" violates type hint , as dimension 'N' expected 2 but got 3." - }, - { - "case": "union-all-failed", - "correct": false, - "reason": "Failed union retained state" - }, - { - "case": "union-nested", - "correct": false, - "reason": "Nested union retained rejected state" - } - ] -} diff --git a/tools/evidence/2026-10-11-remaining-optimization/3.14-released-shape.json b/tools/evidence/2026-10-11-remaining-optimization/3.14-released-shape.json deleted file mode 100644 index 8e0c7a1..0000000 --- a/tools/evidence/2026-10-11-remaining-optimization/3.14-released-shape.json +++ /dev/null @@ -1,430 +0,0 @@ -{ - "python": "3.14.5 (main, May 10 2026, 19:20:57) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit-Mach-O", - "machine": "arm64", - "bearshape_origin": "/private/tmp/remaining-bench-shape-released-3.14/lib/python3.14/site-packages/bearshape/__init__.py", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6", - "optree": "0.19.1" - }, - "results": [ - { - "case": "bare/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.016691599739715457, 0.016491598216816783, 0.016175000928342342, - 0.017041596584022045, 0.017133401706814766, 0.017266598297283053, - 0.017216603737324476, 0.017141597345471382, 0.016933400183916092 - ], - "median_us": 0.017041596584022045, - "min_us": 0.016175000928342342, - "max_us": 0.017266598297283053 - }, - { - "case": "native/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.08814180037006736, 0.08820000221021473, 0.08781659998930991, - 0.08769159903749824, 0.08759999764151871, 0.08726660162210464, - 0.08824999677017331, 0.08750840206630528, 0.08699999889358878 - ], - "median_us": 0.08769159903749824, - "min_us": 0.08699999889358878, - "max_us": 0.08824999677017331 - }, - { - "case": "strict/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 5.15814179670997, 5.1028584013693035, 5.111766798654571, - 5.1378083997406065, 5.286233400693163, 5.240183399291709, - 5.160925001837313, 5.125891603529453, 5.157083197264001 - ], - "median_us": 5.157083197264001, - "min_us": 5.1028584013693035, - "max_us": 5.286233400693163 - }, - { - "case": "explicit/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 6.562533398391679, 6.546683399938047, 6.560133397579193, - 6.584574998123571, 6.526524998480454, 6.546333199366927, - 6.547466601477936, 6.690649996744469, 6.755491602234542 - ], - "median_us": 6.560133397579193, - "min_us": 6.526524998480454, - "max_us": 6.755491602234542 - }, - { - "case": "like/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 3.014149999944493, 3.024550003465265, 2.913141599856317, - 2.8847831999883056, 2.840100001776591, 2.8640083968639374, - 2.8746499971020967, 2.8770915989298373, 2.832133404444903 - ], - "median_us": 2.8770915989298373, - "min_us": 2.832133404444903, - "max_us": 3.024550003465265 - }, - { - "case": "nested/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 13.300158403581008, 13.29461659770459, 13.322591595351696, - 13.282191602047533, 13.712366804247722, 13.316841598134488, - 13.337608199799433, 13.266233401373029, 13.426900003105402 - ], - "median_us": 13.316841598134488, - "min_us": 13.266233401373029, - "max_us": 13.712366804247722 - }, - { - "case": "value/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 9.240166598465294, 9.259949997067451, 9.267241804627702, - 9.250383399194106, 9.345658199163154, 9.296391595853493, - 9.302491799462587, 9.296241600532085, 9.269299998413771 - ], - "median_us": 9.269299998413771, - "min_us": 9.240166598465294, - "max_us": 9.345658199163154 - }, - { - "case": "like-sequence/3", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 3.527208400191739, 3.507133398670703, 3.506208199542016, - 3.4782166010700166, 3.5131334036123008, 3.4940084035042673, - 3.480791801121086, 3.5101165995001793, 3.5169084032531828 - ], - "median_us": 3.507133398670703, - "min_us": 3.4782166010700166, - "max_us": 3.527208400191739 - }, - { - "case": "diagnostic/3", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 60.84358299267478, 59.93537500035018, 59.05112499021925, - 59.93370898067951, 59.64374999166466, 59.31691697333008, - 58.971499995095655, 59.280917019350454, 59.08737500431016 - ], - "median_us": 59.31691697333008, - "min_us": 58.971499995095655, - "max_us": 60.84358299267478 - }, - { - "case": "bare/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.01710840151645243, 0.016091804718598723, 0.016091600991785526, - 0.01640000264160335, 0.016449997201561928, 0.017183402087539434, - 0.017325003864243627, 0.016900000628083944, 0.01725819893181324 - ], - "median_us": 0.016900000628083944, - "min_us": 0.016091600991785526, - "max_us": 0.017325003864243627 - }, - { - "case": "native/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.08995839743874967, 0.09228319977410138, 0.08679160382598639, - 0.0867167953401804, 0.08623339817859232, 0.08691680268384516, - 0.08663319749757648, 0.08917500381357968, 0.08655820274725556 - ], - "median_us": 0.08679160382598639, - "min_us": 0.08623339817859232, - "max_us": 0.09228319977410138 - }, - { - "case": "strict/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 5.13881659717299, 5.169041600311175, 5.1204250019509345, - 5.146608402719721, 5.149283399805427, 5.086841603042558, - 5.133516597561538, 5.143549997592345, 5.156400002306327 - ], - "median_us": 5.143549997592345, - "min_us": 5.086841603042558, - "max_us": 5.169041600311175 - }, - { - "case": "explicit/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 6.543241802137345, 6.593549996614456, 6.576616800157353, - 6.6404584038537, 6.600699998671189, 6.509250000817701, - 6.616950000170618, 6.509583402657881, 6.627574999583885 - ], - "median_us": 6.593549996614456, - "min_us": 6.509250000817701, - "max_us": 6.6404584038537 - }, - { - "case": "like/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 2.909700002055615, 2.8403750038705766, 2.8879249992314726, - 2.8505834052339196, 2.8813167999032885, 2.877149998676032, - 2.8808333969209343, 2.8716665983665735, 2.8487583971582353 - ], - "median_us": 2.877149998676032, - "min_us": 2.8403750038705766, - "max_us": 2.909700002055615 - }, - { - "case": "nested/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 13.523800001712516, 13.402991800103337, 13.305091601796448, - 13.302725000539795, 13.366658403538167, 13.303491799160838, - 13.31133340136148, 13.407324999570847, 13.324116601143032 - ], - "median_us": 13.324116601143032, - "min_us": 13.302725000539795, - "max_us": 13.523800001712516 - }, - { - "case": "value/1000000", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 9.306124999420717, 9.339250001357868, 9.297183400485665, - 9.32664159918204, 9.328974998788908, 9.211016597691923, - 9.344033402157947, 9.323300002142787, 9.291124995797873 - ], - "median_us": 9.323300002142787, - "min_us": 9.211016597691923, - "max_us": 9.344033402157947 - }, - { - "case": "like-sequence/1000000", - "calls_per_repeat": 5, - "repeats": 9, - "samples_us": [ - 12512.13340437971, 12352.866801666096, 12335.34180209972, - 12235.491804312915, 12148.866604547948, 12146.35840151459, - 12230.291601736099, 12176.558398641646, 12176.683405414224 - ], - "median_us": 12230.291601736099, - "min_us": 12146.35840151459, - "max_us": 12512.13340437971 - }, - { - "case": "diagnostic/1000000", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 67.68599999486469, 65.78804101445712, 65.76525000855327, - 65.30416599707678, 65.38374998490326, 65.57874998543411, - 65.44366598245688, 65.24479101062752, 65.09991700295359 - ], - "median_us": 65.44366598245688, - "min_us": 65.09991700295359, - "max_us": 67.68599999486469 - }, - { - "case": "tree/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 7.630191597854719, 7.758424995699897, 7.697425002697855, - 7.647525001084432, 7.603741600178182, 7.912049995502457, - 7.667933398624882, 7.719358202302828, 7.683508394984528 - ], - "median_us": 7.683508394984528, - "min_us": 7.603741600178182, - "max_us": 7.912049995502457 - }, - { - "case": "tree-value/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 18.85443340288475, 19.045100000221282, 19.31362499599345, - 19.612908200360835, 18.913916597375646, 18.744058400625363, - 19.145816599484533, 18.82896659662947, 18.658766598673537 - ], - "median_us": 18.913916597375646, - "min_us": 18.658766598673537, - "max_us": 19.612908200360835 - }, - { - "case": "tree-composite/1", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 10.410200001206249, 10.408874996937811, 10.458591603673995, - 10.42587500414811, 10.376249998807907, 10.400624998146668, - 10.665391600923613, 10.7698667969089, 10.434633400291204 - ], - "median_us": 10.42587500414811, - "min_us": 10.376249998807907, - "max_us": 10.7698667969089 - }, - { - "case": "tree/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 302.6791795855388, 306.5366600640118, 306.30749999545515, - 308.03084024228156, 303.6366595188156, 302.0591603126377, - 304.20668015722185, 300.9033203125, 300.17249984666705 - ], - "median_us": 303.6366595188156, - "min_us": 300.17249984666705, - "max_us": 308.03084024228156 - }, - { - "case": "tree-value/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 479.1358200600371, 479.7183402115479, 455.01418004278094, - 416.409180033952, 438.76999989151955, 437.7291799755767, - 411.9741596514359, 404.9774998566136, 408.95583981182426 - ], - "median_us": 437.7291799755767, - "min_us": 404.9774998566136, - "max_us": 479.7183402115479 - }, - { - "case": "tree-composite/100", - "calls_per_repeat": 50, - "repeats": 9, - "samples_us": [ - 281.3150000292808, 283.2658198894933, 281.9416800048202, - 283.06166001129895, 278.0425001401454, 279.78581958450377, - 291.18582024239004, 303.0458401190117, 283.61668053548783 - ], - "median_us": 283.06166001129895, - "min_us": 278.0425001401454, - "max_us": 303.0458401190117 - }, - { - "case": "multiaxis", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 6.910650001373142, 6.842533400049433, 6.945483403978869, - 6.86955819837749, 6.821474997559562, 6.833074998576194, - 6.830475002061576, 6.794274999992922, 6.841150001855567 - ], - "median_us": 6.841150001855567, - "min_us": 6.794274999992922, - "max_us": 6.945483403978869 - }, - { - "case": "variadic", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 7.126541598699987, 7.2116833995096385, 7.172808394534513, - 7.149383198702708, 7.241683400934562, 7.229775004088879, - 7.140941597754136, 7.167674996890128, 7.166866597253829 - ], - "median_us": 7.167674996890128, - "min_us": 7.126541598699987, - "max_us": 7.241683400934562 - }, - { - "case": "like-cast", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 3.291816799901426, 3.304366604425013, 3.3268667990341783, - 3.44422499765642, 3.3226581988856196, 3.2983249984681606, - 3.284100000746548, 3.286433400353417, 3.2840167987160385 - ], - "median_us": 3.2983249984681606, - "min_us": 3.2840167987160385, - "max_us": 3.44422499765642 - }, - { - "case": "extract-dtype", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.6971082009840757, 0.6854583974927664, 0.6904331967234612, - 0.6976331991609186, 0.6835834006778896, 0.6959000020287931, - 0.6980667996685952, 0.6903750007040799, 0.6935250014066696 - ], - "median_us": 0.6935250014066696, - "min_us": 0.6835834006778896, - "max_us": 0.6980667996685952 - }, - { - "case": "match-dtype", - "calls_per_repeat": 5000, - "repeats": 9, - "samples_us": [ - 0.7700418005697429, 0.739866797812283, 0.7602584024425596, - 0.755833403673023, 0.7567333988845348, 0.7692084007430822, - 0.7562666025478393, 0.7699584006331861, 0.7751249999273568 - ], - "median_us": 0.7602584024425596, - "min_us": 0.739866797812283, - "max_us": 0.7751249999273568 - }, - { - "case": "decorate_array", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 122.39787500584498, 120.54991599870846, 124.4058329903055, - 120.66566699650139, 121.80845800321549, 120.55550000513904, - 121.02237500948831, 121.55924999387935, 122.69508300232701 - ], - "median_us": 121.55924999387935, - "min_us": 120.54991599870846, - "max_us": 124.4058329903055 - }, - { - "case": "construct_tree_validator", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 1.464916014811024, 1.46562498412095, 1.4625830226577818, - 1.4504170103464276, 1.4311670092865825, 1.3713329972233623, - 1.4118750113993883, 1.4613749808631837, 1.4620829897467047 - ], - "median_us": 1.4613749808631837, - "min_us": 1.3713329972233623, - "max_us": 1.46562498412095 - }, - { - "case": "construct_array_validator", - "calls_per_repeat": 1000, - "repeats": 9, - "samples_us": [ - 0.6425839965231717, 0.6392919749487191, 0.6458749994635582, - 0.6491669919341803, 0.6586250092368573, 0.6418330012820661, - 0.8831250015646219, 0.6148340180516243, 0.6154169968795031 - ], - "median_us": 0.6425839965231717, - "min_us": 0.6148340180516243, - "max_us": 0.8831250015646219 - } - ] -} diff --git a/tools/evidence/2026-10-11-remaining-optimization/3.14-root-combined.json b/tools/evidence/2026-10-11-remaining-optimization/3.14-root-combined.json deleted file mode 100644 index 1d75f7f..0000000 --- a/tools/evidence/2026-10-11-remaining-optimization/3.14-root-combined.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "python": "3.14.5 (main, May 10 2026, 19:20:57) [Clang 22.1.3 ]", - "calls": 20000, - "repeats": 9, - "results": [ - { - "case": "custom-extract", - "samples_us": [ - 0.056647948804311454, 0.05713124992325902, 0.05735414888476953, - 0.05722710047848523, 0.057054149510804564, 0.057106249732896686, - 0.057481249677948654, 0.06390835042111576, 0.0586895999731496 - ], - "median_us": 0.05722710047848523 - }, - { - "case": "custom-strict", - "samples_us": [ - 3.6492562503553927, 3.5938166998676024, 3.6133603993221186, - 3.5634666492114775, 3.554497950244695, 3.6102312500588596, - 3.5931624996010214, 3.6113479000050575, 3.5793583490885794 - ], - "median_us": 3.5938166998676024 - } - ] -} diff --git a/tools/evidence/2026-10-11-remaining-optimization/3.14-root-dtype.json b/tools/evidence/2026-10-11-remaining-optimization/3.14-root-dtype.json deleted file mode 100644 index 7a1432e..0000000 --- a/tools/evidence/2026-10-11-remaining-optimization/3.14-root-dtype.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "python": "3.14.5 (main, May 10 2026, 19:20:57) [Clang 22.1.3 ]", - "calls": 20000, - "repeats": 9, - "results": [ - { - "case": "custom-extract", - "samples_us": [ - 0.05637084977934137, 0.05747079994762316, 0.05523330037249252, - 0.055389599583577365, 0.05951875064056367, 0.05948750040261075, - 0.05780415085610002, 0.05770624993601814, 0.05799374921480194 - ], - "median_us": 0.05770624993601814 - }, - { - "case": "custom-strict", - "samples_us": [ - 3.7044124997919425, 3.7461020998307504, 3.787408350035548, - 3.812002099584788, 3.7147125010960735, 3.787575000023935, - 3.8373687508283183, 3.859564549929928, 3.8217208508285694 - ], - "median_us": 3.787575000023935 - } - ] -} diff --git a/tools/evidence/2026-10-11-remaining-optimization/3.14-root-main.json b/tools/evidence/2026-10-11-remaining-optimization/3.14-root-main.json deleted file mode 100644 index 8345fe4..0000000 --- a/tools/evidence/2026-10-11-remaining-optimization/3.14-root-main.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "python": "3.14.5 (main, May 10 2026, 19:20:57) [Clang 22.1.3 ]", - "calls": 20000, - "repeats": 9, - "results": [ - { - "case": "custom-extract", - "samples_us": [ - 0.10465624945936725, 0.10286665055900812, 0.10392290132585913, - 0.10509999992791563, 0.10559375077718869, 0.10632914927555248, - 0.10044374939752743, 0.10402710031485185, 0.10496250033611432 - ], - "median_us": 0.10465624945936725 - }, - { - "case": "custom-strict", - "samples_us": [ - 3.8222145492909476, 3.8083645995357074, 3.8433228997746482, - 3.809089549758937, 3.7994666505255736, 3.814368748862762, - 3.8135312497615814, 3.8151542001287453, 3.8262478992692195 - ], - "median_us": 3.814368748862762 - } - ] -} diff --git a/tools/evidence/2026-10-11-remaining-optimization/3.14-root-shape.json b/tools/evidence/2026-10-11-remaining-optimization/3.14-root-shape.json deleted file mode 100644 index c730f7e..0000000 --- a/tools/evidence/2026-10-11-remaining-optimization/3.14-root-shape.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "python": "3.14.5 (main, May 10 2026, 19:20:57) [Clang 22.1.3 ]", - "calls": 20000, - "repeats": 9, - "results": [ - { - "case": "custom-extract", - "samples_us": [ - 0.10379165032645687, 0.10207915038336068, 0.10383959888713434, - 0.1040667004417628, 0.10368539951741695, 0.10442079947097227, - 0.10310835059499368, 0.10422709892736748, 0.10503125085961074 - ], - "median_us": 0.10383959888713434 - }, - { - "case": "custom-strict", - "samples_us": [ - 3.6780916998395696, 3.709781249926891, 3.7080479494761676, - 3.7380624999059364, 3.7228250002954155, 3.749352050363086, - 3.6924749991158023, 3.668108298734296, 3.6627770503400825 - ], - "median_us": 3.7080479494761676 - } - ] -} diff --git a/tools/evidence/2026-10-11-remaining-optimization/README.md b/tools/evidence/2026-10-11-remaining-optimization/README.md deleted file mode 100644 index f321b2b..0000000 --- a/tools/evidence/2026-10-11-remaining-optimization/README.md +++ /dev/null @@ -1,164 +0,0 @@ -# Remaining optimization evidence - -PR [#56](https://github.com/beartype/bearshape/pull/56) prepares builtin dtype -names, keeps plain dtype strings cheap without NumPy, and removes a per-call -Like casting closure. PR [#57](https://github.com/beartype/bearshape/pull/57) -prepares shape traversal once per annotation. They are independent changes on -main `28e8858`, following the already merged lazy-scope and Tree optimizations. -The combined validation head is `e5eddd6`; identity.json pins full source IDs, -archive and wheel hashes. Later documentation commits do not change these -runtime wheels. Publication remains blocked on supported upstream integration -and the existing release prerequisites. - -## Method - -Use the same tools/benchmark_runtime.py revision, normal wheel installations, -NumPy 2.4.6, optree 0.19.1 and typing_extensions 4.16.0 in all four variants. -Compare exact published beartype 0.23.1 and the unchanged local upstream -proposal separately. On each interpreter, run every environment's Python with -`-I`, from outside the checkout, then the benchmark's absolute path and -`--calls 5000 --repeats 9`. Expensive cases use the smaller per-case counts -recorded in JSON. All runs are sequential with local validation idle: -main/dtype/shape/combined on 3.11, reversed on 3.14. Ordinary proposal -comparisons use -`tools/upstream/benchmark_transactions.py --calls 10000 --repeats 9`. Raw -samples, versions and installed origins accompany this report. These are local -observations, not a portable guarantee or CI threshold. Do not compare these -timings with an older benchmark run to infer an additional speedup. - -## Matched warm results - -Median microseconds per call; Tree input plus return visits all 100 leaves -twice. “Dtype” and “Shape” each change only their named PR; “Combined” includes -both. - -| Dependency / Python | Case | Main | Dtype | Shape | Combined | -| ------------------- | ----------- | ------- | ------- | ------- | -------- | -| released 3.11 | `strict/3` | 5.514 | 4.005 | 5.507 | 4.200 | -| released 3.11 | `tree/100` | 310.550 | 166.441 | 310.151 | 159.878 | -| released 3.11 | `value/3` | 10.077 | 8.664 | 10.145 | 8.472 | -| released 3.11 | `like-cast` | 3.232 | 2.398 | 3.330 | 2.449 | -| released 3.11 | `multiaxis` | 7.297 | 5.703 | 7.280 | 5.618 | -| released 3.11 | `variadic` | 7.519 | 5.934 | 7.640 | 5.879 | -| proposal 3.11 | `strict/3` | 5.069 | 3.402 | 4.881 | 3.253 | -| proposal 3.11 | `tree/100` | 316.684 | 169.452 | 306.442 | 159.303 | -| proposal 3.11 | `value/3` | 8.542 | 6.862 | 8.357 | 6.642 | -| proposal 3.11 | `like-cast` | 2.992 | 2.179 | 2.945 | 2.379 | -| proposal 3.11 | `multiaxis` | 6.897 | 5.156 | 6.413 | 4.823 | -| proposal 3.11 | `variadic` | 6.943 | 5.388 | 6.625 | 4.971 | -| released 3.14 | `strict/3` | 5.220 | 3.774 | 5.157 | 3.624 | -| released 3.14 | `tree/100` | 315.511 | 174.293 | 303.637 | 159.987 | -| released 3.14 | `value/3` | 9.411 | 7.753 | 9.269 | 7.655 | -| released 3.14 | `like-cast` | 3.368 | 2.385 | 3.298 | 2.306 | -| released 3.14 | `multiaxis` | 7.286 | 5.568 | 6.841 | 5.288 | -| released 3.14 | `variadic` | 7.605 | 5.843 | 7.168 | 5.534 | -| proposal 3.14 | `strict/3` | 4.949 | 3.536 | 4.783 | 3.333 | -| proposal 3.14 | `tree/100` | 314.614 | 170.283 | 301.280 | 160.959 | -| proposal 3.14 | `value/3` | 8.645 | 6.921 | 8.587 | 6.914 | -| proposal 3.14 | `like-cast` | 3.245 | 2.241 | 3.106 | 2.201 | -| proposal 3.14 | `multiaxis` | 6.931 | 5.303 | 6.487 | 4.972 | -| proposal 3.14 | `variadic` | 7.097 | 5.513 | 6.917 | 5.235 | - -The final combined measurements improve strict checks by about 24–36% and -100-leaf Trees by about 48–50% against main. The dtype preparation supplies most -of the improvement. Shape preparation adds a smaller, workload-dependent saving -and reuses the same dimension checker and error ordering. Its isolated 3.11 -released results are nearly flat, including a 1.6% higher variadic median. The -combined strict 3.11 released median is also higher than dtype-only (4.200 -versus 4.005 us), while the other endpoint/dependency comparisons improve. -Retain these outcomes alongside the favorable cases; small differences are -sensitive to run variance. Tree still takes a snapshot per leaf and for each -enclosing check. No validation result, array, arbitrary dtype, call scope, frame -or user class is cached. Known builtin dtype class identities and strings are -the only retained normalization data; identity keys avoid user metaclass -hashing/equality. The original custom/extension dtype protocol remains live, -including metadata changes, endian and structured layout checks. - -## Startup and controls - -First dtype extraction is measured in 13 fresh subprocesses per variant, after -NumPy and bearshape imports and array creation. The JSON contains the exact -code. This is one-time normalization setup, not full application startup. - -| Python | Main | Dtype | Shape | Combined | -| ------ | ------ | ------ | ----- | -------- | -| 3.11 | 11.250 | 27.750 | 9.792 | 28.875 | -| 3.14 | 12.167 | 26.250 | 9.750 | 26.875 | - -Preparing the dtype table costs tens of microseconds once. Shape validator -construction also grows slightly; the raw `construct_array_validator` case -measures internal uncached construction, not cached public subscripting. Full -decoration, native controls, diagnostics, Value, composite Trees and -million-item conversion remain in the raw results, including unfavorable/noisy -samples. Conversion still scales with input size; Tree still scales with leaves. - -A separate custom-array benchmark asserts that NumPy is never imported. It uses -plain dtype strings and the source saved in experiments.json, 20,000 calls per -repeat and nine repeats. Results below are median microseconds. - -| Python | Case | Main | Dtype | Shape | Combined | -| ------ | -------------- | ----- | ----- | ----- | -------- | -| 3.11 | custom-extract | 0.099 | 0.062 | 0.095 | 0.065 | -| 3.11 | custom-strict | 4.134 | 4.034 | 4.007 | 3.950 | -| 3.14 | custom-extract | 0.105 | 0.058 | 0.104 | 0.057 | -| 3.14 | custom-strict | 3.814 | 3.788 | 3.708 | 3.594 | - -The first implementation added an avoidable NumPy discovery cost for root-only -string dtypes. The final narrow fast path removes it, while exact string-type -checking preserves string subclasses with their own dtype-name protocol. Custom -metaclass hashing failures found during review were fixed before the final -measurements; two explicit regressions protect that boundary. - -## Ordinary beartype costs and the rejected extra cache - -The upstream patch series is unchanged. The same combined bearshape wheel is -installed for released/proposal comparisons. Native controls do not invoke -bearshape; root references and one sampled-reference list retain the native -proxy path. Composite references retain the already implemented specialization. -These costs also apply to ordinary beartype users of the proposed upstream -changes, even without bearshape. No universal zero-overhead claim is made. - -| Python | Case | Released | Proposal | -| ------ | ---------------------------- | -------- | -------- | -| 3.11 | `native` | 0.100 | 0.099 | -| 3.11 | `forward-resolved-stateless` | 0.711 | 0.755 | -| 3.11 | `forward-nested-stateless` | 0.763 | 0.793 | -| 3.11 | `forward-tuple` | 0.727 | 0.170 | -| 3.11 | `forward-mapping` | 0.748 | 0.197 | -| 3.11 | `forward-nested-lists` | 0.771 | 0.221 | -| 3.14 | `native` | 0.106 | 0.094 | -| 3.14 | `forward-resolved-stateless` | 0.515 | 0.502 | -| 3.14 | `forward-nested-stateless` | 0.585 | 0.556 | -| 3.14 | `forward-tuple` | 0.517 | 0.175 | -| 3.14 | `forward-mapping` | 0.579 | 0.220 | -| 3.14 | `forward-nested-lists` | 0.603 | 0.243 | - -We also measured a best-case prepopulated weak lookup cache. On 3.11, current -getattr/weak-map/guarded-weak-set lookup medians were 60.5/40.7/56.9 ns; on -3.14, 12.9/41.1/53.7 ns. Raw samples and exact experiment source are retained. -These are isolated lookup costs, not full checker speedups. The cache -alternative is already slower on 3.14 before accounting for initialization, -invalidation, ownership or custom metaclass semantics. Retain the current lookup -and the prior code-factory compatibility decision; no additional upstream patch -is justified by this experiment. Ordinary first-call samples remain single -observations, not statistical cold-start evidence. Incorrect released-union -cases are labelled as failures rather than timed as valid behavior. - -## Validation and limits - -Each focused PR passes its runtime and four-checker routes. The combined wheel -passes 1,323 normally installed baseline tests and 1,450 proposal tests on both -Python 3.11.15 and 3.14.5. The proposal total includes all 69 bearshape -composition cases and 58 upstream protocol/scope/mixin cases. It also passes the -unchanged union probe. Source coverage is 91.23%; fresh minimal wheel consumers -and all 95 documentation snippets pass syntax validation (not execution). Five -local skips cover missing CuPy and four platform-specific extended-precision -cases, not union semantics. Hosted PR checks add platform/interpreter, -compatibility-floor, docs/notebook and archive lanes. See each PR for the final -check status. - -The published dependency still lacks full union rollback. This work does not -replace that release prerequisite or supply fresh CUDA evidence. Nothing has -been published or sent upstream. Both PRs were merged on 12 October 2026 at main -`a475c9b`, preserving the reviewed histories. Post-merge validation is recorded -in the [handoff](../../../docs/maintainers/production-readiness.md). diff --git a/tools/evidence/2026-10-11-remaining-optimization/cold-dtype-samples.json b/tools/evidence/2026-10-11-remaining-optimization/cold-dtype-samples.json deleted file mode 100644 index fc411a4..0000000 --- a/tools/evidence/2026-10-11-remaining-optimization/cold-dtype-samples.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "code": "import json,time,numpy as np\nfrom bearshape._dtypes import extract_dtype_str\narray=np.ones(3,dtype=np.float32)\nstart=time.perf_counter_ns()\nassert extract_dtype_str(array)=='float32'\nprint(json.dumps((time.perf_counter_ns()-start)/1000))", - "samples_us": { - "3.11-main": [ - 10.042, 12.375, 11.042, 12.5, 11.291, 11.25, 11.959, 10.709, 12.042, - 10.75, 11.208, 10.875, 11.333 - ], - "3.11-dtype": [ - 26.25, 30.5, 30.792, 25.0, 30.458, 27.625, 28.125, 27.75, 29.333, 28.166, - 27.208, 27.125, 25.792 - ], - "3.11-shape": [ - 10.792, 11.167, 8.917, 9.792, 9.875, 10.083, 9.375, 9.834, 9.667, 9.292, - 10.458, 8.917, 9.459 - ], - "3.11-combined": [ - 27.792, 28.959, 23.75, 29.833, 26.833, 25.417, 29.625, 28.583, 34.25, - 28.875, 29.0, 27.334, 31.292 - ], - "3.14-main": [ - 9.667, 11.291, 11.625, 14.042, 11.458, 23.5, 11.5, 12.167, 12.209, 11.25, - 12.291, 14.333, 12.416 - ], - "3.14-dtype": [ - 35.292, 29.916, 24.542, 31.167, 27.833, 24.208, 24.417, 30.292, 24.584, - 24.667, 26.25, 25.708, 27.458 - ], - "3.14-shape": [ - 9.75, 9.583, 15.833, 9.833, 9.625, 9.583, 10.542, 9.958, 9.666, 9.875, - 10.167, 8.958, 8.75 - ], - "3.14-combined": [ - 25.25, 28.208, 25.375, 27.042, 24.167, 26.875, 25.417, 24.75, 30.333, - 27.791, 24.0, 27.875, 28.75 - ] - } -} diff --git a/tools/evidence/2026-10-11-remaining-optimization/experiments.json b/tools/evidence/2026-10-11-remaining-optimization/experiments.json deleted file mode 100644 index 7797e11..0000000 --- a/tools/evidence/2026-10-11-remaining-optimization/experiments.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "root_protocol": "import json,statistics,sys,timeit\nfrom beartype import beartype\nfrom bearshape import N,DtypeSpec,make_array_type\nfrom bearshape._dtypes import extract_dtype_str\nclass Array:\n shape=(3,)\n dtype='float32'\nF32=make_array_type(Array,DtypeSpec('Float32',frozenset({'float32'})))\n@beartype\ndef checked(value:F32[N])->F32[N]:return value\narray=Array()\nchecked(array)\nassert 'numpy' not in sys.modules\nresults=[]\nfor name,statement in [('custom-extract','extract_dtype_str(array)'),('custom-strict','checked(array)')]:\n samples=[t*1e6/20000 for t in timeit.repeat(statement,globals=globals(),number=20000,repeat=9)]\n results.append({'case':name,'samples_us':samples,'median_us':statistics.median(samples)})\nassert 'numpy' not in sys.modules\nprint(json.dumps({'python':sys.version,'calls':20000,'repeats':9,'results':results},indent=2))\n", - "lookup_alternatives": "import json,statistics,timeit,sys\nfrom weakref import WeakKeyDictionary, WeakSet\nclass Plain: pass\nweak_map=WeakKeyDictionary({Plain:None})\nweak_set=WeakSet([Plain])\ncases={\n 'current_getattr':\"getattr(Plain, '__beartype_state__', None)\",\n 'weak_map_get':\"weak_map.get(Plain)\",\n 'guarded_weak_set':\"type(Plain) is type and Plain in weak_set\",\n}\nresults=[]\nfor name,statement in cases.items():\n samples=[t*1000 for t in timeit.repeat(statement,globals=globals(),number=1000000,repeat=9)]\n results.append({'case':name,'samples_ns':samples,'median_ns':statistics.median(samples)})\nprint(json.dumps({'python':sys.version,'calls':1000000,'repeats':9,'statements':cases,'results':results},indent=2))\n" -} diff --git a/tools/evidence/2026-10-11-remaining-optimization/identity.json b/tools/evidence/2026-10-11-remaining-optimization/identity.json deleted file mode 100644 index 018095d..0000000 --- a/tools/evidence/2026-10-11-remaining-optimization/identity.json +++ /dev/null @@ -1,154 +0,0 @@ -{ - "wheels": { - "dtype": { - "path": "/Users/ale/Code/bearshape/build/remaining-optimization/review-dtype-dist/bearshape-0.1.0rc1-py3-none-any.whl", - "sha256": "daa22b1c7efc52239fcff3c81829852c806a1debf2ec66fb977d592b82eec480" - }, - "shape": { - "path": "/Users/ale/Code/bearshape/build/remaining-optimization/shape-dist/bearshape-0.1.0rc1-py3-none-any.whl", - "sha256": "42a22f86d358c344ea52a50e3e59d3f17cf08775068923b11606e348f2d2b4cc" - }, - "combined": { - "path": "/Users/ale/Code/bearshape/build/remaining-optimization/review-dist/bearshape-0.1.0rc1-py3-none-any.whl", - "sha256": "313642ed018e897e5f5ea8123c5571da2deae6ff67a1422448bbf28075529db6" - }, - "main": { - "path": "/Users/ale/Code/bearshape/build/merge-closeout/main-dist/bearshape-0.1.0rc1-py3-none-any.whl", - "sha256": "1e0bf25f4ad018d661d28b84a9136ade8f4f809a5c54c745a213c22d52284897" - }, - "released": { - "path": "/Users/ale/Code/bearshape/build/union-isolation-revision/released/beartype-0.23.1-py3-none-any.whl", - "sha256": "4461b4dc57e3fdd6c8a8464b22cf118002eea107c33e9fef651c69068ab3cce3" - }, - "proposal": { - "path": "/Users/ale/Code/bearshape/build/union-isolation-revision/optimized311/dist/beartype-0.23.1-py3-none-any.whl", - "sha256": "0580ede1fe87229728b42674d45fb8c32ce09a7e348f962cc2741304ef2f10d8" - } - }, - "environments": [ - { - "variant": "dtype", - "dependency": "released", - "python": "3.11", - "interpreter": "/private/tmp/remaining-bench-dtype-released-3.11/bin/python" - }, - { - "variant": "shape", - "dependency": "released", - "python": "3.11", - "interpreter": "/private/tmp/remaining-bench-shape-released-3.11/bin/python" - }, - { - "variant": "combined", - "dependency": "released", - "python": "3.11", - "interpreter": "/private/tmp/remaining-bench-combined-released-3.11/bin/python" - }, - { - "variant": "main", - "dependency": "released", - "python": "3.11", - "interpreter": "/private/tmp/remaining-bench-main-released-3.11/bin/python" - }, - { - "variant": "dtype", - "dependency": "proposal", - "python": "3.11", - "interpreter": "/private/tmp/remaining-bench-dtype-proposal-3.11/bin/python" - }, - { - "variant": "shape", - "dependency": "proposal", - "python": "3.11", - "interpreter": "/private/tmp/remaining-bench-shape-proposal-3.11/bin/python" - }, - { - "variant": "combined", - "dependency": "proposal", - "python": "3.11", - "interpreter": "/private/tmp/remaining-bench-combined-proposal-3.11/bin/python" - }, - { - "variant": "main", - "dependency": "proposal", - "python": "3.11", - "interpreter": "/private/tmp/remaining-bench-main-proposal-3.11/bin/python" - }, - { - "variant": "dtype", - "dependency": "released", - "python": "3.14", - "interpreter": "/private/tmp/remaining-bench-dtype-released-3.14/bin/python" - }, - { - "variant": "shape", - "dependency": "released", - "python": "3.14", - "interpreter": "/private/tmp/remaining-bench-shape-released-3.14/bin/python" - }, - { - "variant": "combined", - "dependency": "released", - "python": "3.14", - "interpreter": "/private/tmp/remaining-bench-combined-released-3.14/bin/python" - }, - { - "variant": "main", - "dependency": "released", - "python": "3.14", - "interpreter": "/private/tmp/remaining-bench-main-released-3.14/bin/python" - }, - { - "variant": "dtype", - "dependency": "proposal", - "python": "3.14", - "interpreter": "/private/tmp/remaining-bench-dtype-proposal-3.14/bin/python" - }, - { - "variant": "shape", - "dependency": "proposal", - "python": "3.14", - "interpreter": "/private/tmp/remaining-bench-shape-proposal-3.14/bin/python" - }, - { - "variant": "combined", - "dependency": "proposal", - "python": "3.14", - "interpreter": "/private/tmp/remaining-bench-combined-proposal-3.14/bin/python" - }, - { - "variant": "main", - "dependency": "proposal", - "python": "3.14", - "interpreter": "/private/tmp/remaining-bench-main-proposal-3.14/bin/python" - } - ], - "scripts": { - "benchmark_runtime.py": "d2e02d848cc633d1781fd1607604f274e8f5f352b4e5a166f1b738db2609d98f", - "benchmark_transactions.py": "52363525b7b8785830527b467c79ae492b0f2a5ab2dd3dec133a75a86a8de969" - }, - "calls": 5000, - "repeats": 9, - "order": "3.11 main/dtype/shape/combined; 3.14 combined/shape/dtype/main; sequential local runs", - "source_commits": { - "main": "28e885837e61705d3d3295463874c3e0acf35ca8", - "dtype": "6ae31a27fd5a2a95991c29433585cd342f47a1a0", - "shape": "4c0a65be3ae737c13d82944b1c0592cd343cbe10", - "combined": "e5eddd6aa0cab07a35e1ed4b25c00b2f6dade5cf" - }, - "tested_archives": { - "dtype": { - "bearshape-0.1.0rc1.tar.gz": "06b859b7f2b97f019cf23bb12a34557034c52946cc7d461535736c9d7a3a7212", - "bearshape-0.1.0rc1-py3-none-any.whl": "daa22b1c7efc52239fcff3c81829852c806a1debf2ec66fb977d592b82eec480" - }, - "shape": { - "bearshape-0.1.0rc1.tar.gz": "f6eeaa435b7c8a5ec425dfcfeeaeb8499d00ec4bce64cc67eb474dfb150a3ce4", - "bearshape-0.1.0rc1-py3-none-any.whl": "42a22f86d358c344ea52a50e3e59d3f17cf08775068923b11606e348f2d2b4cc" - }, - "combined": { - "bearshape-0.1.0rc1.tar.gz": "3160a505a6bc01e55c8c3c2f1a4868473ecaaac94376afd7751b408ca2e001cc", - "bearshape-0.1.0rc1-py3-none-any.whl": "313642ed018e897e5f5ea8123c5571da2deae6ff67a1422448bbf28075529db6" - } - }, - "scope": "Local macOS arm64, CPython 3.11.15/3.14.5, normally installed wheels, sequential measurements, no timing gate." -} diff --git a/tools/probe_union.py b/tools/probe_union.py deleted file mode 100644 index f75dc6e..0000000 --- a/tools/probe_union.py +++ /dev/null @@ -1,31 +0,0 @@ -"""Reproduce the unresolved native composite-union rollback release blocker.""" - -from __future__ import annotations - -import sys -from importlib.metadata import version - -import numpy as np -from beartype import beartype - -from bearshape import C, N -from bearshape.numpy import F32 - - -@beartype -def choose(_pair: tuple[F32[N], str] | tuple[F32[C], int], _y: F32[N]) -> None: - """Accept the second alternative without retaining the first one's N binding.""" - - -def main() -> None: - sys.stdout.write( - f"Python {sys.version}; bearshape {version('bearshape')}; " - f"beartype {version('beartype')}; NumPy {version('numpy')}\n" - ) - sys.stdout.flush() - choose((np.ones(2, dtype=np.float32), 1), np.ones(3, dtype=np.float32)) - sys.stdout.write("Native composite-union rollback probe passed\n") - - -if __name__ == "__main__": - main() diff --git a/tools/smoke_minimal.py b/tools/smoke_minimal.py deleted file mode 100644 index 583c857..0000000 --- a/tools/smoke_minimal.py +++ /dev/null @@ -1,132 +0,0 @@ -"""Exercise an installed bearshape wheel without any optional backend. - -Run with the isolated Python from a fresh environment containing only the wheel -and its declared runtime dependencies: python -I tools/smoke_minimal.py -""" - -from __future__ import annotations - -import json -import sys -from dataclasses import dataclass -from importlib.metadata import version -from importlib.util import find_spec -from pathlib import Path - -from beartype import beartype -from beartype.roar import ( - BeartypeCallHintParamViolation, - BeartypeCallHintReturnViolation, -) - -import bearshape -from bearshape import DtypeSpec, N, make_array_type - -BACKENDS = ("numpy", "jax", "torch", "cupy", "optree") - - -@dataclass -class CustomArray: - shape: tuple[int, ...] - dtype: str = "float32" - - -FloatArray = make_array_type( - CustomArray, DtypeSpec("FloatArray", frozenset({"float32"})) -) - - -@beartype -def pair(x: FloatArray[N], _y: FloatArray[N]) -> FloatArray[N]: - return x - - -@beartype -def wrong_return(x: FloatArray[N]) -> FloatArray[N]: - return CustomArray((x.shape[0] + 1,)) - - -@beartype -def broadcast_pair(x: FloatArray[~+N], _y: FloatArray[~+N]) -> FloatArray[~+N]: - return x - - -@beartype -def strict_broadcast_pair(x: FloatArray[~N], _y: FloatArray[~+N]) -> FloatArray[~N]: - return x - - -@beartype -def strict_transition( - x: FloatArray[~+N], _y: FloatArray[~N], _z: FloatArray[~N] -) -> None: - pass - - -def _expect_param_failure(x: CustomArray, bad: CustomArray) -> None: - try: - pair(x, bad) - except BeartypeCallHintParamViolation: - pass - else: - sys.exit("Custom array metadata mismatch was accepted") - - -def main() -> None: - location = Path(bearshape.__file__).resolve() - if not location.is_relative_to(Path(sys.prefix).resolve()): - sys.exit(f"Imported bearshape outside the consumer environment: {location}") - if present := [backend for backend in BACKENDS if find_spec(backend) is not None]: - sys.exit(f"Minimal consumer unexpectedly has optional backends: {present}") - x = CustomArray((3,)) - if pair(x, CustomArray((3,))) is not x: - sys.exit("Validation replaced the custom array argument") - if isinstance(CustomArray((-1,)), FloatArray[N]): - sys.exit("Negative custom array metadata was accepted") - _expect_param_failure(x, CustomArray((4,))) - _expect_param_failure(x, CustomArray((3,), "int32")) - try: - wrong_return(x) - except BeartypeCallHintReturnViolation: - pass - else: - sys.exit("Custom array return mismatch was accepted") - for left, right in [((2, 1), (1, 3)), ((0, 1), (1, 3)), ((), (2, 3))]: - first = CustomArray(left) - if broadcast_pair(first, CustomArray(right)) is not first: - sys.exit("Broadcast validation replaced the custom array argument") - try: - broadcast_pair(CustomArray((2, 3)), CustomArray((4, 3))) - except BeartypeCallHintParamViolation: - pass - else: - sys.exit("Incompatible custom variadic shapes were accepted") - strict_broadcast_pair(CustomArray((2, 3)), CustomArray((1, 3))) - for function, arguments in [ - (strict_broadcast_pair, (CustomArray((1,)), CustomArray((2,)))), - (strict_transition, (CustomArray((2,)), CustomArray((2,)), CustomArray((1,)))), - ]: - try: - function(*arguments) - except BeartypeCallHintParamViolation: - pass - else: - sys.exit("A strict custom variadic binding was weakened") - if imported := sorted(set(BACKENDS).intersection(sys.modules)): - sys.exit(f"Root/custom-array validation imported optional backends: {imported}") - json.dump( - { - "bearshape": version("bearshape"), - "beartype": version("beartype"), - "python": sys.version, - "module": str(location), - "optional_backends": [], - }, - sys.stdout, - indent=2, - ) - sys.stdout.write("\n") - - -if __name__ == "__main__": - main() diff --git a/tools/upstream/DESIGN_REVIEW.md b/tools/upstream/DESIGN_REVIEW.md deleted file mode 100644 index ceff50d..0000000 --- a/tools/upstream/DESIGN_REVIEW.md +++ /dev/null @@ -1,103 +0,0 @@ -# Scope and transaction design review - -This review targets beartype v0.23.1 (`f85b67d8`) and the ordered patches in -`patches/series.json`. The implementation is a proposal for upstream review, not -a supported dependency release. The performance delta remains separate in #47. - -## Isolation correction - -The previous scope implementation distinguished public invocations, but its -transaction stack enrolled every nested state getter into every active parent. -When an independent check used a getter before an outer forward alias resolved, -the parent retained the inner state object. Its eventual rollback then missed -the outer binding. A valid fallback union could fail a later shape check. - -Transactions now record the identity of their live public checking frame and -enroll only into live parents with the same identity. Internal alias delegates -skip their own boundary and therefore join the caller. Public DOOR calls and -nested decorated calls have different owners, including recursive calls through -the same wrapper code. The private identifier is cleared on exit; no transaction -retains a frame. An active parent's frame cannot be recycled, and completed -parents retained by copied contexts are ignored. - -The existing boundary traversal is shared by the public scope accessor and the -private owner lookup. Ownership does not allocate a `HintCheckScope`. The public -API is unchanged: `get_hint_check_scope()` returns a scope with `state`, lazy -`arguments`, and `owner_code`, or `None` outside checking. `owner_code` -identifies the generated entry point for explicit decorator integration; only -scope object identity distinguishes invocations. Plugins should use a private -object key in `state`, and must not retain scopes after checking. - -## Alternatives considered - -- Getter identity alone is incorrect: one getter locates different state in - different invocations. -- State identity alone is insufficient: it still lets one invocation roll back - another's independent successful state. -- Allocating a public scope for every transaction could provide identity, but - adds allocation for ordinary unresolved references and weakens lazy - creation. -- A ContextVar boundary around every wrapper could isolate ownership, but adds - entry/exit machinery to ordinary calls and expands async/cancellation - handling. -- Wrapper code identity is incorrect for recursion: separate invocations share a - code object. -- Reusing the boundary lookup and retaining only a private identifier is the - chosen correction. It needs no new public surface, retained frames or - ordinary public-scope allocation. - -Leaf-only rollback, resetting the whole call, rewriting annotations and retrying -validators do not preserve all earlier bindings, native composition, ordering -and side effects. Existing hint-reduction hooks transform hints but cannot -observe the success or failure of an enclosing union branch. An explicit -configuration flag would change bearshape's existing bare `@beartype` contract -for late aliases. These alternatives were evaluated against that contract; this -is not a claim that all possible designs have been exhaustively proved inferior. - -## Compatibility with upstream implementation - -The proposal keeps beartype's native expression generator and union ordering. It -adds checkpoints at the boundaries owned by that generator, keeps its random -sample value, and compiles transactional expressions once. Forward proxies keep -native lazy resolution. Composite aliases use the existing DOOR code factory -through a separate internal cache: the current cache key does not include the -code factory, so sharing the public cache would mix scope semantics. - -Diagnostic traversal uses the same state protocol and restores its exploratory -mutations. The existing special paths for `NoReturn` and legacy tuple unions are -preserved. The snapshot token is opaque; a plugin getter locates state, while -`snapshot()` and `restore(token)` implement rollback. Python's bare `isinstance` -does not gain this protocol, so bearshape retains its leaf guarantees. - -PR #47 keeps known-domain transactions unpublished and consults owner identity -only when a parent exists. Its ordinary composite specialization waits for -natural resolution to plain classes, captures those classes, and invalidates -through the existing reference cache. It never eagerly resolves an unused -alternative or replays a predicate. Root references and single sampled-reference -lists retain native proxy checking. Atomic-leaf optimization remains an explicit -plugin promise; custom metaclasses and stateful aliases keep the general path. - -The full proposal touches code generation, aliases, diagnostics and caches; it -should not be presented as a trivial one-hook change. The isolation correction -itself changes only the scope lookup and transaction enrollment. Native checks -without state or relevant references do not walk scopes. Ordinary reference -users still have hook lookup and cold/general-path costs. The performance PR -measures those costs rather than claiming universal zero overhead. - -## Evidence and remaining limits - -The preserved candidate fails eight of 17 new generic isolation cases. The -corrected build passes all 17, plus 24 bearshape cases covering nested public -testers, raisers, decorated calls, both discovery orders, caught failures and -automatic/explicit memo scopes. The generic suite also covers recursion, copied -active contexts in another thread, successful and failed object release, and -absence of public scope allocation for ordinary checks. Existing alias, async, -union, error, sampling and cache regressions remain required. - -The plan records fresh installed consumers and upstream results on CPython 3.11 -and 3.14. Those endpoints and local macOS measurements do not prove every -interpreter, platform or optional backend. Hosted CI provides additional -coverage. Upstream review of the public API and integration remains necessary; -the proposal has not shipped upstream. Its bearshape adapter and review -artifacts are merged through #46/#47; that merge does not apply the patches to -beartype. diff --git a/tools/upstream/README.md b/tools/upstream/README.md deleted file mode 100644 index c4c1fcb..0000000 --- a/tools/upstream/README.md +++ /dev/null @@ -1,219 +0,0 @@ -# Native union integration proposal - -## Current state — 12 October 2026 - -The bearshape adapter, regressions and review patches from PRs #46/#47 are -merged into bearshape main, together with the later audit and optimizations -through #57. The complete combined installed proposal suites passed **1,450 -cases per Python endpoint** at the optimization snapshot; the -[post-merge proposal run](https://github.com/beartype/bearshape/actions/runs/38217028857) -also passes. -[The current handoff](../../docs/maintainers/production-readiness.md) records -exact source/artifact identities. These merges neither modify installed beartype -nor make the proposed API available in published 0.23.1. - -The command below is the maintained reproduction route. Later sections labelled -historical describe earlier patch designs and their own measurements; do not use -an earlier single-patch recipe instead of `patches/series.json`. - -## Correctness proposal - -PR #46 now also isolates transaction enrollment by live public invocation. The -[design review](DESIGN_REVIEW.md) explains the correction and alternatives. Its -isolation-stage installed endpoint suites passed 1,251 tests each, including 41 -added isolation cases. Those measurements describe the earlier artifact. - -PR #46 supersedes the earlier ownership design. The previous proposal passed 22 -union cases but failed eleven additional alias and caught-failure regressions. -The scope interface is now `beartype.plug.get_hint_check_scope()`: it returns an -invocation-owned `HintCheckScope` with a private-keyed `state` dictionary, -`owner_code`, and lazily bound `arguments`. Internal alias checks share the -caller; nested decorated and public DOOR checks remain independent. No frame or -context token is retained by a scope. Ordinary users allocate no scope unless a -plugin requests one. bearshape keeps its released-0.23.1 fallback. - -`patches/series.json` pins the released upstream base and SHA256 of each ordered -patch. `0001-state.patch` preserves the original state protocol proposal; -`0002-scope-correctness.patch` adds the public scope API and independent -rollback for a rejected late leaf, including invocation-owned enrollment. These -files are review artifacts, never runtime code loaded or automatically applied -by bearshape. The local wheels still identify as 0.23.1; they are **not the -published beartype 0.23.1 wheel**. - -Create a disposable clean checkout of beartype at -`f85b67d8b0b6bd9c910bd97f0d2d417c4550b038`. From this bearshape checkout, run: - -```sh -uv run --locked python tools/check_upstream_proposal.py \ - --upstream-source /path/to/clean/beartype \ - --output /path/to/new/proposal-evidence --python 3.11 -``` - -Repeat with a second clean upstream checkout, a new output directory and Python -3.14. The driver rejects a dirty/wrong-base checkout and changed patch hashes, -clears hook-local Git variables, applies the reviewed series, builds both -wheels, and runs copied consumers outside source checkouts in a fresh -environment. It includes all runtime tests, four static consumer engines, the -original union probe, scope regressions and upstream protocol/scope unit cases. -It writes exact commands, source base and artifact hashes to the output -directory. A partial failure leaves evidence intact; retry with fresh disposable -paths. Use the created environment's interpreter directly for additional -experiments. - -The `Validate local upstream proposal` workflow runs these endpoint consumers -with read-only repository permissions. It has no publishing job or credentials. -This evidence supplements the released-dependency CI; it does not change release -gates, the dependency lock or the requirement for supported upstream adoption. - -## Ordinary-check optimization - -PR #47 adds `0003-ordinary-performance.patch` independently of the scope fix. -Known state domains avoid publishing an unnecessary transaction context. -bearshape also declares `__beartype_state_atomic__ = True`: each leaf restores -its own mutations on False or any BaseException. Composite parents still own -rollback when a later check rejects the whole alternative. - -For composite checks containing only ordinary forward references, specialization -waits until native checking has resolved every reference to a plain class with -the builtin metaclass and no state hook. It compiles the same expression with -those classes; it never resolves an unused alternative, retries predicates or -changes sampling. The upstream reference cache holds weak invalidation -listeners. Clearing it discards specializations immediately. An already-running -fast check finishes with its captured classes; later calls re-resolve normally. -Custom metaclasses and stateful/composite aliases retain transactions. State -hooks must remain stable while their compiled checker is cached. - -Root references and single sampled-reference lists keep native proxy checking. -They retain a small additional hook lookup cost. This avoids expanding the -change into code-factory caching contracts merely to optimize that last lookup. -The benchmark now records tuple, mapping and nested-list cases plus the first -invocation of each case. First-invocation samples include setup and may share -previously resolved aliases, so they are not a statistical cold-start benchmark. -Warm medians and raw samples use the same script and wheel inputs in all -variants; there is no timing threshold in CI. See the -[current matched results and raw samples](evidence/2026-10-11-isolation/README.md). - -## Historical proposal evidence - -The `test_union_transactions.py` suite exercises the proposed beartype -`__beartype_state__` protocol. It runs explicitly because the required upstream -change has not shipped. These tests are real failures on published beartype -`0.23.1`; they have no skips or expected-failure markers. Passing the normal -0.23.1 CI suite does not prove this integration. - -The bearshape adapter exposes the existing `get_memo` function as a shared state -getter on its runtime-hint metaclass. It returns the active `ShapeMemo`, whose -`snapshot()` and `restore(token)` methods cover single dimensions, variadic -dimensions and tree structures. State is located once per checking expression. -Existing leaf validation remains necessary for rc0 and bare `isinstance` calls. - -The original local proposal at upstream commit -`4aef992d1cd0a6d09fe5c3784523c44e0874b178` used a callback per snapshot. It -remains historical comparison evidence. The optimized proposal replaces that -interface with a state getter, compiles checking functions once, keeps simple -rollback records, and avoids unnecessary root snapshots and stateless-path -setup. Both proposals are based on upstream -`a2729e0e358bf963ee6f177e300ae08a622d05d6`, which identifies itself as -development `0.23.0rc1`. This version string does not imply acceptance or -publication. The optimized patch and exact commit are recorded in the focused -ExecPlan. Neither proposal is vendored or applied at import time. - -## Historical single-patch reproduction - -Apply the supplied patch to a clean checkout of the upstream base commit. From -this bearshape checkout, export the locked tools and backends while excluding -the upstream package being tested: - -```sh -uv export --locked --no-hashes --no-emit-project --no-emit-package beartype \ - --output-file /tmp/bearshape-union-requirements.txt -uv venv /tmp/bearshape-union-env --python 3.11 -UV_TORCH_BACKEND=cpu uv pip install \ - --python /tmp/bearshape-union-env/bin/python \ - -r /tmp/bearshape-union-requirements.txt \ - /path/to/patched/beartype . -/tmp/bearshape-union-env/bin/python tools/probe_union.py -/tmp/bearshape-union-env/bin/python -m pytest \ - tests/ tools/upstream/test_union_transactions.py -n auto -``` - -Repeat in a separate Python 3.14 environment. The probe must pass, the new -regressions must pass without skips, and the existing runtime and four-checker -suite must remain green. Use the environment's interpreter directly: a later -`uv run --locked` would restore the published dependency from the lock. - -To observe the published dependency's unresolved failure directly: - -```sh -uv run --locked python tools/probe_union.py -uv run --locked pytest tools/upstream/test_union_transactions.py -n 0 -``` - -Both commands currently fail. This is baseline evidence, not successful -validation. Once an upstream-supported release exists, update the dependency -floor, lock, exact-version preflight and shared CI together, and move these -regressions into the required `tests/` suite. Do not retain a separate optional -integration lane after adopting the dependency that fixes the defect. - -## Original 22-case coverage - -The 22 integration cases cover selected and rejected alternatives, earlier -bindings, nested unions, parameters and returns, explicit scopes, Like and -variadic annotations, tree structure bindings, async calls, cancellation, thread -isolation, object release, `Annotated` predicates, container sampling, and -aliases resolved after decoration. Negative cases still reject wrong values and -dimensions with useful beartype violations. - -The proposal preserves the upstream ordering and sampling rules. A later -argument failure does not cause a search for a different earlier alternative. -Hidden state changes inside arbitrary predicates are not discovered; the -stateful runtime hint must expose the state hook. Completed transactions release -their state references and are ignored by subsequent checks using a copied -execution context; the upstream proposal includes regressions for both cases. - -Local CPU runs do not establish CUDA coverage for the changed artifacts. The -handoff report and ExecPlan record interpreter versions, checks and availability -separately from earlier GPU evidence. - -## Historical overhead comparison - -Run the same benchmark script in each normally installed environment: - -```sh -/path/to/environment/bin/python tools/upstream/benchmark_transactions.py \ - --calls 20000 --repeats 7 -/path/to/environment/bin/python tools/benchmark_runtime.py \ - --calls 10000 --repeats 5 -``` - -The transaction benchmark verifies each case before timing it. An incorrect -baseline is recorded as `correct: false`; its failure is not presented as a -faster valid implementation. The synthetic plugin fixture supports both local -proposal interfaces solely to compare their bookkeeping using identical inputs. -The actual bearshape adapter exposes only the current proposed interface. - -Compare original bearshape with rc0 and the first proposal, then optimized -bearshape with rc0 and the optimized proposal. PR #35 independently reduces -frame-discovery work; include it in both sides of the latter comparison to avoid -attributing that improvement to upstream. Record versions, source commits and -artifact hashes, and keep raw repeat samples. Timing has no CI threshold. - -Upstream submission and adoption remain separate from this local review -material. Use the current reproduction driver and retain matched artifact -identities for any new comparison. - -## October 2026 refresh - -The proposal now applies to upstream release tag `v0.23.1`, source `f85b67d8`. -Published 0.23.1 still fails 20 of the 22 integration cases. The locally built -port passes all 22 on Python 3.11.15 and 3.14.5, with the original union probe -unchanged. Normally installed module origins were checked. Upstream unit tests -passed 446 cases on 3.11 and 457 on 3.14, with 18/7 -interpreter/optional-dependency skips; upstream pyright reports no errors. These -are proposal results, not claims about the published wheel. - -The durable patch and logs are under the main checkout's ignored -`build/release-2026-10-11/`. The focused program plan records the current -Python/dependency baseline. No upstream push, PR or maintainer message has been -sent. Supported upstream adoption is still required before releasing bearshape -with the full composition contract. diff --git a/tools/upstream/benchmark_transactions.py b/tools/upstream/benchmark_transactions.py deleted file mode 100644 index 68f15f8..0000000 --- a/tools/upstream/benchmark_transactions.py +++ /dev/null @@ -1,233 +0,0 @@ -"""Measure checked union behavior; label incorrect baselines instead of timing them.""" - -from __future__ import annotations - -import argparse -import json -import platform -import statistics -import sys -import timeit -from collections.abc import Callable -from importlib.metadata import version -from time import perf_counter_ns - -import numpy as np -from beartype import BeartypeConf, beartype -from beartype.door import is_bearable -from beartype.roar import BeartypeCallHintParamViolation - -from bearshape import C, N, check, check_context -from bearshape._memo import get_memo -from bearshape.numpy import F32 - - -@beartype -def strict(value: F32[N]) -> F32[N]: - return value - - -@check(conf=BeartypeConf()) -def explicit(value: F32[N]) -> F32[N]: - return value - - -@beartype -def union(_pair: tuple[F32[N], str] | tuple[F32[C], int], _last: F32[N]) -> None: - pass - - -@check(conf=BeartypeConf()) -def union_explicit( - _pair: tuple[F32[N], str] | tuple[F32[C], int], _last: F32[N] -) -> None: - pass - - -@beartype -def native(value: int | str) -> int | str: - return value - - -@beartype -def forward(value: LaterNative) -> object: - return value - - -@beartype -def unselected(value: int | NeverResolved) -> object: # ruff: ignore[undefined-name] - return value - - -@beartype -def nested_forward(value: list[LaterNative]) -> object: - return value - - -@beartype -def tuple_forward(value: tuple[LaterNative, int]) -> object: - return value - - -@beartype -def mapping_forward(value: dict[str, LaterNative]) -> object: - return value - - -@beartype -def nested_lists_forward(value: list[list[LaterNative]]) -> object: - return value - - -class LaterNative: - pass - - -_bindings: dict[str, int] = {} - - -class _State: - def snapshot(self) -> dict[str, int]: - return _bindings.copy() - - def restore(self, old: dict[str, int]) -> None: - _bindings.clear() - _bindings.update(old) - - -_state = _State() - - -def _get_state() -> _State: - return _state - - -def _old_snapshot() -> Callable[[], None]: - # The fixture supports both local proposals for matched comparisons. - before = _state.snapshot() - return lambda: _state.restore(before) - - -class _StatefulMeta(type): - __beartype_state__ = staticmethod(_get_state) - __beartype_snapshot__ = staticmethod(_old_snapshot) - - def __instancecheck__(cls, value: object) -> bool: - if not isinstance(value, list): - return False - return _bindings.setdefault(cls.__name__, len(value)) == len(value) - - -class StateA(metaclass=_StatefulMeta): - pass - - -class StateB(metaclass=_StatefulMeta): - pass - - -@beartype -def plugin_leaf(_value: StateA) -> None: - pass - - -@beartype -def plugin_union(_value: tuple[StateA, str] | tuple[StateB, int]) -> None: - pass - - -def plugin_second() -> None: - plugin_union(([1], 1)) - if _bindings != {"StateB": 1}: - msg = "Plugin union retained rejected state" - raise AssertionError(msg) - - -_array2 = np.ones(2, dtype=np.float32) -_array3 = np.ones(3, dtype=np.float32) -_union_hint = tuple[F32[N], str] | tuple[F32[C], int] -_nested_hint = tuple[_union_hint, str] | tuple[tuple[F32[N], int], int] - - -def all_failed() -> None: - with check_context(): - if is_bearable((_array2, None), _union_hint): - msg = "Invalid union accepted" - raise AssertionError(msg) - if get_memo().single: - msg = "Failed union retained state" - raise AssertionError(msg) - - -def nested() -> None: - with check_context(): - if not is_bearable(((_array2, 1), 1), _nested_hint): - msg = "Valid nested union rejected" - raise AssertionError(msg) - if get_memo().single != {"N": 2}: - msg = "Nested union retained rejected state" - raise AssertionError(msg) - - -def main() -> None: - parser = argparse.ArgumentParser(description=__doc__) - parser.add_argument("--calls", type=int, default=20_000) - parser.add_argument("--repeats", type=int, default=7) - args = parser.parse_args() - if args.calls < 1 or args.repeats < 1: - parser.error("calls and repeats must be positive") - later = LaterNative() - later_list = [later] - cases: dict[str, Callable[[], object]] = { - "native": lambda: native(1), - "forward-resolved-stateless": lambda: forward(later), - "forward-unselected": lambda: unselected(1), - "forward-nested-stateless": lambda: nested_forward(later_list), - "forward-tuple": lambda: tuple_forward((later, 1)), - "forward-mapping": lambda: mapping_forward({"key": later}), - "forward-nested-lists": lambda: nested_lists_forward([later_list]), - "plugin-leaf": lambda: plugin_leaf([1]), - "plugin-union-second": plugin_second, - "strict": lambda: strict(_array2), - "explicit": lambda: explicit(_array2), - "union-first": lambda: union((_array2, "yes"), _array2), - "union-second": lambda: union((_array2, 1), _array3), - "union-explicit-second": lambda: union_explicit((_array2, 1), _array3), - "union-all-failed": all_failed, - "union-nested": nested, - } - results = [] - for name, call in cases.items(): - _bindings.clear() - start = perf_counter_ns() - try: - call() - except (AssertionError, BeartypeCallHintParamViolation) as error: - results.append({"case": name, "correct": False, "reason": str(error)}) - continue - first_call_us = (perf_counter_ns() - start) / 1000 - samples = [ - seconds * 1_000_000 / args.calls - for seconds in timeit.repeat(call, number=args.calls, repeat=args.repeats) - ] - results.append({ - "case": name, - "correct": True, - "first_call_us": first_call_us, - "median_us": statistics.median(samples), - "samples_us": samples, - }) - evidence = { - "python": sys.version, - "platform": platform.platform(), - "versions": {p: version(p) for p in ("bearshape", "beartype", "numpy")}, - "calls": args.calls, - "repeats": args.repeats, - "results": results, - } - json.dump(evidence, sys.stdout, indent=2) - sys.stdout.write("\n") - - -if __name__ == "__main__": - main() diff --git a/tools/upstream/evidence/2026-10-11-isolation/README.md b/tools/upstream/evidence/2026-10-11-isolation/README.md deleted file mode 100644 index 2efc403..0000000 --- a/tools/upstream/evidence/2026-10-11-isolation/README.md +++ /dev/null @@ -1,84 +0,0 @@ -# Measurements after the isolation correction - -Matched sequential local runs on macOS arm64 with Python 3.11.15 and 3.14.5, -NumPy 2.4.6 and optree 0.19.1. All variants use the same normally installed -bearshape wheel. Only the upstream wheel changes: published 0.23.1, corrected -scope proposal `e44afa92`, or optimized proposal `7d039bcb`. The pinned release -base is `f85b67d8`; bearshape implementation inputs are commit `dee5bb1`. - -The unchanged transaction benchmark uses 20,000 calls and seven raw repeats, -checking each case before timing. Incorrect baseline unions are recorded as -incorrect. First-call times are single setup observations, not statistical -cold-start results. The unchanged runtime benchmark uses 10,000 calls and five -repeats (with fewer calls for diagnostics) and includes small/large arrays, Like -conversions, nested checking, Value, Tree and error diagnostics. Its JSON -records median/min/max; transaction JSON retains every raw repeat. - -Each file identifies script and wheel hashes, versions and normally installed -origins. Package files were compared byte-for-byte against their input wheels: -482 released beartype files, 484 proposal files, and 18 bearshape files. New -virtual environments were used, with no tests running during benchmarks. Full -commands and logs remain under `build/union-isolation-revision/` in the main -checkout. Earlier measurements in the adjacent folder are preserved. - -Times below are warm microseconds per call. - -| Case | Python | Released | Correctness | Optimized | -| -------------- | ------ | --------: | ----------: | --------: | -| Native | 3.11 | 0.096 | 0.099 | 0.099 | -| Native | 3.14 | 0.101 | 0.098 | 0.141 | -| Root ref | 3.11 | 0.646 | 0.717 | 0.725 | -| Root ref | 3.14 | 0.501 | 0.517 | 0.590 | -| Sampled list | 3.11 | 0.690 | 1.656 | 0.776 | -| Sampled list | 3.14 | 0.569 | 1.289 | 0.622 | -| Tuple | 3.11 | 0.685 | 1.600 | 0.171 | -| Tuple | 3.14 | 0.535 | 1.256 | 0.186 | -| Mapping | 3.11 | 0.713 | 1.615 | 0.197 | -| Mapping | 3.14 | 0.583 | 1.306 | 0.234 | -| Nested lists | 3.11 | 0.727 | 1.665 | 0.229 | -| Nested lists | 3.14 | 0.605 | 1.354 | 0.287 | -| Strict | 3.11 | 12.749 | 11.844 | 8.562 | -| Strict | 3.14 | 13.626 | 12.577 | 9.422 | -| Explicit | 3.11 | 8.434 | 10.074 | 6.938 | -| Explicit | 3.14 | 8.412 | 10.484 | 7.400 | -| Union fallback | 3.11 | Incorrect | 15.942 | 13.787 | -| Union fallback | 3.14 | Incorrect | 16.980 | 14.642 | - -On 3.11 the remaining root-reference and sampled-list costs are about 0.08–0.09 -microseconds beyond released 0.23.1. Warm ordinary composites avoid transaction -ownership work after specialization. The correctness-only candidate pays more -for owner lookup on the general path; the independent optimization removes that -work where state domains are already known or references are proven plain. Cold, -custom-metaclass and stateful paths retain real costs. - -The first full 3.14 run measured native checking at 0.141 microseconds in the -optimized environment, versus 0.101 released. That observation is retained. -Because native generated checks do not enter the transaction path, an additional -stability probe ran three rounds with rotated variant order, one million calls -and seven repeats per case, including a bare-call control. Optimized native -medians were 0.094–0.096; released medians were 0.101–0.103. The probe source, -all samples and generated disassembly are in `native-stability-314.json`. The -initial slowdown did not reproduce; these local timings are not a universal -performance guarantee or a CI threshold. - -Fresh installed suites pass 1,251 correctness and 1,262 optimized tests on each -endpoint, including all four checker consumers, the original union probe and 41 -added isolation cases. Five CPU skips remain absent CuPy and four platform -precision cases. Upstream units pass 473/481 correctness and 484/492 optimized -cases, with 15/7 existing interpreter, optional and known-issue skips. Upstream -pyright analyzes 483 files with no errors or warnings. The 17 new generic cases -and 24 bearshape cases cover independent nested calls, recursion, discovery -order, caught failures, copied contexts, lifetime and lazy public-scope -allocation. - -The tested upstream wheel hashes are: - -- Released: `4461b4dc57e3fdd6c8a8464b22cf118002eea107c33e9fef651c69068ab3cce3` -- Corrected: `0e19b66f35fd1a49dff124f67d69f273dd2309d1b850d4b6bc59cad6521a9100` -- Optimized: `0580ede1fe87229728b42674d45fb8c32ce09a7e348f962cc2741304ef2f10d8` - -The common bearshape wheel SHA256 is -`fe593320362bee43e8f1f91bb3ec10d1b3f85a0ea1039a3b7f7b409302ad8026`. No package -has been published; the proposal wheels still identify as 0.23.1 and must not be -confused with the published wheel. Supported upstream adoption remains a release -prerequisite. diff --git a/tools/upstream/evidence/2026-10-11-isolation/native-stability-314.json b/tools/upstream/evidence/2026-10-11-isolation/native-stability-314.json deleted file mode 100644 index db87119..0000000 --- a/tools/upstream/evidence/2026-10-11-isolation/native-stability-314.json +++ /dev/null @@ -1,223 +0,0 @@ -{ - "calls": 1000000, - "repeats": 7, - "runs": [ - { - "python": "3.14.5 (main, May 10 2026, 19:20:57) [Clang 22.1.3 ]", - "cases": { - "bare": { - "median_us": 0.015098624979145825, - "samples_us": [ - 0.014800208009546623, 0.014658875006716698, 0.015098624979145825, - 0.015199332992779091, 0.015160582988755777, 0.015152582986047491, - 0.015086332976352423 - ] - }, - "native": { - "median_us": 0.10145437499159016, - "samples_us": [ - 0.10123079200275242, 0.10145437499159016, 0.1012733340030536, - 0.10236550000263378, 0.10283104199334048, 0.10170370899140835, - 0.09956304199295118 - ] - } - }, - "disassembly": " 1 RESUME 0\n\n 11 LOAD_GLOBAL 1 (len + NULL)\n LOAD_FAST_BORROW 5 (args)\n CALL 1\n STORE_FAST 7 (__beartype_args_len)\n\n 16 LOAD_FAST_BORROW 7 (__beartype_args_len)\n LOAD_SMALL_INT 0\n COMPARE_OP 148 (bool(>))\n POP_JUMP_IF_FALSE 10 (to L1)\n NOT_TAKEN\n LOAD_FAST_BORROW 5 (args)\n LOAD_SMALL_INT 0\n BINARY_OP 26 ([])\n JUMP_FORWARD 17 (to L2)\n\n 17 L1: LOAD_FAST_BORROW 6 (kwargs)\n LOAD_ATTR 3 (get + NULL|self)\n LOAD_CONST 1 ('value')\n LOAD_FAST_BORROW 1 (__beartype_get_violation)\n CALL 2\n\n 15 L2: STORE_FAST 8 (__beartype_pith_0)\n\n 21 LOAD_FAST_BORROW_LOAD_FAST_BORROW 129 (__beartype_pith_0, __beartype_get_violation)\n IS_OP 1 (is not)\n POP_JUMP_IF_FALSE 31 (to L3)\n NOT_TAKEN\n\n 25 LOAD_GLOBAL 5 (isinstance + NULL)\n LOAD_FAST_BORROW_LOAD_FAST_BORROW 128 (__beartype_pith_0, __beartype_object_4404311808)\n CALL 2\n TO_BOOL\n POP_JUMP_IF_TRUE 14 (to L3)\n NOT_TAKEN\n\n 27 LOAD_FAST_BORROW 1 (__beartype_get_violation)\n PUSH_NULL\n\n 28 LOAD_FAST_BORROW 3 (__beartype_call_curr)\n\n 29 LOAD_CONST 1 ('value')\n\n 30 LOAD_FAST_BORROW 8 (__beartype_pith_0)\n\n 27 LOAD_CONST 2 (('decor_func', 'pith_name', 'pith_value'))\n CALL_KW 3\n STORE_FAST 9 (__beartype_violation)\n\n 33 LOAD_FAST_BORROW 9 (__beartype_violation)\n RAISE_VARARGS 1\n\n 36 L3: LOAD_FAST_BORROW 4 (__beartype_func)\n PUSH_NULL\n LOAD_FAST_BORROW 5 (args)\n BUILD_MAP 0\n LOAD_FAST_BORROW 6 (kwargs)\n DICT_MERGE 1\n CALL_FUNCTION_EX\n STORE_FAST 8 (__beartype_pith_0)\n\n 40 NOP\n\n 44 LOAD_GLOBAL 5 (isinstance + NULL)\n LOAD_FAST_BORROW_LOAD_FAST_BORROW 128 (__beartype_pith_0, __beartype_object_4404311808)\n CALL 2\n TO_BOOL\n POP_JUMP_IF_TRUE 14 (to L4)\n NOT_TAKEN\n\n 46 LOAD_FAST_BORROW 1 (__beartype_get_violation)\n PUSH_NULL\n\n 47 LOAD_FAST_BORROW 3 (__beartype_call_curr)\n\n 48 LOAD_CONST 3 ('return')\n\n 49 LOAD_FAST_BORROW 8 (__beartype_pith_0)\n\n 46 LOAD_CONST 2 (('decor_func', 'pith_name', 'pith_value'))\n CALL_KW 3\n STORE_FAST 9 (__beartype_violation)\n\n 52 LOAD_FAST_BORROW 9 (__beartype_violation)\n RAISE_VARARGS 1\n\n 53 L4: LOAD_FAST_BORROW 8 (__beartype_pith_0)\n RETURN_VALUE\n", - "variant": "released", - "round": 1 - }, - { - "python": "3.14.5 (main, May 10 2026, 19:20:57) [Clang 22.1.3 ]", - "cases": { - "bare": { - "median_us": 0.015123165998375043, - "samples_us": [ - 0.015120791998924688, 0.015446208009961993, 0.014990166993811727, - 0.015437291993293911, 0.015123165998375043, 0.014916917018126696, - 0.015204167022602633 - ] - }, - "native": { - "median_us": 0.09672233302262612, - "samples_us": [ - 0.09776779200183228, 0.09672233302262612, 0.09656454200739972, - 0.0963241670106072, 0.09654800000134856, 0.09683958298410289, - 0.09836049997829832 - ] - } - }, - "disassembly": " 1 RESUME 0\n\n 12 LOAD_GLOBAL 1 (len + NULL)\n LOAD_FAST_BORROW 6 (args)\n CALL 1\n STORE_FAST 8 (__beartype_args_len)\n\n 17 LOAD_FAST_BORROW 8 (__beartype_args_len)\n LOAD_SMALL_INT 0\n COMPARE_OP 148 (bool(>))\n POP_JUMP_IF_FALSE 10 (to L1)\n NOT_TAKEN\n LOAD_FAST_BORROW 6 (args)\n LOAD_SMALL_INT 0\n BINARY_OP 26 ([])\n JUMP_FORWARD 17 (to L2)\n\n 18 L1: LOAD_FAST_BORROW 7 (kwargs)\n LOAD_ATTR 3 (get + NULL|self)\n LOAD_CONST 1 ('value')\n LOAD_FAST_BORROW 1 (__beartype_get_violation)\n CALL 2\n\n 16 L2: STORE_FAST 9 (__beartype_pith_0)\n\n 22 LOAD_FAST_BORROW_LOAD_FAST_BORROW 145 (__beartype_pith_0, __beartype_get_violation)\n IS_OP 1 (is not)\n POP_JUMP_IF_FALSE 31 (to L3)\n NOT_TAKEN\n\n 26 LOAD_GLOBAL 5 (isinstance + NULL)\n LOAD_FAST_BORROW_LOAD_FAST_BORROW 144 (__beartype_pith_0, __beartype_object_4482839424)\n CALL 2\n TO_BOOL\n POP_JUMP_IF_TRUE 14 (to L3)\n NOT_TAKEN\n\n 28 LOAD_FAST_BORROW 1 (__beartype_get_violation)\n PUSH_NULL\n\n 29 LOAD_FAST_BORROW 3 (__beartype_call_curr)\n\n 30 LOAD_CONST 1 ('value')\n\n 31 LOAD_FAST_BORROW 9 (__beartype_pith_0)\n\n 28 LOAD_CONST 2 (('decor_func', 'pith_name', 'pith_value'))\n CALL_KW 3\n STORE_FAST 10 (__beartype_violation)\n\n 34 LOAD_FAST_BORROW 10 (__beartype_violation)\n RAISE_VARARGS 1\n\n 37 L3: LOAD_FAST_BORROW 4 (__beartype_func)\n PUSH_NULL\n LOAD_FAST_BORROW 6 (args)\n BUILD_MAP 0\n LOAD_FAST_BORROW 7 (kwargs)\n DICT_MERGE 1\n CALL_FUNCTION_EX\n STORE_FAST 9 (__beartype_pith_0)\n\n 41 NOP\n\n 45 LOAD_GLOBAL 5 (isinstance + NULL)\n LOAD_FAST_BORROW_LOAD_FAST_BORROW 144 (__beartype_pith_0, __beartype_object_4482839424)\n CALL 2\n TO_BOOL\n POP_JUMP_IF_TRUE 14 (to L4)\n NOT_TAKEN\n\n 47 LOAD_FAST_BORROW 1 (__beartype_get_violation)\n PUSH_NULL\n\n 48 LOAD_FAST_BORROW 3 (__beartype_call_curr)\n\n 49 LOAD_CONST 3 ('return')\n\n 50 LOAD_FAST_BORROW 9 (__beartype_pith_0)\n\n 47 LOAD_CONST 2 (('decor_func', 'pith_name', 'pith_value'))\n CALL_KW 3\n STORE_FAST 10 (__beartype_violation)\n\n 53 LOAD_FAST_BORROW 10 (__beartype_violation)\n RAISE_VARARGS 1\n\n 54 L4: LOAD_FAST_BORROW 9 (__beartype_pith_0)\n RETURN_VALUE\n", - "variant": "correctness", - "round": 1 - }, - { - "python": "3.14.5 (main, May 10 2026, 19:20:57) [Clang 22.1.3 ]", - "cases": { - "bare": { - "median_us": 0.015092290996108204, - "samples_us": [ - 0.015092290996108204, 0.01498425001045689, 0.014943124988349155, - 0.015311249997466803, 0.014902666007401422, 0.015310832997784019, - 0.015429083025082946 - ] - }, - "native": { - "median_us": 0.09572591600590385, - "samples_us": [ - 0.0952904169971589, 0.09570162498857826, 0.09621583297848701, - 0.09572591600590385, 0.09572383400518447, 0.09582537499954924, - 0.09575916701578535 - ] - } - }, - "disassembly": " 1 RESUME 0\n\n 12 LOAD_GLOBAL 1 (len + NULL)\n LOAD_FAST_BORROW 6 (args)\n CALL 1\n STORE_FAST 8 (__beartype_args_len)\n\n 17 LOAD_FAST_BORROW 8 (__beartype_args_len)\n LOAD_SMALL_INT 0\n COMPARE_OP 148 (bool(>))\n POP_JUMP_IF_FALSE 10 (to L1)\n NOT_TAKEN\n LOAD_FAST_BORROW 6 (args)\n LOAD_SMALL_INT 0\n BINARY_OP 26 ([])\n JUMP_FORWARD 17 (to L2)\n\n 18 L1: LOAD_FAST_BORROW 7 (kwargs)\n LOAD_ATTR 3 (get + NULL|self)\n LOAD_CONST 1 ('value')\n LOAD_FAST_BORROW 1 (__beartype_get_violation)\n CALL 2\n\n 16 L2: STORE_FAST 9 (__beartype_pith_0)\n\n 22 LOAD_FAST_BORROW_LOAD_FAST_BORROW 145 (__beartype_pith_0, __beartype_get_violation)\n IS_OP 1 (is not)\n POP_JUMP_IF_FALSE 31 (to L3)\n NOT_TAKEN\n\n 26 LOAD_GLOBAL 5 (isinstance + NULL)\n LOAD_FAST_BORROW_LOAD_FAST_BORROW 144 (__beartype_pith_0, __beartype_object_4402743040)\n CALL 2\n TO_BOOL\n POP_JUMP_IF_TRUE 14 (to L3)\n NOT_TAKEN\n\n 28 LOAD_FAST_BORROW 1 (__beartype_get_violation)\n PUSH_NULL\n\n 29 LOAD_FAST_BORROW 3 (__beartype_call_curr)\n\n 30 LOAD_CONST 1 ('value')\n\n 31 LOAD_FAST_BORROW 9 (__beartype_pith_0)\n\n 28 LOAD_CONST 2 (('decor_func', 'pith_name', 'pith_value'))\n CALL_KW 3\n STORE_FAST 10 (__beartype_violation)\n\n 34 LOAD_FAST_BORROW 10 (__beartype_violation)\n RAISE_VARARGS 1\n\n 37 L3: LOAD_FAST_BORROW 4 (__beartype_func)\n PUSH_NULL\n LOAD_FAST_BORROW 6 (args)\n BUILD_MAP 0\n LOAD_FAST_BORROW 7 (kwargs)\n DICT_MERGE 1\n CALL_FUNCTION_EX\n STORE_FAST 9 (__beartype_pith_0)\n\n 41 NOP\n\n 45 LOAD_GLOBAL 5 (isinstance + NULL)\n LOAD_FAST_BORROW_LOAD_FAST_BORROW 144 (__beartype_pith_0, __beartype_object_4402743040)\n CALL 2\n TO_BOOL\n POP_JUMP_IF_TRUE 14 (to L4)\n NOT_TAKEN\n\n 47 LOAD_FAST_BORROW 1 (__beartype_get_violation)\n PUSH_NULL\n\n 48 LOAD_FAST_BORROW 3 (__beartype_call_curr)\n\n 49 LOAD_CONST 3 ('return')\n\n 50 LOAD_FAST_BORROW 9 (__beartype_pith_0)\n\n 47 LOAD_CONST 2 (('decor_func', 'pith_name', 'pith_value'))\n CALL_KW 3\n STORE_FAST 10 (__beartype_violation)\n\n 53 LOAD_FAST_BORROW 10 (__beartype_violation)\n RAISE_VARARGS 1\n\n 54 L4: LOAD_FAST_BORROW 9 (__beartype_pith_0)\n RETURN_VALUE\n", - "variant": "optimized", - "round": 1 - }, - { - "python": "3.14.5 (main, May 10 2026, 19:20:57) [Clang 22.1.3 ]", - "cases": { - "bare": { - "median_us": 0.01503187499474734, - "samples_us": [ - 0.014736667013494298, 0.015322249993914738, 0.015158166992478073, - 0.014546207996318117, 0.014834959001746029, 0.01503187499474734, - 0.015213334001600742 - ] - }, - "native": { - "median_us": 0.09412883300683461, - "samples_us": [ - 0.09408750000875443, 0.09402858300018124, 0.09436758299125358, - 0.09455645800335333, 0.0943277080077678, 0.09412883300683461, - 0.09399308302090503 - ] - } - }, - "disassembly": " 1 RESUME 0\n\n 12 LOAD_GLOBAL 1 (len + NULL)\n LOAD_FAST_BORROW 6 (args)\n CALL 1\n STORE_FAST 8 (__beartype_args_len)\n\n 17 LOAD_FAST_BORROW 8 (__beartype_args_len)\n LOAD_SMALL_INT 0\n COMPARE_OP 148 (bool(>))\n POP_JUMP_IF_FALSE 10 (to L1)\n NOT_TAKEN\n LOAD_FAST_BORROW 6 (args)\n LOAD_SMALL_INT 0\n BINARY_OP 26 ([])\n JUMP_FORWARD 17 (to L2)\n\n 18 L1: LOAD_FAST_BORROW 7 (kwargs)\n LOAD_ATTR 3 (get + NULL|self)\n LOAD_CONST 1 ('value')\n LOAD_FAST_BORROW 1 (__beartype_get_violation)\n CALL 2\n\n 16 L2: STORE_FAST 9 (__beartype_pith_0)\n\n 22 LOAD_FAST_BORROW_LOAD_FAST_BORROW 145 (__beartype_pith_0, __beartype_get_violation)\n IS_OP 1 (is not)\n POP_JUMP_IF_FALSE 31 (to L3)\n NOT_TAKEN\n\n 26 LOAD_GLOBAL 5 (isinstance + NULL)\n LOAD_FAST_BORROW_LOAD_FAST_BORROW 144 (__beartype_pith_0, __beartype_object_4412802176)\n CALL 2\n TO_BOOL\n POP_JUMP_IF_TRUE 14 (to L3)\n NOT_TAKEN\n\n 28 LOAD_FAST_BORROW 1 (__beartype_get_violation)\n PUSH_NULL\n\n 29 LOAD_FAST_BORROW 3 (__beartype_call_curr)\n\n 30 LOAD_CONST 1 ('value')\n\n 31 LOAD_FAST_BORROW 9 (__beartype_pith_0)\n\n 28 LOAD_CONST 2 (('decor_func', 'pith_name', 'pith_value'))\n CALL_KW 3\n STORE_FAST 10 (__beartype_violation)\n\n 34 LOAD_FAST_BORROW 10 (__beartype_violation)\n RAISE_VARARGS 1\n\n 37 L3: LOAD_FAST_BORROW 4 (__beartype_func)\n PUSH_NULL\n LOAD_FAST_BORROW 6 (args)\n BUILD_MAP 0\n LOAD_FAST_BORROW 7 (kwargs)\n DICT_MERGE 1\n CALL_FUNCTION_EX\n STORE_FAST 9 (__beartype_pith_0)\n\n 41 NOP\n\n 45 LOAD_GLOBAL 5 (isinstance + NULL)\n LOAD_FAST_BORROW_LOAD_FAST_BORROW 144 (__beartype_pith_0, __beartype_object_4412802176)\n CALL 2\n TO_BOOL\n POP_JUMP_IF_TRUE 14 (to L4)\n NOT_TAKEN\n\n 47 LOAD_FAST_BORROW 1 (__beartype_get_violation)\n PUSH_NULL\n\n 48 LOAD_FAST_BORROW 3 (__beartype_call_curr)\n\n 49 LOAD_CONST 3 ('return')\n\n 50 LOAD_FAST_BORROW 9 (__beartype_pith_0)\n\n 47 LOAD_CONST 2 (('decor_func', 'pith_name', 'pith_value'))\n CALL_KW 3\n STORE_FAST 10 (__beartype_violation)\n\n 53 LOAD_FAST_BORROW 10 (__beartype_violation)\n RAISE_VARARGS 1\n\n 54 L4: LOAD_FAST_BORROW 9 (__beartype_pith_0)\n RETURN_VALUE\n", - "variant": "optimized", - "round": 2 - }, - { - "python": "3.14.5 (main, May 10 2026, 19:20:57) [Clang 22.1.3 ]", - "cases": { - "bare": { - "median_us": 0.015189957979600877, - "samples_us": [ - 0.01503808400593698, 0.015207416989142075, 0.015368291991762817, - 0.015668584004743025, 0.015037457982543856, 0.015189957979600877, - 0.015065624989802018 - ] - }, - "native": { - "median_us": 0.09655541699612513, - "samples_us": [ - 0.09691362499142997, 0.09632179199252278, 0.09631320799235255, - 0.09670741701847874, 0.09655541699612513, 0.0958467079908587, - 0.11213966700597666 - ] - } - }, - "disassembly": " 1 RESUME 0\n\n 12 LOAD_GLOBAL 1 (len + NULL)\n LOAD_FAST_BORROW 6 (args)\n CALL 1\n STORE_FAST 8 (__beartype_args_len)\n\n 17 LOAD_FAST_BORROW 8 (__beartype_args_len)\n LOAD_SMALL_INT 0\n COMPARE_OP 148 (bool(>))\n POP_JUMP_IF_FALSE 10 (to L1)\n NOT_TAKEN\n LOAD_FAST_BORROW 6 (args)\n LOAD_SMALL_INT 0\n BINARY_OP 26 ([])\n JUMP_FORWARD 17 (to L2)\n\n 18 L1: LOAD_FAST_BORROW 7 (kwargs)\n LOAD_ATTR 3 (get + NULL|self)\n LOAD_CONST 1 ('value')\n LOAD_FAST_BORROW 1 (__beartype_get_violation)\n CALL 2\n\n 16 L2: STORE_FAST 9 (__beartype_pith_0)\n\n 22 LOAD_FAST_BORROW_LOAD_FAST_BORROW 145 (__beartype_pith_0, __beartype_get_violation)\n IS_OP 1 (is not)\n POP_JUMP_IF_FALSE 31 (to L3)\n NOT_TAKEN\n\n 26 LOAD_GLOBAL 5 (isinstance + NULL)\n LOAD_FAST_BORROW_LOAD_FAST_BORROW 144 (__beartype_pith_0, __beartype_object_4467815808)\n CALL 2\n TO_BOOL\n POP_JUMP_IF_TRUE 14 (to L3)\n NOT_TAKEN\n\n 28 LOAD_FAST_BORROW 1 (__beartype_get_violation)\n PUSH_NULL\n\n 29 LOAD_FAST_BORROW 3 (__beartype_call_curr)\n\n 30 LOAD_CONST 1 ('value')\n\n 31 LOAD_FAST_BORROW 9 (__beartype_pith_0)\n\n 28 LOAD_CONST 2 (('decor_func', 'pith_name', 'pith_value'))\n CALL_KW 3\n STORE_FAST 10 (__beartype_violation)\n\n 34 LOAD_FAST_BORROW 10 (__beartype_violation)\n RAISE_VARARGS 1\n\n 37 L3: LOAD_FAST_BORROW 4 (__beartype_func)\n PUSH_NULL\n LOAD_FAST_BORROW 6 (args)\n BUILD_MAP 0\n LOAD_FAST_BORROW 7 (kwargs)\n DICT_MERGE 1\n CALL_FUNCTION_EX\n STORE_FAST 9 (__beartype_pith_0)\n\n 41 NOP\n\n 45 LOAD_GLOBAL 5 (isinstance + NULL)\n LOAD_FAST_BORROW_LOAD_FAST_BORROW 144 (__beartype_pith_0, __beartype_object_4467815808)\n CALL 2\n TO_BOOL\n POP_JUMP_IF_TRUE 14 (to L4)\n NOT_TAKEN\n\n 47 LOAD_FAST_BORROW 1 (__beartype_get_violation)\n PUSH_NULL\n\n 48 LOAD_FAST_BORROW 3 (__beartype_call_curr)\n\n 49 LOAD_CONST 3 ('return')\n\n 50 LOAD_FAST_BORROW 9 (__beartype_pith_0)\n\n 47 LOAD_CONST 2 (('decor_func', 'pith_name', 'pith_value'))\n CALL_KW 3\n STORE_FAST 10 (__beartype_violation)\n\n 53 LOAD_FAST_BORROW 10 (__beartype_violation)\n RAISE_VARARGS 1\n\n 54 L4: LOAD_FAST_BORROW 9 (__beartype_pith_0)\n RETURN_VALUE\n", - "variant": "correctness", - "round": 2 - }, - { - "python": "3.14.5 (main, May 10 2026, 19:20:57) [Clang 22.1.3 ]", - "cases": { - "bare": { - "median_us": 0.015378667012555525, - "samples_us": [ - 0.015672292007366195, 0.014993624994531274, 0.014963249996071681, - 0.015327499975683168, 0.015466707991436124, 0.015537166997091845, - 0.015378667012555525 - ] - }, - "native": { - "median_us": 0.10278370798914693, - "samples_us": [ - 0.10182999999960884, 0.10278370798914693, 0.10327650001272559, - 0.10358070800430141, 0.10305737497401424, 0.1011885829793755, - 0.10216533299535513 - ] - } - }, - "disassembly": " 1 RESUME 0\n\n 11 LOAD_GLOBAL 1 (len + NULL)\n LOAD_FAST_BORROW 5 (args)\n CALL 1\n STORE_FAST 7 (__beartype_args_len)\n\n 16 LOAD_FAST_BORROW 7 (__beartype_args_len)\n LOAD_SMALL_INT 0\n COMPARE_OP 148 (bool(>))\n POP_JUMP_IF_FALSE 10 (to L1)\n NOT_TAKEN\n LOAD_FAST_BORROW 5 (args)\n LOAD_SMALL_INT 0\n BINARY_OP 26 ([])\n JUMP_FORWARD 17 (to L2)\n\n 17 L1: LOAD_FAST_BORROW 6 (kwargs)\n LOAD_ATTR 3 (get + NULL|self)\n LOAD_CONST 1 ('value')\n LOAD_FAST_BORROW 1 (__beartype_get_violation)\n CALL 2\n\n 15 L2: STORE_FAST 8 (__beartype_pith_0)\n\n 21 LOAD_FAST_BORROW_LOAD_FAST_BORROW 129 (__beartype_pith_0, __beartype_get_violation)\n IS_OP 1 (is not)\n POP_JUMP_IF_FALSE 31 (to L3)\n NOT_TAKEN\n\n 25 LOAD_GLOBAL 5 (isinstance + NULL)\n LOAD_FAST_BORROW_LOAD_FAST_BORROW 128 (__beartype_pith_0, __beartype_object_4443846528)\n CALL 2\n TO_BOOL\n POP_JUMP_IF_TRUE 14 (to L3)\n NOT_TAKEN\n\n 27 LOAD_FAST_BORROW 1 (__beartype_get_violation)\n PUSH_NULL\n\n 28 LOAD_FAST_BORROW 3 (__beartype_call_curr)\n\n 29 LOAD_CONST 1 ('value')\n\n 30 LOAD_FAST_BORROW 8 (__beartype_pith_0)\n\n 27 LOAD_CONST 2 (('decor_func', 'pith_name', 'pith_value'))\n CALL_KW 3\n STORE_FAST 9 (__beartype_violation)\n\n 33 LOAD_FAST_BORROW 9 (__beartype_violation)\n RAISE_VARARGS 1\n\n 36 L3: LOAD_FAST_BORROW 4 (__beartype_func)\n PUSH_NULL\n LOAD_FAST_BORROW 5 (args)\n BUILD_MAP 0\n LOAD_FAST_BORROW 6 (kwargs)\n DICT_MERGE 1\n CALL_FUNCTION_EX\n STORE_FAST 8 (__beartype_pith_0)\n\n 40 NOP\n\n 44 LOAD_GLOBAL 5 (isinstance + NULL)\n LOAD_FAST_BORROW_LOAD_FAST_BORROW 128 (__beartype_pith_0, __beartype_object_4443846528)\n CALL 2\n TO_BOOL\n POP_JUMP_IF_TRUE 14 (to L4)\n NOT_TAKEN\n\n 46 LOAD_FAST_BORROW 1 (__beartype_get_violation)\n PUSH_NULL\n\n 47 LOAD_FAST_BORROW 3 (__beartype_call_curr)\n\n 48 LOAD_CONST 3 ('return')\n\n 49 LOAD_FAST_BORROW 8 (__beartype_pith_0)\n\n 46 LOAD_CONST 2 (('decor_func', 'pith_name', 'pith_value'))\n CALL_KW 3\n STORE_FAST 9 (__beartype_violation)\n\n 52 LOAD_FAST_BORROW 9 (__beartype_violation)\n RAISE_VARARGS 1\n\n 53 L4: LOAD_FAST_BORROW 8 (__beartype_pith_0)\n RETURN_VALUE\n", - "variant": "released", - "round": 2 - }, - { - "python": "3.14.5 (main, May 10 2026, 19:20:57) [Clang 22.1.3 ]", - "cases": { - "bare": { - "median_us": 0.01515862499945797, - "samples_us": [ - 0.014848291000816971, 0.01515862499945797, 0.014857458998449147, - 0.015043583000078797, 0.015176625020103529, 0.015424209006596357, - 0.01524758301093243 - ] - }, - "native": { - "median_us": 0.09436820799601264, - "samples_us": [ - 0.09436820799601264, 0.09437295800307766, 0.09456483300891705, - 0.0942612919898238, 0.09681483299937099, 0.09427533301641233, - 0.09385499998461455 - ] - } - }, - "disassembly": " 1 RESUME 0\n\n 12 LOAD_GLOBAL 1 (len + NULL)\n LOAD_FAST_BORROW 6 (args)\n CALL 1\n STORE_FAST 8 (__beartype_args_len)\n\n 17 LOAD_FAST_BORROW 8 (__beartype_args_len)\n LOAD_SMALL_INT 0\n COMPARE_OP 148 (bool(>))\n POP_JUMP_IF_FALSE 10 (to L1)\n NOT_TAKEN\n LOAD_FAST_BORROW 6 (args)\n LOAD_SMALL_INT 0\n BINARY_OP 26 ([])\n JUMP_FORWARD 17 (to L2)\n\n 18 L1: LOAD_FAST_BORROW 7 (kwargs)\n LOAD_ATTR 3 (get + NULL|self)\n LOAD_CONST 1 ('value')\n LOAD_FAST_BORROW 1 (__beartype_get_violation)\n CALL 2\n\n 16 L2: STORE_FAST 9 (__beartype_pith_0)\n\n 22 LOAD_FAST_BORROW_LOAD_FAST_BORROW 145 (__beartype_pith_0, __beartype_get_violation)\n IS_OP 1 (is not)\n POP_JUMP_IF_FALSE 31 (to L3)\n NOT_TAKEN\n\n 26 LOAD_GLOBAL 5 (isinstance + NULL)\n LOAD_FAST_BORROW_LOAD_FAST_BORROW 144 (__beartype_pith_0, __beartype_object_4402689152)\n CALL 2\n TO_BOOL\n POP_JUMP_IF_TRUE 14 (to L3)\n NOT_TAKEN\n\n 28 LOAD_FAST_BORROW 1 (__beartype_get_violation)\n PUSH_NULL\n\n 29 LOAD_FAST_BORROW 3 (__beartype_call_curr)\n\n 30 LOAD_CONST 1 ('value')\n\n 31 LOAD_FAST_BORROW 9 (__beartype_pith_0)\n\n 28 LOAD_CONST 2 (('decor_func', 'pith_name', 'pith_value'))\n CALL_KW 3\n STORE_FAST 10 (__beartype_violation)\n\n 34 LOAD_FAST_BORROW 10 (__beartype_violation)\n RAISE_VARARGS 1\n\n 37 L3: LOAD_FAST_BORROW 4 (__beartype_func)\n PUSH_NULL\n LOAD_FAST_BORROW 6 (args)\n BUILD_MAP 0\n LOAD_FAST_BORROW 7 (kwargs)\n DICT_MERGE 1\n CALL_FUNCTION_EX\n STORE_FAST 9 (__beartype_pith_0)\n\n 41 NOP\n\n 45 LOAD_GLOBAL 5 (isinstance + NULL)\n LOAD_FAST_BORROW_LOAD_FAST_BORROW 144 (__beartype_pith_0, __beartype_object_4402689152)\n CALL 2\n TO_BOOL\n POP_JUMP_IF_TRUE 14 (to L4)\n NOT_TAKEN\n\n 47 LOAD_FAST_BORROW 1 (__beartype_get_violation)\n PUSH_NULL\n\n 48 LOAD_FAST_BORROW 3 (__beartype_call_curr)\n\n 49 LOAD_CONST 3 ('return')\n\n 50 LOAD_FAST_BORROW 9 (__beartype_pith_0)\n\n 47 LOAD_CONST 2 (('decor_func', 'pith_name', 'pith_value'))\n CALL_KW 3\n STORE_FAST 10 (__beartype_violation)\n\n 53 LOAD_FAST_BORROW 10 (__beartype_violation)\n RAISE_VARARGS 1\n\n 54 L4: LOAD_FAST_BORROW 9 (__beartype_pith_0)\n RETURN_VALUE\n", - "variant": "correctness", - "round": 3 - }, - { - "python": "3.14.5 (main, May 10 2026, 19:20:57) [Clang 22.1.3 ]", - "cases": { - "bare": { - "median_us": 0.01514270799816586, - "samples_us": [ - 0.015364125021733344, 0.01514270799816586, 0.015162125026108697, - 0.01509749999968335, 0.014785457984544337, 0.014721499988809228, - 0.015149957995163277 - ] - }, - "native": { - "median_us": 0.10292879201006144, - "samples_us": [ - 0.10292879201006144, 0.10448262499994598, 0.10354874999029562, - 0.1032943339960184, 0.10273175002657808, 0.0998018330137711, - 0.10254458300187252 - ] - } - }, - "disassembly": " 1 RESUME 0\n\n 11 LOAD_GLOBAL 1 (len + NULL)\n LOAD_FAST_BORROW 5 (args)\n CALL 1\n STORE_FAST 7 (__beartype_args_len)\n\n 16 LOAD_FAST_BORROW 7 (__beartype_args_len)\n LOAD_SMALL_INT 0\n COMPARE_OP 148 (bool(>))\n POP_JUMP_IF_FALSE 10 (to L1)\n NOT_TAKEN\n LOAD_FAST_BORROW 5 (args)\n LOAD_SMALL_INT 0\n BINARY_OP 26 ([])\n JUMP_FORWARD 17 (to L2)\n\n 17 L1: LOAD_FAST_BORROW 6 (kwargs)\n LOAD_ATTR 3 (get + NULL|self)\n LOAD_CONST 1 ('value')\n LOAD_FAST_BORROW 1 (__beartype_get_violation)\n CALL 2\n\n 15 L2: STORE_FAST 8 (__beartype_pith_0)\n\n 21 LOAD_FAST_BORROW_LOAD_FAST_BORROW 129 (__beartype_pith_0, __beartype_get_violation)\n IS_OP 1 (is not)\n POP_JUMP_IF_FALSE 31 (to L3)\n NOT_TAKEN\n\n 25 LOAD_GLOBAL 5 (isinstance + NULL)\n LOAD_FAST_BORROW_LOAD_FAST_BORROW 128 (__beartype_pith_0, __beartype_object_4471748608)\n CALL 2\n TO_BOOL\n POP_JUMP_IF_TRUE 14 (to L3)\n NOT_TAKEN\n\n 27 LOAD_FAST_BORROW 1 (__beartype_get_violation)\n PUSH_NULL\n\n 28 LOAD_FAST_BORROW 3 (__beartype_call_curr)\n\n 29 LOAD_CONST 1 ('value')\n\n 30 LOAD_FAST_BORROW 8 (__beartype_pith_0)\n\n 27 LOAD_CONST 2 (('decor_func', 'pith_name', 'pith_value'))\n CALL_KW 3\n STORE_FAST 9 (__beartype_violation)\n\n 33 LOAD_FAST_BORROW 9 (__beartype_violation)\n RAISE_VARARGS 1\n\n 36 L3: LOAD_FAST_BORROW 4 (__beartype_func)\n PUSH_NULL\n LOAD_FAST_BORROW 5 (args)\n BUILD_MAP 0\n LOAD_FAST_BORROW 6 (kwargs)\n DICT_MERGE 1\n CALL_FUNCTION_EX\n STORE_FAST 8 (__beartype_pith_0)\n\n 40 NOP\n\n 44 LOAD_GLOBAL 5 (isinstance + NULL)\n LOAD_FAST_BORROW_LOAD_FAST_BORROW 128 (__beartype_pith_0, __beartype_object_4471748608)\n CALL 2\n TO_BOOL\n POP_JUMP_IF_TRUE 14 (to L4)\n NOT_TAKEN\n\n 46 LOAD_FAST_BORROW 1 (__beartype_get_violation)\n PUSH_NULL\n\n 47 LOAD_FAST_BORROW 3 (__beartype_call_curr)\n\n 48 LOAD_CONST 3 ('return')\n\n 49 LOAD_FAST_BORROW 8 (__beartype_pith_0)\n\n 46 LOAD_CONST 2 (('decor_func', 'pith_name', 'pith_value'))\n CALL_KW 3\n STORE_FAST 9 (__beartype_violation)\n\n 52 LOAD_FAST_BORROW 9 (__beartype_violation)\n RAISE_VARARGS 1\n\n 53 L4: LOAD_FAST_BORROW 8 (__beartype_pith_0)\n RETURN_VALUE\n", - "variant": "released", - "round": 3 - }, - { - "python": "3.14.5 (main, May 10 2026, 19:20:57) [Clang 22.1.3 ]", - "cases": { - "bare": { - "median_us": 0.015194416977465153, - "samples_us": [ - 0.015015124983619899, 0.015194416977465153, 0.01529958299943246, - 0.01518295900314115, 0.015403958997922018, 0.01489116600714624, - 0.015321582992328331 - ] - }, - "native": { - "median_us": 0.09592670798883773, - "samples_us": [ - 0.09670391702093184, 0.09583120900788344, 0.09649791699484922, - 0.09591820801142603, 0.0953448340005707, 0.09668687501107343, - 0.09592670798883773 - ] - } - }, - "disassembly": " 1 RESUME 0\n\n 12 LOAD_GLOBAL 1 (len + NULL)\n LOAD_FAST_BORROW 6 (args)\n CALL 1\n STORE_FAST 8 (__beartype_args_len)\n\n 17 LOAD_FAST_BORROW 8 (__beartype_args_len)\n LOAD_SMALL_INT 0\n COMPARE_OP 148 (bool(>))\n POP_JUMP_IF_FALSE 10 (to L1)\n NOT_TAKEN\n LOAD_FAST_BORROW 6 (args)\n LOAD_SMALL_INT 0\n BINARY_OP 26 ([])\n JUMP_FORWARD 17 (to L2)\n\n 18 L1: LOAD_FAST_BORROW 7 (kwargs)\n LOAD_ATTR 3 (get + NULL|self)\n LOAD_CONST 1 ('value')\n LOAD_FAST_BORROW 1 (__beartype_get_violation)\n CALL 2\n\n 16 L2: STORE_FAST 9 (__beartype_pith_0)\n\n 22 LOAD_FAST_BORROW_LOAD_FAST_BORROW 145 (__beartype_pith_0, __beartype_get_violation)\n IS_OP 1 (is not)\n POP_JUMP_IF_FALSE 31 (to L3)\n NOT_TAKEN\n\n 26 LOAD_GLOBAL 5 (isinstance + NULL)\n LOAD_FAST_BORROW_LOAD_FAST_BORROW 144 (__beartype_pith_0, __beartype_object_4407100800)\n CALL 2\n TO_BOOL\n POP_JUMP_IF_TRUE 14 (to L3)\n NOT_TAKEN\n\n 28 LOAD_FAST_BORROW 1 (__beartype_get_violation)\n PUSH_NULL\n\n 29 LOAD_FAST_BORROW 3 (__beartype_call_curr)\n\n 30 LOAD_CONST 1 ('value')\n\n 31 LOAD_FAST_BORROW 9 (__beartype_pith_0)\n\n 28 LOAD_CONST 2 (('decor_func', 'pith_name', 'pith_value'))\n CALL_KW 3\n STORE_FAST 10 (__beartype_violation)\n\n 34 LOAD_FAST_BORROW 10 (__beartype_violation)\n RAISE_VARARGS 1\n\n 37 L3: LOAD_FAST_BORROW 4 (__beartype_func)\n PUSH_NULL\n LOAD_FAST_BORROW 6 (args)\n BUILD_MAP 0\n LOAD_FAST_BORROW 7 (kwargs)\n DICT_MERGE 1\n CALL_FUNCTION_EX\n STORE_FAST 9 (__beartype_pith_0)\n\n 41 NOP\n\n 45 LOAD_GLOBAL 5 (isinstance + NULL)\n LOAD_FAST_BORROW_LOAD_FAST_BORROW 144 (__beartype_pith_0, __beartype_object_4407100800)\n CALL 2\n TO_BOOL\n POP_JUMP_IF_TRUE 14 (to L4)\n NOT_TAKEN\n\n 47 LOAD_FAST_BORROW 1 (__beartype_get_violation)\n PUSH_NULL\n\n 48 LOAD_FAST_BORROW 3 (__beartype_call_curr)\n\n 49 LOAD_CONST 3 ('return')\n\n 50 LOAD_FAST_BORROW 9 (__beartype_pith_0)\n\n 47 LOAD_CONST 2 (('decor_func', 'pith_name', 'pith_value'))\n CALL_KW 3\n STORE_FAST 10 (__beartype_violation)\n\n 53 LOAD_FAST_BORROW 10 (__beartype_violation)\n RAISE_VARARGS 1\n\n 54 L4: LOAD_FAST_BORROW 9 (__beartype_pith_0)\n RETURN_VALUE\n", - "variant": "optimized", - "round": 3 - } - ], - "probe": "import json,sys,timeit,statistics,dis,io,hashlib\nfrom beartype import beartype\n@beartype\ndef native(value:int|str)->int|str:return value\ndef bare(value):return value\nresult={\"python\":sys.version,\"cases\":{}}\nfor name,fn in [(\"bare\",bare),(\"native\",native)]:\n call=lambda:fn(1)\n call()\n samples=[x*1e6/1000000 for x in timeit.repeat(call,number=1000000,repeat=7)]\n result[\"cases\"][name]={\"median_us\":statistics.median(samples),\"samples_us\":samples}\ns=io.StringIO();dis.dis(native,file=s);result[\"disassembly\"]=s.getvalue()\nprint(json.dumps(result))\n" -} diff --git a/tools/upstream/evidence/2026-10-11-isolation/runtime-correctness-311.json b/tools/upstream/evidence/2026-10-11-isolation/runtime-correctness-311.json deleted file mode 100644 index 799f0df..0000000 --- a/tools/upstream/evidence/2026-10-11-isolation/runtime-correctness-311.json +++ /dev/null @@ -1,194 +0,0 @@ -{ - "python": "3.11.15 (main, May 10 2026, 19:23:07) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit", - "machine": "arm64", - "bearshape_origin": "/private/tmp/isolation-bench-correctness-311/lib/python3.11/site-packages/bearshape/__init__.py", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6", - "optree": "0.19.1" - }, - "results": [ - { - "case": "bare/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 0.01926249824464321, - "min_us": 0.019166700076311827, - "max_us": 0.0196165987290442 - }, - { - "case": "native/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 0.09073340042959899, - "min_us": 0.08387500129174441, - "max_us": 0.09262080129701644 - }, - { - "case": "strict/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 11.926474998472258, - "min_us": 11.89310000045225, - "max_us": 11.964341698330827 - }, - { - "case": "explicit/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 10.316716600209475, - "min_us": 10.234545898856595, - "max_us": 10.825079202186316 - }, - { - "case": "like/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 10.820675001014024, - "min_us": 8.61881659948267, - "max_us": 11.524479198851623 - }, - { - "case": "nested/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 24.50047500024084, - "min_us": 23.596829202142544, - "max_us": 27.018045898876153 - }, - { - "case": "value/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 12.090066701057367, - "min_us": 11.687120801070705, - "max_us": 13.58802090107929 - }, - { - "case": "like-sequence/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 8.632291699177586, - "min_us": 8.570341701852158, - "max_us": 9.141070800251327 - }, - { - "case": "diagnostic/3", - "calls_per_repeat": 1000, - "repeats": 5, - "median_us": 99.2494169913698, - "min_us": 91.92979198996909, - "max_us": 147.367249999661 - }, - { - "case": "bare/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 0.018158400780521333, - "min_us": 0.018029101192951202, - "max_us": 0.01934999891091138 - }, - { - "case": "native/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 0.0976250012172386, - "min_us": 0.08966670138761401, - "max_us": 0.1102125010220334 - }, - { - "case": "strict/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 13.676412499626167, - "min_us": 13.095754201640375, - "max_us": 19.81567500042729 - }, - { - "case": "explicit/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 10.947975001181476, - "min_us": 10.581900001852773, - "max_us": 11.7340291995788 - }, - { - "case": "like/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 7.950029199128039, - "min_us": 7.776524999644607, - "max_us": 8.100229199044406 - }, - { - "case": "nested/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 22.882375001790933, - "min_us": 22.753462500986643, - "max_us": 27.600000001257285 - }, - { - "case": "value/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 11.286537500564009, - "min_us": 11.247391600045376, - "max_us": 11.491695800214075 - }, - { - "case": "like-sequence/1000000", - "calls_per_repeat": 5, - "repeats": 5, - "median_us": 11769.250000361353, - "min_us": 11616.849998245016, - "max_us": 11925.241601420566 - }, - { - "case": "diagnostic/1000000", - "calls_per_repeat": 1000, - "repeats": 5, - "median_us": 95.47316702082753, - "min_us": 94.0858340181876, - "max_us": 97.80104100354947 - }, - { - "case": "tree/1", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 19.85141249897424, - "min_us": 19.512612497783266, - "max_us": 20.404270800645463 - }, - { - "case": "tree/100", - "calls_per_repeat": 100, - "repeats": 5, - "median_us": 611.2691698945127, - "min_us": 606.245830131229, - "max_us": 621.2770901038311 - } - ], - "evidence": { - "variant": "correctness", - "script": "tools/benchmark_runtime.py", - "script_sha256": "ff0f6cb59229bc1ddf3dfd47ea2b3b3aceac5d1db878fcb8479934b5d513887b", - "wheel_sha256": { - "bearshape": "fe593320362bee43e8f1f91bb3ec10d1b3f85a0ea1039a3b7f7b409302ad8026", - "beartype": "0e19b66f35fd1a49dff124f67d69f273dd2309d1b850d4b6bc59cad6521a9100" - }, - "origins": { - "beartype": "/private/tmp/isolation-bench-correctness-311/lib/python3.11/site-packages/beartype/__init__.py", - "bearshape": "/private/tmp/isolation-bench-correctness-311/lib/python3.11/site-packages/bearshape/__init__.py" - }, - "installed_files_verified": { - "beartype": 484, - "bearshape": 18 - }, - "upstream_commit": "e44afa92", - "bearshape_commit": "dee5bb1", - "sequential": true - } -} diff --git a/tools/upstream/evidence/2026-10-11-isolation/runtime-correctness-314.json b/tools/upstream/evidence/2026-10-11-isolation/runtime-correctness-314.json deleted file mode 100644 index 55dedb5..0000000 --- a/tools/upstream/evidence/2026-10-11-isolation/runtime-correctness-314.json +++ /dev/null @@ -1,194 +0,0 @@ -{ - "python": "3.14.5 (main, May 10 2026, 19:20:57) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit-Mach-O", - "machine": "arm64", - "bearshape_origin": "/private/tmp/isolation-bench-correctness-314/lib/python3.14/site-packages/bearshape/__init__.py", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6", - "optree": "0.19.1" - }, - "results": [ - { - "case": "bare/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 0.01950410078279674, - "min_us": 0.01898330228868872, - "max_us": 0.020108302123844624 - }, - { - "case": "native/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 0.09677090274635702, - "min_us": 0.09655410249251872, - "max_us": 0.14074999780859798 - }, - { - "case": "strict/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 12.341295799706131, - "min_us": 12.176329098292626, - "max_us": 12.421295800595544 - }, - { - "case": "explicit/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 10.542000000714324, - "min_us": 10.372058401117101, - "max_us": 10.626383300404996 - }, - { - "case": "like/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 8.118312497390434, - "min_us": 8.054237501346506, - "max_us": 8.166729201911949 - }, - { - "case": "nested/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 23.70445840060711, - "min_us": 23.45037499908358, - "max_us": 24.095566602773033 - }, - { - "case": "value/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 11.467370798345655, - "min_us": 11.405574998934753, - "max_us": 11.620941699948162 - }, - { - "case": "like-sequence/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 9.140520801884122, - "min_us": 9.053958402364515, - "max_us": 9.1923375002807 - }, - { - "case": "diagnostic/3", - "calls_per_repeat": 1000, - "repeats": 5, - "median_us": 84.3299999833107, - "min_us": 82.74670797982253, - "max_us": 86.9900000107009 - }, - { - "case": "bare/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 0.01650420017540455, - "min_us": 0.016045899246819317, - "max_us": 0.017016602214425802 - }, - { - "case": "native/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 0.09072910179384053, - "min_us": 0.08997499826364219, - "max_us": 0.09194590093102306 - }, - { - "case": "strict/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 12.506400002166629, - "min_us": 12.359962501795962, - "max_us": 12.647079100133851 - }, - { - "case": "explicit/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 10.554529199725948, - "min_us": 10.407312502502464, - "max_us": 10.929033398861066 - }, - { - "case": "like/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 8.542399998987094, - "min_us": 8.396874999743886, - "max_us": 10.89293330151122 - }, - { - "case": "nested/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 24.5804833015427, - "min_us": 24.356770800659433, - "max_us": 24.71940840187017 - }, - { - "case": "value/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 11.688941699685529, - "min_us": 11.537225000211038, - "max_us": 12.081887500244193 - }, - { - "case": "like-sequence/1000000", - "calls_per_repeat": 5, - "repeats": 5, - "median_us": 12835.941603407264, - "min_us": 12566.816597245634, - "max_us": 13117.649999912828 - }, - { - "case": "diagnostic/1000000", - "calls_per_repeat": 1000, - "repeats": 5, - "median_us": 90.06212497479282, - "min_us": 88.87837501242757, - "max_us": 93.24620800907724 - }, - { - "case": "tree/1", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 20.31581670162268, - "min_us": 20.05651250074152, - "max_us": 21.921329101314768 - }, - { - "case": "tree/100", - "calls_per_repeat": 100, - "repeats": 5, - "median_us": 634.2724998830818, - "min_us": 628.1412500538863, - "max_us": 639.6841700188816 - } - ], - "evidence": { - "variant": "correctness", - "script": "tools/benchmark_runtime.py", - "script_sha256": "ff0f6cb59229bc1ddf3dfd47ea2b3b3aceac5d1db878fcb8479934b5d513887b", - "wheel_sha256": { - "bearshape": "fe593320362bee43e8f1f91bb3ec10d1b3f85a0ea1039a3b7f7b409302ad8026", - "beartype": "0e19b66f35fd1a49dff124f67d69f273dd2309d1b850d4b6bc59cad6521a9100" - }, - "origins": { - "beartype": "/private/tmp/isolation-bench-correctness-314/lib/python3.14/site-packages/beartype/__init__.py", - "bearshape": "/private/tmp/isolation-bench-correctness-314/lib/python3.14/site-packages/bearshape/__init__.py" - }, - "installed_files_verified": { - "beartype": 484, - "bearshape": 18 - }, - "upstream_commit": "e44afa92", - "bearshape_commit": "dee5bb1", - "sequential": true - } -} diff --git a/tools/upstream/evidence/2026-10-11-isolation/runtime-optimized-311.json b/tools/upstream/evidence/2026-10-11-isolation/runtime-optimized-311.json deleted file mode 100644 index 50935ab..0000000 --- a/tools/upstream/evidence/2026-10-11-isolation/runtime-optimized-311.json +++ /dev/null @@ -1,194 +0,0 @@ -{ - "python": "3.11.15 (main, May 10 2026, 19:23:07) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit", - "machine": "arm64", - "bearshape_origin": "/private/tmp/isolation-bench-optimized-311/lib/python3.11/site-packages/bearshape/__init__.py", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6", - "optree": "0.19.1" - }, - "results": [ - { - "case": "bare/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 0.017724998178891838, - "min_us": 0.01724580070003867, - "max_us": 0.018412497593089938 - }, - { - "case": "native/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 0.08621250162832439, - "min_us": 0.08577500120736659, - "max_us": 0.11258750164415687 - }, - { - "case": "strict/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 8.718412500456907, - "min_us": 8.551379101118073, - "max_us": 8.758941700216383 - }, - { - "case": "explicit/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 7.152675001998432, - "min_us": 7.042279199231416, - "max_us": 7.571450000978075 - }, - { - "case": "like/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 5.919470899971202, - "min_us": 5.872358399210498, - "max_us": 5.983554199337959 - }, - { - "case": "nested/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 16.130779098602943, - "min_us": 16.092150000622496, - "max_us": 16.287979198386893 - }, - { - "case": "value/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 8.017070800997317, - "min_us": 7.941612499416806, - "max_us": 8.209887499106117 - }, - { - "case": "like-sequence/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 6.859074998646975, - "min_us": 6.81222919956781, - "max_us": 7.12791669939179 - }, - { - "case": "diagnostic/3", - "calls_per_repeat": 1000, - "repeats": 5, - "median_us": 85.79408298828639, - "min_us": 84.34620901243761, - "max_us": 98.14574997290038 - }, - { - "case": "bare/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 0.017020897939801216, - "min_us": 0.016799999866634607, - "max_us": 0.017354197916574776 - }, - { - "case": "native/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 0.08399580256082118, - "min_us": 0.08105839951895177, - "max_us": 0.10392499971203506 - }, - { - "case": "strict/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 8.748770799138583, - "min_us": 8.693362501799129, - "max_us": 9.060799999861047 - }, - { - "case": "explicit/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 7.037825000588782, - "min_us": 6.952212497708388, - "max_us": 7.050224998965859 - }, - { - "case": "like/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 6.141916598426178, - "min_us": 6.001770799048245, - "max_us": 6.4560582977719605 - }, - { - "case": "nested/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 18.45882920024451, - "min_us": 16.524979201494716, - "max_us": 21.276920899981633 - }, - { - "case": "value/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 8.054024999728426, - "min_us": 8.016029201098718, - "max_us": 8.066079198033549 - }, - { - "case": "like-sequence/1000000", - "calls_per_repeat": 5, - "repeats": 5, - "median_us": 11741.099995560944, - "min_us": 11574.74999781698, - "max_us": 11852.96659823507 - }, - { - "case": "diagnostic/1000000", - "calls_per_repeat": 1000, - "repeats": 5, - "median_us": 94.14195799035951, - "min_us": 90.78266599681228, - "max_us": 96.70295802061446 - }, - { - "case": "tree/1", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 15.812895802082494, - "min_us": 15.723899999284185, - "max_us": 16.297808301169425 - }, - { - "case": "tree/100", - "calls_per_repeat": 100, - "repeats": 5, - "median_us": 585.423749871552, - "min_us": 584.3933401047252, - "max_us": 587.2116598766297 - } - ], - "evidence": { - "variant": "optimized", - "script": "tools/benchmark_runtime.py", - "script_sha256": "ff0f6cb59229bc1ddf3dfd47ea2b3b3aceac5d1db878fcb8479934b5d513887b", - "wheel_sha256": { - "bearshape": "fe593320362bee43e8f1f91bb3ec10d1b3f85a0ea1039a3b7f7b409302ad8026", - "beartype": "0580ede1fe87229728b42674d45fb8c32ce09a7e348f962cc2741304ef2f10d8" - }, - "origins": { - "beartype": "/private/tmp/isolation-bench-optimized-311/lib/python3.11/site-packages/beartype/__init__.py", - "bearshape": "/private/tmp/isolation-bench-optimized-311/lib/python3.11/site-packages/bearshape/__init__.py" - }, - "installed_files_verified": { - "beartype": 484, - "bearshape": 18 - }, - "upstream_commit": "7d039bcb", - "bearshape_commit": "dee5bb1", - "sequential": true - } -} diff --git a/tools/upstream/evidence/2026-10-11-isolation/runtime-optimized-314.json b/tools/upstream/evidence/2026-10-11-isolation/runtime-optimized-314.json deleted file mode 100644 index 7b61456..0000000 --- a/tools/upstream/evidence/2026-10-11-isolation/runtime-optimized-314.json +++ /dev/null @@ -1,194 +0,0 @@ -{ - "python": "3.14.5 (main, May 10 2026, 19:20:57) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit-Mach-O", - "machine": "arm64", - "bearshape_origin": "/private/tmp/isolation-bench-optimized-314/lib/python3.14/site-packages/bearshape/__init__.py", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6", - "optree": "0.19.1" - }, - "results": [ - { - "case": "bare/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 0.017425001715309918, - "min_us": 0.017041602404788136, - "max_us": 0.018279199139215052 - }, - { - "case": "native/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 0.09148749813903123, - "min_us": 0.09065830090548843, - "max_us": 0.09220829815603793 - }, - { - "case": "strict/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 8.778829200309701, - "min_us": 8.753145800437778, - "max_us": 9.12335000175517 - }, - { - "case": "explicit/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 7.150379099766724, - "min_us": 7.082800002535805, - "max_us": 10.039112501544878 - }, - { - "case": "like/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 6.2677540990989655, - "min_us": 6.232962501235306, - "max_us": 6.342654200852849 - }, - { - "case": "nested/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 16.824320898740552, - "min_us": 16.720279198489152, - "max_us": 16.9056584010832 - }, - { - "case": "value/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 8.180216699838638, - "min_us": 8.151783398352563, - "max_us": 8.356708299834281 - }, - { - "case": "like-sequence/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 7.354391599074006, - "min_us": 7.27666660095565, - "max_us": 7.44071250082925 - }, - { - "case": "diagnostic/3", - "calls_per_repeat": 1000, - "repeats": 5, - "median_us": 80.90562501456589, - "min_us": 79.66787499026395, - "max_us": 83.51266698446125 - }, - { - "case": "bare/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 0.017583300359547138, - "min_us": 0.017179202404804528, - "max_us": 0.018212501890957355 - }, - { - "case": "native/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 0.09162089845631272, - "min_us": 0.08972500218078494, - "max_us": 0.0928458000998944 - }, - { - "case": "strict/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 8.834545899298973, - "min_us": 8.781591698061675, - "max_us": 8.938216598471627 - }, - { - "case": "explicit/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 7.177408298593946, - "min_us": 7.143787501263432, - "max_us": 7.2810124984243885 - }, - { - "case": "like/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 6.3234792003640905, - "min_us": 6.301537502440624, - "max_us": 6.344154101680033 - }, - { - "case": "nested/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 16.667533398140222, - "min_us": 16.511208299198188, - "max_us": 16.85058329894673 - }, - { - "case": "value/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 8.185908402083442, - "min_us": 8.161358398501761, - "max_us": 8.271874999627471 - }, - { - "case": "like-sequence/1000000", - "calls_per_repeat": 5, - "repeats": 5, - "median_us": 12125.833396567032, - "min_us": 12028.808397008106, - "max_us": 12456.366600235924 - }, - { - "case": "diagnostic/1000000", - "calls_per_repeat": 1000, - "repeats": 5, - "median_us": 88.23441600543447, - "min_us": 86.63462501135655, - "max_us": 91.05112499673851 - }, - { - "case": "tree/1", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 17.568466701777652, - "min_us": 17.411900000297464, - "max_us": 17.877212501480244 - }, - { - "case": "tree/100", - "calls_per_repeat": 100, - "repeats": 5, - "median_us": 652.5883299764246, - "min_us": 640.8987499889918, - "max_us": 833.0474997637793 - } - ], - "evidence": { - "variant": "optimized", - "script": "tools/benchmark_runtime.py", - "script_sha256": "ff0f6cb59229bc1ddf3dfd47ea2b3b3aceac5d1db878fcb8479934b5d513887b", - "wheel_sha256": { - "bearshape": "fe593320362bee43e8f1f91bb3ec10d1b3f85a0ea1039a3b7f7b409302ad8026", - "beartype": "0580ede1fe87229728b42674d45fb8c32ce09a7e348f962cc2741304ef2f10d8" - }, - "origins": { - "beartype": "/private/tmp/isolation-bench-optimized-314/lib/python3.14/site-packages/beartype/__init__.py", - "bearshape": "/private/tmp/isolation-bench-optimized-314/lib/python3.14/site-packages/bearshape/__init__.py" - }, - "installed_files_verified": { - "beartype": 484, - "bearshape": 18 - }, - "upstream_commit": "7d039bcb", - "bearshape_commit": "dee5bb1", - "sequential": true - } -} diff --git a/tools/upstream/evidence/2026-10-11-isolation/runtime-released-311.json b/tools/upstream/evidence/2026-10-11-isolation/runtime-released-311.json deleted file mode 100644 index cb05a6f..0000000 --- a/tools/upstream/evidence/2026-10-11-isolation/runtime-released-311.json +++ /dev/null @@ -1,194 +0,0 @@ -{ - "python": "3.11.15 (main, May 10 2026, 19:23:07) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit", - "machine": "arm64", - "bearshape_origin": "/private/tmp/isolation-bench-released-311/lib/python3.11/site-packages/bearshape/__init__.py", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6", - "optree": "0.19.1" - }, - "results": [ - { - "case": "bare/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 0.020425001275725663, - "min_us": 0.019120800425298512, - "max_us": 0.0209540972718969 - }, - { - "case": "native/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 0.09018330019898713, - "min_us": 0.08902499976102263, - "max_us": 0.09133749990724027 - }, - { - "case": "strict/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 12.94655829842668, - "min_us": 12.91634579829406, - "max_us": 13.139995900564827 - }, - { - "case": "explicit/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 8.663691600668244, - "min_us": 8.63160409789998, - "max_us": 8.748045898391865 - }, - { - "case": "like/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 6.736149999778718, - "min_us": 6.64411660109181, - "max_us": 6.956358297611587 - }, - { - "case": "nested/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 25.80605410039425, - "min_us": 25.536983300116844, - "max_us": 26.219616600428708 - }, - { - "case": "value/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 9.723120799753815, - "min_us": 9.646825000527315, - "max_us": 9.739666699897498 - }, - { - "case": "like-sequence/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 7.534170898725279, - "min_us": 7.504654102376662, - "max_us": 7.561858301050961 - }, - { - "case": "diagnostic/3", - "calls_per_repeat": 1000, - "repeats": 5, - "median_us": 88.48304199636914, - "min_us": 88.11450001667254, - "max_us": 89.65783301391639 - }, - { - "case": "bare/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 0.017116701928898692, - "min_us": 0.01701669825706631, - "max_us": 0.017750001279637218 - }, - { - "case": "native/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 0.08130409987643361, - "min_us": 0.08065410074777901, - "max_us": 0.08215420239139348 - }, - { - "case": "strict/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 13.022737498977222, - "min_us": 12.974708402180113, - "max_us": 13.508041598834097 - }, - { - "case": "explicit/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 8.789787499699742, - "min_us": 8.656225001323037, - "max_us": 8.97120829904452 - }, - { - "case": "like/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 6.77256660128478, - "min_us": 6.761316698975861, - "max_us": 6.864491698797792 - }, - { - "case": "nested/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 25.875470900791697, - "min_us": 25.706337500014342, - "max_us": 25.936024999828078 - }, - { - "case": "value/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 9.698008300620131, - "min_us": 9.574954101117328, - "max_us": 9.767954199924134 - }, - { - "case": "like-sequence/1000000", - "calls_per_repeat": 5, - "repeats": 5, - "median_us": 11843.708396190777, - "min_us": 11629.241798073053, - "max_us": 11861.941800452769 - }, - { - "case": "diagnostic/1000000", - "calls_per_repeat": 1000, - "repeats": 5, - "median_us": 95.42541598784737, - "min_us": 94.65941699454561, - "max_us": 96.56495801755227 - }, - { - "case": "tree/1", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 17.515233301674016, - "min_us": 17.360795801505446, - "max_us": 17.93478750041686 - }, - { - "case": "tree/100", - "calls_per_repeat": 100, - "repeats": 5, - "median_us": 323.51499976357445, - "min_us": 321.26749982126057, - "max_us": 326.472089800518 - } - ], - "evidence": { - "variant": "released", - "script": "tools/benchmark_runtime.py", - "script_sha256": "ff0f6cb59229bc1ddf3dfd47ea2b3b3aceac5d1db878fcb8479934b5d513887b", - "wheel_sha256": { - "bearshape": "fe593320362bee43e8f1f91bb3ec10d1b3f85a0ea1039a3b7f7b409302ad8026", - "beartype": "4461b4dc57e3fdd6c8a8464b22cf118002eea107c33e9fef651c69068ab3cce3" - }, - "origins": { - "beartype": "/private/tmp/isolation-bench-released-311/lib/python3.11/site-packages/beartype/__init__.py", - "bearshape": "/private/tmp/isolation-bench-released-311/lib/python3.11/site-packages/bearshape/__init__.py" - }, - "installed_files_verified": { - "beartype": 482, - "bearshape": 18 - }, - "upstream_commit": "f85b67d8b0b6bd9c910bd97f0d2d417c4550b038", - "bearshape_commit": "dee5bb1", - "sequential": true - } -} diff --git a/tools/upstream/evidence/2026-10-11-isolation/runtime-released-314.json b/tools/upstream/evidence/2026-10-11-isolation/runtime-released-314.json deleted file mode 100644 index e7047d2..0000000 --- a/tools/upstream/evidence/2026-10-11-isolation/runtime-released-314.json +++ /dev/null @@ -1,194 +0,0 @@ -{ - "python": "3.14.5 (main, May 10 2026, 19:20:57) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit-Mach-O", - "machine": "arm64", - "bearshape_origin": "/private/tmp/isolation-bench-released-314/lib/python3.14/site-packages/bearshape/__init__.py", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6", - "optree": "0.19.1" - }, - "results": [ - { - "case": "bare/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 0.017499999376013875, - "min_us": 0.016541601507924497, - "max_us": 0.019275001250207424 - }, - { - "case": "native/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 0.08840000082273036, - "min_us": 0.08792080043349415, - "max_us": 0.08869160083122551 - }, - { - "case": "strict/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 13.251183301326819, - "min_us": 13.176679197931662, - "max_us": 14.78864170203451 - }, - { - "case": "explicit/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 8.323341701179743, - "min_us": 7.974104199092835, - "max_us": 8.78571670036763 - }, - { - "case": "like/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 7.131604198366404, - "min_us": 7.067095799720846, - "max_us": 8.393487500143237 - }, - { - "case": "nested/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 26.664716697996482, - "min_us": 24.969583298661746, - "max_us": 44.67981250199955 - }, - { - "case": "value/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 10.47614999988582, - "min_us": 9.451512500527315, - "max_us": 10.857045798911713 - }, - { - "case": "like-sequence/3", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 9.374379200744443, - "min_us": 8.178370899986476, - "max_us": 10.480904200812802 - }, - { - "case": "diagnostic/3", - "calls_per_repeat": 1000, - "repeats": 5, - "median_us": 118.1911249877885, - "min_us": 100.25083299842663, - "max_us": 133.03966700914316 - }, - { - "case": "bare/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 0.017283399938605726, - "min_us": 0.017187499906867743, - "max_us": 0.017933300114236772 - }, - { - "case": "native/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 0.0880292005604133, - "min_us": 0.08748749969527125, - "max_us": 0.09672090236563236 - }, - { - "case": "strict/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 16.663912500371225, - "min_us": 14.550583399250172, - "max_us": 17.492629200569354 - }, - { - "case": "explicit/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 9.425637501408346, - "min_us": 8.309720800025389, - "max_us": 9.79824579844717 - }, - { - "case": "like/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 7.6650000002700835, - "min_us": 7.2019458981230855, - "max_us": 9.623174997977912 - }, - { - "case": "nested/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 26.831241699983366, - "min_us": 25.688908298616298, - "max_us": 27.433362501324154 - }, - { - "case": "value/1000000", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 9.386387499398552, - "min_us": 9.237500000745058, - "max_us": 12.196774999029003 - }, - { - "case": "like-sequence/1000000", - "calls_per_repeat": 5, - "repeats": 5, - "median_us": 12017.550005111843, - "min_us": 11865.550000220537, - "max_us": 14703.358401311561 - }, - { - "case": "diagnostic/1000000", - "calls_per_repeat": 1000, - "repeats": 5, - "median_us": 108.51049999473616, - "min_us": 100.2717919764109, - "max_us": 130.96799998311326 - }, - { - "case": "tree/1", - "calls_per_repeat": 10000, - "repeats": 5, - "median_us": 18.820429197512567, - "min_us": 18.647149999742396, - "max_us": 22.301595800672658 - }, - { - "case": "tree/100", - "calls_per_repeat": 100, - "repeats": 5, - "median_us": 369.9504100950435, - "min_us": 343.1175000150688, - "max_us": 394.9391600326635 - } - ], - "evidence": { - "variant": "released", - "script": "tools/benchmark_runtime.py", - "script_sha256": "ff0f6cb59229bc1ddf3dfd47ea2b3b3aceac5d1db878fcb8479934b5d513887b", - "wheel_sha256": { - "bearshape": "fe593320362bee43e8f1f91bb3ec10d1b3f85a0ea1039a3b7f7b409302ad8026", - "beartype": "4461b4dc57e3fdd6c8a8464b22cf118002eea107c33e9fef651c69068ab3cce3" - }, - "origins": { - "beartype": "/private/tmp/isolation-bench-released-314/lib/python3.14/site-packages/beartype/__init__.py", - "bearshape": "/private/tmp/isolation-bench-released-314/lib/python3.14/site-packages/bearshape/__init__.py" - }, - "installed_files_verified": { - "beartype": 482, - "bearshape": 18 - }, - "upstream_commit": "f85b67d8b0b6bd9c910bd97f0d2d417c4550b038", - "bearshape_commit": "dee5bb1", - "sequential": true - } -} diff --git a/tools/upstream/evidence/2026-10-11-isolation/transactions-correctness-311.json b/tools/upstream/evidence/2026-10-11-isolation/transactions-correctness-311.json deleted file mode 100644 index af1d075..0000000 --- a/tools/upstream/evidence/2026-10-11-isolation/transactions-correctness-311.json +++ /dev/null @@ -1,209 +0,0 @@ -{ - "python": "3.11.15 (main, May 10 2026, 19:23:07) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6" - }, - "calls": 20000, - "repeats": 7, - "results": [ - { - "case": "native", - "correct": true, - "first_call_us": 0.792, - "median_us": 0.09867290063994005, - "samples_us": [ - 0.09568544919602573, 0.0993416499113664, 0.09733545011840761, - 0.09481460001552477, 0.09867290063994005, 0.10066039976663888, - 0.10093954915646464 - ] - }, - { - "case": "forward-resolved-stateless", - "correct": true, - "first_call_us": 37.167, - "median_us": 0.7172083511250094, - "samples_us": [ - 0.7172083511250094, 0.7228354006656446, 0.7184375004726462, - 0.7156749998102896, 0.7160478999139741, 0.7079187504132278, - 0.7196771010058001 - ] - }, - { - "case": "forward-unselected", - "correct": true, - "first_call_us": 1.875, - "median_us": 0.08758124895393848, - "samples_us": [ - 0.08458334923489019, 0.08566665055695921, 0.08758124895393848, - 0.08869790035532787, 0.08813330059638247, 0.08896459912648425, - 0.08333959995070472 - ] - }, - { - "case": "forward-nested-stateless", - "correct": true, - "first_call_us": 29.084, - "median_us": 1.6562457996769808, - "samples_us": [ - 1.6199041507206857, 1.6316979003022425, 1.638981250289362, - 1.6562457996769808, 1.68170624965569, 1.696227100910619, - 1.7026146000716835 - ] - }, - { - "case": "forward-tuple", - "correct": true, - "first_call_us": 20.458, - "median_us": 1.6001354510081, - "samples_us": [ - 1.6132042001117952, 1.6100729510071687, 1.5987208491424099, - 1.6001354510081, 1.5990166502888314, 1.5945937499054708, - 1.6008041493478231 - ] - }, - { - "case": "forward-mapping", - "correct": true, - "first_call_us": 20.917, - "median_us": 1.615031249821186, - "samples_us": [ - 1.6094624996185303, 1.6120562504511327, 1.609960399218835, - 1.6215750001720153, 1.615031249821186, 1.6250125001533888, - 1.621331249771174 - ] - }, - { - "case": "forward-nested-lists", - "correct": true, - "first_call_us": 18.333, - "median_us": 1.6652145510306582, - "samples_us": [ - 1.6450916504254565, 1.648868749907706, 1.6591895488090813, - 1.6652145510306582, 1.8350896003539674, 1.7071833499358036, - 1.6774707997683436 - ] - }, - { - "case": "plugin-leaf", - "correct": true, - "first_call_us": 11.042, - "median_us": 1.1086646001785994, - "samples_us": [ - 1.070524999522604, 1.0639416505000554, 1.0835604509338737, - 1.1154082996654324, 1.159279199782759, 1.1160624999320135, - 1.1086646001785994 - ] - }, - { - "case": "plugin-union-second", - "correct": true, - "first_call_us": 12.375, - "median_us": 1.5546624999842606, - "samples_us": [ - 1.6030854007112794, 1.5546624999842606, 1.5508750002481975, - 1.5698416493250988, 1.5728333499282598, 1.5436041503562592, - 1.5515728999162093 - ] - }, - { - "case": "strict", - "correct": true, - "first_call_us": 108.583, - "median_us": 11.84359585022321, - "samples_us": [ - 11.824014601006638, 11.785510399204213, 11.790904199006036, - 11.87917499919422, 11.84359585022321, 11.954250000417233, - 11.859100000583567 - ] - }, - { - "case": "explicit", - "correct": true, - "first_call_us": 19.375, - "median_us": 10.074408299988136, - "samples_us": [ - 10.064137500012293, 10.113672949955799, 10.044233351072762, - 10.063562499999534, 10.353441700863186, 10.075260399025865, - 10.074408299988136 - ] - }, - { - "case": "union-first", - "correct": true, - "first_call_us": 45.625, - "median_us": 12.673312499828171, - "samples_us": [ - 12.632750000921078, 12.673312499828171, 12.635970849078149, - 12.838720848958474, 12.656389598851092, 12.730487500084564, - 12.717360399255995 - ] - }, - { - "case": "union-second", - "correct": true, - "first_call_us": 25.375, - "median_us": 15.94227915047668, - "samples_us": [ - 16.146383350132965, 15.987099999620114, 15.940456250973511, - 15.92772084986791, 16.30507289955858, 15.93086460052291, - 15.94227915047668 - ] - }, - { - "case": "union-explicit-second", - "correct": true, - "first_call_us": 23.584, - "median_us": 13.75442499993369, - "samples_us": [ - 13.750379149860237, 13.729414599947631, 13.795499999832828, - 13.737543749448378, 13.75442499993369, 13.800706250185613, - 13.79222500108881 - ] - }, - { - "case": "union-all-failed", - "correct": true, - "first_call_us": 153.792, - "median_us": 8.64868124917848, - "samples_us": [ - 8.68323124886956, 8.64868124917848, 8.615962500334717, - 8.635216650145594, 8.632920849777292, 8.686414550174959, - 8.684735398855992 - ] - }, - { - "case": "union-nested", - "correct": true, - "first_call_us": 510.458, - "median_us": 11.768004200712312, - "samples_us": [ - 11.728193750604987, 11.768004200712312, 11.722291698970366, - 11.770577100105584, 11.74070830020355, 11.853939600405283, - 11.772658349946141 - ] - } - ], - "evidence": { - "variant": "correctness", - "script": "tools/upstream/benchmark_transactions.py", - "script_sha256": "52363525b7b8785830527b467c79ae492b0f2a5ab2dd3dec133a75a86a8de969", - "wheel_sha256": { - "bearshape": "fe593320362bee43e8f1f91bb3ec10d1b3f85a0ea1039a3b7f7b409302ad8026", - "beartype": "0e19b66f35fd1a49dff124f67d69f273dd2309d1b850d4b6bc59cad6521a9100" - }, - "origins": { - "beartype": "/private/tmp/isolation-bench-correctness-311/lib/python3.11/site-packages/beartype/__init__.py", - "bearshape": "/private/tmp/isolation-bench-correctness-311/lib/python3.11/site-packages/bearshape/__init__.py" - }, - "installed_files_verified": { - "beartype": 484, - "bearshape": 18 - }, - "upstream_commit": "e44afa92", - "bearshape_commit": "dee5bb1", - "sequential": true - } -} diff --git a/tools/upstream/evidence/2026-10-11-isolation/transactions-correctness-314.json b/tools/upstream/evidence/2026-10-11-isolation/transactions-correctness-314.json deleted file mode 100644 index 4b20ba3..0000000 --- a/tools/upstream/evidence/2026-10-11-isolation/transactions-correctness-314.json +++ /dev/null @@ -1,208 +0,0 @@ -{ - "python": "3.14.5 (main, May 10 2026, 19:20:57) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit-Mach-O", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6" - }, - "calls": 20000, - "repeats": 7, - "results": [ - { - "case": "native", - "correct": true, - "first_call_us": 0.792, - "median_us": 0.09779789979802445, - "samples_us": [ - 0.09779789979802445, 0.10019579931395128, 0.09731669997563586, - 0.09827915055211633, 0.09688540012575686, 0.09653335000621155, - 0.09783540008356795 - ] - }, - { - "case": "forward-resolved-stateless", - "correct": true, - "first_call_us": 29.834, - "median_us": 0.5167729497770779, - "samples_us": [ - 0.5112958504469134, 0.5252458489849232, 0.5260958496364765, - 0.5186604495975189, 0.5154979502549395, 0.5103749994304962, - 0.5167729497770779 - ] - }, - { - "case": "forward-unselected", - "correct": true, - "first_call_us": 2.792, - "median_us": 0.09252294985344633, - "samples_us": [ - 0.09214169986080378, 0.09252294985344633, 0.09487710049143061, - 0.0941104008234106, 0.09178125037578866, 0.09364169964101166, - 0.09234794997610152 - ] - }, - { - "case": "forward-nested-stateless", - "correct": true, - "first_call_us": 29.584, - "median_us": 1.289118749264162, - "samples_us": [ - 1.2858457994298078, 1.2937145991600119, 1.289118749264162, - 1.2872708000941202, 1.2925645496579818, 1.2963250002940185, - 1.2835375004215166 - ] - }, - { - "case": "forward-tuple", - "correct": true, - "first_call_us": 21.0, - "median_us": 1.2561645999085158, - "samples_us": [ - 1.2573604501085356, 1.2678166502155364, 1.274354150518775, - 1.256058349099476, 1.2464250001357868, 1.2561645999085158, - 1.23741665011039 - ] - }, - { - "case": "forward-mapping", - "correct": true, - "first_call_us": 19.958, - "median_us": 1.3060083510936238, - "samples_us": [ - 1.3185999996494502, 1.3041979502304457, 1.3060083510936238, - 1.3346020496101119, 1.3111645501339808, 1.3058687502052635, - 1.2998645994230174 - ] - }, - { - "case": "forward-nested-lists", - "correct": true, - "first_call_us": 21.583, - "median_us": 1.353972899960354, - "samples_us": [ - 1.3524666996090673, 1.3472541992086917, 1.3489082994055934, - 1.3558479491621256, 1.3554707998991944, 1.353972899960354, - 1.3582229003077373 - ] - }, - { - "case": "plugin-leaf", - "correct": true, - "first_call_us": 14.75, - "median_us": 1.009372949192766, - "samples_us": [ - 1.009372949192766, 1.034831249853596, 1.0118020989466459, - 1.0160520498175174, 0.9972582993214019, 0.9924750003847294, - 0.9961832998669706 - ] - }, - { - "case": "plugin-union-second", - "correct": true, - "first_call_us": 14.959, - "median_us": 1.4370333010447212, - "samples_us": [ - 1.4220375000149943, 1.453264600422699, 1.4561229501850903, - 1.4299895497970283, 1.4354312501382083, 1.4370333010447212, - 1.4737728997715749 - ] - }, - { - "case": "strict", - "correct": true, - "first_call_us": 117.833, - "median_us": 12.577145849354565, - "samples_us": [ - 12.391704149194993, 12.159783350944053, 12.396704150887672, - 12.577145849354565, 13.006450000102632, 12.997318750421982, - 14.598902050056495 - ] - }, - { - "case": "explicit", - "correct": true, - "first_call_us": 23.917, - "median_us": 10.483618750004098, - "samples_us": [ - 10.525454200978857, 10.346733350888826, 10.478043749753851, - 10.398581250046846, 10.571049999271054, 10.95483749959385, - 10.483618750004098 - ] - }, - { - "case": "union-first", - "correct": true, - "first_call_us": 57.0, - "median_us": 13.275999999314081, - "samples_us": [ - 13.275999999314081, 13.159852050011978, 13.323795799806248, - 13.249268749495968, 13.15053540020017, 13.351622900518123, - 13.818716700188816 - ] - }, - { - "case": "union-second", - "correct": true, - "first_call_us": 27.167, - "median_us": 16.98002085031476, - "samples_us": [ - 17.13691250042757, 17.16008750081528, 17.01778330025263, - 16.48227710102219, 16.98002085031476, 16.821512499882374, - 16.783447899797466 - ] - }, - { - "case": "union-explicit-second", - "correct": true, - "first_call_us": 27.917, - "median_us": 14.431341648742091, - "samples_us": [ - 14.431341648742091, 14.499866649566684, 14.298631249403115, - 14.338166700326838, 14.480331250524614, 14.391847899241839, - 14.483327099878807 - ] - }, - { - "case": "union-all-failed", - "correct": true, - "first_call_us": 209.042, - "median_us": 9.881914549623616, - "samples_us": [ - 9.881914549623616, 9.88716874999227, 9.881999999925029, - 9.786489550606348, 9.78499580087373, 9.973200000240467, 9.72996670025168 - ] - }, - { - "case": "union-nested", - "correct": true, - "first_call_us": 604.875, - "median_us": 13.106512499507517, - "samples_us": [ - 13.106512499507517, 13.080889600678347, 13.153883299673907, - 13.106456250534393, 13.149539599544369, 12.97386250080308, - 13.195027099573053 - ] - } - ], - "evidence": { - "variant": "correctness", - "script": "tools/upstream/benchmark_transactions.py", - "script_sha256": "52363525b7b8785830527b467c79ae492b0f2a5ab2dd3dec133a75a86a8de969", - "wheel_sha256": { - "bearshape": "fe593320362bee43e8f1f91bb3ec10d1b3f85a0ea1039a3b7f7b409302ad8026", - "beartype": "0e19b66f35fd1a49dff124f67d69f273dd2309d1b850d4b6bc59cad6521a9100" - }, - "origins": { - "beartype": "/private/tmp/isolation-bench-correctness-314/lib/python3.14/site-packages/beartype/__init__.py", - "bearshape": "/private/tmp/isolation-bench-correctness-314/lib/python3.14/site-packages/bearshape/__init__.py" - }, - "installed_files_verified": { - "beartype": 484, - "bearshape": 18 - }, - "upstream_commit": "e44afa92", - "bearshape_commit": "dee5bb1", - "sequential": true - } -} diff --git a/tools/upstream/evidence/2026-10-11-isolation/transactions-optimized-311.json b/tools/upstream/evidence/2026-10-11-isolation/transactions-optimized-311.json deleted file mode 100644 index 404a94a..0000000 --- a/tools/upstream/evidence/2026-10-11-isolation/transactions-optimized-311.json +++ /dev/null @@ -1,207 +0,0 @@ -{ - "python": "3.11.15 (main, May 10 2026, 19:23:07) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6" - }, - "calls": 20000, - "repeats": 7, - "results": [ - { - "case": "native", - "correct": true, - "first_call_us": 0.75, - "median_us": 0.09889164939522743, - "samples_us": [ - 0.09831665083765984, 0.09889164939522743, 0.09920419979607686, - 0.09477500134380534, 0.09888750064419582, 0.09889794891932979, - 0.09933330002240837 - ] - }, - { - "case": "forward-resolved-stateless", - "correct": true, - "first_call_us": 27.666, - "median_us": 0.7252083494677208, - "samples_us": [ - 0.7222625004942529, 0.7252083494677208, 0.7228958493215032, - 0.7263874998898245, 0.7265562497195788, 0.7139916502637789, - 0.7266687505762093 - ] - }, - { - "case": "forward-unselected", - "correct": true, - "first_call_us": 1.875, - "median_us": 0.08830625010887161, - "samples_us": [ - 0.08488125022267923, 0.0865416499436833, 0.09114580025197938, - 0.08830625010887161, 0.0883708504261449, 0.08885415008990094, - 0.08496874943375587 - ] - }, - { - "case": "forward-nested-stateless", - "correct": true, - "first_call_us": 17.542, - "median_us": 0.7758958498016, - "samples_us": [ - 0.768312498985324, 0.76728540007025, 0.7787353999447078, - 0.7758958498016, 0.7736792002106085, 0.7920770993223414, - 0.865999999223277 - ] - }, - { - "case": "forward-tuple", - "correct": true, - "first_call_us": 144.708, - "median_us": 0.1712271012365818, - "samples_us": [ - 0.1703354500932619, 0.1705125003354624, 0.1735000012558885, - 0.1712271012365818, 0.17037085053743795, 0.17201459995703772, - 0.17210414953297004 - ] - }, - { - "case": "forward-mapping", - "correct": true, - "first_call_us": 162.375, - "median_us": 0.1967146003153175, - "samples_us": [ - 0.1964750001206994, 0.19584375113481656, 0.19712709909072146, - 0.1967146003153175, 0.1976708008442074, 0.1937062494107522, - 0.19798124994849786 - ] - }, - { - "case": "forward-nested-lists", - "correct": true, - "first_call_us": 140.542, - "median_us": 0.2294999998412095, - "samples_us": [ - 0.23054374905768782, 0.2294999998412095, 0.22934375010663643, - 0.26872499875025824, 0.24543749896110967, 0.22836040006950498, - 0.22645415010629222 - ] - }, - { - "case": "plugin-leaf", - "correct": true, - "first_call_us": 24.375, - "median_us": 0.5689062498277053, - "samples_us": [ - 0.6034874997567385, 0.5952624997007661, 0.5731750003178604, - 0.5620895492029376, 0.5668562487699091, 0.5689062498277053, - 0.5648166494211182 - ] - }, - { - "case": "plugin-union-second", - "correct": true, - "first_call_us": 13.166, - "median_us": 1.013506249000784, - "samples_us": [ - 1.0026646006735973, 0.9950416497304104, 1.013506249000784, - 1.023129149689339, 1.016931250342168, 1.038368750596419, - 1.0110750008607283 - ] - }, - { - "case": "strict", - "correct": true, - "first_call_us": 133.084, - "median_us": 8.562412500032224, - "samples_us": [ - 8.639895799569786, 8.688570800586604, 8.562412500032224, - 8.48097914858954, 8.50400419876678, 8.507677100715227, 8.603810399654321 - ] - }, - { - "case": "explicit", - "correct": true, - "first_call_us": 16.292, - "median_us": 6.937831250252202, - "samples_us": [ - 6.920089549385011, 6.942483299644664, 6.937831250252202, - 6.928941649675835, 6.894204200943932, 6.970318748790305, - 6.963722899672575 - ] - }, - { - "case": "union-first", - "correct": true, - "first_call_us": 48.834, - "median_us": 10.603447900211904, - "samples_us": [ - 10.641547900740989, 10.677025000040885, 10.672087500279304, - 10.603447900211904, 10.598681250121444, 10.534952049783897, - 10.541270849353168 - ] - }, - { - "case": "union-second", - "correct": true, - "first_call_us": 22.5, - "median_us": 13.78660414920887, - "samples_us": [ - 13.702004149672575, 13.78660414920887, 13.777437499084044, - 13.67647084989585, 14.099227050610352, 13.844393751060124, - 13.880291700479575 - ] - }, - { - "case": "union-explicit-second", - "correct": true, - "first_call_us": 19.875, - "median_us": 11.765102051140275, - "samples_us": [ - 11.808850000670645, 11.920972898951732, 11.766310399980284, - 11.690660400199704, 11.69257919973461, 11.694618749606889, - 11.765102051140275 - ] - }, - { - "case": "union-all-failed", - "correct": true, - "first_call_us": 244.417, - "median_us": 9.245695848949254, - "samples_us": [ - 11.48011250043055, 10.04919789993437, 10.419254149019253, - 8.833879200392403, 8.49291875056224, 9.245695848949254, 8.61899579904275 - ] - }, - { - "case": "union-nested", - "correct": true, - "first_call_us": 619.583, - "median_us": 11.788358299236279, - "samples_us": [ - 11.801410399493761, 11.551035450247582, 11.788358299236279, - 11.736208299407735, 13.466133350448217, 12.10843125008978, - 11.697837500832975 - ] - } - ], - "evidence": { - "variant": "optimized", - "script": "tools/upstream/benchmark_transactions.py", - "script_sha256": "52363525b7b8785830527b467c79ae492b0f2a5ab2dd3dec133a75a86a8de969", - "wheel_sha256": { - "bearshape": "fe593320362bee43e8f1f91bb3ec10d1b3f85a0ea1039a3b7f7b409302ad8026", - "beartype": "0580ede1fe87229728b42674d45fb8c32ce09a7e348f962cc2741304ef2f10d8" - }, - "origins": { - "beartype": "/private/tmp/isolation-bench-optimized-311/lib/python3.11/site-packages/beartype/__init__.py", - "bearshape": "/private/tmp/isolation-bench-optimized-311/lib/python3.11/site-packages/bearshape/__init__.py" - }, - "installed_files_verified": { - "beartype": 484, - "bearshape": 18 - }, - "upstream_commit": "7d039bcb", - "bearshape_commit": "dee5bb1", - "sequential": true - } -} diff --git a/tools/upstream/evidence/2026-10-11-isolation/transactions-optimized-314.json b/tools/upstream/evidence/2026-10-11-isolation/transactions-optimized-314.json deleted file mode 100644 index 386c596..0000000 --- a/tools/upstream/evidence/2026-10-11-isolation/transactions-optimized-314.json +++ /dev/null @@ -1,207 +0,0 @@ -{ - "python": "3.14.5 (main, May 10 2026, 19:20:57) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit-Mach-O", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6" - }, - "calls": 20000, - "repeats": 7, - "results": [ - { - "case": "native", - "correct": true, - "first_call_us": 1.917, - "median_us": 0.14095210062805563, - "samples_us": [ - 0.1291874999878928, 0.1589645995409228, 0.12818749964935705, - 0.13533540040953085, 0.14115420053713024, 0.14095210062805563, - 0.14545209996867925 - ] - }, - { - "case": "forward-resolved-stateless", - "correct": true, - "first_call_us": 74.958, - "median_us": 0.5898395989788696, - "samples_us": [ - 0.7503479500883259, 0.7115312502719462, 0.5898395989788696, - 0.6092291994718835, 0.562424999952782, 0.5830041496665217, - 0.5716270999982953 - ] - }, - { - "case": "forward-unselected", - "correct": true, - "first_call_us": 4.125, - "median_us": 0.1050541497534141, - "samples_us": [ - 0.09346875012852252, 0.12053749960614368, 0.10846454970305786, - 0.09933124965755269, 0.1050541497534141, 0.09712710016174242, - 0.1354812498902902 - ] - }, - { - "case": "forward-nested-stateless", - "correct": true, - "first_call_us": 30.375, - "median_us": 0.6218270500539802, - "samples_us": [ - 0.6218270500539802, 0.6255020503886044, 0.6065624998882413, - 0.7172083496698178, 0.6448020998504944, 0.6165000013425015, - 0.6150417000753805 - ] - }, - { - "case": "forward-tuple", - "correct": true, - "first_call_us": 166.834, - "median_us": 0.18632084975251928, - "samples_us": [ - 0.18561460019554943, 0.18632084975251928, 0.19523960072547197, - 0.18547079962445423, 0.18602920026751235, 0.18724374967860058, - 0.20271874964237213 - ] - }, - { - "case": "forward-mapping", - "correct": true, - "first_call_us": 159.416, - "median_us": 0.23414375027641654, - "samples_us": [ - 0.2233250008430332, 0.23154585069278255, 0.23414375027641654, - 0.24361044925171882, 0.22847500076750293, 0.23587500036228448, - 0.24320000084117055 - ] - }, - { - "case": "forward-nested-lists", - "correct": true, - "first_call_us": 170.333, - "median_us": 0.2867292001610622, - "samples_us": [ - 0.24846460000844672, 0.2542791495216079, 0.2915916498750448, - 0.2598958497401327, 0.2867292001610622, 0.3021416501724161, - 0.2982771009556018 - ] - }, - { - "case": "plugin-leaf", - "correct": true, - "first_call_us": 22.084, - "median_us": 0.6958770492929034, - "samples_us": [ - 0.7436458501615562, 0.6958770492929034, 0.6948770998860709, - 0.683137500891462, 0.6848437507869676, 0.7069792001857422, - 0.7130312500521541 - ] - }, - { - "case": "plugin-union-second", - "correct": true, - "first_call_us": 16.917, - "median_us": 0.9973332998924889, - "samples_us": [ - 1.2383916502585635, 1.0745750012574717, 0.987087500107009, - 0.9888270506053232, 0.9973332998924889, 0.9841603998211212, - 1.0714645497500896 - ] - }, - { - "case": "strict", - "correct": true, - "first_call_us": 115.75, - "median_us": 9.42173749936046, - "samples_us": [ - 9.499520850658882, 9.42173749936046, 9.426354149763938, 9.4697645996348, - 9.374987499904819, 9.247708349721506, 9.039572899928316 - ] - }, - { - "case": "explicit", - "correct": true, - "first_call_us": 21.833, - "median_us": 7.399620799697004, - "samples_us": [ - 7.261737500084564, 7.305949999135919, 7.276404149888549, - 8.193112499429844, 7.399620799697004, 7.541147900337819, - 7.530304150714073 - ] - }, - { - "case": "union-first", - "correct": true, - "first_call_us": 69.709, - "median_us": 11.562531249364838, - "samples_us": [ - 11.744541650114115, 11.063566649681889, 11.191822950786445, - 11.562531249364838, 12.793170798977371, 12.489425000967458, - 11.041895850212313 - ] - }, - { - "case": "union-second", - "correct": true, - "first_call_us": 22.333, - "median_us": 14.641831249173265, - "samples_us": [ - 14.815641699533444, 14.641831249173265, 17.05176664981991, - 14.704847898974549, 14.32254789979197, 14.540760400996078, - 14.43053749972023 - ] - }, - { - "case": "union-explicit-second", - "correct": true, - "first_call_us": 24.541, - "median_us": 12.173772900132462, - "samples_us": [ - 12.553577100334223, 12.19838124961825, 12.10604169900762, - 12.173772900132462, 12.062627049454022, 12.322364599094726, - 12.117733299965039 - ] - }, - { - "case": "union-all-failed", - "correct": true, - "first_call_us": 206.667, - "median_us": 9.303718750015832, - "samples_us": [ - 9.303718750015832, 9.33607704937458, 9.24141874857014, - 9.262768749613315, 9.2384082992794, 9.3844208488008, 9.34566045034444 - ] - }, - { - "case": "union-nested", - "correct": true, - "first_call_us": 651.875, - "median_us": 12.769295850011986, - "samples_us": [ - 13.525031249446329, 13.466391649853904, 12.685172900091857, - 12.754368750029244, 12.633364599605557, 14.601497899275273, - 12.769295850011986 - ] - } - ], - "evidence": { - "variant": "optimized", - "script": "tools/upstream/benchmark_transactions.py", - "script_sha256": "52363525b7b8785830527b467c79ae492b0f2a5ab2dd3dec133a75a86a8de969", - "wheel_sha256": { - "bearshape": "fe593320362bee43e8f1f91bb3ec10d1b3f85a0ea1039a3b7f7b409302ad8026", - "beartype": "0580ede1fe87229728b42674d45fb8c32ce09a7e348f962cc2741304ef2f10d8" - }, - "origins": { - "beartype": "/private/tmp/isolation-bench-optimized-314/lib/python3.14/site-packages/beartype/__init__.py", - "bearshape": "/private/tmp/isolation-bench-optimized-314/lib/python3.14/site-packages/bearshape/__init__.py" - }, - "installed_files_verified": { - "beartype": 484, - "bearshape": 18 - }, - "upstream_commit": "7d039bcb", - "bearshape_commit": "dee5bb1", - "sequential": true - } -} diff --git a/tools/upstream/evidence/2026-10-11-isolation/transactions-released-311.json b/tools/upstream/evidence/2026-10-11-isolation/transactions-released-311.json deleted file mode 100644 index f1135b3..0000000 --- a/tools/upstream/evidence/2026-10-11-isolation/transactions-released-311.json +++ /dev/null @@ -1,179 +0,0 @@ -{ - "python": "3.11.15 (main, May 10 2026, 19:23:07) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6" - }, - "calls": 20000, - "repeats": 7, - "results": [ - { - "case": "native", - "correct": true, - "first_call_us": 0.958, - "median_us": 0.09595415031071752, - "samples_us": [ - 0.09341459954157472, 0.09596455056453124, 0.0983604506473057, - 0.09233125019818544, 0.09300414967583492, 0.09595415031071752, - 0.09701665112515911 - ] - }, - { - "case": "forward-resolved-stateless", - "correct": true, - "first_call_us": 26.958, - "median_us": 0.646320849773474, - "samples_us": [ - 0.6487645994639024, 0.6453541500377469, 0.646320849773474, - 0.6490271000075154, 0.6355083009111695, 0.647210399620235, - 0.6447833511629142 - ] - }, - { - "case": "forward-unselected", - "correct": true, - "first_call_us": 1.959, - "median_us": 0.08427710126852617, - "samples_us": [ - 0.08585000032326207, 0.08114584925351664, 0.08178544958354905, - 0.0830479504656978, 0.08443749975413084, 0.08427710126852617, - 0.08798330090939999 - ] - }, - { - "case": "forward-nested-stateless", - "correct": true, - "first_call_us": 16.125, - "median_us": 0.6902729001012631, - "samples_us": [ - 0.6907895498443395, 0.6968417001189664, 0.7088437501806766, - 0.6891625002026558, 0.6854749997728504, 0.6902729001012631, - 0.6841979004093446 - ] - }, - { - "case": "forward-tuple", - "correct": true, - "first_call_us": 14.458, - "median_us": 0.6853749990114011, - "samples_us": [ - 0.6843125011073425, 0.6810646009398624, 0.682370801223442, - 0.6879396009026095, 0.6931041498319246, 0.7057041992084123, - 0.6853749990114011 - ] - }, - { - "case": "forward-mapping", - "correct": true, - "first_call_us": 18.667, - "median_us": 0.713054150401149, - "samples_us": [ - 0.7076374997268431, 0.7508041511755437, 0.7123999996110797, - 0.713054150401149, 0.707397899532225, 0.7239062499138527, - 0.7144562492612749 - ] - }, - { - "case": "forward-nested-lists", - "correct": true, - "first_call_us": 14.417, - "median_us": 0.7272749993717298, - "samples_us": [ - 0.7258312500198372, 0.7311833003768697, 0.744650000706315, - 0.7255791497300379, 0.7272749993717298, 0.7423458489938639, - 0.7227791502373293 - ] - }, - { - "case": "plugin-leaf", - "correct": true, - "first_call_us": 4.25, - "median_us": 0.15061459998833016, - "samples_us": [ - 0.1532791502540931, 0.15233955055009574, 0.14712914999108762, - 0.1507458495325409, 0.1498541998444125, 0.1443937493604608, - 0.15061459998833016 - ] - }, - { - "case": "plugin-union-second", - "correct": false, - "reason": "Plugin union retained rejected state" - }, - { - "case": "strict", - "correct": true, - "first_call_us": 96.5, - "median_us": 12.749029148835689, - "samples_us": [ - 12.72421664907597, 12.831643749086652, 12.90935625002021, - 12.743354149279185, 12.749029148835689, 12.755335398833267, - 12.697516698972322 - ] - }, - { - "case": "explicit", - "correct": true, - "first_call_us": 19.583, - "median_us": 8.433674999105278, - "samples_us": [ - 8.433674999105278, 8.401500000036322, 8.438272900821175, - 8.483170799445361, 8.552229149790946, 8.419187499384861, - 8.417675000964664 - ] - }, - { - "case": "union-first", - "correct": true, - "first_call_us": 45.333, - "median_us": 14.096058350696694, - "samples_us": [ - 14.096058350696694, 13.954579149140045, 14.396195849985816, - 14.155952099827118, 14.038920850725845, 14.003731250704732, - 14.146852100384422 - ] - }, - { - "case": "union-second", - "correct": false, - "reason": "Function __main__.union() parameter _last=\"array([1., 1., 1.], dtype=float32)\" violates type hint , as dimension 'N' expected 2 but got 3." - }, - { - "case": "union-explicit-second", - "correct": false, - "reason": "Function __main__.union_explicit() parameter _last=\"array([1., 1., 1.], dtype=float32)\" violates type hint , as dimension 'N' expected 2 but got 3." - }, - { - "case": "union-all-failed", - "correct": false, - "reason": "Failed union retained state" - }, - { - "case": "union-nested", - "correct": false, - "reason": "Nested union retained rejected state" - } - ], - "evidence": { - "variant": "released", - "script": "tools/upstream/benchmark_transactions.py", - "script_sha256": "52363525b7b8785830527b467c79ae492b0f2a5ab2dd3dec133a75a86a8de969", - "wheel_sha256": { - "bearshape": "fe593320362bee43e8f1f91bb3ec10d1b3f85a0ea1039a3b7f7b409302ad8026", - "beartype": "4461b4dc57e3fdd6c8a8464b22cf118002eea107c33e9fef651c69068ab3cce3" - }, - "origins": { - "beartype": "/private/tmp/isolation-bench-released-311/lib/python3.11/site-packages/beartype/__init__.py", - "bearshape": "/private/tmp/isolation-bench-released-311/lib/python3.11/site-packages/bearshape/__init__.py" - }, - "installed_files_verified": { - "beartype": 482, - "bearshape": 18 - }, - "upstream_commit": "f85b67d8b0b6bd9c910bd97f0d2d417c4550b038", - "bearshape_commit": "dee5bb1", - "sequential": true - } -} diff --git a/tools/upstream/evidence/2026-10-11-isolation/transactions-released-314.json b/tools/upstream/evidence/2026-10-11-isolation/transactions-released-314.json deleted file mode 100644 index 735ea0f..0000000 --- a/tools/upstream/evidence/2026-10-11-isolation/transactions-released-314.json +++ /dev/null @@ -1,179 +0,0 @@ -{ - "python": "3.14.5 (main, May 10 2026, 19:20:57) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit-Mach-O", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6" - }, - "calls": 20000, - "repeats": 7, - "results": [ - { - "case": "native", - "correct": true, - "first_call_us": 0.792, - "median_us": 0.10140829981537536, - "samples_us": [ - 0.1044250006088987, 0.1044041506247595, 0.09772289922693744, - 0.09936455026036128, 0.10140829981537536, 0.09946040081558749, - 0.10208960011368617 - ] - }, - { - "case": "forward-resolved-stateless", - "correct": true, - "first_call_us": 41.709, - "median_us": 0.5013999994844198, - "samples_us": [ - 0.4971521004335955, 0.5040187505073845, 0.5031645996496081, - 0.5001791490940377, 0.5012187495594844, 0.5013999994844198, - 0.5058041497250088 - ] - }, - { - "case": "forward-unselected", - "correct": true, - "first_call_us": 2.958, - "median_us": 0.09319579985458404, - "samples_us": [ - 0.08999374986160547, 0.09015834948513657, 0.09333334892289713, - 0.09394790104124695, 0.09367085003759712, 0.09319579985458404, - 0.0911812501726672 - ] - }, - { - "case": "forward-nested-stateless", - "correct": true, - "first_call_us": 16.958, - "median_us": 0.5685374999302439, - "samples_us": [ - 0.5561812489759177, 0.5662187497364357, 0.5752666998887435, - 0.5701124988263473, 0.5685374999302439, 0.5707437507226132, - 0.5656562512740493 - ] - }, - { - "case": "forward-tuple", - "correct": true, - "first_call_us": 14.167, - "median_us": 0.535368750570342, - "samples_us": [ - 0.5368104495573789, 0.535368750570342, 0.5318124996847473, - 0.537985451228451, 0.5327791499439627, 0.5315375005011447, - 0.5383229494327679 - ] - }, - { - "case": "forward-mapping", - "correct": true, - "first_call_us": 14.834, - "median_us": 0.5833604489453137, - "samples_us": [ - 0.5797374993562698, 0.6090812501497567, 0.5868978987564333, - 0.5772187490947545, 0.5833604489453137, 0.5706500000087544, - 0.5872333509614691 - ] - }, - { - "case": "forward-nested-lists", - "correct": true, - "first_call_us": 19.584, - "median_us": 0.6050708005204797, - "samples_us": [ - 0.6082457999582402, 0.6050708005204797, 0.6027103998349048, - 0.6151228997623548, 0.6092583513236605, 0.5966604003333487, - 0.5980708505376242 - ] - }, - { - "case": "plugin-leaf", - "correct": true, - "first_call_us": 7.125, - "median_us": 0.16188125009648502, - "samples_us": [ - 0.16188125009648502, 0.16259580006590113, 0.16306460020132363, - 0.15927295025903732, 0.15920209989417344, 0.15950835077092052, - 0.16351459926227108 - ] - }, - { - "case": "plugin-union-second", - "correct": false, - "reason": "Plugin union retained rejected state" - }, - { - "case": "strict", - "correct": true, - "first_call_us": 118.792, - "median_us": 13.626433348690625, - "samples_us": [ - 13.082693750038743, 13.170768749841955, 18.138195799838286, - 14.151591699919663, 13.626433348690625, 13.20195414882619, - 14.024470851290971 - ] - }, - { - "case": "explicit", - "correct": true, - "first_call_us": 22.959, - "median_us": 8.411637500103097, - "samples_us": [ - 8.800193750357721, 10.154464549850672, 8.56388750107726, - 8.411637500103097, 8.093108299362939, 7.93638125032885, - 7.928112499939743 - ] - }, - { - "case": "union-first", - "correct": true, - "first_call_us": 65.75, - "median_us": 15.65015414962545, - "samples_us": [ - 16.922833351418376, 15.146520850248635, 16.000289599469397, - 15.65015414962545, 14.529504149686545, 14.92781874985667, - 16.923683299683034 - ] - }, - { - "case": "union-second", - "correct": false, - "reason": "Function __main__.union() parameter _last=\"array([1., 1., 1.], dtype=float32)\" violates type hint , as dimension 'N' expected 2 but got 3." - }, - { - "case": "union-explicit-second", - "correct": false, - "reason": "Function __main__.union_explicit() parameter _last=\"array([1., 1., 1.], dtype=float32)\" violates type hint , as dimension 'N' expected 2 but got 3." - }, - { - "case": "union-all-failed", - "correct": false, - "reason": "Failed union retained state" - }, - { - "case": "union-nested", - "correct": false, - "reason": "Nested union retained rejected state" - } - ], - "evidence": { - "variant": "released", - "script": "tools/upstream/benchmark_transactions.py", - "script_sha256": "52363525b7b8785830527b467c79ae492b0f2a5ab2dd3dec133a75a86a8de969", - "wheel_sha256": { - "bearshape": "fe593320362bee43e8f1f91bb3ec10d1b3f85a0ea1039a3b7f7b409302ad8026", - "beartype": "4461b4dc57e3fdd6c8a8464b22cf118002eea107c33e9fef651c69068ab3cce3" - }, - "origins": { - "beartype": "/private/tmp/isolation-bench-released-314/lib/python3.14/site-packages/beartype/__init__.py", - "bearshape": "/private/tmp/isolation-bench-released-314/lib/python3.14/site-packages/bearshape/__init__.py" - }, - "installed_files_verified": { - "beartype": 482, - "bearshape": 18 - }, - "upstream_commit": "f85b67d8b0b6bd9c910bd97f0d2d417c4550b038", - "bearshape_commit": "dee5bb1", - "sequential": true - } -} diff --git a/tools/upstream/evidence/2026-10-11/README.md b/tools/upstream/evidence/2026-10-11/README.md deleted file mode 100644 index 301495c..0000000 --- a/tools/upstream/evidence/2026-10-11/README.md +++ /dev/null @@ -1,67 +0,0 @@ -# Scope and optimization measurements - -Matched sequential local runs on macOS arm64, Python 3.11.15 and 3.14.5, NumPy -2.4.6 and optree 0.19.1. Each warm median uses 20,000 calls and seven raw -repeats. All variants use the same bearshape wheel; only the upstream wheel -changes. The shared `benchmark_transactions.py` checks correctness before -timing. Invalid published-baseline union cases are recorded as incorrect, not -faster valid runs. First invocations are single setup observations, not -cold-start distributions. - -Each JSON file records the script hash, both wheel hashes, interpreter, -platform, versions, every raw repeat and correctness result. Published wheel -package files were compared byte-for-byte with the PyPI wheel in both baseline -environments. The correctness source is local upstream commit `5071616b`; -optimized source is `01f32470`. Ordered patches against released `f85b67d8` are -in `../../patches/`. The implementation source is bearshape commit `291af356`; -later evidence changes do not change the tested runtime files. All 17 runtime -source files were compared with the tested wheel. These are local proposal -wheels, not upstream releases. - -Times below are microseconds per call. - -| Case | Python | Released | Correctness | Optimized | -| -------------- | ------ | --------: | ----------: | --------: | -| native | 3.11 | 0.092 | 0.094 | 0.096 | -| native | 3.14 | 0.093 | 0.093 | 0.095 | -| Root ref | 3.11 | 0.636 | 0.685 | 0.704 | -| Root ref | 3.14 | 0.498 | 0.492 | 0.502 | -| Sampled list | 3.11 | 0.683 | 1.108 | 0.745 | -| Sampled list | 3.14 | 0.536 | 0.915 | 0.563 | -| Tuple | 3.11 | 0.672 | 1.107 | 0.162 | -| Tuple | 3.14 | 0.520 | 0.865 | 0.176 | -| Mapping | 3.11 | 0.693 | 1.126 | 0.193 | -| Mapping | 3.14 | 0.569 | 0.910 | 0.214 | -| Nested lists | 3.11 | 0.723 | 1.147 | 0.213 | -| Nested lists | 3.14 | 0.590 | 0.944 | 0.245 | -| strict | 3.11 | 12.572 | 9.816 | 7.600 | -| strict | 3.14 | 12.875 | 10.313 | 7.905 | -| explicit | 3.11 | 8.292 | 8.190 | 6.044 | -| explicit | 3.14 | 7.802 | 8.707 | 6.459 | -| Union fallback | 3.11 | Incorrect | 13.491 | 12.205 | -| Union fallback | 3.14 | Incorrect | 14.048 | 12.482 | - -The warm tuple/mapping/nested-list cases are faster than both earlier variants. -Native checks remain around 0.09 microseconds, with a few nanoseconds of local -variation. Root references and the simple sampled list retain proxy checking: on -3.11 their additional cost is about 0.06–0.07 microseconds relative to released -0.23.1. Custom metaclasses and stateful/composite aliases deliberately retain -the general path; these results do not claim that all possible annotations are -faster. The first successful composite check still performs normal resolution -and may compile its specialization. State-hook metadata must remain stable until -cache invalidation, as with other compiled hint metadata. No timing threshold is -used. - -Fresh normally installed optimized endpoint suites passed 1,221 cases each, -including all four checker consumers; five skips identify absent CuPy and four -platform precision cases. Correctness-only suites passed 1,210 each. Upstream -unit suites passed 467/475 optimized cases and 456/464 correctness cases, with -15/7 interpreter or optional-dependency skips. Upstream pyright passed. The -optimizer adds eleven cases covering invalidation, concurrent clearing, retained -classes, unselected aliases, known-domain contexts, atomic leaves and -sampling/predicates. - -The full commands, exact archives, imported paths and logs are preserved under -the main checkout's ignored `build/union-scope-development/`. Proposal workflow -artifacts provide independently built hosted evidence. No package publication, -upstream PR, maintainer message or main merge is part of these results. diff --git a/tools/upstream/evidence/2026-10-11/correctness311.json b/tools/upstream/evidence/2026-10-11/correctness311.json deleted file mode 100644 index a5356bb..0000000 --- a/tools/upstream/evidence/2026-10-11/correctness311.json +++ /dev/null @@ -1,193 +0,0 @@ -{ - "python": "3.11.15 (main, May 10 2026, 19:23:07) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6" - }, - "calls": 20000, - "repeats": 7, - "results": [ - { - "case": "native", - "correct": true, - "first_call_us": 0.75, - "median_us": 0.09437709959456697, - "samples_us": [ - 0.0922854000236839, 0.09444375027669594, 0.09437709959456697, - 0.09589374967617914, 0.09563959902152419, 0.09224170062225312, - 0.09226459951605648 - ] - }, - { - "case": "forward-resolved-stateless", - "correct": true, - "first_call_us": 25.041, - "median_us": 0.6847979500889778, - "samples_us": [ - 0.6950374998268671, 0.6847979500889778, 0.6805937504395843, - 0.6996562500717118, 0.6819500005804002, 0.6828103985753842, - 0.6863833012175746 - ] - }, - { - "case": "forward-unselected", - "correct": true, - "first_call_us": 1.5, - "median_us": 0.08472294866805896, - "samples_us": [ - 0.08441045065410435, 0.08472294866805896, 0.08577710104873404, - 0.0854916506796144, 0.08613954996690154, 0.08365624962607399, - 0.08148750057443976 - ] - }, - { - "case": "forward-nested-stateless", - "correct": true, - "first_call_us": 18.542, - "median_us": 1.108104150625877, - "samples_us": [ - 1.0992249997798353, 1.1340729004587047, 1.1065833503380418, - 1.103739600512199, 1.114772899018135, 1.108104150625877, - 1.126116699015256 - ] - }, - { - "case": "forward-tuple", - "correct": true, - "first_call_us": 9.833, - "median_us": 1.1069896005210467, - "samples_us": [ - 1.1020478996215388, 1.1026937499991618, 1.1166416996275075, - 1.108791699516587, 1.1132333500427194, 1.1029437504475936, - 1.1069896005210467 - ] - }, - { - "case": "forward-mapping", - "correct": true, - "first_call_us": 10.875, - "median_us": 1.1257541496888734, - "samples_us": [ - 1.1257541496888734, 1.1314645991660655, 1.1304145999019966, - 1.1165707997861318, 1.1307312495773658, 1.124822899873834, - 1.1216854501981288 - ] - }, - { - "case": "forward-nested-lists", - "correct": true, - "first_call_us": 11.25, - "median_us": 1.146591649740003, - "samples_us": [ - 1.1514521000208333, 1.1422312498325482, 1.1472103986307047, - 1.1400250004953705, 1.1418624999350868, 1.1616020987275988, - 1.146591649740003 - ] - }, - { - "case": "plugin-leaf", - "correct": true, - "first_call_us": 7.75, - "median_us": 0.6313854493782856, - "samples_us": [ - 0.6246895994991064, 0.6249479003599845, 0.6381874991348013, - 0.6436208510422148, 0.6302624999079853, 0.6313854493782856, - 0.6415208510588855 - ] - }, - { - "case": "plugin-union-second", - "correct": true, - "first_call_us": 7.666, - "median_us": 1.0591916492558084, - "samples_us": [ - 1.073731250653509, 1.0537645997828804, 1.0594332998152822, - 1.0591916492558084, 1.0554958498687483, 1.0607500007608905, - 1.0541749987169169 - ] - }, - { - "case": "strict", - "correct": true, - "first_call_us": 163.584, - "median_us": 9.815885400166735, - "samples_us": [ - 9.84235210053157, 9.815885400166735, 9.811033299774863, - 9.827839549689088, 9.800935399834998, 9.821797949553002, - 9.810883349564392 - ] - }, - { - "case": "explicit", - "correct": true, - "first_call_us": 17.167, - "median_us": 8.189779199892655, - "samples_us": [ - 8.186283349641599, 8.179927099263296, 8.189779199892655, - 8.184204150165897, 8.190237499366049, 8.209925000846852, - 8.279208349995315 - ] - }, - { - "case": "union-first", - "correct": true, - "first_call_us": 40.583, - "median_us": 10.681943751114886, - "samples_us": [ - 10.762549999344628, 10.705793750821613, 10.675339550653007, - 10.681943751114886, 10.701356250501703, 10.674050000670832, - 10.644483299984131 - ] - }, - { - "case": "union-second", - "correct": true, - "first_call_us": 29.292, - "median_us": 13.491143750434276, - "samples_us": [ - 13.465175000601448, 13.487850000092294, 13.47691874980228, - 13.491816649911925, 13.491143750434276, 13.52899165067356, - 13.530143749085255 - ] - }, - { - "case": "union-explicit-second", - "correct": true, - "first_call_us": 19.875, - "median_us": 11.491856249631383, - "samples_us": [ - 11.477927050145809, 11.493650000193156, 11.491856249631383, - 11.509220801235642, 11.490777099970728, 11.491674999706447, - 11.5182604000438 - ] - }, - { - "case": "union-all-failed", - "correct": true, - "first_call_us": 155.833, - "median_us": 7.4359583493787795, - "samples_us": [ - 7.423437500256114, 7.4359583493787795, 7.416358350019436, - 7.417879199783783, 7.517202050075866, 7.462981250137091, - 7.504658300604206 - ] - }, - { - "case": "union-nested", - "correct": true, - "first_call_us": 516.625, - "median_us": 10.296145798929501, - "samples_us": [ - 10.309950000373647, 10.306133300764486, 10.305441649688873, - 10.291931249957997, 10.289477100013755, 10.296145798929501, - 10.253893749904819 - ] - } - ], - "script_sha256": "52363525b7b8785830527b467c79ae492b0f2a5ab2dd3dec133a75a86a8de969", - "bearshape_wheel_sha256": "fe593320362bee43e8f1f91bb3ec10d1b3f85a0ea1039a3b7f7b409302ad8026", - "beartype_wheel_sha256": "29bfe7ac44e8b8fd6157ac02853a933c256db88184dace6e4d85d01698e66342", - "variant": "correctness" -} diff --git a/tools/upstream/evidence/2026-10-11/correctness314.json b/tools/upstream/evidence/2026-10-11/correctness314.json deleted file mode 100644 index 3f3b9d6..0000000 --- a/tools/upstream/evidence/2026-10-11/correctness314.json +++ /dev/null @@ -1,192 +0,0 @@ -{ - "python": "3.14.5 (main, May 10 2026, 19:20:57) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit-Mach-O", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6" - }, - "calls": 20000, - "repeats": 7, - "results": [ - { - "case": "native", - "correct": true, - "first_call_us": 0.875, - "median_us": 0.0928770998143591, - "samples_us": [ - 0.09155415027635172, 0.09401039860676974, 0.09523545013507828, - 0.0973520494881086, 0.09150209953077137, 0.09029790089698508, - 0.0928770998143591 - ] - }, - { - "case": "forward-resolved-stateless", - "correct": true, - "first_call_us": 22.667, - "median_us": 0.4919895494822413, - "samples_us": [ - 0.4935250006383285, 0.48948749899864197, 0.4960458507412113, - 0.4939187507261522, 0.48985624889610335, 0.49154794978676364, - 0.4919895494822413 - ] - }, - { - "case": "forward-unselected", - "correct": true, - "first_call_us": 1.833, - "median_us": 0.0889146002009511, - "samples_us": [ - 0.0889146002009511, 0.08992290095193312, 0.09084374905796722, - 0.08818125061225146, 0.08671039977343753, 0.0882270498550497, - 0.08962084975792095 - ] - }, - { - "case": "forward-nested-stateless", - "correct": true, - "first_call_us": 17.292, - "median_us": 0.9150958503596485, - "samples_us": [ - 0.9208229486830533, 0.9019291508593597, 0.9100604511331767, - 0.9150958503596485, 0.8984583502751775, 0.9197042003506795, - 0.9246646004612558 - ] - }, - { - "case": "forward-tuple", - "correct": true, - "first_call_us": 11.875, - "median_us": 0.8645291498396546, - "samples_us": [ - 0.8696875011082739, 0.8630083510070108, 0.8650146002764814, - 0.8645291498396546, 0.8708624998689629, 0.8576895997975953, - 0.8587520496803336 - ] - }, - { - "case": "forward-mapping", - "correct": true, - "first_call_us": 9.875, - "median_us": 0.9096374997170642, - "samples_us": [ - 0.9212624994688667, 0.9096374997170642, 0.9124083007918671, - 0.9008770502987318, 0.9082103992113844, 0.9141750007984228, - 0.9064062498509884 - ] - }, - { - "case": "forward-nested-lists", - "correct": true, - "first_call_us": 11.917, - "median_us": 0.9441021000384353, - "samples_us": [ - 0.9443958493648097, 0.9396437497343868, 0.9634729503886774, - 0.9455666498979554, 0.9317978998296894, 0.9360458498122171, - 0.9441021000384353 - ] - }, - { - "case": "plugin-leaf", - "correct": true, - "first_call_us": 10.916, - "median_us": 0.6272062499192543, - "samples_us": [ - 0.6282542002736591, 0.6240603994228877, 0.6407333494280465, - 0.6236166998860426, 0.6214812499820255, 0.6272062499192543, - 0.6284291506744921 - ] - }, - { - "case": "plugin-union-second", - "correct": true, - "first_call_us": 10.5, - "median_us": 1.0232417000224814, - "samples_us": [ - 1.0232417000224814, 1.025268751254771, 1.0273687512381002, - 1.0223167002550326, 1.0222812488791533, 1.0275520500726998, - 1.022560401179362 - ] - }, - { - "case": "strict", - "correct": true, - "first_call_us": 101.708, - "median_us": 10.31328124954598, - "samples_us": [ - 10.348297949531116, 10.31328124954598, 10.270052051055245, - 10.321677100728266, 10.30314170056954, 10.28699794987915, - 10.32406249869382 - ] - }, - { - "case": "explicit", - "correct": true, - "first_call_us": 19.125, - "median_us": 8.70747084991308, - "samples_us": [ - 8.70747084991308, 8.700970849895384, 8.704129149555229, - 8.712158299749717, 8.705458301119506, 8.752312501019333, - 8.734785400156397 - ] - }, - { - "case": "union-first", - "correct": true, - "first_call_us": 37.791, - "median_us": 11.194941650319379, - "samples_us": [ - 11.25853539997479, 11.28314164961921, 11.26547289895825, - 11.181818750628736, 11.18974584969692, 11.194941650319379, - 11.185324999678414 - ] - }, - { - "case": "union-second", - "correct": true, - "first_call_us": 21.125, - "median_us": 14.048231250490062, - "samples_us": [ - 14.069364550232422, 14.059156250732485, 14.040812500752509, - 13.996300000871997, 14.048231250490062, 14.18263749947073, - 14.035741650150158 - ] - }, - { - "case": "union-explicit-second", - "correct": true, - "first_call_us": 20.75, - "median_us": 11.998220800887793, - "samples_us": [ - 12.00971875077812, 11.98493959964253, 11.96397710009478, - 11.998220800887793, 12.020606250735, 12.020366700016893, - 11.910906250705011 - ] - }, - { - "case": "union-all-failed", - "correct": true, - "first_call_us": 181.625, - "median_us": 8.307314600097016, - "samples_us": [ - 8.305179201124702, 8.31668539904058, 8.307314600097016, - 8.359237501281314, 8.417654150980525, 8.29266044893302, 8.29522080020979 - ] - }, - { - "case": "union-nested", - "correct": true, - "first_call_us": 577.375, - "median_us": 11.049785400973633, - "samples_us": [ - 11.044789550942369, 11.056431250472087, 11.061299999710172, - 11.032406249432825, 11.054710400640033, 11.049785400973633, - 11.045985399687197 - ] - } - ], - "script_sha256": "52363525b7b8785830527b467c79ae492b0f2a5ab2dd3dec133a75a86a8de969", - "bearshape_wheel_sha256": "fe593320362bee43e8f1f91bb3ec10d1b3f85a0ea1039a3b7f7b409302ad8026", - "beartype_wheel_sha256": "29bfe7ac44e8b8fd6157ac02853a933c256db88184dace6e4d85d01698e66342", - "variant": "correctness" -} diff --git a/tools/upstream/evidence/2026-10-11/optimized311.json b/tools/upstream/evidence/2026-10-11/optimized311.json deleted file mode 100644 index bc74931..0000000 --- a/tools/upstream/evidence/2026-10-11/optimized311.json +++ /dev/null @@ -1,193 +0,0 @@ -{ - "python": "3.11.15 (main, May 10 2026, 19:23:07) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6" - }, - "calls": 20000, - "repeats": 7, - "results": [ - { - "case": "native", - "correct": true, - "first_call_us": 0.958, - "median_us": 0.0963541999226436, - "samples_us": [ - 0.09091039974009618, 0.09272290044464171, 0.09443125018151477, - 0.0965687504503876, 0.0963541999226436, 0.09755205101100728, - 0.10063329973490909 - ] - }, - { - "case": "forward-resolved-stateless", - "correct": true, - "first_call_us": 40.417, - "median_us": 0.7044020501780324, - "samples_us": [ - 0.7044020501780324, 0.6974416988668963, 0.7092958490829915, - 0.7034750000457279, 0.6953374992008321, 0.7299999997485429, - 0.7048729006783105 - ] - }, - { - "case": "forward-unselected", - "correct": true, - "first_call_us": 2.083, - "median_us": 0.08642290049465373, - "samples_us": [ - 0.0871395503054373, 0.08765834936639294, 0.08779585041338578, - 0.08597705018473789, 0.08250209939433262, 0.08440414967481047, - 0.08642290049465373 - ] - }, - { - "case": "forward-nested-stateless", - "correct": true, - "first_call_us": 17.125, - "median_us": 0.7446833507856354, - "samples_us": [ - 0.7417291504680179, 0.7509687493438832, 0.7635250003659166, - 0.7300520490389317, 0.7446833507856354, 0.7400271002552472, - 0.7544958498328924 - ] - }, - { - "case": "forward-tuple", - "correct": true, - "first_call_us": 85.708, - "median_us": 0.16180209931917489, - "samples_us": [ - 0.159535399870947, 0.16180209931917489, 0.1653062499826774, - 0.1614229506230913, 0.16368960059480742, 0.16664790018694475, - 0.15873334923526272 - ] - }, - { - "case": "forward-mapping", - "correct": true, - "first_call_us": 65.875, - "median_us": 0.1928333003888838, - "samples_us": [ - 0.1898937509395182, 0.19332710071466863, 0.1837500007241033, - 0.18913329986389726, 0.1928333003888838, 0.19406455103307962, - 0.19427704974077642 - ] - }, - { - "case": "forward-nested-lists", - "correct": true, - "first_call_us": 59.792, - "median_us": 0.21331459865905344, - "samples_us": [ - 0.20726039947476238, 0.21277290070429444, 0.21420624980237335, - 0.21331459865905344, 0.2146667000488378, 0.21078124991618097, - 0.21843750000698492 - ] - }, - { - "case": "plugin-leaf", - "correct": true, - "first_call_us": 11.208, - "median_us": 0.5646416495437734, - "samples_us": [ - 0.56404999922961, 0.571514549665153, 0.5640041999868117, - 0.5614666995825246, 0.5646416495437734, 0.565395801095292, - 0.5686374992365018 - ] - }, - { - "case": "plugin-union-second", - "correct": true, - "first_call_us": 7.541, - "median_us": 0.9838312500505708, - "samples_us": [ - 0.9998749999795109, 0.9838312500505708, 0.989581250178162, - 0.9827333502471447, 0.9837187506491318, 0.9896812494844198, - 0.9815458004595712 - ] - }, - { - "case": "strict", - "correct": true, - "first_call_us": 82.25, - "median_us": 7.600050000473857, - "samples_us": [ - 7.600050000473857, 9.177487500710413, 7.6261417008936405, - 7.601308349694591, 7.560114600346424, 7.572031251038425, - 7.551920801051892 - ] - }, - { - "case": "explicit", - "correct": true, - "first_call_us": 15.125, - "median_us": 6.043797900201753, - "samples_us": [ - 6.050039549882058, 6.031422950036358, 6.061135399795603, - 6.022220849990845, 6.043797900201753, 6.054310400213581, - 6.021654199867044 - ] - }, - { - "case": "union-first", - "correct": true, - "first_call_us": 36.0, - "median_us": 9.396218750043772, - "samples_us": [ - 9.43754374893615, 9.449589549330994, 9.388043750368524, - 9.396218750043772, 9.395237499848008, 9.411231249396224, - 9.392495799693279 - ] - }, - { - "case": "union-second", - "correct": true, - "first_call_us": 20.208, - "median_us": 12.204935451154597, - "samples_us": [ - 12.21892294997815, 12.19422915019095, 12.21043124969583, - 12.212579150218517, 12.198689600336365, 12.204935451154597, - 12.196714550373144 - ] - }, - { - "case": "union-explicit-second", - "correct": true, - "first_call_us": 19.125, - "median_us": 10.27335624967236, - "samples_us": [ - 10.255660400434863, 10.282427098718472, 10.231829149415717, - 10.35832290071994, 10.293695799191482, 10.256277098960709, - 10.27335624967236 - ] - }, - { - "case": "union-all-failed", - "correct": true, - "first_call_us": 139.917, - "median_us": 7.41449375054799, - "samples_us": [ - 7.392660400364548, 7.435160399472807, 7.427141649532132, - 7.405829148774501, 7.418310450157151, 7.41449375054799, - 7.407602098828647 - ] - }, - { - "case": "union-nested", - "correct": true, - "first_call_us": 512.416, - "median_us": 10.223604200291447, - "samples_us": [ - 10.193893749965355, 10.19417289935518, 10.232074999657925, - 10.223604200291447, 10.636491699551698, 10.320191649952903, - 10.18639795074705 - ] - } - ], - "script_sha256": "52363525b7b8785830527b467c79ae492b0f2a5ab2dd3dec133a75a86a8de969", - "bearshape_wheel_sha256": "fe593320362bee43e8f1f91bb3ec10d1b3f85a0ea1039a3b7f7b409302ad8026", - "beartype_wheel_sha256": "777f5641545dc78c4eec30447c6ddfadec6144767e6466781210831ff50c85fa", - "variant": "optimized" -} diff --git a/tools/upstream/evidence/2026-10-11/optimized314.json b/tools/upstream/evidence/2026-10-11/optimized314.json deleted file mode 100644 index 9ef0019..0000000 --- a/tools/upstream/evidence/2026-10-11/optimized314.json +++ /dev/null @@ -1,193 +0,0 @@ -{ - "python": "3.14.5 (main, May 10 2026, 19:20:57) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit-Mach-O", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6" - }, - "calls": 20000, - "repeats": 7, - "results": [ - { - "case": "native", - "correct": true, - "first_call_us": 0.958, - "median_us": 0.09542500047245994, - "samples_us": [ - 0.09355834918096662, 0.09599584882380441, 0.09542500047245994, - 0.09673540043877438, 0.09434579988010228, 0.09529999952064827, - 0.09691875020507723 - ] - }, - { - "case": "forward-resolved-stateless", - "correct": true, - "first_call_us": 20.792, - "median_us": 0.5017146002501249, - "samples_us": [ - 0.5017146002501249, 0.5016603987314738, 0.502356250945013, - 0.4980958008673042, 0.5067270496510901, 0.5072562504210509, - 0.4979499994078651 - ] - }, - { - "case": "forward-unselected", - "correct": true, - "first_call_us": 1.916, - "median_us": 0.09011039946926758, - "samples_us": [ - 0.09061250020749867, 0.09140000038314611, 0.08894164930097759, - 0.08834585023578256, 0.09011039946926758, 0.0900771003216505, - 0.09146039956249297 - ] - }, - { - "case": "forward-nested-stateless", - "correct": true, - "first_call_us": 15.333, - "median_us": 0.5631687512504868, - "samples_us": [ - 0.5626979007502086, 0.5693582992535084, 0.5543312508962117, - 0.5631687512504868, 0.5653896005242132, 0.5629249993944541, - 0.563179150049109 - ] - }, - { - "case": "forward-tuple", - "correct": true, - "first_call_us": 95.417, - "median_us": 0.17587914917385206, - "samples_us": [ - 0.17103955033235252, 0.17241875029867515, 0.17587914917385206, - 0.17726250080158934, 0.17781039932742715, 0.179264550388325, - 0.17016874917317182 - ] - }, - { - "case": "forward-mapping", - "correct": true, - "first_call_us": 74.125, - "median_us": 0.214060400321614, - "samples_us": [ - 0.2152103988919407, 0.21329375013010576, 0.214060400321614, - 0.21856459934497252, 0.21140210010344163, 0.21600414911517873, - 0.20961875125067309 - ] - }, - { - "case": "forward-nested-lists", - "correct": true, - "first_call_us": 62.458, - "median_us": 0.24476669932482764, - "samples_us": [ - 0.24476669932482764, 0.2421666489681229, 0.2457666487316601, - 0.24408335011685267, 0.24257705081254244, 0.24521040031686425, - 0.249266650644131 - ] - }, - { - "case": "plugin-leaf", - "correct": true, - "first_call_us": 13.25, - "median_us": 0.5211124997003935, - "samples_us": [ - 0.5211124997003935, 0.5202666492550634, 0.5254250005236827, - 0.5204541492275894, 0.5255604497506283, 0.5171333497855812, - 0.5228354493738152 - ] - }, - { - "case": "plugin-union-second", - "correct": true, - "first_call_us": 8.292, - "median_us": 0.9175208513624966, - "samples_us": [ - 0.9055625007022172, 0.9167437499854714, 0.9219521001796238, - 0.9187166506308131, 0.9162041504168883, 0.9208604009472765, - 0.9175208513624966 - ] - }, - { - "case": "strict", - "correct": true, - "first_call_us": 103.625, - "median_us": 7.904906249314081, - "samples_us": [ - 7.904906249314081, 7.889599999180064, 7.907983349286951, - 7.892310399620328, 7.935252100287471, 7.886635450995527, - 7.922106250771321 - ] - }, - { - "case": "explicit", - "correct": true, - "first_call_us": 17.792, - "median_us": 6.458729150472209, - "samples_us": [ - 6.4181791502051055, 6.514195849013049, 6.480364600429311, - 6.43523750040913, 6.458729150472209, 6.5275291504804045, - 6.403579200559761 - ] - }, - { - "case": "union-first", - "correct": true, - "first_call_us": 50.792, - "median_us": 9.701768749800976, - "samples_us": [ - 9.696022950811312, 9.764264599652961, 9.736920850991737, - 9.686906250135507, 9.705258299072739, 9.701768749800976, - 9.668522949505132 - ] - }, - { - "case": "union-second", - "correct": true, - "first_call_us": 21.584, - "median_us": 12.481610399845522, - "samples_us": [ - 12.438535450201016, 12.489735399140045, 12.481610399845522, - 12.465404150134418, 12.420377049420495, 12.599845849035773, - 12.483679149590898 - ] - }, - { - "case": "union-explicit-second", - "correct": true, - "first_call_us": 18.667, - "median_us": 10.484566650120541, - "samples_us": [ - 10.49107705039205, 10.477368750434835, 10.47632080008043, - 10.47138959984295, 10.613524999644142, 10.635272899526171, - 10.484566650120541 - ] - }, - { - "case": "union-all-failed", - "correct": true, - "first_call_us": 186.334, - "median_us": 8.054516700212844, - "samples_us": [ - 8.069266700476874, 8.054516700212844, 8.028502098750323, - 8.052902099734638, 8.020564599428326, 8.147452099365182, - 8.09285834984621 - ] - }, - { - "case": "union-nested", - "correct": true, - "first_call_us": 638.625, - "median_us": 11.007493750366848, - "samples_us": [ - 11.007114550739061, 10.985852099838667, 11.007493750366848, - 11.004185400088318, 11.009408300742507, 14.08706664951751, - 15.233056250144728 - ] - } - ], - "script_sha256": "52363525b7b8785830527b467c79ae492b0f2a5ab2dd3dec133a75a86a8de969", - "bearshape_wheel_sha256": "fe593320362bee43e8f1f91bb3ec10d1b3f85a0ea1039a3b7f7b409302ad8026", - "beartype_wheel_sha256": "777f5641545dc78c4eec30447c6ddfadec6144767e6466781210831ff50c85fa", - "variant": "optimized" -} diff --git a/tools/upstream/evidence/2026-10-11/released311.json b/tools/upstream/evidence/2026-10-11/released311.json deleted file mode 100644 index db78b74..0000000 --- a/tools/upstream/evidence/2026-10-11/released311.json +++ /dev/null @@ -1,164 +0,0 @@ -{ - "python": "3.11.15 (main, May 10 2026, 19:23:07) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6" - }, - "calls": 20000, - "repeats": 7, - "results": [ - { - "case": "native", - "correct": true, - "first_call_us": 0.833, - "median_us": 0.09209374984493479, - "samples_us": [ - 0.09009580098791048, 0.09070414962479845, 0.0927542001591064, - 0.09326250001322478, 0.09362915006931871, 0.08976874960353598, - 0.09209374984493479 - ] - }, - { - "case": "forward-resolved-stateless", - "correct": true, - "first_call_us": 22.166, - "median_us": 0.6355021003400907, - "samples_us": [ - 0.6393624993506819, 0.6407687498722225, 0.630995849496685, - 0.6333312499918975, 0.6355021003400907, 0.6395374992280267, - 0.6266062497161329 - ] - }, - { - "case": "forward-unselected", - "correct": true, - "first_call_us": 1.209, - "median_us": 0.08303545037051663, - "samples_us": [ - 0.0806271011242643, 0.08110000053420663, 0.08645624911878258, - 0.08684585045557469, 0.08691459952387959, 0.08303545037051663, - 0.08266250079032034 - ] - }, - { - "case": "forward-nested-stateless", - "correct": true, - "first_call_us": 10.625, - "median_us": 0.6828832993051037, - "samples_us": [ - 0.6888979492941871, 0.6828832993051037, 0.6763021010556258, - 0.6969166512135416, 0.6875145496451296, 0.67279789946042, - 0.6731999994372018 - ] - }, - { - "case": "forward-tuple", - "correct": true, - "first_call_us": 5.875, - "median_us": 0.6723229002091102, - "samples_us": [ - 0.6772353997803293, 0.6723229002091102, 0.6671020993962884, - 0.6720208504702896, 0.679964548908174, 0.6790104496758431, - 0.6701708494802006 - ] - }, - { - "case": "forward-mapping", - "correct": true, - "first_call_us": 11.75, - "median_us": 0.6925458495970815, - "samples_us": [ - 0.6972624993068166, 0.6850895995739847, 0.6919749997905456, - 0.6925458495970815, 0.6995582996751182, 0.6921541498741135, - 0.69638959976146 - ] - }, - { - "case": "forward-nested-lists", - "correct": true, - "first_call_us": 9.459, - "median_us": 0.7225458510220051, - "samples_us": [ - 0.7322541991015896, 0.7336916503845714, 0.7183520996477455, - 0.7168937503593042, 0.7321729004615918, 0.7163562491768971, - 0.7225458510220051 - ] - }, - { - "case": "plugin-leaf", - "correct": true, - "first_call_us": 3.416, - "median_us": 0.14865204866509885, - "samples_us": [ - 0.14935835060896352, 0.14981040003476664, 0.1457374994060956, - 0.14342499925987795, 0.14865204866509885, 0.14893539919285104, - 0.14311664999695495 - ] - }, - { - "case": "plugin-union-second", - "correct": false, - "reason": "Plugin union retained rejected state" - }, - { - "case": "strict", - "correct": true, - "first_call_us": 85.459, - "median_us": 12.572322899359278, - "samples_us": [ - 12.708277099591214, 12.579216649464797, 12.831885399646126, - 12.572322899359278, 12.562608349253424, 12.561985399224795, - 12.547600000107195 - ] - }, - { - "case": "explicit", - "correct": true, - "first_call_us": 25.458, - "median_us": 8.292491651081946, - "samples_us": [ - 8.300797949777916, 8.296600000176113, 8.277097949758172, - 8.286233349645045, 8.283129151095636, 8.361197900376283, - 8.292491651081946 - ] - }, - { - "case": "union-first", - "correct": true, - "first_call_us": 37.625, - "median_us": 13.79377499979455, - "samples_us": [ - 13.86067295097746, 13.734164550260175, 13.706383299722802, - 13.820262499211822, 13.714408349187579, 13.883912499295548, - 13.79377499979455 - ] - }, - { - "case": "union-second", - "correct": false, - "reason": "Function __main__.union() parameter _last=\"array([1., 1., 1.], dtype=float32)\" violates type hint , as dimension 'N' expected 2 but got 3." - }, - { - "case": "union-explicit-second", - "correct": false, - "reason": "Function __main__.union_explicit() parameter _last=\"array([1., 1., 1.], dtype=float32)\" violates type hint , as dimension 'N' expected 2 but got 3." - }, - { - "case": "union-all-failed", - "correct": false, - "reason": "Failed union retained state" - }, - { - "case": "union-nested", - "correct": false, - "reason": "Nested union retained rejected state" - } - ], - "script_sha256": "52363525b7b8785830527b467c79ae492b0f2a5ab2dd3dec133a75a86a8de969", - "bearshape_wheel_sha256": "fe593320362bee43e8f1f91bb3ec10d1b3f85a0ea1039a3b7f7b409302ad8026", - "variant": "released", - "beartype_wheel_sha256": "4461b4dc57e3fdd6c8a8464b22cf118002eea107c33e9fef651c69068ab3cce3", - "beartype_wheel_url": "https://files.pythonhosted.org/packages/1c/cb/2f6aa982e2860c1156830db3da7f823b71784ed7d533ca289ea9b6c6347a/beartype-0.23.1-py3-none-any.whl" -} diff --git a/tools/upstream/evidence/2026-10-11/released314.json b/tools/upstream/evidence/2026-10-11/released314.json deleted file mode 100644 index d051e36..0000000 --- a/tools/upstream/evidence/2026-10-11/released314.json +++ /dev/null @@ -1,164 +0,0 @@ -{ - "python": "3.14.5 (main, May 10 2026, 19:20:57) [Clang 22.1.3 ]", - "platform": "macOS-27.0.1-arm64-arm-64bit-Mach-O", - "versions": { - "bearshape": "0.1.0rc1", - "beartype": "0.23.1", - "numpy": "2.4.6" - }, - "calls": 20000, - "repeats": 7, - "results": [ - { - "case": "native", - "correct": true, - "first_call_us": 0.916, - "median_us": 0.0928458000998944, - "samples_us": [ - 0.09484375041211024, 0.09721250098664314, 0.0942208498599939, - 0.0928458000998944, 0.09026250045280904, 0.08751874993322417, - 0.09005000028992072 - ] - }, - { - "case": "forward-resolved-stateless", - "correct": true, - "first_call_us": 32.0, - "median_us": 0.4976728989277035, - "samples_us": [ - 0.48198540025623515, 0.5026041486416943, 0.5004895996535197, - 0.4982562502846122, 0.48919164983090013, 0.47738330031279474, - 0.4976728989277035 - ] - }, - { - "case": "forward-unselected", - "correct": true, - "first_call_us": 1.708, - "median_us": 0.09402705036336556, - "samples_us": [ - 0.09676039917394519, 0.0968041509622708, 0.09765625, - 0.09204789967043325, 0.09229374991264194, 0.09312704933108762, - 0.09402705036336556 - ] - }, - { - "case": "forward-nested-stateless", - "correct": true, - "first_call_us": 10.708, - "median_us": 0.5364146010833792, - "samples_us": [ - 0.5364146010833792, 0.5335416499292478, 0.5609604486380704, - 0.5378041503718123, 0.532991650106851, 0.5349937491700985, - 0.539516648859717 - ] - }, - { - "case": "forward-tuple", - "correct": true, - "first_call_us": 5.875, - "median_us": 0.5198832994210534, - "samples_us": [ - 0.5198521001148038, 0.5267916494631208, 0.5193895500269718, - 0.5184854497201741, 0.5302687495714054, 0.5238833502517082, - 0.5198832994210534 - ] - }, - { - "case": "forward-mapping", - "correct": true, - "first_call_us": 8.375, - "median_us": 0.5693958504707552, - "samples_us": [ - 0.5601604498224333, 0.5590062501141801, 0.5788854003185406, - 0.5577562493272126, 0.5693958504707552, 0.5885521008167416, - 0.5884916492504999 - ] - }, - { - "case": "forward-nested-lists", - "correct": true, - "first_call_us": 6.958, - "median_us": 0.5902457996853627, - "samples_us": [ - 0.578002049587667, 0.5937604000791907, 0.6223500007763505, - 0.5776417005108669, 0.5778437494882382, 0.5902457996853627, - 0.6120875012129545 - ] - }, - { - "case": "plugin-leaf", - "correct": true, - "first_call_us": 4.458, - "median_us": 0.16760625003371388, - "samples_us": [ - 0.16560624935664237, 0.1662833004957065, 0.16760625003371388, - 0.17702085024211556, 0.17782710056053475, 0.1816271003917791, - 0.15621670027030632 - ] - }, - { - "case": "plugin-union-second", - "correct": false, - "reason": "Plugin union retained rejected state" - }, - { - "case": "strict", - "correct": true, - "first_call_us": 98.834, - "median_us": 12.875231250654906, - "samples_us": [ - 12.691037499462254, 12.894510399200954, 12.875231250654906, - 12.930579199746717, 12.956618749012705, 12.867172899132129, - 12.793599998985883 - ] - }, - { - "case": "explicit", - "correct": true, - "first_call_us": 24.167, - "median_us": 7.801599999947939, - "samples_us": [ - 7.897547949687578, 7.777147900196724, 9.101825000834651, - 7.801599999947939, 7.768264549667947, 7.709831249667332, - 7.985456250025891 - ] - }, - { - "case": "union-first", - "correct": true, - "first_call_us": 58.542, - "median_us": 14.103314599196892, - "samples_us": [ - 14.103314599196892, 14.084683349938132, 14.20017914933851, - 14.141779149940703, 14.184008351003285, 14.0172542000073, - 14.053993750712834 - ] - }, - { - "case": "union-second", - "correct": false, - "reason": "Function __main__.union() parameter _last=\"array([1., 1., 1.], dtype=float32)\" violates type hint , as dimension 'N' expected 2 but got 3." - }, - { - "case": "union-explicit-second", - "correct": false, - "reason": "Function __main__.union_explicit() parameter _last=\"array([1., 1., 1.], dtype=float32)\" violates type hint , as dimension 'N' expected 2 but got 3." - }, - { - "case": "union-all-failed", - "correct": false, - "reason": "Failed union retained state" - }, - { - "case": "union-nested", - "correct": false, - "reason": "Nested union retained rejected state" - } - ], - "script_sha256": "52363525b7b8785830527b467c79ae492b0f2a5ab2dd3dec133a75a86a8de969", - "bearshape_wheel_sha256": "fe593320362bee43e8f1f91bb3ec10d1b3f85a0ea1039a3b7f7b409302ad8026", - "variant": "released", - "beartype_wheel_sha256": "4461b4dc57e3fdd6c8a8464b22cf118002eea107c33e9fef651c69068ab3cce3", - "beartype_wheel_url": "https://files.pythonhosted.org/packages/1c/cb/2f6aa982e2860c1156830db3da7f823b71784ed7d533ca289ea9b6c6347a/beartype-0.23.1-py3-none-any.whl" -} diff --git a/tools/upstream/patches/0001-state.patch b/tools/upstream/patches/0001-state.patch deleted file mode 100644 index 162d247..0000000 --- a/tools/upstream/patches/0001-state.patch +++ /dev/null @@ -1,1203 +0,0 @@ -diff --git a/beartype/_check/cls/hint/tree/hinttreecode.py b/beartype/_check/cls/hint/tree/hinttreecode.py -index e4ec7587..2adc3682 100644 ---- a/beartype/_check/cls/hint/tree/hinttreecode.py -+++ b/beartype/_check/cls/hint/tree/hinttreecode.py -@@ -13,6 +13,7 @@ This private submodule is *not* intended for importation by downstream callers. - ''' - - # ....................{ IMPORTS }.................... -+from beartype.plug._plugstate import StateGetter - from beartype.roar import BeartypeDecorHintRecursionException - from beartype._check.cls.call.calldataabc import BeartypeCallDataABC - from beartype._check.cls.call.calldataexternal import ( -@@ -190,6 +191,8 @@ class HintTreeCode(HintTreeABC): - # called @beartype decorations. Slotting has been shown to reduce read and - # write costs by approximately ~10%, which is non-trivial. - __slots__ = ( -+ 'check_state_getters', -+ 'check_root_stateless_expr', - 'func_curr_code', - 'func_wrapper_locals', - 'hint_curr_expr', -@@ -207,6 +210,8 @@ class HintTreeCode(HintTreeABC): - # Squelch false negatives from mypy. This is absurd. This is mypy. See: - # https://github.com/python/mypy/issues/5941 - if TYPE_CHECKING: -+ check_state_getters: dict[int, StateGetter] -+ check_root_stateless_expr: Optional[str] - func_curr_code: str - func_wrapper_locals: LexicalScope - hint_curr : HintDataCode -@@ -250,6 +255,8 @@ class HintTreeCode(HintTreeABC): - ''' - - # Nullify all instance variables for safety. -+ self.check_state_getters = {} -+ self.check_root_stateless_expr = None - self.call_curr = ( # type: ignore[assignment] - self.conf) = ( # pyright: ignore - self.func_curr_code) = ( # pyright: ignore -diff --git a/beartype/_check/cls/hint/tree/hinttreeerror.py b/beartype/_check/cls/hint/tree/hinttreeerror.py -index cac290c2..fe955aa6 100644 ---- a/beartype/_check/cls/hint/tree/hinttreeerror.py -+++ b/beartype/_check/cls/hint/tree/hinttreeerror.py -@@ -51,6 +51,7 @@ This private submodule is *not* intended for importation by downstream callers. - #excellent start, anyway. Great job for finally doing something, us! \o/ - - # ....................{ IMPORTS }.................... -+from beartype.plug._plugstate import _HintCheckState - from beartype.roar._roarexc import _BeartypeCallHintPepRaiseException - from beartype._cave._cavemap import NoneTypeOr - from beartype._check.convert.convmain import sanify_hint_child -@@ -149,6 +150,7 @@ class HintTreeError(HintTreeABC): - # * Prevent accidental declaration of erroneous instance variables. - # * Minimize space and time complexity. - __slots__ = ( -+ 'check_state', - 'cause_indent', - 'cause_str_or_none', - 'exception_cls', -@@ -161,6 +163,7 @@ class HintTreeError(HintTreeABC): - # Squelch false negatives from mypy. This is absurd. This is mypy. See: - # https://github.com/python/mypy/issues/5941 - if TYPE_CHECKING: -+ check_state: Optional[_HintCheckState] - cause_indent: str - cause_str_or_none: Optional[str] - exception_cls: TypeException -@@ -173,6 +176,7 @@ class HintTreeError(HintTreeABC): - # ..................{ CLASS VARIABLES ~ set }.................. - _COPY_VAR_NAMES = frozenset(( - 'call_curr', -+ 'check_state', - 'cause_indent', - 'cause_str_or_none', - 'conf', -@@ -218,6 +222,7 @@ class HintTreeError(HintTreeABC): - - # Optional parameters. - cause_str_or_none: Optional[str] = None, -+ check_state: Optional[_HintCheckState] = None, - ) -> None: - ''' - Initialize this violation cause. -@@ -249,6 +254,7 @@ class HintTreeError(HintTreeABC): - ) - - # Classify all passed parameters. -+ self.check_state = check_state - self.cause_indent = cause_indent - self.cause_str_or_none = cause_str_or_none - self.exception_cls = exception_cls -@@ -498,7 +504,19 @@ class HintTreeError(HintTreeABC): - # ..................{ RETURN }.................. - # Call this getter function with ourselves and return the string - # returned by this getter. -- return cause_finder(self) -+ state = self.check_state -+ if state is None: -+ return cause_finder(self) -+ state.begin() -+ result = None -+ try: -+ result = cause_finder(self) -+ return result -+ finally: -+ if result is not None and result.cause_str_or_none is None: -+ state.commit() -+ else: -+ state.rollback() - - # ..................{ PERMUTERS }.................. - def permute_cause(self, **kwargs) -> 'HintTreeError': -diff --git a/beartype/_check/cls/scope/checkexprscope.py b/beartype/_check/cls/scope/checkexprscope.py -index 65191405..5836b74d 100644 ---- a/beartype/_check/cls/scope/checkexprscope.py -+++ b/beartype/_check/cls/scope/checkexprscope.py -@@ -13,6 +13,7 @@ This private submodule is *not* intended for importation by downstream callers. - ''' - - # ....................{ IMPORTS }.................... -+from beartype.plug._plugstate import StateGetter - from beartype._cave._cavemap import NoneTypeOr - from beartype._check.forward.reference.fwdreftest import is_beartype_ref_proxy - from beartype._check.forward.reference.fwdreftyping import ( -@@ -35,6 +36,9 @@ class BeartypeCheckExprScope(FrozenDictStrToAny): - - Attributes - ---------- -+ check_state_getters : tuple[Callable, ...] -+ Identity-deduplicated snapshot getters discovered while generating this -+ expression. These locate runtime state; they never hold snapshots. - beartype_ref_proxies : tuple[BeartypeForwardRefMetaclass, ...] - Tuple of all :mod:`beartype`-specific **forward reference proxies** - (i.e., classes whose metaclass defers the resolution of forward -@@ -53,6 +57,7 @@ class BeartypeCheckExprScope(FrozenDictStrToAny): - # called @beartype decorations. Slotting has been shown to reduce read and - # write costs by approximately ~10%, which is non-trivial. - __slots__ = ( -+ 'check_state_getters', - 'beartype_ref_proxies', - 'is_check_expr_cacheable', - ) -@@ -60,6 +65,7 @@ class BeartypeCheckExprScope(FrozenDictStrToAny): - # Squelch false negatives from mypy. This is absurd. This is mypy. See: - # https://github.com/python/mypy/issues/5941 - if TYPE_CHECKING: -+ check_state_getters: tuple[StateGetter, ...] - beartype_ref_proxies: TupleBeartypeForwardRefs - is_check_expr_cacheable: bool - -@@ -73,6 +79,7 @@ class BeartypeCheckExprScope(FrozenDictStrToAny): - # Optional keyword-only parameters. - beartype_ref_proxies: Optional[TupleBeartypeForwardRefs] = None, - is_check_expr_cacheable: bool = False, -+ check_state_getters: tuple[StateGetter, ...] = (), - **kwargs - ) -> None: - ''' -@@ -122,6 +129,7 @@ class BeartypeCheckExprScope(FrozenDictStrToAny): - - # Classify all remaining parameters. - self.is_check_expr_cacheable = is_check_expr_cacheable -+ self.check_state_getters = check_state_getters - - # ..................{ REFREEZERS }.................. - def refreeze(self, *args, **kwargs) -> 'BeartypeCheckExprScope': -@@ -152,5 +160,6 @@ class BeartypeCheckExprScope(FrozenDictStrToAny): - # scope, for efficiency. - beartype_ref_proxies=self.beartype_ref_proxies, - is_check_expr_cacheable=self.is_check_expr_cacheable, -+ check_state_getters=self.check_state_getters, - **kwargs - ) -diff --git a/beartype/_check/code/_pep/pep484/codepep484604union.py b/beartype/_check/code/_pep/pep484/codepep484604union.py -index 04daea12..ae5c02e5 100644 ---- a/beartype/_check/code/_pep/pep484/codepep484604union.py -+++ b/beartype/_check/code/_pep/pep484/codepep484604union.py -@@ -12,6 +12,7 @@ This private submodule is *not* intended for importation by downstream callers. - ''' - - # ....................{ IMPORTS }.................... -+from beartype._check.forward.reference.fwdreftest import is_beartype_ref_proxy - from beartype._check.code.codescope import add_hints_meta_scope_type_or_types - from beartype._check.cls.hint.tree.hinttreecode import HintTreeCode - from beartype._check.cls.hint.hintsane import ( -@@ -42,7 +43,9 @@ from beartype._util.hint.pep.utilpepsign import get_hint_pep_sign_or_none - from beartype._util.hint.pep.utilpeptest import is_hint_pep - - # ....................{ FACTORIES }.................... --def make_hint_pep484604_check_expr(hint_tree: HintTreeCode) -> None: -+def make_hint_pep484604_check_expr( -+ hint_tree: HintTreeCode, *, is_root: bool = False, -+) -> None: - ''' - Either a Python code snippet type-checking the current pith against the - passed :pep:`484`- or :pep:`604`-compliant union type hint if this union is -@@ -205,6 +208,39 @@ def make_hint_pep484604_check_expr(hint_tree: HintTreeCode) -> None: - # generate and append efficient code type-checking these child hints - # *BEFORE* less efficient code type-checking any PEP-compliant child hints - # subscripting this union. -+ if is_root: -+ # A leading stateless success needs no transaction at all. Preserve -+ # existing ordering, and stop before the first participating class. -+ stateless_prefix = [] -+ for child in sorted(hint_childs_nonpep, key=is_beartype_ref_proxy): -+ if is_beartype_ref_proxy(child) or getattr(child, '__beartype_state__', None) is not None: -+ break -+ stateless_prefix.append(child) -+ if stateless_prefix and (hint_childs_sane_pep or len(stateless_prefix) < len(hint_childs_nonpep)): -+ prefix_types = add_hints_meta_scope_type_or_types( -+ hint_tree=hint_tree, type_or_types=tuple(stateless_prefix)) -+ hint_tree.check_root_stateless_expr = ( -+ f'isinstance({hint_tree.hint_curr.pith_expr}, {prefix_types})') -+ for child in stateless_prefix: -+ del hint_childs_nonpep[child] -+ -+ if hint_childs_nonpep and any( -+ is_beartype_ref_proxy(child) or -+ getattr(child, '__beartype_state__', None) is not None -+ for child in hint_childs_nonpep -+ ): -+ # Native isinstance(obj, (A, B)) has no per-class failure boundary. -+ # Enqueue these classes individually only when one opts into state. -+ pep_children = tuple(hint_childs_sane_pep) -+ hint_childs_sane_pep.clear() -+ # Match the existing isinstance tuple optimization: resolvable -+ # classes precede lazy proxies, even when the annotation lists a -+ # forward reference first (notably Optional["NotYetDefined"]). -+ for child in sorted(hint_childs_nonpep, key=is_beartype_ref_proxy): -+ hint_childs_sane_pep[HintSane(child)] = None -+ hint_childs_sane_pep.update(dict.fromkeys(pep_children)) -+ hint_childs_nonpep.clear() -+ - if hint_childs_nonpep: - # Python expression evaluating to a tuple of these arguments. - # -@@ -256,7 +292,7 @@ def make_hint_pep484604_check_expr(hint_tree: HintTreeCode) -> None: - # Code deeply type-checking this child hint. - hint_tree.func_curr_code += CODE_PEP484604_UNION_CHILD_PEP_format( - # Expression yielding the value of this pith. -- hint_child_placeholder=hint_tree.enqueue_hint_child_sane( -+ hint_child_placeholder="__BEARTYPE_SNAPSHOT_START__" + hint_tree.enqueue_hint_child_sane( - hint_sane=hint_child_sane_pep, - pith_expr=( - # If either... -@@ -288,7 +324,7 @@ def make_hint_pep484604_check_expr(hint_tree: HintTreeCode) -> None: - # that constraint here. - hint_tree.pith_curr_assign_expr - ), -- ), -+ ) + "__BEARTYPE_SNAPSHOT_END__", - ) - - # ....................{ RETURN }.................... -diff --git a/beartype/_check/code/codemain.py b/beartype/_check/code/codemain.py -index 14be8144..9719dcef 100644 ---- a/beartype/_check/code/codemain.py -+++ b/beartype/_check/code/codemain.py -@@ -43,6 +43,7 @@ from beartype.roar import ( - from beartype._data.check.code.datacodename import ( - ARG_NAME_GETRANDBITS, - VAR_NAME_PITH_ROOT, -+ VAR_NAME_RANDOM_INT, - ) - from beartype._check.cls.hint.hintsane import HINT_SANE_IGNORABLE - from beartype._check.cls.hint.tree.hinttreecode import HintTreeCode -@@ -652,7 +653,8 @@ def make_check_expr( - if hint_curr_sign in HINT_SIGNS_UNION: - # Python code snippet type-checking the current pith against - # this union if this union is unignorable *OR* "None". -- make_hint_pep484604_check_expr(hint_tree) -+ make_hint_pep484604_check_expr( -+ hint_tree, is_root=hints_meta_index_curr == 0) - # Else, this hint is *NOT* a union. - # - # ..........{ CONTAINERS }............ -@@ -1509,6 +1511,62 @@ def make_check_expr( - f'{EXCEPTION_PREFIX_HINT}{repr(hint_sane)} unchecked.') - # Else, the breadth-first search above successfully generated code. - -+ # Resolve deferred transaction boundaries after visiting every child. -+ state_getters = tuple(hint_tree.check_state_getters.values()) -+ from beartype._check.forward.reference.fwdreftest import is_beartype_ref_proxy -+ has_forward_refs = any( -+ is_beartype_ref_proxy(value) -+ for value in hint_tree.func_wrapper_locals.values()) -+ if state_getters or (has_forward_refs and not is_beartype_ref_proxy(hint_sane.hint)): -+ from beartype.plug._plugstate import _HintCheckState -+ from beartype._util.func.utilfuncmake import make_func -+ func_wrapper_code = func_wrapper_code.replace( -+ '__BEARTYPE_SNAPSHOT_START__', -+ '(__beartype_state.begin() and (', -+ ).replace( -+ '__BEARTYPE_SNAPSHOT_END__', -+ ') and __beartype_state.commit() or __beartype_state.rollback())', -+ ) -+ # Compile once. Keeping the entire expression in one function preserves -+ # assignment scope and sampling without allocating a closure per check. -+ parameters = VAR_NAME_PITH_ROOT -+ if hint_tree.is_var_random_int_needed: -+ parameters += f', {VAR_NAME_RANDOM_INT}' -+ check_globals = dict(hint_tree.func_wrapper_locals) -+ check_globals['__beartype_state_factory'] = _HintCheckState -+ check_globals['__beartype_state_getters'] = state_getters -+ from beartype._util.hint.pep.utilpepsign import get_hint_pep_sign_or_none -+ is_root_union = get_hint_pep_sign_or_none(hint_sane.hint) in HINT_SIGNS_UNION -+ check_body = ( -+ f' return {func_wrapper_code}\n' -+ if is_root_union else -+ ' __beartype_state.begin()\n' -+ f' if {func_wrapper_code}:\n' -+ ' return __beartype_state.commit()\n' -+ ' return False\n' -+ ) -+ checker = make_func( -+ func_name='__beartype_stateful', -+ func_code=( -+ f'def __beartype_stateful({parameters}):\n' -+ ' with __beartype_state_factory(__beartype_state_getters) as __beartype_state:\n' -+ f'{check_body}' -+ ), -+ func_globals=check_globals, -+ is_debug=conf.is_debug, -+ ) -+ check_name = add_func_scope_attr( -+ attr=checker, func_scope=hint_tree.func_wrapper_locals) -+ func_wrapper_code = f'{check_name}({parameters})' -+ else: -+ func_wrapper_code = func_wrapper_code.replace( -+ '__BEARTYPE_SNAPSHOT_START__', '').replace( -+ '__BEARTYPE_SNAPSHOT_END__', '') -+ -+ if hint_tree.check_root_stateless_expr is not None: -+ func_wrapper_code = ( -+ f'({hint_tree.check_root_stateless_expr} or {func_wrapper_code})') -+ - # ..................{ SCOPE }.................. - # If type-checking this hint requires a pseudo-random integer, pass a hidden - # parameter to this wrapper function exposing the random.getrandbits() -@@ -1530,6 +1588,7 @@ def make_check_expr( - # otherwise impossible to debug memoization issues. Debugging wins! \o/ - BeartypeCheckExprScope( - hint_tree.func_wrapper_locals, -+ check_state_getters=state_getters, - is_check_expr_cacheable=hint_tree.is_check_expr_cacheable - ), - ) -diff --git a/beartype/_check/code/codescope.py b/beartype/_check/code/codescope.py -index e11bc2d0..81e621f6 100644 ---- a/beartype/_check/code/codescope.py -+++ b/beartype/_check/code/codescope.py -@@ -37,7 +37,8 @@ from beartype._util.cls.utilclstest import is_type_builtin - from beartype._util.func.utilfuncscope import add_func_scope_attr - from beartype._util.utilobjget import get_object_type_basename - from collections.abc import Set --from typing import Optional -+from typing import Optional, cast -+from beartype.plug._plugstate import StateGetter - - # ....................{ ADDERS ~ type }.................... - #FIXME: Unit test us up, please. -@@ -79,6 +80,19 @@ def add_hints_meta_scope_type_or_types( - assert isinstance(hint_tree, HintTreeCode), ( - f'{repr(hint_tree)} not "HintTreeCode" object.') - -+ # Inspect classes already reached by the sanitized traversal. Do not -+ # resolve lazy forward-reference proxies merely to look for an opt-in hook. -+ classes = (type_or_types,) if isinstance(type_or_types, type) else type_or_types -+ for cls in classes: -+ if is_beartype_ref_proxy(cls): -+ continue -+ state_getter = getattr(cls, '__beartype_state__', None) -+ if state_getter is not None: -+ if not callable(state_getter): -+ raise BeartypeDecorHintNonpepException( -+ f'{cls!r} __beartype_state__ is not callable.') -+ hint_tree.check_state_getters[id(state_getter)] = cast(StateGetter, state_getter) -+ - # Defer to the lower-level add_func_scope_type_or_types() adder. - return add_func_scope_type_or_types( - type_or_types=type_or_types, -diff --git a/beartype/_check/error/_pep/errpep484604.py b/beartype/_check/error/_pep/errpep484604.py -index 2fe1bcdc..a6abf7ea 100644 ---- a/beartype/_check/error/_pep/errpep484604.py -+++ b/beartype/_check/error/_pep/errpep484604.py -@@ -159,7 +159,9 @@ def find_cause_pep484604_union(cause: HintTreeError) -> HintTreeError: - - # If this pith is an instance of this type, this pith satisfies this - # hint. In this case, return this cause as is. -- if isinstance(cause.pith, hint_child): -+ child_cause = cause.permute_cause( -+ hint_curr=HintDataError(hint_child_sane)).find_cause() -+ if child_cause.cause_str_or_none is None: - return cause - # Else, this pith is *NOT* an instance of this type, implying this - # pith to *NOT* satisfy this hint. -diff --git a/beartype/_check/error/errmain.py b/beartype/_check/error/errmain.py -index 1d36ae69..c8d44456 100644 ---- a/beartype/_check/error/errmain.py -+++ b/beartype/_check/error/errmain.py -@@ -601,6 +601,26 @@ def _find_hint_object_violation_cause( - exception_prefix=exception_prefix, - ) - -+ from contextlib import ExitStack -+ from beartype._check.code.codemain import make_check_expr -+ from beartype.plug._plugstate import _HintCheckState -+ from typing import NoReturn -+ has_forward_refs = False -+ if hint_sane.hint is NoReturn: -+ # NoReturn has a dedicated return-check path, not a boolean expression. -+ getters = () -+ elif isinstance(hint_sane.hint, tuple): -+ # Legacy tuple unions are likewise checked outside make_check_expr(). -+ getters = tuple({ -+ id(getter): getter for child in hint_sane.hint -+ if (getter := getattr(child, '__beartype_state__', None)) is not None -+ }.values()) -+ else: -+ scope = make_check_expr(call_curr, conf, hint_sane)[1] -+ getters = scope.check_state_getters -+ has_forward_refs = bool(scope.beartype_ref_proxies) -+ state = _HintCheckState(getters) if getters or has_forward_refs else None -+ - # Cause describing the failure of this pith to satisfy this hint. - violation_cause = HintTreeError( - call_curr=call_curr, -@@ -612,7 +632,13 @@ def _find_hint_object_violation_cause( - random_int=random_int, - exception_cls=exception_cls, - exception_prefix=exception_prefix, -- ).find_cause() -+ check_state=state, -+ ) -+ with ExitStack() as diagnostic: -+ if state is not None: -+ diagnostic.enter_context(state) -+ state.begin() -+ violation_cause = violation_cause.find_cause() - - # If this pith satisfies this hint, *SOMETHING HAS GONE VERY TERRIBLY AWRY.* - # In theory, this should never happen, as the parent wrapper function -diff --git a/beartype/_check/forward/reference/_cls/fwdrefmeta.py b/beartype/_check/forward/reference/_cls/fwdrefmeta.py -index 79c85b25..494827b1 100644 ---- a/beartype/_check/forward/reference/_cls/fwdrefmeta.py -+++ b/beartype/_check/forward/reference/_cls/fwdrefmeta.py -@@ -446,6 +446,10 @@ class BeartypeForwardRefMetaclass(type): - # is thus on the hot path for @beartype. If optimization is warranted - # anywhere in the @beartype codebase, it is here. - # print(f'Isinstanceable resolved hint detected: {repr(resolved_hint)}') -+ state_getter = getattr(resolved_hint, '__beartype_state__', None) -+ if state_getter is not None: -+ from beartype.plug._plugstate import isinstance_stateful -+ return isinstance_stateful(obj, resolved_hint, state_getter) - return isinstance(obj, resolved_hint) - # Else, this hint is either: - # * Not isinstanceable, in which case this hint is *NOT* safely passable -diff --git a/beartype/plug/_plugstate.py b/beartype/plug/_plugstate.py -new file mode 100644 -index 00000000..662f4e95 ---- /dev/null -+++ b/beartype/plug/_plugstate.py -@@ -0,0 +1,138 @@ -+#!/usr/bin/env python3 -+# --------------------( LICENSE )-------------------- -+# Copyright (c) 2014-2026 Beartype authors. -+# See "LICENSE" for further details. -+ -+"""Invocation-owned transactions for opt-in stateful runtime hints.""" -+ -+from beartype._data.typing.datatyping import Pep3119Checkable -+from collections.abc import Callable -+from contextlib import ExitStack -+from contextvars import ContextVar, Token -+from typing import Any, Protocol -+ -+ -+class HintState(Protocol): -+ """A library-owned state domain; snapshot tokens are opaque to beartype.""" -+ -+ def snapshot(self) -> Any: ... -+ def restore(self, snapshot: Any) -> None: ... -+ -+ -+StateGetter = Callable[[], HintState] -+Rollback = tuple[Callable[[Any], None], Any] -+ -+ -+class _HintCheckState: -+ """Nested checkpoints sharing state located once per checking expression.""" -+ -+ __slots__ = ('getters', 'states', 'transactions', '_token') -+ -+ def __init__(self, getters: tuple[StateGetter, ...]) -> None: -+ self.getters = getters -+ states = [] -+ for getter in getters: -+ state = getter() -+ _validate_state(state) -+ states.append(state) -+ self.states = tuple(states) -+ self.transactions: list[list[Rollback]] = [] -+ self._token: Token[tuple['_HintCheckState', ...]] | None = None -+ -+ def __enter__(self) -> '_HintCheckState': -+ parents = _ACTIVE_CHECK_STATES.get() -+ if parents: -+ parents = tuple(parent for parent in parents if parent._token is not None) -+ # Resolved aliases enrol their domains before mutating shared state. -+ for parent in parents: -+ parent.register(self.getters, self.states) -+ self._token = _ACTIVE_CHECK_STATES.set((*parents, self)) -+ return self -+ -+ def __exit__(self, *exception: object) -> None: -+ try: -+ if self.transactions: -+ self.close() -+ finally: -+ assert self._token is not None -+ token = self._token -+ self._token = None -+ # copy_context() can outlive this check. Do not let a copied -+ # context retain invocation state or enrol into a finished check. -+ self.getters = () -+ self.states = () -+ _ACTIVE_CHECK_STATES.reset(token) -+ -+ def register( -+ self, getters: tuple[StateGetter, ...], states: tuple[HintState, ...] = (), -+ ) -> None: -+ for index, getter in enumerate(getters): -+ if not any(getter is known for known in self.getters): -+ state = states[index] if states else getter() -+ _validate_state(state) -+ self.getters += (getter,) -+ self.states += (state,) -+ for transaction in self.transactions: -+ transaction.append((state.restore, state.snapshot())) -+ -+ def begin(self) -> bool: -+ transaction: list[Rollback] = [] -+ self.transactions.append(transaction) -+ for state in self.states: -+ transaction.append((state.restore, state.snapshot())) -+ return True -+ -+ def commit(self) -> bool: -+ self.transactions.pop() -+ return True -+ -+ def rollback(self) -> bool: -+ _restore(self.transactions.pop()) -+ return False -+ -+ def close(self) -> None: -+ callbacks = [restore for transaction in self.transactions for restore in transaction] -+ self.transactions.clear() -+ _restore(callbacks) -+ -+ -+def _validate_state(state: HintState) -> None: -+ if not callable(getattr(state, 'snapshot', None)) or not callable(getattr(state, 'restore', None)): -+ raise TypeError( -+ '__beartype_state__() must return an object with callable ' -+ 'snapshot and restore methods.') -+ -+ -+def _restore(callbacks: list[Rollback]) -> None: -+ while callbacks: -+ restore, snapshot = callbacks.pop() -+ try: -+ restore(snapshot) -+ except BaseException: -+ # Keep general context-manager machinery off the successful path, -+ # but still unwind every domain when a broken plugin raises. -+ with ExitStack() as pending: -+ for restore, snapshot in callbacks: -+ pending.callback(restore, snapshot) -+ callbacks.clear() -+ raise -+ -+ -+_ACTIVE_CHECK_STATES: ContextVar[tuple[_HintCheckState, ...]] = ContextVar( -+ 'beartype_check_states', default=()) -+ -+ -+def isinstance_stateful(obj: object, hint: Pep3119Checkable, getter: StateGetter) -> bool: -+ """Check a resolved root reference without another generated wrapper.""" -+ parents = _ACTIVE_CHECK_STATES.get() -+ if parents: -+ parents = tuple(parent for parent in parents if parent._token is not None) -+ if parents: -+ for parent in parents: -+ parent.register((getter,)) -+ return isinstance(obj, hint) -+ with _HintCheckState((getter,)) as state: -+ state.begin() -+ if isinstance(obj, hint): -+ return state.commit() -+ return False -diff --git a/beartype_test/a00_unit/a40_api/plug/test_plugstate.py b/beartype_test/a00_unit/a40_api/plug/test_plugstate.py -new file mode 100644 -index 00000000..145f1be8 ---- /dev/null -+++ b/beartype_test/a00_unit/a40_api/plug/test_plugstate.py -@@ -0,0 +1,477 @@ -+#!/usr/bin/env python3 -+# --------------------( LICENSE )-------------------- -+# Copyright (c) 2014-2026 Beartype authors. -+# See "LICENSE" for further details. -+ -+"""Opt-in stateful hints compose without changing ordinary union checks.""" -+ -+import pytest -+ -+ -+def _run_check(check, getters): -+ from beartype.plug._plugstate import _HintCheckState -+ -+ with _HintCheckState(getters) as state: -+ state.begin() -+ if check(state): -+ return state.commit() -+ return False -+ -+ -+@pytest.fixture -+def stateful_hints(): -+ bindings = {} -+ snapshots = [] -+ -+ class State: -+ def snapshot(self): -+ before = bindings.copy() -+ snapshots.append(before) -+ return before -+ -+ def restore(self, before): -+ bindings.clear() -+ bindings.update(before) -+ -+ state = State() -+ -+ def get_state(): -+ return state -+ -+ def hint(name, *, reject=False, raises=None): -+ class Meta(type): -+ __beartype_state__ = staticmethod(get_state) -+ -+ def __instancecheck__(cls, value): -+ if not isinstance(value, list): -+ return False -+ previous = bindings.setdefault(name, len(value)) -+ if raises is not None: -+ raise raises -+ return previous == len(value) and not reject -+ -+ def __instancecheck_str__(cls, value): -+ return f'{name} expected {bindings.get(name)} but got {len(value)}' -+ -+ return Meta(f'{name}_{id(bindings)}', (), {}) -+ -+ return bindings, snapshots, hint -+ -+ -+def test_composite_union_rollback(stateful_hints): -+ from beartype import beartype -+ from beartype.roar import BeartypeCallHintParamViolation -+ -+ bindings, snapshots, hint = stateful_hints -+ N, C = hint('N'), hint('C') -+ -+ @beartype -+ def choose(pair: tuple[N, str] | tuple[C, int], last: N): -+ pass -+ -+ choose(([1, 2], 1), [1, 2, 3]) -+ assert bindings == {'C': 2, 'N': 3} -+ # Two alternatives and the last parameter each need one checkpoint; -+ # the top-level union needs no duplicate snapshot around its alternatives. -+ assert len(snapshots) == 3 -+ with pytest.raises(BeartypeCallHintParamViolation): -+ choose(([1, 2], 1), [1, 2, 3, 4]) -+ assert bindings == {'C': 2, 'N': 3} -+ -+ -+def test_plain_class_union_rollback(stateful_hints): -+ from beartype.door import is_bearable -+ -+ bindings, _, hint = stateful_hints -+ Failed, Success = hint('failed', reject=True), hint('success') -+ assert is_bearable([1, 2], Failed | Success) -+ assert bindings == {'success': 2} -+ -+ -+def test_failed_plain_class_union_rollback(stateful_hints): -+ from beartype.door import die_if_unbearable, is_bearable -+ from beartype.roar import BeartypeDoorHintViolation -+ -+ bindings, _, hint = stateful_hints -+ A, B = hint('a', reject=True), hint('b', reject=True) -+ assert not is_bearable([1], A | B) -+ assert bindings == {} -+ with pytest.raises(BeartypeDoorHintViolation): -+ die_if_unbearable([1], A | B) -+ assert bindings == {} -+ -+ -+@pytest.mark.parametrize('error', [ValueError('validator failed'), KeyboardInterrupt()]) -+def test_validator_exception_restores_state(stateful_hints, error): -+ from beartype.door import is_bearable -+ -+ bindings, _, hint = stateful_hints -+ First, Raises = hint('first'), hint('throws', raises=error) -+ bindings['existing'] = 3 -+ with pytest.raises(type(error)): -+ is_bearable(([1], [2]), tuple[First, Raises] | str) -+ assert bindings == {'existing': 3} -+ -+ -+def test_nested_transaction_restores_selected_inner_branch(stateful_hints): -+ from beartype.door import is_bearable -+ -+ bindings, _, hint = stateful_hints -+ N, C = hint('N'), hint('C') -+ Nested = tuple[tuple[N, str] | tuple[C, int], str] | tuple[tuple[N, int], int] -+ assert is_bearable((([1, 2], 1), 1), Nested) -+ assert bindings == {'N': 2} -+ -+ -+def test_diagnostics_reconstruct_bindings_without_retaining_them(stateful_hints): -+ from beartype.door import die_if_unbearable -+ from beartype.roar import BeartypeDoorHintViolation -+ -+ bindings, _, hint = stateful_hints -+ N, C = hint('N'), hint('C') -+ with pytest.raises(BeartypeDoorHintViolation, match='expected 2 but got 3'): -+ die_if_unbearable(([1, 2], [1, 2, 3]), tuple[N, N] | tuple[C, str]) -+ assert bindings == {} -+ -+ -+def test_multiple_state_domains_restore_in_reverse_order(): -+ from types import SimpleNamespace -+ -+ events = [] -+ a = SimpleNamespace( -+ snapshot=lambda: events.append('save-a'), -+ restore=lambda token: events.append('restore-a')) -+ b = SimpleNamespace( -+ snapshot=lambda: events.append('save-b'), -+ restore=lambda token: events.append('restore-b')) -+ assert not _run_check(lambda state: False, (lambda: a, lambda: b)) -+ assert events == ['save-a', 'save-b', 'restore-b', 'restore-a'] -+ -+ -+def test_snapshot_failure_restores_previously_saved_domains(): -+ from types import SimpleNamespace -+ -+ restored = [] -+ -+ def fail(): -+ raise RuntimeError('snapshot failed') -+ -+ a = SimpleNamespace(snapshot=lambda: None, restore=lambda token: restored.append(True)) -+ b = SimpleNamespace(snapshot=fail, restore=lambda token: None) -+ with pytest.raises(RuntimeError, match='snapshot failed'): -+ _run_check(lambda state: True, (lambda: a, lambda: b)) -+ assert restored == [True] -+ -+ -+def test_ordinary_union_keeps_native_expression(): -+ from beartype import BeartypeConf -+ from beartype._check.cls.call.calldataexternal import BEARTYPE_CALL_EXTERNAL_META -+ from beartype._check.cls.hint.hintsane import HintSane -+ from beartype._check.code.codemain import make_check_expr -+ -+ expression, scope = make_check_expr( -+ BEARTYPE_CALL_EXTERNAL_META, BeartypeConf(), HintSane(tuple[str, int] | float)) -+ assert scope.check_state_getters == () -+ assert 'lambda' not in expression -+ assert 'SNAPSHOT' not in expression -+ assert '__beartype_state' not in expression -+ -+ -+def test_unselected_forward_reference_stays_unresolved(): -+ from beartype import beartype -+ -+ @beartype -+ def choose(value: 'int | UndefinedSnapshotAlternative'): -+ return value -+ -+ assert choose(3) == 3 -+ -+ -+def test_lazy_stateful_forward_reference(stateful_hints, monkeypatch): -+ from beartype import beartype -+ import sys -+ -+ bindings, _, hint = stateful_hints -+ -+ @beartype -+ def choose(pair: 'tuple[LateSnapshotN, str] | tuple[LateSnapshotC, int]', last: 'LateSnapshotN'): -+ pass -+ -+ monkeypatch.setattr(sys.modules[__name__], 'LateSnapshotN', hint('N'), raising=False) -+ monkeypatch.setattr(sys.modules[__name__], 'LateSnapshotC', hint('C'), raising=False) -+ choose(([1, 2], 1), [1, 2, 3]) -+ assert bindings == {'C': 2, 'N': 3} -+ -+ -+def test_invalid_state_result_cleans_up_context(): -+ from beartype.plug._plugstate import _ACTIVE_CHECK_STATES -+ -+ with pytest.raises(TypeError, match='callable snapshot and restore'): -+ _run_check(lambda state: True, (lambda: None,)) -+ assert _ACTIVE_CHECK_STATES.get() == () -+ -+ -+def test_rollback_failure_still_restores_other_domains(): -+ from beartype.plug._plugstate import _ACTIVE_CHECK_STATES -+ from types import SimpleNamespace -+ -+ restored = [] -+ -+ def broken_restore(token): -+ raise RuntimeError('broken rollback') -+ -+ a = SimpleNamespace(snapshot=lambda: None, restore=lambda token: restored.append(True)) -+ b = SimpleNamespace(snapshot=lambda: None, restore=broken_restore) -+ with pytest.raises(RuntimeError, match='broken rollback'): -+ _run_check(lambda state: False, (lambda: a, lambda: b)) -+ assert restored == [True] -+ assert _ACTIVE_CHECK_STATES.get() == () -+ -+ -+def test_state_is_located_once_for_nested_branches(): -+ from beartype import beartype -+ from types import SimpleNamespace -+ -+ calls = [] -+ state = SimpleNamespace(snapshot=lambda: None, restore=lambda token: None) -+ -+ def get_state(): -+ calls.append(True) -+ return state -+ -+ class Meta(type): -+ __beartype_state__ = staticmethod(get_state) -+ -+ def __instancecheck__(cls, obj): -+ return isinstance(obj, list) -+ -+ class A(metaclass=Meta): -+ pass -+ -+ @beartype -+ def choose(value: tuple[tuple[A, str] | tuple[A, int], str] | tuple[A, int]): -+ pass -+ -+ choose(([1], 1)) -+ assert calls == [True] -+ -+ -+def test_stateless_root_alternative_does_not_locate_state(): -+ from beartype import beartype -+ -+ def get_state(): -+ raise AssertionError('unselected state was located') -+ -+ class Meta(type): -+ __beartype_state__ = staticmethod(get_state) -+ -+ class A(metaclass=Meta): -+ pass -+ -+ @beartype -+ def choose(value: int | tuple[A, str]): -+ pass -+ -+ choose(3) -+ -+ -+def test_rejected_stateless_prefix_is_checked_once(stateful_hints): -+ from beartype import beartype -+ -+ bindings, _, hint = stateful_hints -+ N = hint('N') -+ calls = [] -+ -+ class Meta(type): -+ def __instancecheck__(cls, obj): -+ calls.append(obj) -+ return False -+ -+ class Reject(metaclass=Meta): -+ pass -+ -+ @beartype -+ def choose(value: Reject | tuple[N, int]): -+ pass -+ -+ calls.clear() -+ value = ([1, 2], 3) -+ choose(value) -+ assert calls == [value] -+ assert bindings == {'N': 2} -+ -+ -+def test_resolved_root_reference_failure_rolls_back(stateful_hints, monkeypatch): -+ from beartype import beartype -+ from beartype.roar import BeartypeCallHintParamViolation -+ import sys -+ -+ bindings, _, hint = stateful_hints -+ -+ @beartype -+ def choose(value: 'LaterRejectedState'): -+ pass -+ -+ monkeypatch.setattr(sys.modules[__name__], 'LaterRejectedState', hint('N', reject=True), raising=False) -+ with pytest.raises(BeartypeCallHintParamViolation): -+ choose([1, 2]) -+ assert bindings == {} -+ -+ -+def test_nested_union_bindings_match_independent_reference(stateful_hints): -+ from beartype.door import is_bearable -+ from random import Random -+ from types import UnionType -+ from typing import get_args, get_origin -+ -+ bindings, _, hint = stateful_hints -+ N, C = hint('N'), hint('C') -+ inner = tuple[N, str] | tuple[C, int] -+ hints = ( -+ inner, tuple[inner, N], tuple[N, inner], -+ tuple[inner, str] | tuple[tuple[N, int], int], -+ ) -+ random = Random(9231) -+ -+ def value(depth): -+ if depth and random.randrange(2): -+ return value(depth - 1), value(depth - 1) -+ return random.choice((0, 's', None, [], [1], [1, 2])) -+ -+ def reference(obj, annotation, state): -+ before = state.copy() -+ origin = get_origin(annotation) -+ if origin is UnionType: -+ valid = any(reference(obj, child, state) for child in get_args(annotation)) -+ elif origin is tuple: -+ children = get_args(annotation) -+ valid = isinstance(obj, tuple) and len(obj) == len(children) and all( -+ reference(item, child, state) for item, child in zip(obj, children)) -+ elif annotation in (N, C): -+ name = 'N' if annotation is N else 'C' -+ valid = isinstance(obj, list) and state.setdefault(name, len(obj)) == len(obj) -+ else: -+ valid = isinstance(obj, annotation) -+ if not valid: -+ state.clear() -+ state.update(before) -+ return valid -+ -+ for annotation in hints: -+ for _ in range(150): -+ obj = value(3) -+ initial = {'earlier': 9} -+ if random.randrange(2): -+ initial['N'] = random.randrange(3) -+ bindings.clear() -+ bindings.update(initial) -+ expected = initial.copy() -+ result = reference(obj, annotation, expected) -+ assert is_bearable(obj, annotation) is result -+ assert bindings == expected -+ -+ -+def test_unhashable_state_getters_are_distinct_by_identity(): -+ from beartype.door import is_bearable -+ from types import SimpleNamespace -+ -+ restored = [] -+ -+ class Getter: -+ __hash__ = None -+ -+ def __init__(self, name): -+ self.state = SimpleNamespace( -+ snapshot=lambda: name, -+ restore=lambda token: restored.append(token)) -+ -+ def __call__(self): -+ return self.state -+ -+ def __eq__(self, other): -+ return True -+ -+ class MetaA(type): -+ __beartype_state__ = Getter('a') -+ -+ def __instancecheck__(cls, obj): -+ return isinstance(obj, list) -+ -+ class MetaB(type): -+ __beartype_state__ = Getter('b') -+ -+ def __instancecheck__(cls, obj): -+ return isinstance(obj, list) -+ -+ class A(metaclass=MetaA): -+ pass -+ -+ class B(metaclass=MetaB): -+ pass -+ -+ assert not is_bearable(([], [], None), tuple[A, B, int]) -+ assert restored == ['b', 'a'] -+ -+ -+def test_copied_context_does_not_retain_finished_state(): -+ from beartype.door import is_bearable -+ from contextvars import copy_context -+ import gc -+ import weakref -+ -+ captured = [] -+ holder = [] -+ -+ class State: -+ def snapshot(self): -+ return None -+ -+ def restore(self, token): -+ pass -+ -+ def get_state(): -+ return holder[-1] -+ -+ class Meta(type): -+ __beartype_state__ = staticmethod(get_state) -+ -+ def __instancecheck__(cls, obj): -+ if not isinstance(obj, list): -+ return False -+ captured.append(copy_context()) -+ return True -+ -+ class A(metaclass=Meta): -+ pass -+ -+ state = State() -+ ref = weakref.ref(state) -+ holder.append(state) -+ assert is_bearable([], A) -+ holder.clear() -+ del state -+ gc.collect() -+ assert captured -+ assert ref() is None -+ -+ -+def test_copied_context_ignores_finished_transactions(stateful_hints, monkeypatch): -+ from beartype import beartype -+ from beartype.roar import BeartypeCallHintParamViolation -+ from contextvars import copy_context -+ import sys -+ -+ bindings, _, hint = stateful_hints -+ captured = [] -+ first = hint('first') -+ _run_check(lambda state: captured.append(copy_context()) or True, -+ (first.__beartype_state__,)) -+ -+ @beartype -+ def choose(value: 'CopiedContextFailure'): -+ pass -+ -+ monkeypatch.setattr(sys.modules[__name__], 'CopiedContextFailure', hint('leaked', reject=True), raising=False) -+ with pytest.raises(BeartypeCallHintParamViolation): -+ captured[0].run(choose, [1, 2]) -+ assert bindings == {} -diff --git a/doc/src/api.rst b/doc/src/api.rst -index dbfc0015..7f0a311c 100644 ---- a/doc/src/api.rst -+++ b/doc/src/api.rst -@@ -56,6 +56,7 @@ begins with :func:`beartype.beartype`, just like all rivers run to the sea. - Beartype Validators - Beartype Introspectors - Beartype Errors -+ Beartype Plugins - - .. #FIXME: Uncomment *AFTER* re-enabling "autoapi" support in "conf.py" and - .. #resolving outstanding issues with that support. *gulp* -diff --git a/doc/src/api_plug.rst b/doc/src/api_plug.rst -new file mode 100644 -index 00000000..7ca24330 ---- /dev/null -+++ b/doc/src/api_plug.rst -@@ -0,0 +1,101 @@ -+.. # Copyright (c) 2014-2026 Beartype authors. -+.. # See "LICENSE" for further details. -+ -+################ -+Beartype Plugins -+################ -+ -+Stateful runtime hints -+====================== -+ -+A runtime hint can opt into transactional checking by exposing a callable -+``__beartype_state__`` attribute. Calling it returns the library's active state -+object, which provides ``snapshot()`` and ``restore(token)`` methods. No beartype -+base class is required. The snapshot token can be any object, including None; -+beartype only passes it back to the corresponding restore method. -+ -+This is useful for hints that bind named dimensions or other shared constraints. -+For ``tuple[N, str] | tuple[C, int]``, checking the first tuple may bind ``N`` -+before discovering that the second item is not a string. That rejected -+alternative must discard its bindings before checking the second alternative. -+ -+For example, a library managing a context-local state object can expose:: -+ -+ class ShapeState: -+ def __init__(self): -+ self.bindings = {} -+ -+ def snapshot(self): -+ return self.bindings.copy() -+ -+ def restore(self, before): -+ self.bindings.clear() -+ self.bindings.update(before) -+ -+ def get_state(): -+ return current_state.get() -+ -+ class ShapeHintMeta(type): -+ __beartype_state__ = staticmethod(get_state) -+ -+ def __instancecheck__(cls, value): -+ # Validate and bind dimensions in current_state.get().bindings. -+ ... -+ -+Here, ``current_state`` is the library's context variable containing its active -+``ShapeState``. Hints sharing a state domain expose the **same getter object**. -+The getter locates state; it must not perform validation or mutate bindings. -+It returns a state object that remains valid throughout this checking expression. -+Beartype locates known domains once per expression and reuses their objects -+across union alternatives. Getters are deduplicated by identity. All methods -+are synchronous, and restore must restore the token without raising. -+ -+The library owns state lifetime, including thread and task isolation. Cached -+hints and generated code must not retain any invocation's snapshots or argument -+objects. The getter may create invocation-local state if none exists yet. -+ -+Transaction boundaries -+---------------------- -+ -+Successful alternatives retain state; rejected alternatives restore it before -+trying the next alternative. Failure of an outer alternative also undoes -+successful checks nested inside it. A failed parameter, return or DOOR check -+restores its entry state. Exceptions unwind all open checkpoints, including -+exceptions outside the stateful hint's own instance check. Successful earlier -+parameters remain bound if a later parameter fails. -+ -+The implementation avoids a duplicate outer checkpoint when a top-level union's -+alternatives already protect the whole check. Leading stateless native -+alternatives can succeed before locating any state. These optimizations preserve -+existing alternative ordering, short-circuiting and container sampling. No -+alternative is evaluated twice. There is no backtracking to a different earlier -+parameter alternative, and sampling remains sampling. -+ -+Diagnostics retain successful sibling bindings while explaining a failure, -+then restore all diagnostic changes. A later mismatch therefore reports the -+correct earlier dimension without leaving state in the caller's context. -+ -+Discovery and forward references -+-------------------------------- -+ -+Beartype discovers the hook on classes reached by its sanitized hint traversal, -+including classes inside containers, generic bases and ``Annotated``. It does -+not introspect arbitrary Python predicates for hidden state changes. -+ -+An evaluated lazy reference may introduce a domain after code generation. That -+domain joins open transactions before validation mutates it. Unselected -+references remain unresolved. A root reference delegates to its resolved hint; -+ordinary root references do not allocate a transaction. Nested expressions with -+unresolved references still require deferred transaction tracking. Context-local -+tracking keeps concurrent checks isolated. Copied contexts ignore finished -+checks, and finished checks release their state objects even when a copied -+context outlives them. -+ -+Ordinary hints without participating classes or references retain their direct -+checking path. Transactional expressions are compiled once at decoration rather -+than allocating a checking closure on each invocation. Each checkpoint stores -+restore methods and opaque tokens; general exception-unwinding machinery is only -+needed if a plugin's restore method itself raises. -+ -+Python's bare ``isinstance`` does not invoke this protocol. Libraries should -+preserve any individual-check guarantees they need outside beartype. diff --git a/tools/upstream/patches/0002-scope-correctness.patch b/tools/upstream/patches/0002-scope-correctness.patch deleted file mode 100644 index f810215..0000000 --- a/tools/upstream/patches/0002-scope-correctness.patch +++ /dev/null @@ -1,638 +0,0 @@ -diff --git a/beartype/_check/forward/reference/_cls/fwdrefmeta.py b/beartype/_check/forward/reference/_cls/fwdrefmeta.py -index 494827b1..160e6006 100644 ---- a/beartype/_check/forward/reference/_cls/fwdrefmeta.py -+++ b/beartype/_check/forward/reference/_cls/fwdrefmeta.py -@@ -469,7 +469,7 @@ class BeartypeForwardRefMetaclass(type): - # is_bearable() and die_if_unbearable() functions. - - # Avoid circular import dependencies. -- from beartype.door._func.doorfunc import is_bearable -+ from beartype.plug._plugstate import is_bearable_delegated as is_bearable - - # Return true only if the passed object satisfies this hint. - return is_bearable( -diff --git a/beartype/_check/make/checkmakecls.py b/beartype/_check/make/checkmakecls.py -index 0070ae67..1bb8a9b7 100644 ---- a/beartype/_check/make/checkmakecls.py -+++ b/beartype/_check/make/checkmakecls.py -@@ -406,6 +406,7 @@ class BeartypeFuncCheckerFactoryCache(CacheMegaStrongABC): - # single unified parameter (rather than individually as multiple - # distinct parameters). - func_scope[ARG_NAME_CALL_META] = call_curr -+ func_scope.setdefault('__beartype_scope_boundary__', True) - - # Type-checking expression lexical scope to be returned. - func_scope_refrozen = func_scope_frozen.refreeze(func_scope) -diff --git a/beartype/_decor/_nontype/_wrap/wrapmain.py b/beartype/_decor/_nontype/_wrap/wrapmain.py -index 36b42fe5..5f47c122 100644 ---- a/beartype/_decor/_nontype/_wrap/wrapmain.py -+++ b/beartype/_decor/_nontype/_wrap/wrapmain.py -@@ -165,6 +165,7 @@ def generate_code(decor_func: BeartypeCallDecorFuncData) -> str: - # optimization that could yield non-trivial benefits (e.g., if this wrapper - # function is frequently called). - func_scope[ARG_NAME_FUNC] = decor_func.func_wrappee -+ func_scope['__beartype_scope_boundary__'] = True - - # ....................{ SIGNATURE }.................... - # Python code snippet declaring the signature of this type-checking wrapper -diff --git a/beartype/plug/__init__.py b/beartype/plug/__init__.py -index e8cd0b5e..de479d35 100644 ---- a/beartype/plug/__init__.py -+++ b/beartype/plug/__init__.py -@@ -20,3 +20,7 @@ This submodule publishes a medley of attributes enabling users to extend - from beartype.plug._plughintable import ( - BeartypeHintable as BeartypeHintable, - ) -+from beartype.plug._plugscope import ( -+ HintCheckScope as HintCheckScope, -+ get_hint_check_scope as get_hint_check_scope, -+) -diff --git a/beartype/plug/_plugscope.py b/beartype/plug/_plugscope.py -new file mode 100644 -index 00000000..fb034019 ---- /dev/null -+++ b/beartype/plug/_plugscope.py -@@ -0,0 +1,100 @@ -+#!/usr/bin/env python3 -+# --------------------( LICENSE )-------------------- -+# Copyright (c) 2014-2026 Beartype authors. -+# See "LICENSE" for further details. -+ -+"""Lazy invocation scopes for cooperating stateful hint plugins.""" -+ -+from collections.abc import Callable -+from inspect import signature -+from sys import _getframe -+from types import CodeType, FrameType -+from typing import Any -+ -+ -+class HintCheckScope: -+ """State and arguments owned by one checking invocation. -+ -+ ``state`` is a mutable namespace for plugins; use a private object as a key. -+ ``owner_code`` identifies the generated entry point, not an invocation. -+ ``arguments`` lazily binds the original callable's named arguments, including -+ defaults. Standalone DOOR checks have no named function arguments. -+ -+ Instances retain neither a frame nor a ContextVar token. Do not retain this -+ object beyond a check: its state and arguments may contain user objects. -+ """ -+ -+ __slots__ = ('state', 'owner_code', '_func', '_args', '_kwargs', '_arguments') -+ -+ def __init__( -+ self, owner_code: CodeType, func: Callable[..., Any] | None, -+ args: tuple[Any, ...], kwargs: dict[str, Any], -+ ) -> None: -+ self.state: dict[object, object] = {} -+ self.owner_code = owner_code -+ self._func = func -+ self._args = args -+ self._kwargs = kwargs -+ self._arguments: dict[str, Any] | None = None -+ -+ @property -+ def arguments(self) -> dict[str, Any]: -+ """Named arguments for this invocation, materialized on first access.""" -+ if self._arguments is None: -+ if self._func is None: -+ self._arguments = {} -+ else: -+ bound = signature(self._func).bind_partial(*self._args, **self._kwargs) -+ bound.apply_defaults() -+ self._arguments = dict(bound.arguments) -+ return self._arguments -+ -+ -+def get_hint_check_scope() -> HintCheckScope | None: -+ """Return the nearest public check scope, or None outside a check. -+ -+ Parameters and return checks share their decorated invocation. Public DOOR -+ calls and nested decorated calls start independent scopes. Internal alias -+ delegation shares the caller's scope. Scopes are allocated only on demand; -+ ordinary beartype checks never allocate a public scope. -+ """ -+ frame = _get_hint_check_frame() -+ try: -+ if frame is None: -+ return None -+ values = frame.f_locals -+ scope = values.get('__beartype_scope_instance__') -+ if scope is None: -+ scope = HintCheckScope( -+ frame.f_code, values.get('__beartype_func'), -+ values.get('args', ()), values.get('kwargs', {})) -+ values['__beartype_scope_instance__'] = scope -+ return scope -+ finally: -+ del frame -+ -+ -+def _get_hint_check_owner_id() -> int | None: -+ """Identify a live invocation without retaining its frame or allocating state.""" -+ frame = _get_hint_check_frame() -+ try: -+ return id(frame) if frame is not None else None -+ finally: -+ del frame -+ -+ -+def _get_hint_check_frame() -> FrameType | None: -+ """Find the public boundary; callers must release the returned frame.""" -+ frame = _getframe(1) -+ try: -+ while frame is not None: -+ # The producer owns this marker. Plugins never inspect generated -+ # names, bytecode or undocumented locals to decide delegation. -+ if '__beartype_scope_boundary__' in frame.f_code.co_varnames: -+ values = frame.f_locals -+ if values.get('__beartype_scope_boundary__') is True: -+ return frame -+ frame = frame.f_back -+ return None -+ finally: -+ del frame -diff --git a/beartype/plug/_plugstate.py b/beartype/plug/_plugstate.py -index 662f4e95..209d6bf4 100644 ---- a/beartype/plug/_plugstate.py -+++ b/beartype/plug/_plugstate.py -@@ -6,10 +6,11 @@ - """Invocation-owned transactions for opt-in stateful runtime hints.""" - - from beartype._data.typing.datatyping import Pep3119Checkable -+from beartype.plug._plugscope import _get_hint_check_owner_id - from collections.abc import Callable - from contextlib import ExitStack - from contextvars import ContextVar, Token --from typing import Any, Protocol -+from typing import Any, Protocol, cast - - - class HintState(Protocol): -@@ -26,7 +27,7 @@ Rollback = tuple[Callable[[Any], None], Any] - class _HintCheckState: - """Nested checkpoints sharing state located once per checking expression.""" - -- __slots__ = ('getters', 'states', 'transactions', '_token') -+ __slots__ = ('getters', 'states', 'transactions', '_token', '_owner_id') - - def __init__(self, getters: tuple[StateGetter, ...]) -> None: - self.getters = getters -@@ -38,12 +39,17 @@ class _HintCheckState: - self.states = tuple(states) - self.transactions: list[list[Rollback]] = [] - self._token: Token[tuple['_HintCheckState', ...]] | None = None -+ self._owner_id: int | None = None - - def __enter__(self) -> '_HintCheckState': -+ self._owner_id = _get_hint_check_owner_id() - parents = _ACTIVE_CHECK_STATES.get() - if parents: -- parents = tuple(parent for parent in parents if parent._token is not None) -+ parents = tuple(parent for parent in parents -+ if parent._token is not None -+ and parent._owner_id == self._owner_id) - # Resolved aliases enrol their domains before mutating shared state. -+ # Independent public calls, including recursion, never join a parent. - for parent in parents: - parent.register(self.getters, self.states) - self._token = _ACTIVE_CHECK_STATES.set((*parents, self)) -@@ -57,6 +63,7 @@ class _HintCheckState: - assert self._token is not None - token = self._token - self._token = None -+ self._owner_id = None - # copy_context() can outlive this check. Do not let a copied - # context retain invocation state or enrol into a finished check. - self.getters = () -@@ -124,15 +131,32 @@ _ACTIVE_CHECK_STATES: ContextVar[tuple[_HintCheckState, ...]] = ContextVar( - - def isinstance_stateful(obj: object, hint: Pep3119Checkable, getter: StateGetter) -> bool: - """Check a resolved root reference without another generated wrapper.""" -- parents = _ACTIVE_CHECK_STATES.get() -- if parents: -- parents = tuple(parent for parent in parents if parent._token is not None) -- if parents: -- for parent in parents: -- parent.register((getter,)) -- return isinstance(obj, hint) - with _HintCheckState((getter,)) as state: - state.begin() - if isinstance(obj, hint): - return state.commit() - return False -+ -+ -+def _make_code_delegated_check(*args, **kwargs): -+ """Generate an internal alias check sharing the caller's public scope.""" -+ from beartype._check.make.checkmakefunc import make_code_tester_check -+ code, scope = make_code_tester_check(*args, **kwargs) -+ values = dict(scope) -+ values['__beartype_scope_boundary__'] = False -+ return code, scope.refreeze(values) -+ -+ -+_delegate_tester_factory = None -+ -+ -+def is_bearable_delegated(obj, hint, *, conf) -> bool: -+ """Check an internal subhint without creating a public checking scope.""" -+ global _delegate_tester_factory -+ if _delegate_tester_factory is None: -+ from beartype._check.make.checkmakecls import BeartypeFuncCheckerFactoryCache -+ _delegate_tester_factory = BeartypeFuncCheckerFactoryCache() -+ checker = cast(Callable[[object], bool], -+ _delegate_tester_factory.cache_func_checker( -+ hint, conf, 'is_bearable() ', _make_code_delegated_check)) -+ return checker(obj) -diff --git a/beartype_test/a00_unit/a40_api/plug/test_plugscope.py b/beartype_test/a00_unit/a40_api/plug/test_plugscope.py -new file mode 100644 -index 00000000..f74d9aee ---- /dev/null -+++ b/beartype_test/a00_unit/a40_api/plug/test_plugscope.py -@@ -0,0 +1,117 @@ -+"""Public scope identity, named arguments and release of user values.""" -+import gc -+import weakref -+from contextvars import copy_context -+from typing import Annotated -+ -+import pytest -+from beartype import beartype, BeartypeConf -+from beartype.door import is_bearable, die_if_unbearable -+from beartype.plug import get_hint_check_scope -+from beartype.vale import Is -+ -+ -+def test_no_scope_outside_check(): -+ assert get_hint_check_scope() is None -+ -+ -+def test_arguments_defaults_return_and_invocation_identity(): -+ scopes = [] -+ -+ def capture(value): -+ scope = get_hint_check_scope() -+ assert scope is get_hint_check_scope() -+ scopes.append(scope) -+ return True -+ -+ hint = Annotated[int, Is[capture]] -+ -+ @beartype -+ def checked(x: hint, /, width=3, *, height=4) -> hint: -+ return x -+ -+ assert checked(2, height=5) == 2 -+ assert scopes[0] is scopes[1] -+ assert scopes[0].arguments == {'x': 2, 'width': 3, 'height': 5} -+ checked(7) -+ assert scopes[2] is not scopes[0] -+ assert scopes[2].owner_code is checked.__code__ -+ assert scopes[2].state == {} -+ assert get_hint_check_scope() is None -+ -+ -+@pytest.mark.parametrize('public_first', [True, False]) -+def test_delegation_and_public_checker_cache_are_distinct(public_first): -+ from beartype.plug._plugstate import is_bearable_delegated -+ captures = [] -+ -+ def capture(value): -+ captures.append(get_hint_check_scope()) -+ return True -+ -+ hint = Annotated[int, Is[capture]] -+ conf = BeartypeConf() -+ -+ def parent(value): -+ scope = get_hint_check_scope() -+ operations = ( -+ lambda: is_bearable(1, hint, conf=conf), -+ lambda: is_bearable_delegated(1, hint, conf=conf)) -+ if not public_first: -+ operations = operations[::-1] -+ for operation in operations: -+ assert operation() -+ public_scope, delegated_scope = captures if public_first else captures[::-1] -+ assert delegated_scope is scope -+ assert public_scope is not scope -+ assert public_scope.arguments == {} -+ return True -+ -+ assert is_bearable(1, Annotated[int, Is[parent]]) -+ -+ -+def test_nested_decorated_and_door_raiser_scopes_are_independent(): -+ captures = [] -+ -+ def capture(value): -+ captures.append(get_hint_check_scope()) -+ return True -+ -+ hint = Annotated[int, Is[capture]] -+ -+ @beartype -+ def inner(x: hint): -+ pass -+ -+ def parent(value): -+ outer = get_hint_check_scope() -+ inner(value) -+ die_if_unbearable(value, hint) -+ assert len(captures) == 2 -+ assert all(scope is not outer for scope in captures) -+ assert captures[0] is not captures[1] -+ return True -+ -+ assert is_bearable(1, Annotated[int, Is[parent]]) -+ -+ -+@pytest.mark.parametrize('reject', [False, True]) -+def test_completed_scope_does_not_retain_argument_or_leak_through_context(reject): -+ contexts = [] -+ -+ def capture(value): -+ scope = get_hint_check_scope() -+ scope.state[object()] = value -+ contexts.append(copy_context()) -+ return not reject -+ -+ class Value: -+ pass -+ -+ value = Value() -+ ref = weakref.ref(value) -+ assert is_bearable(value, Annotated[Value, Is[capture]]) is not reject -+ del value -+ gc.collect() -+ assert ref() is None -+ assert contexts[0].run(get_hint_check_scope) is None -diff --git a/beartype_test/a00_unit/a40_api/plug/test_plugstate_isolation.py b/beartype_test/a00_unit/a40_api/plug/test_plugstate_isolation.py -new file mode 100644 -index 00000000..caf09c29 ---- /dev/null -+++ b/beartype_test/a00_unit/a40_api/plug/test_plugstate_isolation.py -@@ -0,0 +1,228 @@ -+"""Transaction domains belong to one live public checking invocation.""" -+ -+import gc -+import sys -+import weakref -+from contextvars import copy_context -+from typing import Annotated -+ -+import pytest -+from beartype import beartype -+from beartype.door import die_if_unbearable, is_bearable -+from beartype.plug import get_hint_check_scope -+from beartype.roar import BeartypeCallHintParamViolation, BeartypeDoorHintViolation -+from beartype.vale import Is -+from beartype._check.forward.reference._cls.fwdrefcache import ref_proxy_cache -+ -+ -+@pytest.fixture -+def isolated_domains(monkeypatch, request): -+ ref_proxy_cache.clear_cache() -+ key = object() -+ states = [] -+ -+ class State: -+ def __init__(self): -+ self.bindings = {} -+ -+ def snapshot(self): -+ return self.bindings.copy() -+ -+ def restore(self, before): -+ self.bindings.clear() -+ self.bindings.update(before) -+ -+ def get_state(): -+ scope = get_hint_check_scope() -+ assert scope is not None -+ if key not in scope.state: -+ state = State() -+ states.append(state) -+ scope.state[key] = state -+ return scope.state[key] -+ -+ class Meta(type): -+ __beartype_state__ = staticmethod(get_state) -+ -+ def __instancecheck__(cls, value): -+ if not isinstance(value, list): -+ return False -+ state = get_state() -+ return state.bindings.setdefault(cls.__name__, len(value)) == len(value) -+ -+ N, C = Meta('N', (), {}), Meta('C', (), {}) -+ for hint in (N, C): -+ hint.__qualname__ = f'{request.node.name}.{hint.__name__}' -+ -+ def resolve(): -+ monkeypatch.setattr(sys.modules[__name__], 'IsolationLaterN', N, raising=False) -+ monkeypatch.setattr(sys.modules[__name__], 'IsolationLaterC', C, raising=False) -+ -+ yield N, C, get_state, states, resolve -+ ref_proxy_cache.clear_cache() -+ -+ -+@pytest.mark.parametrize('kind', ['door', 'raiser', 'decorated']) -+@pytest.mark.parametrize('nested_first', [True, False]) -+@pytest.mark.parametrize('nested_rejects', [True, False]) -+def test_independent_nested_domain_never_enrolls_in_outer( -+ isolated_domains, kind, nested_first, nested_rejects): -+ N, _, _, states, resolve = isolated_domains -+ inner_states = [] -+ inner_hint = tuple[N, str if nested_rejects else int] -+ -+ @beartype -+ def inner(value: inner_hint): -+ pass -+ -+ def independent(value): -+ start = len(states) -+ item = ([0] * 7, 1) -+ if kind == 'door': -+ assert is_bearable(item, inner_hint) is not nested_rejects -+ elif nested_rejects: -+ exception = (BeartypeDoorHintViolation if kind == 'raiser' -+ else BeartypeCallHintParamViolation) -+ with pytest.raises(exception): -+ die_if_unbearable(item, inner_hint) if kind == 'raiser' else inner(item) -+ elif kind == 'raiser': -+ die_if_unbearable(item, inner_hint) -+ else: -+ inner(item) -+ inner_states.extend(states[start:]) -+ return True -+ -+ # Beartype caches composite hints by repr; give each closure its own name. -+ independent.__qualname__ += f'_{kind}_{nested_first}_{nested_rejects}' -+ probe = Annotated[int, Is[independent]] -+ hint = ( -+ tuple[probe, 'IsolationLaterN', str] | tuple[int, 'IsolationLaterC', int] -+ if nested_first else -+ tuple['IsolationLaterN', probe, str] | tuple['IsolationLaterC', int, int]) -+ -+ @beartype -+ def outer(value: hint, last: N): -+ pass -+ -+ resolve() -+ value = (1, [0, 0], 1) if nested_first else ([0, 0], 1, 1) -+ outer(value, [0, 0, 0]) -+ assert inner_states -+ assert all(state.bindings == ({} if nested_rejects else {'N': 7}) -+ for state in inner_states) -+ # A successful first alternative must still constrain later arguments. -+ first = (*value[:2], 'accepted') -+ with pytest.raises(BeartypeCallHintParamViolation): -+ outer(first, [0, 0, 0]) -+ outer(first, [0, 0]) -+ -+ -+def test_recursive_invocations_of_same_wrapper_have_different_owners(isolated_domains): -+ N, _, get_state, _, resolve = isolated_domains -+ depth = 0 -+ completed = [] -+ -+ def recurse(value): -+ nonlocal depth -+ if not depth: -+ depth += 1 -+ try: -+ outer((0, [0] * 7, 'accepted'), [0] * 7) -+ finally: -+ depth -= 1 -+ return True -+ -+ probe = Annotated[int, Is[recurse]] -+ -+ @beartype -+ def outer(value: tuple[probe, 'IsolationLaterN', str] -+ | tuple[int, 'IsolationLaterC', int], last: N): -+ completed.append(get_state()) -+ -+ resolve() -+ outer((1, [0, 0], 1), [0, 0, 0]) -+ assert completed[0].bindings == {'N': 7} -+ assert completed[1].bindings == {'C': 2, 'N': 3} -+ -+ -+def test_copied_active_context_does_not_join_another_thread(isolated_domains): -+ from concurrent.futures import ThreadPoolExecutor -+ -+ N, _, _, states, resolve = isolated_domains -+ inner_states = [] -+ -+ def independent(value): -+ start = len(states) -+ with ThreadPoolExecutor(max_workers=1) as executor: -+ assert executor.submit(copy_context().run, is_bearable, -+ ([0] * 7, 1), tuple[N, int]).result() -+ inner_states.extend(states[start:]) -+ return True -+ -+ probe = Annotated[int, Is[independent]] -+ -+ @beartype -+ def outer(value: tuple[probe, 'IsolationLaterN', str] -+ | tuple[int, 'IsolationLaterC', int], last: N): -+ pass -+ -+ resolve() -+ outer((1, [0, 0], 1), [0, 0, 0]) -+ assert all(state.bindings == {'N': 7} for state in inner_states) -+ -+ -+def test_transaction_ownership_does_not_allocate_public_scopes(monkeypatch): -+ from beartype.plug import _plugscope -+ -+ ref_proxy_cache.clear_cache() -+ -+ def unexpected(*args, **kwargs): -+ raise AssertionError('Ordinary checking allocated a public scope') -+ -+ monkeypatch.setattr(_plugscope, 'HintCheckScope', unexpected) -+ -+ @beartype -+ def checked(value: tuple['IsolationPlainClass', int]): -+ pass -+ -+ class Plain: -+ pass -+ -+ monkeypatch.setattr(sys.modules[__name__], 'IsolationPlainClass', Plain, raising=False) -+ checked((Plain(), 1)) -+ checked((Plain(), 2)) -+ ref_proxy_cache.clear_cache() -+ -+ -+@pytest.mark.parametrize('reject', [False, True]) -+def test_finished_transaction_releases_owner_arguments(isolated_domains, reject): -+ _, _, _, states, resolve = isolated_domains -+ contexts = [] -+ -+ def capture(value): -+ contexts.append(copy_context()) -+ return not reject -+ -+ capture.__qualname__ += f'_{reject}' -+ probe = Annotated[object, Is[capture]] -+ -+ @beartype -+ def checked(value: tuple[probe, 'IsolationLaterN', str]): -+ pass -+ -+ class Value: -+ pass -+ -+ resolve() -+ value = Value() -+ reference = weakref.ref(value) -+ if reject: -+ with pytest.raises(BeartypeCallHintParamViolation): -+ checked((value, [0], 'accepted')) -+ else: -+ checked((value, [0], 'accepted')) -+ del value -+ states.clear() -+ gc.collect() -+ assert reference() is None -+ assert contexts[0].run(get_hint_check_scope) is None -diff --git a/doc/src/api_plug.rst b/doc/src/api_plug.rst -index 7ca24330..c27343af 100644 ---- a/doc/src/api_plug.rst -+++ b/doc/src/api_plug.rst -@@ -99,3 +99,28 @@ needed if a plugin's restore method itself raises. - - Python's bare ``isinstance`` does not invoke this protocol. Libraries should - preserve any individual-check guarantees they need outside beartype. -+ -+Invocation scopes -+----------------- -+ -+``beartype.plug.get_hint_check_scope()`` returns a ``HintCheckScope`` for the -+nearest generated public check, or ``None`` outside checking. Scope creation -+is lazy: checks that never request state allocate no scope object. Parameters -+and returns share the decorated invocation. Nested decorated calls and public -+DOOR calls start separate scopes, while an internally delegated forward alias -+shares the enclosing scope. Checker caches preserve that distinction regardless -+of which path is used first. -+ -+Use ``scope.state`` as a library namespace keyed by a private object, rather -+than a string another plugin might use. ``scope.arguments`` lazily provides -+bound function arguments, including defaults; standalone DOOR scopes provide -+an empty mapping. ``scope.owner_code`` identifies the generated entry point -+for explicit decorator integration; it is not an invocation identifier. -+Scope object identity distinguishes invocations. Scope lookup follows the -+live call stack, so copied execution contexts cannot resurrect completed scopes. -+ -+Do not retain a scope past the check: its state and arguments may retain user -+objects. Scope objects themselves hold no frames or context tokens. Scope -+ownership does not replace state rollback: a rejected composite alternative -+must restore registered domains, and a rejected nested leaf must roll back even -+when a predicate catches the rejection and then succeeds. diff --git a/tools/upstream/patches/0003-ordinary-performance.patch b/tools/upstream/patches/0003-ordinary-performance.patch deleted file mode 100644 index abc47ea..0000000 --- a/tools/upstream/patches/0003-ordinary-performance.patch +++ /dev/null @@ -1,497 +0,0 @@ -diff --git a/beartype/_check/code/codemain.py b/beartype/_check/code/codemain.py -index 9719dcef..5644ffd4 100644 ---- a/beartype/_check/code/codemain.py -+++ b/beartype/_check/code/codemain.py -@@ -1517,9 +1517,29 @@ def make_check_expr( - has_forward_refs = any( - is_beartype_ref_proxy(value) - for value in hint_tree.func_wrapper_locals.values()) -- if state_getters or (has_forward_refs and not is_beartype_ref_proxy(hint_sane.hint)): -- from beartype.plug._plugstate import _HintCheckState -+ is_atomic_leaf = ( -+ bool(state_getters) and isinstance(hint_sane.hint, type) and -+ not is_beartype_ref_proxy(hint_sane.hint) and -+ getattr(hint_sane.hint, '__beartype_state_atomic__', False) is True) -+ from typing import get_args, get_origin -+ from beartype import BeartypeStrategy -+ from beartype._util.hint.pep.utilpepsign import get_hint_pep_sign_or_none -+ from beartype._data.hint.sign.datahintsigns import HintSignForwardRef -+ root_args = get_args(hint_sane.hint) -+ is_single_ref_sample = ( -+ conf.strategy is BeartypeStrategy.O1 and -+ get_origin(hint_sane.hint) is list and len(root_args) == 1 and -+ (is_beartype_ref_proxy(root_args[0]) or -+ get_hint_pep_sign_or_none(root_args[0]) is HintSignForwardRef)) -+ if (state_getters and not is_atomic_leaf) or ( -+ has_forward_refs and not is_beartype_ref_proxy(hint_sane.hint) -+ and not is_single_ref_sample -+ ): -+ from beartype.plug._plugstate import _HintCheckState, _KnownHintCheckState - from beartype._util.func.utilfuncmake import make_func -+ plain_expr = func_wrapper_code.replace( -+ '__BEARTYPE_SNAPSHOT_START__', '').replace( -+ '__BEARTYPE_SNAPSHOT_END__', '') - func_wrapper_code = func_wrapper_code.replace( - '__BEARTYPE_SNAPSHOT_START__', - '(__beartype_state.begin() and (', -@@ -1533,7 +1553,8 @@ def make_check_expr( - if hint_tree.is_var_random_int_needed: - parameters += f', {VAR_NAME_RANDOM_INT}' - check_globals = dict(hint_tree.func_wrapper_locals) -- check_globals['__beartype_state_factory'] = _HintCheckState -+ check_globals['__beartype_state_factory'] = ( -+ _HintCheckState if has_forward_refs else _KnownHintCheckState) - check_globals['__beartype_state_getters'] = state_getters - from beartype._util.hint.pep.utilpepsign import get_hint_pep_sign_or_none - is_root_union = get_hint_pep_sign_or_none(hint_sane.hint) in HINT_SIGNS_UNION -@@ -1555,6 +1576,11 @@ def make_check_expr( - func_globals=check_globals, - is_debug=conf.is_debug, - ) -+ if has_forward_refs and not state_getters: -+ from beartype.plug._plugstate import _PlainForwardCheck -+ checker = _PlainForwardCheck( -+ checker, parameters, plain_expr, -+ dict(hint_tree.func_wrapper_locals)) - check_name = add_func_scope_attr( - attr=checker, func_scope=hint_tree.func_wrapper_locals) - func_wrapper_code = f'{check_name}({parameters})' -diff --git a/beartype/_check/forward/reference/_cls/fwdrefcache.py b/beartype/_check/forward/reference/_cls/fwdrefcache.py -index dd4fef94..e236b898 100644 ---- a/beartype/_check/forward/reference/_cls/fwdrefcache.py -+++ b/beartype/_check/forward/reference/_cls/fwdrefcache.py -@@ -55,7 +55,7 @@ from typing import ( - TYPE_CHECKING, - Optional, - ) --from weakref import WeakKeyDictionary -+from weakref import WeakKeyDictionary, WeakSet - - # ....................{ HINTS }.................... - BeartypeForwardRefABC = type[ -@@ -121,6 +121,8 @@ class BeartypeForwardRefProxyCache(CacheABC): - # @beartype decorations. Slotting has been shown to reduce read and write - # costs by approximately ~10%, which is non-trivial. - __slots__ = ( -+ '_state_checkers', -+ '_state_revision', - '_ref_proxy_to_resolved_hint', - '_ref_proxy_to_resolved_hint_get', - '_ref_proxy_to_resolved_hint_set', -@@ -171,6 +173,8 @@ class BeartypeForwardRefProxyCache(CacheABC): - super().__init__(*args, **kwargs) - - # Initialize all instance variables. -+ self._state_checkers = WeakSet() -+ self._state_revision = 0 - self._ref_proxy_to_resolved_hint = WeakKeyDictionary() - self._ref_proxy_to_resolved_type = WeakKeyDictionary() - self._ref_proxy_to_resolved_hint_get = ( -@@ -188,6 +192,9 @@ class BeartypeForwardRefProxyCache(CacheABC): - - # Thread-safely clear *BOTH* of the weak dictionaries defined above. - with self._lock: -+ self._state_revision += 1 -+ for checker in tuple(self._state_checkers): -+ checker.invalidate() - self._ref_proxy_to_resolved_hint.clear() - self._ref_proxy_to_resolved_type.clear() - -@@ -362,6 +369,7 @@ class BeartypeForwardRefProxyCache(CacheABC): - # of this property casually returns this referent rather than - # repeatedly (i.e., uselessly) calling the die_unless_hint() raiser. - self._ref_proxy_to_resolved_hint_set(ref_proxy, referent_hint) -+ self._state_revision += 1 - - # If this referent is *NOT* a supported type hint... - # -diff --git a/beartype/plug/_plugstate.py b/beartype/plug/_plugstate.py -index 209d6bf4..07a68da7 100644 ---- a/beartype/plug/_plugstate.py -+++ b/beartype/plug/_plugstate.py -@@ -129,9 +129,32 @@ _ACTIVE_CHECK_STATES: ContextVar[tuple[_HintCheckState, ...]] = ContextVar( - 'beartype_check_states', default=()) - - -+class _KnownHintCheckState(_HintCheckState): -+ """Known domains need not advertise themselves to unresolved references.""" -+ -+ __slots__ = () -+ -+ def __enter__(self) -> '_KnownHintCheckState': -+ parents = _ACTIVE_CHECK_STATES.get() -+ if parents: -+ owner_id = _get_hint_check_owner_id() -+ for parent in parents: -+ if parent._token is not None and parent._owner_id == owner_id: -+ parent.register(self.getters, self.states) -+ return self -+ -+ def __exit__(self, *exception: object) -> None: -+ try: -+ if self.transactions: -+ self.close() -+ finally: -+ self.getters = () -+ self.states = () -+ -+ - def isinstance_stateful(obj: object, hint: Pep3119Checkable, getter: StateGetter) -> bool: - """Check a resolved root reference without another generated wrapper.""" -- with _HintCheckState((getter,)) as state: -+ with _KnownHintCheckState((getter,)) as state: - state.begin() - if isinstance(obj, hint): - return state.commit() -@@ -160,3 +183,66 @@ def is_bearable_delegated(obj, hint, *, conf) -> bool: - _delegate_tester_factory.cache_func_checker( - hint, conf, 'is_bearable() ', _make_code_delegated_check)) - return checker(obj) -+ -+ -+class _PlainForwardCheck: -+ """Specialize resolved ordinary references without resolving unused hints. -+ -+ Fast functions capture plain classes, not proxies: a cache clear racing an -+ in-flight check cannot switch that check to a new stateful referent. Clearing -+ the reference cache drops fast functions and captured classes immediately. -+ """ -+ -+ __slots__ = ( -+ '_slow', '_parameters', '_expression', '_globals', '_refs', '_cache', -+ '_fast', '_revision', '__weakref__') -+ -+ def __init__(self, slow, parameters, expression, scope): -+ from beartype._check.forward.reference._cls.fwdrefcache import ref_proxy_cache -+ from beartype._check.forward.reference.fwdreftest import is_beartype_ref_proxy -+ self._slow = slow -+ self._parameters = parameters -+ self._expression = expression -+ self._globals = scope -+ self._refs = {name: value for name, value in scope.items() -+ if is_beartype_ref_proxy(value)} -+ self._cache = ref_proxy_cache -+ self._fast = None -+ self._revision = -1 -+ with self._cache._lock: -+ self._cache._state_checkers.add(self) -+ -+ def invalidate(self): -+ self._fast = None -+ self._revision = -1 -+ -+ def __call__(self, *args): -+ fast = self._fast -+ if fast is not None: -+ return fast(*args) -+ result = self._slow(*args) -+ if self._revision != self._cache._state_revision: -+ self._specialize() -+ return result -+ -+ def _specialize(self): -+ from inspect import getattr_static -+ from beartype._data.kind.datakindiota import SENTINEL -+ from beartype._util.func.utilfuncmake import make_func -+ from beartype._util.hint.pep.utilpeptest import is_hint_pep -+ with self._cache._lock: -+ self._revision = self._cache._state_revision -+ scope = dict(self._globals) -+ for name, proxy in self._refs.items(): -+ hint = self._cache._ref_proxy_to_resolved_hint_get(proxy, SENTINEL) -+ # Exclude custom metaclasses, unknown/composite hints and state -+ # hooks. No resolution and no user predicate runs here. -+ if (type(hint) is not type or is_hint_pep(hint) or -+ getattr_static(hint, '__beartype_state__', None) is not None): -+ return -+ scope[name] = hint -+ self._fast = make_func( -+ func_name='__beartype_plain_forward', -+ func_code=(f'def __beartype_plain_forward({self._parameters}):\n' -+ f' return {self._expression}\n'), -+ func_globals=scope) -diff --git a/beartype_test/a00_unit/a40_api/plug/test_plugstate_fast.py b/beartype_test/a00_unit/a40_api/plug/test_plugstate_fast.py -new file mode 100644 -index 00000000..0cf4aed6 ---- /dev/null -+++ b/beartype_test/a00_unit/a40_api/plug/test_plugstate_fast.py -@@ -0,0 +1,243 @@ -+"""Optimization preserves lazy resolution, sampling and cache invalidation.""" -+import gc -+import weakref -+from concurrent.futures import ThreadPoolExecutor -+from typing import Annotated -+ -+import pytest -+from beartype import beartype -+from beartype.door import is_bearable -+from beartype.roar import BeartypeCallHintParamViolation -+from beartype.vale import Is -+from beartype._check.forward.reference._cls.fwdrefcache import ref_proxy_cache -+from beartype.plug._plugstate import _PlainForwardCheck -+ -+ -+@beartype -+def plain_tuple(value: tuple['LatePlain', int]): -+ pass -+ -+ -+@beartype -+def plain_mapping(value: dict[str, 'LatePlain']): -+ pass -+ -+ -+@beartype -+def plain_nested_list(value: list[list['LatePlain']]): -+ pass -+ -+ -+class LatePlain: -+ pass -+ -+ -+def dispatcher(func): -+ return next(value for value in func.__kwdefaults__.values() -+ if isinstance(value, _PlainForwardCheck)) -+ -+ -+@pytest.mark.parametrize('func,wrap', [ -+ (plain_tuple, lambda value: (value, 1)), -+ (plain_mapping, lambda value: {'key': value}), -+ (plain_nested_list, lambda value: [[value]]), -+]) -+def test_plain_references_specialize_only_after_check(func, wrap): -+ ref_proxy_cache.clear_cache() -+ state = dispatcher(func) -+ assert state._fast is None -+ func(wrap(LatePlain())) -+ assert state._fast is not None -+ func(wrap(LatePlain())) -+ with pytest.raises(BeartypeCallHintParamViolation): -+ func(wrap(object())) -+ -+ -+def test_unselected_reference_remains_unresolved(): -+ @beartype -+ def optional(value: tuple['NeverDefinedForFastPath', int] | str): -+ pass -+ -+ for _ in range(3): -+ optional('selected stateless alternative') -+ state = dispatcher(optional) -+ assert state._fast is None -+ from beartype._data.kind.datakindiota import SENTINEL -+ assert all(ref_proxy_cache.get_ref_proxy_referent_hint_if_resolved_or_sentinel(proxy) -+ is SENTINEL for proxy in state._refs.values()) -+ -+ -+def test_clear_invalidates_plain_to_stateful_and_back(monkeypatch): -+ bindings = {} -+ -+ class State: -+ def snapshot(self): -+ return bindings.copy() -+ -+ def restore(self, saved): -+ bindings.clear() -+ bindings.update(saved) -+ -+ state = State() -+ -+ class Meta(type): -+ __beartype_state__ = staticmethod(lambda: state) -+ -+ def __instancecheck__(cls, value): -+ if value is None: -+ return False -+ bindings['seen'] = True -+ return True -+ -+ class Stateful(metaclass=Meta): -+ pass -+ -+ ref_proxy_cache.clear_cache() -+ plain_tuple((LatePlain(), 1)) -+ fast_ref = weakref.ref(dispatcher(plain_tuple)._fast) -+ old = LatePlain -+ monkeypatch.setitem(globals(), 'LatePlain', Stateful) -+ ref_proxy_cache.clear_cache() -+ gc.collect() -+ assert fast_ref() is None -+ with pytest.raises(BeartypeCallHintParamViolation): -+ plain_tuple((object(), None)) -+ assert bindings == {} -+ assert dispatcher(plain_tuple)._fast is None -+ monkeypatch.setitem(globals(), 'LatePlain', old) -+ ref_proxy_cache.clear_cache() -+ plain_tuple((old(), 1)) -+ assert dispatcher(plain_tuple)._fast is not None -+ ref_proxy_cache.clear_cache() -+ -+ -+def test_fast_expression_keeps_captured_plain_types_during_clear(monkeypatch): -+ ref_proxy_cache.clear_cache() -+ value = LatePlain() -+ plain_tuple((value, 1)) -+ in_flight = dispatcher(plain_tuple)._fast -+ monkeypatch.setitem(globals(), 'LatePlain', type('Replacement', (), {})) -+ ref_proxy_cache.clear_cache() -+ # A caller that already loaded the fast function finishes on its old -+ # snapshot. New calls must use the replacement, not the old specialization. -+ assert in_flight((value, 1)) -+ with pytest.raises(BeartypeCallHintParamViolation): -+ plain_tuple((value, 1)) -+ plain_tuple((LatePlain(), 1)) -+ monkeypatch.undo() -+ ref_proxy_cache.clear_cache() -+ -+ -+def test_concurrent_cache_clearing(): -+ def check(_): -+ for _ in range(40): -+ plain_tuple((LatePlain(), 1)) -+ plain_mapping({'a': LatePlain()}) -+ -+ def clear(_): -+ for _ in range(40): -+ ref_proxy_cache.clear_cache() -+ -+ with ThreadPoolExecutor(max_workers=4) as pool: -+ list(pool.map(check, range(3))) -+ futures = [pool.submit(check, 0), pool.submit(clear, 0), pool.submit(check, 0)] -+ for future in futures: -+ future.result() -+ -+ -+def test_known_domains_do_not_publish_extra_context(): -+ from beartype.plug._plugstate import _KnownHintCheckState, _ACTIVE_CHECK_STATES -+ before = _ACTIVE_CHECK_STATES.get() -+ with _KnownHintCheckState(()) as state: -+ assert _ACTIVE_CHECK_STATES.get() is before -+ state.begin() -+ state.commit() -+ -+ -+def test_atomic_root_omits_only_duplicate_snapshot(): -+ snapshots = [] -+ bindings = {} -+ -+ class State: -+ def snapshot(self): -+ snapshots.append(1) -+ return bindings.copy() -+ -+ def restore(self, before): -+ bindings.clear() -+ bindings.update(before) -+ -+ state = State() -+ -+ class Meta(type): -+ __beartype_state__ = staticmethod(lambda: state) -+ __beartype_state_atomic__ = True -+ -+ def __instancecheck__(cls, value): -+ saved = state.snapshot() -+ bindings['seen'] = True -+ if value is None: -+ state.restore(saved) -+ return False -+ return True -+ -+ class Atomic(metaclass=Meta): -+ pass -+ -+ # Compile first: decoration can probe an instance-checkable metaclass. -+ assert is_bearable(1, Atomic) -+ snapshots.clear() -+ bindings.clear() -+ assert is_bearable(1, Atomic) -+ assert len(snapshots) == 1 -+ bindings.clear() -+ assert not is_bearable(None, Atomic) -+ assert bindings == {} -+ assert not is_bearable((1, None), tuple[Atomic, int]) -+ assert bindings == {} -+ -+ -+def test_custom_metaclass_never_specializes(monkeypatch): -+ calls = [] -+ -+ class Meta(type): -+ def __instancecheck__(cls, value): -+ calls.append(value) -+ return True -+ -+ monkeypatch.setitem(globals(), 'LatePlain', Meta('Custom', (), {})) -+ ref_proxy_cache.clear_cache() -+ for _ in range(3): -+ plain_tuple((object(), 1)) -+ assert dispatcher(plain_tuple)._fast is None -+ assert len(calls) >= 3 -+ monkeypatch.undo() -+ ref_proxy_cache.clear_cache() -+ -+ -+def test_specialization_preserves_single_sample_and_predicate_calls(monkeypatch): -+ accesses = [] -+ predicates = [] -+ -+ class SampledList(list): -+ def __getitem__(self, index): -+ accesses.append(index) -+ return super().__getitem__(index) -+ -+ def predicate(value): -+ predicates.append(1) -+ return True -+ -+ @beartype -+ def checked(value: Annotated[tuple['LateForPredicate', int], Is[predicate]]): -+ pass -+ -+ monkeypatch.setitem(globals(), 'LateForPredicate', LatePlain) -+ ref_proxy_cache.clear_cache() -+ for iteration in range(3): -+ plain_nested_list(SampledList([SampledList([LatePlain(), LatePlain()])])) -+ checked((LatePlain(), 1)) -+ assert len(accesses) == 2 * (iteration + 1) -+ assert len(predicates) == iteration + 1 -+ assert dispatcher(plain_nested_list)._fast is not None -+ assert dispatcher(checked)._fast is not None -diff --git a/doc/src/api_plug.rst b/doc/src/api_plug.rst -index c27343af..8eabac9e 100644 ---- a/doc/src/api_plug.rst -+++ b/doc/src/api_plug.rst -@@ -124,3 +124,31 @@ objects. Scope objects themselves hold no frames or context tokens. Scope - ownership does not replace state rollback: a rejected composite alternative - must restore registered domains, and a rejected nested leaf must roll back even - when a predicate catches the rejection and then succeeds. -+ -+Optional atomic leaves and ordinary references -+--------------------------------------------- -+ -+A stateful runtime hint may additionally expose -+``__beartype_state_atomic__ = True``. This promises that its own instance check -+restores every mutation on a false result or any exception, including -+``BaseException``. Only a primitive root with this explicit promise omits its -+otherwise redundant outer checkpoint. Composite parents still take snapshots, -+since a later child may reject the entire alternative. Do not declare the -+promise for a validator that only restores ordinary Exception subclasses. -+ -+Checks whose domains are all known register them with an active parent but do -+not publish an unnecessary new transaction context. Unknown references still -+receive transactional handling on their first check. An ordinary composite -+reference check may specialize after natural resolution has shown every proxy -+to reference a plain class with the builtin metaclass and no state hook. -+Specialization never resolves an unused branch, repeats a predicate, or changes -+container sampling. Custom metaclasses and composite/stateful aliases remain -+on the general path. State hooks, like other compiled hint metadata, must remain -+stable while the corresponding checker is cached. -+ -+Reference-cache clearing discards specialized functions and their captured -+classes. An in-flight call that already loaded a fast function finishes using -+its captured old class snapshot; subsequent calls re-resolve. This preserves -+cache invalidation without a lock around every ordinary check. Root references -+and single sampled-reference lists retain native proxy checking; the proposal -+still adds a small state-hook lookup cost to those paths. diff --git a/tools/upstream/patches/series.json b/tools/upstream/patches/series.json deleted file mode 100644 index 714bfe0..0000000 --- a/tools/upstream/patches/series.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "base_commit": "f85b67d8b0b6bd9c910bd97f0d2d417c4550b038", - "patches": [ - { - "file": "0001-state.patch", - "sha256": "01961e7d28519925e09dadbb10aebe81fd8f25f33f82db9dfff74a22bec7ff5b" - }, - { - "file": "0002-scope-correctness.patch", - "sha256": "054a42e50353a8bf092fa283562f726b06b24669e38148247708009a55358bf0" - }, - { - "file": "0003-ordinary-performance.patch", - "sha256": "6c7d531d57227a6b581af8327a3600ef130161372ecd53dead9c78d22ed07096" - } - ] -} diff --git a/tools/upstream/test_audit_composition.py b/tools/upstream/test_audit_composition.py deleted file mode 100644 index 1f291a9..0000000 --- a/tools/upstream/test_audit_composition.py +++ /dev/null @@ -1,58 +0,0 @@ -"""Preserve corrected Tree and strict-variadic contracts through composition.""" - -from typing import Annotated - -import numpy as np -import pytest -from beartype import BeartypeConf, beartype -from beartype.door import is_bearable -from beartype.roar import BeartypeCallHintParamViolation -from beartype.vale import Is - -from bearshape import C, N, check, check_context -from bearshape._memo import get_memo -from bearshape.numpy import F32 -from bearshape.optree import Tree - - -@pytest.mark.parametrize("backend", ["optree", "jax"]) -@pytest.mark.parametrize("mode", ["automatic", "explicit", "combined"]) -def test_late_tree_alias_with_composite_leaves( - monkeypatch: pytest.MonkeyPatch, backend: str, mode: str -) -> None: - import sys - - tree = Tree - if backend == "jax": - from bearshape.jax import Tree as JaxTree - - tree = JaxTree - alias_name = f"LateAuditTree_{backend}_{mode}" - - def consume(value: object, last: object) -> None: - pass - - consume.__annotations__ = {"value": alias_name, "last": F32[N]} - if mode == "automatic": - checked = beartype(consume) - elif mode == "explicit": - checked = check(beartype(consume)) - else: - checked = check(conf=BeartypeConf())(consume) - leaf_hint = Annotated[F32[N], Is[lambda _value: False]] | F32[C] - monkeypatch.setattr(sys.modules[__name__], alias_name, tree[leaf_hint], raising=False) - two = np.ones(2, dtype=np.float32) - three = np.ones(3, dtype=np.float32) - checked([two, two], three) - with pytest.raises(BeartypeCallHintParamViolation): - checked([two, three], three) - checked([three, three], two) - - -def test_rejected_alternative_restores_variadic_strictness() -> None: - hint = tuple[F32[~N], str] | tuple[F32[~C], int] - with check_context(): - assert is_bearable(np.ones(2, dtype=np.float32), F32[~+N]) - assert is_bearable((np.ones(2, dtype=np.float32), 1), hint) - assert get_memo().variadic == {"N": (True, (2,)), "C": (False, (2,))} - assert is_bearable(np.ones((3, 2), dtype=np.float32), F32[~+N]) diff --git a/tools/upstream/test_scope_isolation.py b/tools/upstream/test_scope_isolation.py deleted file mode 100644 index ae685a0..0000000 --- a/tools/upstream/test_scope_isolation.py +++ /dev/null @@ -1,92 +0,0 @@ -"""Independent public checks cannot contaminate a late union transaction.""" - -import sys -from typing import Annotated - -import numpy as np -import pytest -from beartype import beartype -from beartype._check.forward.reference._cls.fwdrefcache import ref_proxy_cache -from beartype.door import die_if_unbearable, is_bearable -from beartype.roar import BeartypeCallHintParamViolation, BeartypeDoorHintViolation -from beartype.vale import Is - -from bearshape import C, N, check -from bearshape.numpy import F32 - -IsolationN = F32[N] -IsolationC = F32[C] - - -def array(size: int) -> np.ndarray: - return np.ones(size, dtype=np.float32) - - -@pytest.mark.parametrize("mode", ["automatic", "explicit"]) -@pytest.mark.parametrize("kind", ["door", "raiser", "decorated"]) -@pytest.mark.parametrize("nested_first", [True, False]) -@pytest.mark.parametrize("nested_rejects", [True, False]) -def test_nested_composite_checks_are_isolated( - monkeypatch: pytest.MonkeyPatch, - mode: str, - kind: str, - *, - nested_first: bool, - nested_rejects: bool, -) -> None: - module = sys.modules[__name__] - for name in ("IsolationN", "IsolationC"): - monkeypatch.delattr(module, name, raising=False) - ref_proxy_cache.clear_cache() - calls = [] - inner_hint = tuple[F32[N], str if nested_rejects else int] - - @beartype - def inner(value: inner_hint) -> None: - pass - - def independent(value: object) -> bool: - calls.append(True) - item = (array(7), 1) - if kind == "door": - assert is_bearable(item, inner_hint) is not nested_rejects - elif nested_rejects: - exception = ( - BeartypeDoorHintViolation - if kind == "raiser" - else BeartypeCallHintParamViolation - ) - with pytest.raises(exception): - die_if_unbearable(item, inner_hint) if kind == "raiser" else inner(item) - elif kind == "raiser": - die_if_unbearable(item, inner_hint) - else: - inner(item) - return True - - # Avoid reusing another parametrization's closure through upstream repr caches. - independent.__qualname__ += f"_{mode}_{kind}_{nested_first}_{nested_rejects}" - probe = Annotated[int, Is[independent]] - hint = ( - tuple[probe, "IsolationN", str] | tuple[int, "IsolationC", int] - if nested_first - else tuple["IsolationN", probe, str] | tuple["IsolationC", int, int] - ) - - @beartype - def outer(value: hint, last: F32[N]) -> None: - pass - - fn = check(outer) if mode == "explicit" else outer - monkeypatch.setattr(module, "IsolationN", F32[N], raising=False) - monkeypatch.setattr(module, "IsolationC", F32[C], raising=False) - value = (1, array(2), 1) if nested_first else (array(2), 1, 1) - try: - fn(value, array(3)) - assert calls - first = (*value[:2], "accepted") - with pytest.raises(BeartypeCallHintParamViolation): - fn(first, array(3)) - fn(first, array(2)) - finally: - ref_proxy_cache.clear_cache() diff --git a/tools/upstream/test_scope_transactions.py b/tools/upstream/test_scope_transactions.py deleted file mode 100644 index 151b849..0000000 --- a/tools/upstream/test_scope_transactions.py +++ /dev/null @@ -1,227 +0,0 @@ -"""Additional integration checks: same bindings through late composite aliases.""" - -from __future__ import annotations - -from collections.abc import Callable - -import numpy as np -import pytest -from beartype import beartype -from beartype.door import is_bearable -from beartype.roar import BeartypeCallHintParamViolation - -from bearshape import C, N, T, Value, check, check_context -from bearshape._memo import get_memo -from bearshape.numpy import F32 -from bearshape.optree import Tree - - -def array(size: int) -> np.ndarray: - return np.ones(size, dtype=np.float32) - - -@beartype -def composite_alias(pair: LateCompositeAlias, y: F32[N]) -> None: - pass - - -@beartype -def earlier_binding(x: F32[N], pair: LateCompositeTuple) -> None: - pass - - -@beartype -def nested_alias(pair: tuple[LateCompositeTuple, str], y: F32[N]) -> None: - pass - - -LateCompositeAlias = tuple[F32[N], str] | tuple[F32[C], int] -LateCompositeTuple = tuple[F32[N], int] - - -@beartype -def value_alias(width: int, pair: LateValueAlias) -> None: - pass - - -@beartype -def tree_alias(pair: LateTreeAlias, y: Tree[F32[C], T]) -> None: - pass - - -LateValueAlias = tuple[F32[Value("width")], int] -LateTreeAlias = tuple[Tree[F32[N], T], int] - - -@pytest.mark.parametrize("mode", ["automatic", "explicit"]) -def test_late_composite_success_keeps_bindings(mode: str) -> None: - fn = check(composite_alias) if mode == "explicit" else composite_alias - fn((array(2), 1), array(3)) - with pytest.raises(BeartypeCallHintParamViolation): - fn((array(2), "first"), array(3)) - - -@pytest.mark.parametrize("mode", ["automatic", "explicit"]) -def test_late_composite_sees_earlier_bindings(mode: str) -> None: - fn = check(earlier_binding) if mode == "explicit" else earlier_binding - fn(array(2), (array(2), 1)) - with pytest.raises(BeartypeCallHintParamViolation): - fn(array(3), (array(2), 1)) - - -@pytest.mark.parametrize("mode", ["automatic", "explicit"]) -def test_nested_composite_alias_keeps_bindings(mode: str) -> None: - fn = check(nested_alias) if mode == "explicit" else nested_alias - fn(((array(2), 1), "ok"), array(2)) - with pytest.raises(BeartypeCallHintParamViolation): - fn(((array(2), 1), "ok"), array(3)) - - -@pytest.mark.parametrize("mode", ["automatic", "explicit"]) -def test_value_alias_keeps_argument_scope(mode: str) -> None: - fn = check(value_alias) if mode == "explicit" else value_alias - fn(3, (array(3), 1)) - with pytest.raises(BeartypeCallHintParamViolation): - fn(4, (array(3), 1)) - - -@pytest.mark.parametrize("mode", ["automatic", "explicit"]) -def test_tree_alias_keeps_structure_scope(mode: str) -> None: - fn = check(tree_alias) if mode == "explicit" else tree_alias - fn(([array(2)], 1), [array(3)]) - with pytest.raises(BeartypeCallHintParamViolation): - fn(([array(2)], 1), {"different": array(3)}) - - -def test_nested_public_door_check_remains_independent() -> None: - from typing import Annotated - - from beartype.vale import Is - - def independent(value: object) -> bool: - return is_bearable(array(7), F32[N]) - - @beartype - def outer(x: Annotated[F32[N], Is[independent]], y: F32[N]) -> None: - pass - - outer(array(2), array(2)) - with pytest.raises(BeartypeCallHintParamViolation): - outer(array(2), array(7)) - - -def test_failed_composite_without_union_restores_scope() -> None: - with check_context(): - assert is_bearable(array(7), F32[C]) - assert not is_bearable((array(2), None), tuple[F32[N], str]) - assert get_memo().single == {"C": 7} - - -def test_delegated_alias_does_not_retain_argument() -> None: - import gc - import weakref - - def call() -> object: - x = array(2) - reference = weakref.ref(x) - composite_alias((x, "first"), x) - return reference - - reference = call() - gc.collect() - assert reference() is None - - -def test_independent_nested_decorated_call_does_not_share_bindings() -> None: - from typing import Annotated - - from beartype.vale import Is - - @beartype - def inner(x: F32[N]) -> None: - pass - - def predicate(value: object) -> bool: - inner(array(7)) - return True - - @beartype - def outer(x: Annotated[F32[N], Is[predicate]], y: F32[N]) -> None: - pass - - outer(array(2), array(2)) - with pytest.raises(BeartypeCallHintParamViolation): - outer(array(2), array(7)) - - -@beartype -def rejected_late(value: LateRejectingHint) -> None: - pass - - -@beartype -def rejected_late_list(value: list[LateRejectingHint]) -> None: - pass - - -_generic_bindings = {} - - -class _State: - def snapshot(self) -> dict[str, int]: - return _generic_bindings.copy() - - def restore(self, before: dict[str, int]) -> None: - _generic_bindings.clear() - _generic_bindings.update(before) - - -_state = _State() - - -def _get_state() -> _State: - return _state - - -class _Meta(type): - __beartype_state__ = staticmethod(_get_state) - - def __instancecheck__(cls, value: object) -> bool: - if not isinstance(value, list): - return False - _generic_bindings[cls.__name__] = len(value) - return cls.__name__ != "Rejected" - - -class First(metaclass=_Meta): - pass - - -class Rejected(metaclass=_Meta): - pass - - -LateRejectingHint = Rejected - - -@pytest.mark.parametrize("checked", [rejected_late, rejected_late_list]) -def test_caught_nested_late_failure_restores_its_own_state( - checked: Callable[..., object], -) -> None: - from typing import Annotated - - from beartype.vale import Is - - _generic_bindings.clear() - - def catches_failure(value: object) -> bool: - with pytest.raises(BeartypeCallHintParamViolation): - checked([[1, 2]] if checked is rejected_late_list else [1, 2]) - return True - - @beartype - def accepted(value: Annotated[First, Is[catches_failure]]) -> None: - pass - - accepted([1]) - assert _generic_bindings == {"First": 1} diff --git a/tools/upstream/test_union_transactions.py b/tools/upstream/test_union_transactions.py deleted file mode 100644 index e82b7d4..0000000 --- a/tools/upstream/test_union_transactions.py +++ /dev/null @@ -1,272 +0,0 @@ -"""Integration regressions requiring the proposed beartype snapshot protocol. - -Run explicitly with the patched upstream installed. These are real failures on -published rc0; they are neither skipped nor marked as expected failures. -""" - -from __future__ import annotations - -import asyncio -import gc -import weakref -from collections.abc import Callable - -import numpy as np -import pytest -from beartype import BeartypeConf, beartype -from beartype.door import die_if_unbearable, is_bearable -from beartype.roar import ( - BeartypeCallHintParamViolation, - BeartypeCallHintReturnViolation, - BeartypeDoorHintViolation, -) - -from bearshape import C, N, check, check_context -from bearshape._memo import get_memo -from bearshape.numpy import F32, F32Like - - -def array(size: int) -> np.ndarray: - return np.ones(size, dtype=np.float32) - - -@pytest.mark.parametrize("mode", ["automatic", "explicit", "combined"]) -def test_failed_alternative_discards_binding(mode: str) -> None: - def choose(pair: tuple[F32[N], str] | tuple[F32[C], int], y: F32[N]) -> None: - pass - - if mode == "combined": - checked = check(conf=BeartypeConf())(choose) - else: - checked = beartype(choose) - if mode == "explicit": - checked = check(checked) - checked((array(2), 1), array(3)) - with pytest.raises(BeartypeCallHintParamViolation): - checked((array(2), "selected first"), array(3)) - - -def test_selected_alternative_retains_binding() -> None: - @beartype - def choose(pair: tuple[F32[N], str] | tuple[F32[C], int], y: F32[C]) -> None: - pass - - choose((array(2), 1), array(2)) - with pytest.raises(BeartypeCallHintParamViolation, match="expected 2 but got 3"): - choose((array(2), 1), array(3)) - - -def test_preserve_earlier_argument_bindings() -> None: - @beartype - def choose( - first: F32[N], pair: tuple[F32[C], str] | tuple[F32[C], int], last: F32[N] - ) -> None: - pass - - choose(array(3), (array(2), 1), array(3)) - with pytest.raises(BeartypeCallHintParamViolation, match="expected 3 but got 4"): - choose(array(3), (array(2), 1), array(4)) - - -def test_nested_union_discards_selected_inner_alternative_on_outer_failure() -> None: - hint = ( - tuple[tuple[F32[N], str] | tuple[F32[C], int], str] | tuple[tuple[F32[N], int], int] - ) - with check_context(): - assert is_bearable(((array(2), 1), 1), hint) - assert get_memo().single == {"N": 2} - assert is_bearable(array(3), F32[C]) - - -def test_all_alternatives_fail_without_poisoning_context() -> None: - hint = tuple[F32[N], str] | tuple[F32[C], int] - with check_context(): - assert not is_bearable((array(2), None), hint) - assert get_memo().single == {} - assert is_bearable(array(3), F32[N]) - assert is_bearable(array(4), F32[C]) - - -def test_diagnostics_restore_state_and_explain_repeated_dimensions() -> None: - hint = tuple[F32[N], F32[N]] | tuple[F32[C], str] - with check_context(): - with pytest.raises(BeartypeDoorHintViolation, match="expected 2 but got 3"): - die_if_unbearable((array(2), array(3)), hint) - assert get_memo().single == {} - assert is_bearable(array(4), F32[N]) - - -def test_return_union_commits_only_selected_alternative() -> None: - @beartype - def choose() -> tuple[tuple[F32[N], str] | tuple[F32[C], int], F32[N]]: - return (array(2), 1), array(3) - - choose() - - @beartype - def wrong() -> tuple[tuple[F32[N], str] | tuple[F32[C], int], F32[C]]: - return (array(2), 1), array(3) - - with pytest.raises(BeartypeCallHintReturnViolation, match="expected 2 but got 3"): - wrong() - - -def test_like_alternatives_roll_back() -> None: - hint = tuple[F32Like[N], str] | tuple[F32Like[C], int] - with check_context(): - assert is_bearable(([1.0, 2.0], 1), hint) - assert get_memo().single == {"C": 2} - assert is_bearable([1.0, 2.0, 3.0], F32Like[N]) - - -def test_variadic_alternatives_roll_back() -> None: - hint = tuple[F32[~N], str] | tuple[F32[~C], int] - with check_context(): - assert is_bearable((np.ones((2, 3), dtype=np.float32), 1), hint) - assert get_memo().variadic == {"C": (False, (2, 3))} - assert is_bearable(array(4), F32[~N]) - - -def test_tree_structure_alternatives_roll_back() -> None: - from bearshape import S, T - from bearshape.optree import Tree - - hint = tuple[Tree[F32[N], T], str] | tuple[Tree[F32[C], S], int] - with check_context(): - assert is_bearable(([array(2)], 1), hint) - assert set(get_memo().structures) == {"S"} - assert get_memo().single == {"C": 2} - assert is_bearable({"new": array(3)}, Tree[F32[N], T]) - - -def test_async_calls_keep_independent_bindings() -> None: - @check - @beartype - async def choose(pair: tuple[F32[N], str] | tuple[F32[C], int], y: F32[N]) -> F32[N]: - await asyncio.sleep(0) - return y - - async def run() -> None: - results = await asyncio.gather(*(choose((array(2), 1), array(i)) for i in (3, 4))) - assert [len(result) for result in results] == [3, 4] - - asyncio.run(run()) - - -def test_success_does_not_retain_array() -> None: - @beartype - def choose(pair: tuple[F32[N], str] | tuple[F32[C], int], y: F32[N]) -> None: - pass - - def invoke() -> weakref.ReferenceType[np.ndarray]: - y = array(3) - ref = weakref.ref(y) - choose((array(2), 1), y) - return ref - - ref = invoke() - gc.collect() - assert ref() is None - - -@beartype -def _late_alias_choose( - pair: tuple[_LateN, str] | tuple[_LateC, int], y: _LateN -) -> None: - pass - - -_LateN = F32[N] -_LateC = F32[C] - - -def test_late_resolved_aliases() -> None: - _late_alias_choose((array(2), 1), array(3)) - - -@pytest.mark.parametrize("container", ["list", "dict"]) -def test_union_nested_in_container(container: str) -> None: - alternative = tuple[F32[N], str] | tuple[F32[C], int] - value = (array(2), 1) - if container == "list": - hint, obj = list[alternative], [value] - else: - hint, obj = dict[str, alternative], {"item": value} - with check_context(): - assert is_bearable(obj, hint) - assert get_memo().single == {"C": 2} - assert is_bearable(array(3), F32[N]) - - -def test_annotated_predicate_rejection_rolls_back_shape() -> None: - from typing import Annotated - - from beartype.vale import Is - - hint = ( - Annotated[tuple[F32[N], int], Is[lambda pair: pair[1] < 0]] | tuple[F32[C], int] - ) - with check_context(): - assert is_bearable((array(2), 1), hint) - assert get_memo().single == {"C": 2} - - -def test_sampled_union_value_is_evaluated_once() -> None: - class Samples(list): - reads = 0 - - def __getitem__(self, index: int) -> object: - self.reads += 1 - return super().__getitem__(index) - - samples = Samples([(array(2), 1)]) - with check_context(): - assert is_bearable(samples, list[tuple[F32[N], str] | tuple[F32[C], int]]) - assert samples.reads == 1 - assert get_memo().single == {"C": 2} - - -def _raise_value_error(_pair: object) -> bool: - message = "validator failed" - raise ValueError(message) - - -def _raise_cancellation(_pair: object) -> bool: - raise asyncio.CancelledError - - -@pytest.mark.parametrize( - "validator,exception_type", - [(_raise_value_error, ValueError), (_raise_cancellation, asyncio.CancelledError)], -) -def test_exception_after_shape_binding_restores_context( - validator: Callable[[object], bool], exception_type: type[BaseException] -) -> None: - from typing import Annotated - - from beartype.vale import Is - - hint = Annotated[tuple[F32[N], int], Is[validator]] | tuple[F32[C], str] - with check_context(): - assert is_bearable(array(7), F32[C]) - with pytest.raises(exception_type): - is_bearable((array(2), 1), hint) - assert get_memo().single == {"C": 7} - - -def test_interleaved_thread_transactions_keep_independent_contexts() -> None: - from concurrent.futures import ThreadPoolExecutor - from threading import Barrier - - barrier = Barrier(2) - hint = tuple[F32[N], str] | tuple[F32[C], int] - - def worker(size: int) -> bool: - with check_context(): - assert is_bearable((array(size), 1), hint) - barrier.wait(timeout=5) - assert get_memo().single == {"C": size} - return is_bearable(array(size + 1), F32[N]) - - with ThreadPoolExecutor(max_workers=2) as pool: - assert all(pool.map(worker, (2, 7))) diff --git a/tools/validate_runtime.py b/tools/validate_runtime.py index 1e436d9..7612e34 100644 --- a/tools/validate_runtime.py +++ b/tools/validate_runtime.py @@ -11,13 +11,8 @@ _BACKENDS = ("numpy", "jax", "torch", "optree") -def _require_beartype_version(version: str, *, latest_compatible: bool) -> None: - if not latest_compatible: - if version != "0.23.1": - message = f"expected beartype 0.23.1, found {version}" - raise SystemExit(message) - return - +def _require_beartype_version(version: str) -> None: + """Require the installed beartype to satisfy bearshape's declared range.""" from packaging.requirements import Requirement for raw in importlib.metadata.requires("bearshape") or (): @@ -34,11 +29,6 @@ def _require_beartype_version(version: str, *, latest_compatible: bool) -> None: def main() -> None: parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("environment", nargs="?", default="cpu") - parser.add_argument( - "--latest-compatible", - action="store_true", - help="Canary only: require the installed package's dependency range instead of the exact baseline", - ) args = parser.parse_args() factors = args.environment.split("-") if any(factor in {"cpu", "dev", "type"} for factor in factors): @@ -58,9 +48,7 @@ def main() -> None: "path": module.__file__, } if name == "beartype": - _require_beartype_version( - module.__version__, latest_compatible=args.latest_compatible - ) + _require_beartype_version(module.__version__) if name == "torch" and ( module.version.cuda is not None or module.version.hip is not None ): diff --git a/uv.lock b/uv.lock index 8bfd3ea..51f33e8 100644 --- a/uv.lock +++ b/uv.lock @@ -5,8 +5,8 @@ resolution-markers = [ "python_full_version >= '3.15' and sys_platform != 'darwin'", "python_full_version >= '3.15' and sys_platform == 'darwin'", "python_full_version == '3.14.*' and sys_platform != 'darwin'", - "python_full_version == '3.13.*' and sys_platform != 'darwin'", "python_full_version == '3.14.*' and sys_platform == 'darwin'", + "python_full_version == '3.13.*' and sys_platform != 'darwin'", "python_full_version == '3.13.*' and sys_platform == 'darwin'", "python_full_version == '3.12.*' and sys_platform != 'darwin'", "python_full_version == '3.12.*' and sys_platform == 'darwin'", @@ -107,7 +107,7 @@ wheels = [ [[package]] name = "bearshape" -version = "0.1.0rc1" +version = "0.1.0" source = { editable = "." } default-groups = ["dev", "docs", "notebook", "optional", "static", "test"] dependencies = [ @@ -636,8 +636,8 @@ resolution-markers = [ "python_full_version >= '3.15' and sys_platform != 'darwin'", "python_full_version >= '3.15' and sys_platform == 'darwin'", "python_full_version == '3.14.*' and sys_platform != 'darwin'", - "python_full_version == '3.13.*' and sys_platform != 'darwin'", "python_full_version == '3.14.*' and sys_platform == 'darwin'", + "python_full_version == '3.13.*' and sys_platform != 'darwin'", "python_full_version == '3.13.*' and sys_platform == 'darwin'", "python_full_version == '3.12.*' and sys_platform != 'darwin'", "python_full_version == '3.12.*' and sys_platform == 'darwin'", @@ -700,8 +700,8 @@ resolution-markers = [ "python_full_version >= '3.15' and sys_platform != 'darwin'", "python_full_version >= '3.15' and sys_platform == 'darwin'", "python_full_version == '3.14.*' and sys_platform != 'darwin'", - "python_full_version == '3.13.*' and sys_platform != 'darwin'", "python_full_version == '3.14.*' and sys_platform == 'darwin'", + "python_full_version == '3.13.*' and sys_platform != 'darwin'", "python_full_version == '3.13.*' and sys_platform == 'darwin'", "python_full_version == '3.12.*' and sys_platform != 'darwin'", "python_full_version == '3.12.*' and sys_platform == 'darwin'", @@ -1267,8 +1267,8 @@ resolution-markers = [ "python_full_version >= '3.15' and sys_platform != 'darwin'", "python_full_version >= '3.15' and sys_platform == 'darwin'", "python_full_version == '3.14.*' and sys_platform != 'darwin'", - "python_full_version == '3.13.*' and sys_platform != 'darwin'", "python_full_version == '3.14.*' and sys_platform == 'darwin'", + "python_full_version == '3.13.*' and sys_platform != 'darwin'", "python_full_version == '3.13.*' and sys_platform == 'darwin'", "python_full_version == '3.12.*' and sys_platform != 'darwin'", "python_full_version == '3.12.*' and sys_platform == 'darwin'", @@ -1378,8 +1378,8 @@ resolution-markers = [ "python_full_version >= '3.15' and sys_platform != 'darwin'", "python_full_version >= '3.15' and sys_platform == 'darwin'", "python_full_version == '3.14.*' and sys_platform != 'darwin'", - "python_full_version == '3.13.*' and sys_platform != 'darwin'", "python_full_version == '3.14.*' and sys_platform == 'darwin'", + "python_full_version == '3.13.*' and sys_platform != 'darwin'", "python_full_version == '3.13.*' and sys_platform == 'darwin'", "python_full_version == '3.12.*' and sys_platform != 'darwin'", "python_full_version == '3.12.*' and sys_platform == 'darwin'", @@ -2225,8 +2225,8 @@ resolution-markers = [ "python_full_version >= '3.15' and sys_platform != 'darwin'", "python_full_version >= '3.15' and sys_platform == 'darwin'", "python_full_version == '3.14.*' and sys_platform != 'darwin'", - "python_full_version == '3.13.*' and sys_platform != 'darwin'", "python_full_version == '3.14.*' and sys_platform == 'darwin'", + "python_full_version == '3.13.*' and sys_platform != 'darwin'", "python_full_version == '3.13.*' and sys_platform == 'darwin'", "python_full_version == '3.12.*' and sys_platform != 'darwin'", "python_full_version == '3.12.*' and sys_platform == 'darwin'", @@ -2712,7 +2712,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/7e/7b/aa9f69525a430c146cd42bcaa60e29ea3c9e963fd3f30cf6480155546c81/zensical-0.0.69-cp311-abi3-macosx_10_12_x86_64.whl", hash = "sha256:2a1858b34e8b97e95d30409d602c8e4b67abd042317afaddadbaf594ee201f12", size = 18108147, upload-time = "2026-10-08T15:36:33.044Z" }, { url = "https://files.pythonhosted.org/packages/51/db/005b2c05d6be4f478dee031d50cf4cf9f98948e2e12136904836a360a0c4/zensical-0.0.69-cp311-abi3-macosx_11_0_arm64.whl", hash = "sha256:72e5956b565b6cc81b766e3a2efefbe730ce8d115186dd0531a927ba3ff8dffc", size = 17636936, upload-time = "2026-10-08T15:36:37.08Z" }, { url = "https://files.pythonhosted.org/packages/86/32/c0fe3e0128873021f58ac2613966cba7278f17ed7ac929b202e4a3474f76/zensical-0.0.69-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:40c8aa708c5d39c8cea9fec38d2fe4c6e08acf80585c00309f298c33c6da8a01", size = 18146896, upload-time = "2026-10-08T15:36:40.082Z" }, - { url = "https://files.pythonhosted.org/packages/b8/99/e0e6447da8e0c55549f399dfdbb38e18eb64e367e779ae97e08f6d4e5cdc/zensical-0.0.69-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:d930b2ca0ef611446a566040c72469e59c87907029fbfb3dc5eed88738ea63b0", size = 18084079, upload-time = "2026-10-08T15:36:42.728Z" }, { url = "https://files.pythonhosted.org/packages/5d/c6/5b56c8ae4d9ff5dd84dbf0fa7356441dc02a87e8d45d6a69b8c98fd97fec/zensical-0.0.69-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a335af5e74e0b6f488ab57e137f86e48cef44df98ac200342e8235e45cda34bd", size = 18623988, upload-time = "2026-10-08T15:36:45.711Z" }, { url = "https://files.pythonhosted.org/packages/fc/67/02e9904f0b0c1b0ec7fe76e5a71594b972a5907c61e4723f9a19e39cff7c/zensical-0.0.69-cp311-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:68f0e5a4d2228c213a9bd208b89fb52c39c766235a99a7a773c052521fa2053c", size = 18311730, upload-time = "2026-10-08T15:36:48.491Z" }, { url = "https://files.pythonhosted.org/packages/c4/7e/b33ec1fa3d19bffc222c932a1d3b8c5d943aab945fe6d8a1c45d40af2f7d/zensical-0.0.69-cp311-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:3c516e050f645849dc5c9e09574ebfa295ad42f5baad1f8419210c51b83e3bc4", size = 18881453, upload-time = "2026-10-08T15:36:51.062Z" }, diff --git a/zensical.toml b/zensical.toml index aff7c67..b9dd6c6 100644 --- a/zensical.toml +++ b/zensical.toml @@ -45,7 +45,6 @@ nav = [ "examples/index.md", ]}, { "Maintainers" = [ - "maintainers/production-readiness.md", "maintainers/releasing.md", ]}, ] From 79abb476bb57d24c64ba47a3b28f776b2ceb5e21 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 28 Nov 2026 12:10:40 +0000 Subject: [PATCH 2/3] Drop ExecPlan references from the PR template Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01VhCcPq9JDmHrruFMCgcGMa --- .github/pull_request_template.md | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index eacd6c8..58ea883 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,16 +1,13 @@ # Problem and change -Describe the concrete problem and the resulting behavior. Link the issue and -ExecPlan when applicable. List any dependency on another PR. +Describe the problem and the resulting behavior. Link the issue, and any PR this +depends on. ## Validation -Give the relevant commands and results, including positive/negative examples and -checker inference when the public API changes. Distinguish local validation from -hosted checks, and explain skips or remaining limitations. +List the commands you ran and their results. Explain skips or remaining +limitations. -## Documentation and compatibility +## Documentation -Identify updated guides, examples and changelog entries, or explain why none are -needed. Note public-contract, dependency or artifact changes. Merge approval is -separate from release or deployment approval. +List updated guides, examples and changelog entries, or say why none are needed. From 75c5efdb7bb78289ca11c0afbd083e217ba754b7 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 28 Nov 2026 12:12:25 +0000 Subject: [PATCH 3/3] Pin setup-uv to a full release tag astral-sh/setup-uv publishes no moving major tag, so @v10 cannot resolve. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01VhCcPq9JDmHrruFMCgcGMa --- .github/workflows/ci.yml | 14 +++++++------- .github/workflows/docs.yml | 2 +- .github/workflows/pypi.yml | 4 ++-- CHANGELOG.md | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0fef19a..e80e741 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - - uses: astral-sh/setup-uv@v10 + - uses: astral-sh/setup-uv@v10.3.0 with: version: "0.13.0" - run: uv run --locked --only-group dev prek run -a @@ -49,7 +49,7 @@ jobs: - { os: windows-latest, python: "3.14" } steps: - uses: actions/checkout@v7 - - uses: astral-sh/setup-uv@v10 + - uses: astral-sh/setup-uv@v10.3.0 with: version: "0.13.0" python-version: ${{ matrix.python }} @@ -68,7 +68,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - - uses: astral-sh/setup-uv@v10 + - uses: astral-sh/setup-uv@v10.3.0 with: version: "0.13.0" python-version: "3.14" @@ -87,7 +87,7 @@ jobs: python: ["3.11", "3.12", "3.13", "3.14"] steps: - uses: actions/checkout@v7 - - uses: astral-sh/setup-uv@v10 + - uses: astral-sh/setup-uv@v10.3.0 with: version: "0.13.0" python-version: ${{ matrix.python }} @@ -116,7 +116,7 @@ jobs: - py313-bt0231-type-pyrefly steps: - uses: actions/checkout@v7 - - uses: astral-sh/setup-uv@v10 + - uses: astral-sh/setup-uv@v10.3.0 with: version: "0.13.0" enable-cache: true @@ -126,7 +126,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - - uses: astral-sh/setup-uv@v10 + - uses: astral-sh/setup-uv@v10.3.0 with: version: "0.13.0" python-version: "3.14" @@ -139,7 +139,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - - uses: astral-sh/setup-uv@v10 + - uses: astral-sh/setup-uv@v10.3.0 with: version: "0.13.0" - run: uv build diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 71b7437..ad3b899 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -20,7 +20,7 @@ jobs: FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true steps: - uses: actions/checkout@v7 - - uses: astral-sh/setup-uv@v10 + - uses: astral-sh/setup-uv@v10.3.0 with: version: "0.13.0" - run: uv run --locked --only-group docs zensical build --clean diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index aea164f..12b96d9 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -19,7 +19,7 @@ jobs: contents: write steps: - uses: actions/checkout@v7 - - uses: astral-sh/setup-uv@v10 + - uses: astral-sh/setup-uv@v10.3.0 with: version: "0.13.0" - name: Check that the tag matches the package version @@ -48,7 +48,7 @@ jobs: id-token: write steps: - uses: actions/checkout@v7 - - uses: astral-sh/setup-uv@v10 + - uses: astral-sh/setup-uv@v10.3.0 with: version: "0.13.0" - run: uv build diff --git a/CHANGELOG.md b/CHANGELOG.md index 16d0d4e..85f18eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -79,8 +79,8 @@ later checks of the same call; see - Test against the newest beartype prerelease on every PR and weekly. - Release by pushing a `v` tag: the workflow creates the GitHub Release and publishes to PyPI with trusted publishing. Docs deploy on tags. -- Pin GitHub Actions to major-version tags and remove the ExecPlan, evidence and - upstream-proposal tooling. +- Pin GitHub Actions to release tags instead of SHAs, and remove the ExecPlan, + evidence and upstream-proposal tooling. ### Maintenance