diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0e20808..ede458b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -129,6 +129,7 @@ jobs: uses: ./.github/actions/setup-tools # zizmor: ignore[self-repository] actionlint 1.7.12 does not accept $/... with: cache: "false" + tool: cargo - name: Verify default and exact Cargo packages run: | just ci-dependencies @@ -151,6 +152,7 @@ jobs: - uses: ./.github/actions/setup-tools # zizmor: ignore[self-repository] actionlint 1.7.12 does not accept $/... with: cache: "false" + tool: cargo - name: Prepare native dependency provenance run: just release-dependency-builds - name: Capture successful native validation identities diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index c397d14..0eb12da 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -34,6 +34,7 @@ jobs: uses: ./.github/actions/setup-tools # zizmor: ignore[self-repository] actionlint 1.7.12 does not accept $/... with: cache: "false" + tool: cargo - name: Prepare native dependency provenance run: just release-dependency-builds - name: Verify tagged source and freeze native evidence and notes diff --git a/.github/workflows/release-benchmarks.yml b/.github/workflows/release-benchmarks.yml index f0fc844..020e4a1 100644 --- a/.github/workflows/release-benchmarks.yml +++ b/.github/workflows/release-benchmarks.yml @@ -98,7 +98,7 @@ jobs: verify: needs: fetch runs-on: ubuntu-latest - timeout-minutes: 30 + timeout-minutes: 60 permissions: contents: read checks: read @@ -118,6 +118,7 @@ jobs: uses: ./.github/actions/setup-tools # zizmor: ignore[self-repository] actionlint 1.7.12 does not accept $/... with: cache: false + tool: cargo - name: Require this retrieval attempt env: diff --git a/.gitleaks.toml b/.gitleaks.toml index cf79919..8614db3 100644 --- a/.gitleaks.toml +++ b/.gitleaks.toml @@ -13,14 +13,26 @@ paths = [ '''(?:^|[/\\])scripts[/\\]bench_compare\.py$''' ] regexTarget = "line" regexes = [ '''^\s*_V0_4_3_API_COMPATIBILITY\s*=\s*V0_4_3_API_COMPATIBILITY\s*$''' ] -# This immutable run retains base64-encoded Criterion Tukey fences (four -# floating-point statistics), both directly and in its complete-run payload. +# These immutable runs retain base64-encoded Criterion Tukey fences (four +# floating-point statistics), both directly and in their complete-run payloads. # Match only the Tukey field token, including after payload decoding, in this -# exact historical artifact. Keep other fields and default detectors active. +# fixed set of historical artifacts. Keep other fields and default detectors active. # Gitleaks can end a scan chunk within the token, before its closing quote. [[rules.allowlists]] description = "Frozen Criterion Tukey statistics" condition = "AND" -paths = [ '''(?:^|[/\\])docs[/\\]performance-runs[/\\]runs[/\\]2e55909621d0aacbfa7670f678574ae750311ba29353e6e9ebb11461414876a2[/\\]run\.json$''' ] +paths = [ + '''(?:^|[/\\])docs[/\\]performance-runs[/\\]runs[/\\]2e55909621d0aacbfa7670f678574ae750311ba29353e6e9ebb11461414876a2[/\\]run\.json$''', + '''(?:^|[/\\])docs[/\\]performance-runs[/\\]runs[/\\]c71813e122e5fde26d26511b6a57ca21e5a24ed1b03bce2905029cf518ffd29e[/\\]run\.json$''', +] regexTarget = "match" regexes = [ '''^tukey\.json":\s*"[A-Za-z0-9+/]+={0,2}"?$''' ] + +# A scan chunk begins two bytes into the Tukey field in the frozen v0.5.4 run. +# Match the exact encoded fences at that boundary. +[[rules.allowlists]] +description = "Frozen v0.5.4 Tukey field at a scan chunk boundary" +condition = "AND" +paths = [ '''(?:^|[/\\])docs[/\\]performance-runs[/\\]runs[/\\]c71813e122e5fde26d26511b6a57ca21e5a24ed1b03bce2905029cf518ffd29e[/\\]run\.json$''' ] +regexTarget = "match" +regexes = [ '''^key\.json":\s*"WzExLjA2MTA0Nzk3MjM3MDc2NywxMS40NTY0ODIxNjU2MzYxNDIsMTIuNTEwOTczMzQ3Njc3MTQsMTIuOTA2NDA3NTQwOTQyNTE0XQ=="?$''' ] diff --git a/docs/BENCHMARKING.md b/docs/BENCHMARKING.md index bf580e9..5e11361 100644 --- a/docs/BENCHMARKING.md +++ b/docs/BENCHMARKING.md @@ -897,9 +897,8 @@ final clean commit, wait for the tag-triggered draft, stage the independent reco against its authenticated captured target, and dispatch attachment and publication. Both dispatches use the exact tag and owner-generated selection JSON; downloaded files cannot authenticate their own assertions. -`just release-benchmarks "$TAG"` dispatches attachment using the transfer from -the retained owner record by default. `CANDIDATE_TRANSFER_FILE` is an optional -recovery override. Dispatch returns without waiting or acquiring data. +Follow the [attachment commands](RELEASING.md#6-attach-accepted-benchmarks-and-review-the-draft) +to use the pinned uv and the same reviewed selection for staging and dispatch. ### Hosted Release Verification @@ -938,10 +937,9 @@ original measured source from the final release commit. Original local host, session and timestamps remain authoritative. Previously published suite archives remain readable through shared extraction -and saved-sample verification. Their original layouts, inventories, host records -and bytes stay unchanged. The optional `bench-release-inventory`, -`bench-release-check` and `bench-release-check-suite` recipes remain diagnostic -tools; they do not create or authenticate candidate acceptance. +and saved-sample verification. Run `bench-release-inventory` with a fresh +Criterion directory to discover cases and write a local inventory. Use +`bench-release-check` to verify the raw files in an existing saved baseline. ### Validate The Release Workflow diff --git a/docs/RELEASING.md b/docs/RELEASING.md index 5ebf7ec..34ed57b 100644 --- a/docs/RELEASING.md +++ b/docs/RELEASING.md @@ -77,7 +77,7 @@ Final acceptance lives under `/final///`. The default selection is `reviewed`. Repeating verification revalidates the full acceptance, including the original native run, attempt and artifact. To explicitly review a newer complete CI attempt, use a new name such as -`just release-evidence "$OWNER" retry-2` and pass that same selection to +`just release-run release-evidence "$OWNER" retry-2` and pass that same selection to archive, staging and publication recipes before GitHub publication. The command prints the full acceptance file's SHA-256. After GitHub publication, renew only that acceptance and supply its reviewed digest to a fresh Cargo dispatch; @@ -88,8 +88,7 @@ The candidate verification and archive recipes launch the pinned supplier throug `uvx` outside the observed checkout. They do not measure, discover, rebuild the Rust package or mutate Git. They write only requested receipts outside the checkout. Hosted Step 2 jobs prepare their own native Python dependency -provenance before verification. `release-native-evidence` -remains a focused native-CI diagnostic; it does not establish candidate reuse. +provenance before verification. The independently retained `transfer.json` selects the exact draft release and four inert asset IDs/hashes. After attachment, `publication-transfer.json` @@ -120,6 +119,7 @@ API. Release boundaries require published tooling and successful native evidence | Command | Common behavior and la-stack declaration | | --- | --- | +| `release-run RECIPE [ARGS...]` | Run a local recipe with the exact uv from `pyproject.toml`, including after a system uv upgrade | | `update-version TAG [ARGS...]` | Prepare package/citation metadata; Cargo owns the Rust lock, the private Python environment retains its version | | `changelog-release TAG [DATE]` | Generate prospective notes using the prepared citation date | | `release-version-check` | Require synchronized final metadata, changelog and citation dates | @@ -127,7 +127,7 @@ API. Release boundaries require published tooling and successful native evidence | `release-evidence [OWNER] [SELECTION]` | Inspect retained signed main CI and original benchmark acceptance without builds; defaults recover the original owner and `reviewed` selection | | `tag TAG` | Run the final version check and create the annotated tag from generated notes | | `release-notes TAG` | Print generated notes; tag-triggered preparation supplies these to the draft automatically | -| `release-benchmarks TAG` | Dispatch retained archive attachment from the original owner record; explicit `CANDIDATE_TRANSFER_FILE` remains a recovery override | +| `release-benchmarks TAG [OWNER] [SELECTION]` | Dispatch retained archive attachment from the original owner record and selected acceptance; explicit `CANDIDATE_TRANSFER_FILE` remains a recovery override | | `release-publish TAG [OWNER] [SELECTION]` | Revalidate acceptance, notes and canonical assets, then explicitly approve GitHub publication | | `release-upload TAG [OWNER] [SELECTION]` | Dispatch Cargo publication using the existing reviewed acceptance and original publication transfer | | `release-verify TAG` | Verify stable GitHub assets and the exact crates.io version | @@ -355,14 +355,12 @@ source-selection shell variables or exports are needed. Review `docs/performance.md` and the complete new run and index changes under `docs/performance-runs/`. Its current/baseline -tags and commits must match the selected assertions. Both labels must be v0.5.0 +tags and commits must match the selected assertions. Both labels must be v0.5.2 or newer. -Evidence retains every available phase, mean and median estimates, 100 raw -samples per case and 95% intervals. Availability uses the original revision: -APIs introduced in v0.5.2 are unavailable earlier and paired on v0.5.2-or-later -baselines. No supported missing case is treated as unavailable. All 1,403 -library cases and 16 LU peer cases on each phase remain required. +Evidence retains both phases, mean and median estimates, 100 raw samples per +case and 95% intervals. Each phase requires all 1,403 library cases and 16 LU +peer cases, including the library APIs introduced in v0.5.2. The full schema-6 plan declares one sequential trial. Baseline inputs include README because historical releases compile it. Current source includes README @@ -480,6 +478,11 @@ hand-edit the generated changelog to add a known-issue note. ## Step 2: Publish after the PR is merged +Use `just release-run` for local release recipes that require the pinned uv. +It reads the exact pin from this checkout and uses `uvx` to start Just with +that version on `PATH`. If your system uv changes after acquisition, keep the +release checkout's pin and lockfile and continue with the wrapper. + ### 1. Synchronize `main` and wait for CI ```bash @@ -515,11 +518,15 @@ requirement and cannot replace merged main-push evidence. ### 2. Verify the final release commit -The normal commands need no `OWNER` or `RELEASE_COMMIT` shell variables: +Use `reviewed` for the original native CI attempt. If you have rerun all jobs +in that CI run, choose a new selection such as `renewed-ci` and keep using the +same selection through publication. The empty owner argument recovers the +original Step 1 acquisition. ```bash -just release-evidence -just release-archive +RELEASE_SELECTION=reviewed +just release-run release-evidence "" "$RELEASE_SELECTION" && + just release-run release-archive "" "$RELEASE_SELECTION" ``` Require native Linux, macOS and Windows CI, default/exact Cargo packaging and @@ -535,13 +542,16 @@ evidence. Pending, failed, cancelled or expired evidence blocks publication. ### 3. Create the annotated tag ```bash -just tag "$TAG" +just release-run tag "$TAG" "" "$RELEASE_SELECTION" ``` `just tag` first runs `release-version-check` and revalidates the existing reviewed acceptance for clean HEAD. A different commit or missing receipt requires an -explicit `release-evidence` review before tagging. It then builds the annotation from the matching active or archived changelog -section. For a changelog larger than 125 kB, it links that section. +explicit `release-evidence` review before tagging. It fetches locked dependencies +with the same managed Cargo that generates the annotation, so the offline +metadata lookup works with a cold Cargo cache. The annotation comes from the +matching active or archived changelog section. For a changelog larger than +125 kB, it links that section. ### 4. Push the tag @@ -586,7 +596,7 @@ before the benchmark archive can be attached. GitHub recommends this Stage the four inert records: ```bash -just release-stage +just release-run release-stage "" "" "$RELEASE_SELECTION" ``` Staging uses the installed `release assets retrieve` operation and @@ -598,10 +608,10 @@ instead of searching again. A replacement draft is rejected before any upload. This revalidates acceptance, freezes the prepared draft ID before any upload, and prints the independent `transfer.json` path. A retry uses that same draft and identical -bytes. Dispatch from the exact tag using the printed path: +bytes. Dispatch from the exact tag with the same selection: ```bash -just release-benchmarks "$TAG" +just release-run release-benchmarks "$TAG" "" "$RELEASE_SELECTION" ``` The recipe resolves the existing transfer from the original owner record and @@ -633,7 +643,7 @@ pinned tooling and execute no checkout code. From the clean tagged checkout and your human GitHub CLI session: ```bash -just release-publish "$TAG" +just release-run release-publish "$TAG" "" "$RELEASE_SELECTION" ``` This verifies acceptance and remote notes, freezes the canonical attached archive @@ -644,7 +654,7 @@ must become immutable before Cargo publication. Dispatch Cargo publication from that independently retained selection: ```bash -just release-upload "$TAG" +just release-run release-upload "$TAG" "" "$RELEASE_SELECTION" gh run list --workflow publish-crates.yml --limit 5 ``` @@ -678,10 +688,12 @@ After the publishing workflow completes: just release-verify "$TAG" ``` -This requires the published stable GitHub release, nonempty durable baseline -asset and exact non-yanked crates.io version with a checksum. It retries only -proven registry absence, never an upload. A short-lived Actions artifact or a -published GitHub release alone is insufficient. +This reads GitHub and crates.io directly and checks the immutable stable +release, completed nonempty baseline asset, and exact non-yanked crates.io +version with a checksum. It polls only when the exact registry version is +proven absent. Dependency provenance and generated notes are checked by the +publication gates. The visibility recipe works without a synced development +environment. Check a clean consumer with a fresh Cargo home before dependent Delaunay releases: @@ -717,15 +729,20 @@ selections and GitHub commands remain available for older acquisitions, a moved checkout or deliberate recovery. They do not replace or rewrite the normal external owner selection. Do not infer missing assertions from received assets. +Set `RELEASE_SELECTION` below to the acceptance you already reviewed, such as +`renewed-ci` after accepting a complete CI retry. + ```bash RELEASE_COMMIT=$(git --no-pager rev-parse HEAD) OWNER="/path/to/original/independent/acquisition" -just release-evidence "$OWNER" -just release-archive "$OWNER" +RELEASE_SELECTION=reviewed +just release-run release-evidence "$OWNER" "$RELEASE_SELECTION" && + just release-run release-archive "$OWNER" "$RELEASE_SELECTION" ``` The same explicit owner and optional selection arguments are supported by -`tag`, `tag-force`, `release-publish` and `release-upload` during recovery. +`tag`, `tag-force`, `release-stage`, `release-benchmarks`, `release-publish` +and `release-upload` during recovery. Use the recorded workflow/run or inspect the exact current commit: @@ -739,15 +756,18 @@ For manually reviewed preparation retrieval, the shared CLI preserves the same source, original-attempt, job and artifact checks: ```bash -just release-assets retrieve tooling/draft-receipt.toml --tag "$TAG" --commit "$RELEASE_COMMIT" \ - --run-id ORIGINAL_PREPARATION_RUN_ID --output /path/to/independent/preparation -just release-stage "$OWNER" /path/to/independent/preparation/target.json -export CANDIDATE_TRANSFER_FILE="$OWNER/final/$RELEASE_COMMIT/reviewed/transfer.json" -just release-benchmarks "$TAG" -just release-publish "$TAG" "$OWNER" -just release-upload "$TAG" "$OWNER" +just release-run release-assets retrieve tooling/draft-receipt.toml --tag "$TAG" \ + --commit "$RELEASE_COMMIT" --run-id ORIGINAL_PREPARATION_RUN_ID \ + --output /path/to/independent/preparation +just release-run release-stage "$OWNER" /path/to/independent/preparation/target.json "$RELEASE_SELECTION" ``` +Pass `"$OWNER"` in place of the empty owner argument and use the same selection in +[benchmark attachment](#6-attach-accepted-benchmarks-and-review-the-draft) and +[publication](#7-publish-the-reviewed-draft-and-approve-cargo-publication). +Set `CANDIDATE_TRANSFER_FILE` on the attachment command only when explicitly +recovering the reviewed transfer from a different path. + For direct dispatch troubleshooting, `publish-crates.yml` still accepts `--ref "$TAG" -f tag="$TAG" -F candidate=@/original/publication-transfer.json` and `-f acceptance=REVIEWED_FULL_ACCEPTANCE_SHA256`. The explicit selection must @@ -813,7 +833,7 @@ attempts and manual CI dispatch remain ineligible. Accept a new complete native attempt through an explicit new review selection: ```bash -just release-evidence "$OWNER" renewed-ci +just release-run release-evidence "$OWNER" renewed-ci ``` Before GitHub publication, use the new selection for archive, staging and diff --git a/docs/code_organization.md b/docs/code_organization.md index 1a6908a..ccd7410 100644 --- a/docs/code_organization.md +++ b/docs/code_organization.md @@ -248,9 +248,9 @@ independent public API coverage. `tooling/criterion-saved.toml` declares complete saved-sample requirements. Shared discovery and saved-sample APIs own inventory parsing and exact raw-file verification. The shared package also owns suite-scoped verification, provenance, packaging and complete archive assembly. -Legacy archive and saved-sample regressions live in -`tests/tooling/test_release_baseline.py`; new release archives reuse accepted local evidence. -There is no repository-specific suite verifier or archive merge implementation. +RRT tests legacy archive compatibility. The consumer tests in +`tests/tooling/test_release_baseline.py` cover la-stack's independent inventory, +saved samples, and attachment workflow. Release archives reuse accepted local evidence. `tooling/performance.just` declares native Cargo discovery, correctness gates and measurements. `tooling/measurements/{full,non-exact}.toml` declares the diff --git a/docs/dev/release-flow-integration.md b/docs/dev/release-flow-integration.md index 76f2664..d7573c9 100644 --- a/docs/dev/release-flow-integration.md +++ b/docs/dev/release-flow-integration.md @@ -82,8 +82,10 @@ Publication is a separate maintainer-approved operation. Its workflow rechecks the candidate and canonical assets, retains an approval receipt, and performs nonbuilding Cargo upload using authenticated native validation. Published supplier tooling is required at release boundaries. -The crates.io jobs select minimal Rust/Cargo through RRT's managed tool APIs; -the locked Python environment still supplies Just and provenance dependencies. +The attachment and crates.io verifiers select minimal Rust/Cargo through RRT's +managed tool APIs. The locked Python environment still supplies Just and +provenance dependencies. Attachment verification has 60 minutes for cold +setup and evidence checks. Title, generated-notes and published immutability checks live in the shared publishing configuration, alongside the native checks and required assets. diff --git a/justfile b/justfile index b0ba2ba..d6c836a 100644 --- a/justfile +++ b/justfile @@ -7,6 +7,7 @@ set shell := ["bash", "-euo", "pipefail", "-c"] _run := "uv run --locked --no-sync --no-python-downloads research-repo-tools toolchain run --" +_release_cargo := "uv run --locked --no-sync research-repo-tools toolchain run --tool cargo --" _pytest_parallel := "-n " + quote(env("LA_STACK_TEST_WORKERS", "4")) + " --dist worksteal --max-worker-restart 0" @@ -83,6 +84,12 @@ _release-candidate *args: with isolated_release_runtime(load(root=root)): runpy.run_path(str(root / "tooling/release_candidate.py"), run_name="__main__") +# Fetch locked sources for the same managed Cargo that generates the tag notes. +[private] +_tag-release version force: + {{ _release_cargo }} cargo fetch --locked + {{ _release_cargo }} research-repo-tools changelog tag {{ quote(version) }}{{ if force == "force" { " --force" } else { "" } }} + # Ordinary checks accept unreleased history; final release validation is stricter. [private] _version-check: python-sync @@ -137,15 +144,11 @@ bench-latest-vs-last baseline="last": bench-latest bench-linear-form: {{ _run }} cargo bench --locked --features bench --bench linear_form -# Check every discovered benchmark before the release workflow packages it. +# Verify all raw files in a local saved Criterion baseline. bench-release-check tag criterion_dir="target/criterion": _ensure-uv {{ _run }} uv run --locked research-repo-tools performance verify-saved tooling/criterion-saved.toml --saved-sample {{ quote(tag) }} --criterion-dir {{ quote(criterion_dir) }} -# Verify one parallel release runner's exact feature selection before transport. -bench-release-check-suite tag suite criterion_dir="target/criterion": _ensure-uv - {{ _run }} uv run --locked research-repo-tools performance verify-saved tooling/criterion-saved.toml --saved-sample {{ quote(tag) }} --suite {{ quote(suite) }} --criterion-dir {{ quote(criterion_dir) }} - -# Discover all release benchmarks and report their expected measurement budget. +# Discover benchmarks with a fresh Criterion directory and write a local inventory. bench-release-inventory: _ensure-uv #!/usr/bin/env bash set -euo pipefail @@ -153,7 +156,7 @@ bench-release-inventory: _ensure-uv {{ _run }} uv run --locked research-repo-tools performance discover tooling/criterion-inventory.toml --output target/release-benchmark-inventory.json jq -r '.suites | to_entries[] | "[release-baseline] \(.key): \(.value | length) benchmarks; nominal warmup + measurement \((.value | length) * 8 / 60) min; planning estimate at 12 s/benchmark \((.value | length) * 12 / 60) min (not an upper bound)"' target/release-benchmark-inventory.json -# Save a Criterion baseline. Defaults to all release-signal benchmark suites. +# Save a local Criterion baseline. Defaults to all public la-stack cases. bench-save-baseline tag suite="all": #!/usr/bin/env bash set -euo pipefail @@ -177,7 +180,7 @@ bench-save-baseline tag suite="all": ;; esac -# Save a full Criterion baseline for the previous release signal. +# Save the public la-stack cases under the local Criterion baseline name last. bench-save-last: just bench-save-baseline last @@ -266,7 +269,7 @@ ci: python-sync tools-check _ci-policy _ci-execution ci-candidate: (test-python "-m" "release_candidate") # Prepare native release provenance in CI; verified development tooling keeps ordinary checks available. -[script("uv", "run", "--locked", "--no-sync", "--no-python-downloads", "research-repo-tools", "toolchain", "run", "--", "python", "-I")] +[script("uv", "run", "--locked", "--no-sync", "--no-python-downloads", "research-repo-tools", "toolchain", "run", "--tool", "cargo", "--", "python", "-I")] ci-dependencies: python-sync import sys from pathlib import Path @@ -463,8 +466,8 @@ plot-vs-linalg current_tag current_revision baseline_tag baseline_revision view= # Verify clean Cargo source packaging with default and exact features, without upload. publish-check: - {{ _run }} cargo publish --locked --package la-stack --registry crates-io --dry-run - {{ _run }} cargo publish --locked --package la-stack --registry crates-io --dry-run --features exact + {{ _release_cargo }} cargo publish --locked --package la-stack --registry crates-io --dry-run + {{ _release_cargo }} cargo publish --locked --package la-stack --registry crates-io --dry-run --features exact # Check Python formatting, lint, fixtures, and types. python-check: python-sync @@ -510,12 +513,12 @@ release-assets +args: sys.exit(main(["release", "--isolated-runtime", "assets", *sys.argv[1:]])) # Dispatch retained benchmark attachment using the original Step 1 owner selection. -release-benchmarks tag: _ensure-gh _ensure-jq +release-benchmarks tag owner="" selection="reviewed": _ensure-gh _ensure-jq #!/usr/bin/env bash set -euo pipefail tag={{ quote(tag) }} [[ "$tag" =~ ^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]] || { echo "A canonical stable tag is required." >&2; exit 2; } - transfer="${CANDIDATE_TRANSFER_FILE-$(just --quiet _release-candidate record transfer)}" + transfer="${CANDIDATE_TRANSFER_FILE-$(just --quiet _release-candidate record transfer {{ quote(owner) }} --selection {{ quote(selection) }})}" [[ -f "$transfer" && -r "$transfer" ]] || { echo "The selected transfer must be a readable file." >&2; exit 2; } jq -e --arg tag "$tag" '.schema == 1 and .target.repository == "acgetchell/la-stack" and .target.tag == $tag and .target.expected_title == $tag' -- "$transfer" >/dev/null gh workflow run release-benchmarks.yml --repo acgetchell/la-stack --ref "$tag" -f "tag=$tag" -F "candidate=@$transfer" @@ -526,33 +529,12 @@ release-dependencies: # Rebuild declared registry sources and authenticate this machine's installed wheels. release-dependency-builds: python-sync - uv run --locked --no-sync research-repo-tools toolchain run --tool cargo -- cargo fetch --locked - uv run --locked --no-sync research-repo-tools toolchain run --tool cargo -- uv run --locked --no-sync research-repo-tools release dependency-builds + {{ _release_cargo }} cargo fetch --locked + {{ _release_cargo }} uv run --locked --no-sync research-repo-tools release dependency-builds # Bind the original local acquisition to clean HEAD and signed native CI. release-evidence owner="" selection="reviewed": (_release-candidate "verify" owner "--selection" selection) -# Require the release event, reviewed commit, native checks, assets, and notes. -release-gate tag: - uv run --locked --no-sync research-repo-tools release gate {{ quote(tag) }} - -# Verify signed native/Cargo evidence; accept --expected PATH and --github-output PATH. -[positional-arguments] -[script("uvx", "--no-config", "--isolated", "--managed-python", "--python", "3.15", "--from", "research-repo-tools==0.2.9", "python", "-I")] -release-native-evidence *args: - import sys - import tempfile - from pathlib import Path - from research_repo_tools.cli import main - from research_repo_tools.config import load - from research_repo_tools.process import run_git_command - from research_repo_tools.release_metadata import read_package_info - from research_repo_tools.release_runtime import isolated_release_runtime - root = Path.cwd().resolve() - with isolated_release_runtime(load(root=root)), tempfile.TemporaryDirectory(prefix="la-stack-release-evidence-") as temporary: - commit = run_git_command(["--no-pager", "rev-parse", "HEAD"], cwd=root, timeout=30).stdout.strip() - sys.exit(main(["release", "evidence", "verify", "tooling/release-evidence.toml", "--checkout", str(root), "--commit", commit, "--version", read_package_info(root).version, "--output", str(Path(temporary).resolve() / "selection.json"), *sys.argv[1:]])) - # Print release notes from the root changelog or a completed minor archive. release-notes tag: python-sync uv run --locked --group dev research-repo-tools changelog notes {{ quote(tag) }} @@ -569,15 +551,62 @@ release-publish tag owner="" selection="reviewed": (_release-candidate "reviewed release-receive destination *args: just _release-candidate receive "$@" +# Run a recipe with the exact uv declared in this checkout, independent of system updates. +[positional-arguments] +[script("uvx", "--no-config", "--isolated", "--managed-python", "--python", "3.15", "--from", "research-repo-tools==0.2.9", "python", "-I")] +release-run +args: + import sys + from research_repo_tools.config import load + from research_repo_tools.process import run_command_live + from research_repo_tools.toolchain_config import load as load_toolchain + + uv = load_toolchain(load()).uv + result = run_command_live( + "uvx", ["--no-config", "--isolated", "--from", f"uv=={uv}", "just", *sys.argv[1:]], + timeout=None, check=False, + ) + sys.exit(result.returncode) + # Stage accepted inert assets and print the independently retained dispatch record. release-stage owner="" target="" selection="reviewed": (_release-candidate "stage" owner "--selection" selection "--target" target) # Dispatch Cargo publication using the existing reviewed acceptance and immutable assets. release-upload tag owner="" selection="reviewed": (_release-candidate "upload" tag owner "--selection" selection) -# Verify the published GitHub release, required assets, and exact crates.io version. +# Check remote visibility of the immutable release, required assets, and exact crates.io version. +[positional-arguments] +[script("uvx", "--no-config", "--isolated", "--managed-python", "--python", "3.15", "--from", "research-repo-tools==0.2.9", "python", "-I")] release-verify tag: - uv run --locked --no-sync research-repo-tools release verify {{ quote(tag) }} --attempts 7 --interval 10 + import sys + from pathlib import Path + from subprocess import SubprocessError + from research_repo_tools.config import load + from research_repo_tools.process import ExecutableNotFoundError, format_exception_diagnostics + from research_repo_tools.registry import identity, wait_for_version + from research_repo_tools.release_assets import lookup_release + + root = Path.cwd() + policy = load(root=root).publishing + if policy is None: + sys.exit("Release visibility requires a publishing policy.") + tag = sys.argv[1] + version = tag.removeprefix("v") + try: + if tag == version: + raise ValueError("Release visibility requires a stable vX.Y.Z tag.") + identity(policy.registry, policy.package, version) + release = lookup_release(root, policy.repository, tag) + if release.draft or release.prerelease or not release.immutable or release.title != tag: + raise ValueError("Expected the matching immutable, published stable GitHub release.") + required = {pattern.replace("{version}", version) for pattern in policy.required_assets} + uploaded = {name for name, identifier, size, _ in release.assets if size > 0 and (identifier, "uploaded") in release.asset_states} + if missing := required - uploaded: + raise ValueError(f"Missing completed release assets: {', '.join(sorted(missing))}") + if not wait_for_version(policy.registry, policy.package, version, attempts=7).present: + raise ValueError(f"{policy.package} {version} is not visible on {policy.registry}. Inspect the upload run.") + except (ValueError, OSError, SubprocessError, ExecutableNotFoundError) as error: + sys.exit(format_exception_diagnostics(error)) + print(f"Verified immutable GitHub release {tag} and {policy.registry} version {version}.") # Require final changelog, citation date and package metadata agreement. release-version-check: python-sync @@ -633,12 +662,10 @@ spell-check: tools-check {{ _run }} research-repo-tools files run --exclude typos.toml -- typos --config typos.toml --force-exclude -- # Create an annotated git tag from the CHANGELOG.md section for the given version -tag version owner="" selection="reviewed": release-version-check (_release-candidate "reviewed" owner "--selection" selection) - uv run --locked --group dev research-repo-tools changelog tag {{ quote(version) }} +tag version owner="" selection="reviewed": release-version-check (_release-candidate "reviewed" owner "--selection" selection) (_tag-release version "") # Replace an existing local tag only after validating the release notes. -tag-force version owner="" selection="reviewed": release-version-check (_release-candidate "reviewed" owner "--selection" selection) - uv run --locked --group dev research-repo-tools changelog tag {{ quote(version) }} --force +tag-force version owner="" selection="reviewed": release-version-check (_release-candidate "reviewed" owner "--selection" selection) (_tag-release version "force") # Run library unit tests and default-feature doctests. test: test-unit test-doc diff --git a/tests/tooling/support_evidence.py b/tests/tooling/support_evidence.py index 4dfe39f..7fb6392 100644 --- a/tests/tooling/support_evidence.py +++ b/tests/tooling/support_evidence.py @@ -1,24 +1,20 @@ """Independent release evidence and provider fixtures shared by consumer tests.""" -import hashlib -import io import json -import os -import runpy import shlex import subprocess -import sys -from contextlib import redirect_stderr from copy import deepcopy from pathlib import Path -from typing import Any +from typing import TYPE_CHECKING, Any -import pytest -from research_repo_tools import process, release_assets, release_evidence, release_interfaces, release_validation +from research_repo_tools import release_assets, release_evidence, release_interfaces, release_validation from research_repo_tools.cli import main, parser from research_repo_tools.config import load from research_repo_tools.release_interfaces import load_evidence_policy +if TYPE_CHECKING: + import pytest + REPO_ROOT = Path(__file__).resolve().parents[2] REPOSITORY = "acgetchell/la-stack" COMMIT = "a" * 40 @@ -175,13 +171,6 @@ def api(self, endpoint: str, *, repository: str) -> Any: assert endpoint in self.responses, f"unexpected authenticated request: {endpoint}" return deepcopy(self.responses[endpoint]) - def git(self, args: list[str], **kwargs: Any) -> subprocess.CompletedProcess[str]: - """Supply the exact clean checkout identity to the subprocess verifier.""" - assert "rev-parse" in args or "status" in args - assert kwargs["cwd"] == self.root - assert kwargs["timeout"] == 30 - return subprocess.CompletedProcess(args, 0, stdout=COMMIT + "\n" if "rev-parse" in args else "", stderr="") - def gh(self, *args: str) -> str: """Return the selected attestation response without a provider process.""" assert args[:2] == ("attestation", "verify") @@ -264,54 +253,3 @@ def cli(self, *args: str) -> int: *args, ] ) - - -def expected_identity() -> str: - """Independent approval record for the fixture's literal signed bytes.""" - provider = EvidenceProvider(Path()) - selected = { - **provider.document, - "schema": "research-repo-tools/release-selection/v1", - "jobs": {**provider.document["jobs"], "release-evidence": 205}, - "artifact": {key: provider.artifact[key] for key in ("id", "name", "digest", "size_in_bytes")}, - "manifest_sha256": hashlib.sha256(json.dumps(provider.document).encode()).hexdigest(), - } - return json.dumps(selected, sort_keys=True, separators=(",", ":")) - - -PIN_JSON = expected_identity() - - -def run_evidence_fixture() -> int: - """Run the real verifier in a child process with simulated provider responses.""" - root = Path(os.environ["FIXTURE_ROOT"]) - provider = EvidenceProvider(root) - if os.environ.get("FIXTURE_FAILURE") == "failed-job": - provider.jobs[3]["steps"][0]["conclusion"] = "failure" - newline = os.environ.get("FIXTURE_DIAGNOSTIC_NEWLINE", os.linesep) - sys.stdout.buffer.write(("fixture stdout diagnostic" + newline).encode("utf-8")) - sys.stdout.flush() - print("fixture stderr diagnostic", file=sys.stderr) - diagnostic = io.StringIO() - script, *arguments = sys.argv[1:] - with pytest.MonkeyPatch.context() as patch: - provider.install(patch) - patch.setattr(process, "run_git_command", provider.git) - # The uv launcher needs the real test environment; provenance observes - # only the dependency-free release fixture after process startup. - patch.delenv("UV_PROJECT", raising=False) - patch.delenv("UV_PROJECT_ENVIRONMENT", raising=False) - with redirect_stderr(diagnostic): - try: - sys.argv[:] = [script, *arguments] - runpy.run_path(script, run_name="__main__") - status = 0 - except SystemExit as error: - status = error.code - assert isinstance(status, int) - print(diagnostic.getvalue(), end="", file=sys.stderr) - # Just's quiet mode hides stderr. Record the actual verifier outcome so an - # import/shell failure cannot masquerade as the rejection under test. - result = {"status": status, "diagnostic": diagnostic.getvalue(), "import_root": sys.path[0], "arguments": arguments} - (root / "verifier-result.json").write_text(json.dumps(result), encoding="utf-8") - return status diff --git a/tests/tooling/test_release_baseline.py b/tests/tooling/test_release_baseline.py index b9eb59b..a99a512 100644 --- a/tests/tooling/test_release_baseline.py +++ b/tests/tooling/test_release_baseline.py @@ -7,14 +7,12 @@ import shutil import subprocess import sys -import tarfile import tomllib from pathlib import Path import pytest import yaml from research_repo_tools.criterion_inventory import CriterionInventory, load_discovery, serialize_inventory -from research_repo_tools.host_metadata import HostMetadata, serialize_host from research_repo_tools.process import run_command from tests.tooling.support_toolchain import TOOLING_REQUIREMENT @@ -35,7 +33,6 @@ STORAGE = tomllib.loads((REPO_ROOT / "tooling/criterion-saved.toml").read_text(encoding="utf-8"))["storage-paths"] BASELINE = "v1.2.3" RAW_FILES = ("benchmark.json", "estimates.json", "sample.json", "tukey.json") -SUITE_ENV = {"RELEASE_TAG": BASELINE, "GITHUB_SHA": "a" * 40, "GITHUB_REPOSITORY": "owner/repo", "GITHUB_RUN_ID": "123", "GITHUB_RUN_ATTEMPT": "2"} def write_json(path: Path, data: object) -> None: @@ -44,7 +41,7 @@ def write_json(path: Path, data: object) -> None: @pytest.fixture -def dataset(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> tuple[Path, Path]: +def dataset(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> Path: monkeypatch.chdir(tmp_path) for name in ("pyproject.toml", "uv.lock", ".python-version", "rust-toolchain.toml"): shutil.copyfile(REPO_ROOT / name, tmp_path / name) @@ -66,15 +63,14 @@ def dataset(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> tuple[Path, Path write_json(directory / "sample.json", {"iters": [1.0] * 100, "times": [2.0] * 100}) write_json(directory / "estimates.json", {"mean": estimate, "median": estimate}) write_json(directory / "tukey.json", [1.0, 2.0, 3.0, 4.0]) - return criterion, manifest + return criterion -def verify_saved(root: Path, *, suite: str | None = None, criterion_dir: str = "target/criterion") -> subprocess.CompletedProcess[str]: - """Exercise the installed verifier through the actual release-check recipe.""" - recipe = ["bench-release-check", BASELINE, criterion_dir] if suite is None else ["bench-release-check-suite", BASELINE, suite, criterion_dir] +def verify_saved(root: Path) -> subprocess.CompletedProcess[str]: + """Exercise the installed verifier through the local saved-baseline recipe.""" return run_command( "just", - ["--no-deps", "--justfile", str(REPO_ROOT / "justfile"), "--working-directory", str(root), *recipe], + ["--no-deps", "--justfile", str(REPO_ROOT / "justfile"), "--working-directory", str(root), "bench-release-check", BASELINE, "target/criterion"], env={**os.environ, "UV_NO_SYNC": "1", "UV_PROJECT_ENVIRONMENT": sys.prefix}, check=False, ) @@ -94,160 +90,10 @@ def run_shell(script: str, cwd: Path, extra_env: dict[str, str], *, timeout: int ) -def package_suites(root: Path, manifest: Path, criterion: Path) -> None: - """Execute the workflow's installed CLI with all independently required cases.""" - destination = root / "target/release-suites" - destination.mkdir(parents=True) - for suite, ids in IDS.items(): - shard = root / "shards" / suite - output = shard / "target/criterion" - output.mkdir(parents=True) - (shard / "tooling").mkdir() - shutil.copyfile(REPO_ROOT / "tooling/criterion-saved.toml", shard / "tooling/criterion-saved.toml") - shutil.copyfile(manifest, shard / "target/release-benchmark-inventory.json") - host = HostMetadata("fixture OS", "fixture architecture", f"CPU for {suite}", 2, 4, None) - (shard / "target/release-host.json").write_bytes(serialize_host(host)) - for event, timestamp in (("started", "100"), ("finished", "200")): - (shard / f"target/{suite}-{event}").write_text(timestamp, encoding="utf-8", newline="\n") - for benchmark in ids: - storage = STORAGE[benchmark] - shutil.copytree(criterion / storage, output / storage) - # Retain compatibility with previously published suite archives using - # the public installed packer; new releases use candidate archives. - result = run_command( - "uv", - [ - "run", - "--locked", - "--no-sync", - "research-repo-tools", - "--root", - str(shard), - "performance", - "pack-suite", - "tooling/criterion-saved.toml", - suite, - "--saved-sample", - BASELINE, - "--output", - f"target/release-suites/{suite}/criterion.tar.gz", - "--revision", - "a" * 40, - "--session", - "owner/repo:123:2", - "--host", - "target/release-host.json", - "--started-at", - "100", - "--finished-at", - "200", - "--context", - f"command=just bench-save-baseline {BASELINE} {suite}", - "--context", - "features=" + ("bench,exact" if suite == "public-exact" else "bench"), - "--context", - f"runner={suite}", - "--context", - "image=ubuntu24", - "--context", - "image_version=fixture-image", - "--context", - "rustc=rustc fixture;LLVM fixture", - "--context", - "cargo=cargo fixture", - "--context", - "cargo_lock_sha256=" + "f" * 64, - ], - cwd=REPO_ROOT, - check=False, - ) - assert result.returncode == 0, result.stdout + result.stderr - shutil.move(shard / "target/release-suites" / suite, destination / suite) - if suite == "public-default": - shutil.copyfile(manifest, destination / suite / "inventory.json") - - -def test_complete_dataset_round_trips_through_legacy_suite_archive(dataset: tuple[Path, Path], tmp_path: Path) -> None: - criterion, manifest = dataset - criterion = criterion.rename(tmp_path / "original-criterion") - package_suites(tmp_path, manifest, criterion) - for suite, ids in IDS.items(): - verified = verify_saved(tmp_path, suite=suite, criterion_dir=f"shards/{suite}/target/criterion") - assert verified.returncode == 0, verified.stdout + verified.stderr - assert f"Verified {len(ids)} complete saved Criterion benchmarks" in verified.stdout - # Assembly must use the downloaded inventory, not an accidentally retained - # fixture copy or an inventory inferred from the supplied archives. - manifest.unlink() - output = tmp_path / "step outputs" - asset = f"la-stack-{BASELINE}-criterion-baseline.tar.gz" - script = ( - "set -euo pipefail\n" - "cp target/release-suites/public-default/inventory.json target/release-benchmark-inventory.json\n" - "uv run --locked --no-sync research-repo-tools performance assemble-suites tooling/criterion-saved.toml " - "target/release-suites/public-default/criterion.tar.gz target/release-suites/public-exact/criterion.tar.gz " - '--saved-sample "$RELEASE_TAG" --output "la-stack-$RELEASE_TAG-criterion-baseline.tar.gz" ' - '--revision "$GITHUB_SHA" --session "$GITHUB_REPOSITORY:$GITHUB_RUN_ID:$GITHUB_RUN_ATTEMPT"\n' - ) - env = {**SUITE_ENV, "GITHUB_WORKSPACE": tmp_path.as_posix(), "GITHUB_OUTPUT": output.as_posix()} - for assertion in ({"GITHUB_SHA": "b" * 40}, {"GITHUB_RUN_ATTEMPT": "3"}): - rejected = run_shell(script, tmp_path, {**env, **assertion}, timeout=180) - assert rejected.returncode != 0 - assert "source revision or collection session differs" in rejected.stderr - assert not (tmp_path / asset).exists() - assert not output.exists() - # Git Bash accepts forward-slash drive paths on Windows as well as POSIX paths. - result = run_shell(script, tmp_path, env, timeout=180) +def test_complete_saved_baseline_passes_verification(dataset: Path) -> None: + result = verify_saved(dataset.parent.parent) assert result.returncode == 0, result.stdout + result.stderr - assert not output.exists() - assert_archive_contents(tmp_path / asset, criterion) - # Release readers keep the standard tooling environment. Exercise its - # documented extraction and full-dataset verification against the new archive. - run_command( - "uv", - ["run", "--locked", "--no-sync", "research-repo-tools", "performance", "extract", str(tmp_path / asset), str(tmp_path / "restored-criterion")], - cwd=REPO_ROOT, - ) - verified = verify_saved(tmp_path, criterion_dir="restored-criterion") - assert verified.returncode == 0, verified.stdout + verified.stderr - assert f"Verified {sum(map(len, IDS.values()))} complete saved Criterion benchmarks" in verified.stdout - - -def assert_archive_contents(archive_path: Path, criterion: Path) -> None: - """Require every raw byte and original runner observation in the final asset.""" - with tarfile.open(archive_path) as archive: - for ids in IDS.values(): - for benchmark in ids: - for sample in ("new", BASELINE): - for filename in RAW_FILES: - member = archive.extractfile(f"{STORAGE.get(benchmark, benchmark)}/{sample}/{filename}") - assert member is not None - assert member.read() == (criterion / STORAGE.get(benchmark, benchmark) / sample / filename).read_bytes() - member = archive.extractfile("criterion-inventory.json") - assert member is not None - assert json.loads(member.read())["suites"] == IDS - for index, suite in enumerate(sorted(IDS)): - member = archive.extractfile(f"release-suites/{index}.json") - assert member is not None - retained = member.read() - record = json.loads(retained) - assert record["suite"] == suite - run = record["run"] - assert run["provenance"]["revision"] == SUITE_ENV["GITHUB_SHA"] - assert run["session"] == "owner/repo:123:2" - assert (run["started_at"], run["finished_at"]) == (100, 200) - assert run["host"]["cpu"] == f"CPU for {suite}" - context = run["provenance"]["context"] - assert context["command"] == f"just bench-save-baseline {BASELINE} {suite}" - assert context["features"] == ("bench,exact" if suite == "public-exact" else "bench") - assert context["runner"] == suite - assert context["rustc"] == "rustc fixture;LLVM fixture" - assert context["cargo"] == "cargo fixture" - assert context["cargo_lock_sha256"] == "f" * 64 - assert (context["image"], context["image_version"]) == ("ubuntu24", "fixture-image") - with tarfile.open(archive_path.parent / "target/release-suites" / suite / "criterion.tar.gz") as original: - original_manifest = original.extractfile("suite.json") - assert original_manifest is not None - assert retained == original_manifest.read() + assert f"Verified {sum(map(len, IDS.values()))} complete saved Criterion benchmarks" in result.stdout @pytest.mark.parametrize( @@ -260,8 +106,8 @@ def assert_archive_contents(archive_path: Path, criterion: Path) -> None: "rational_dot/large/d22/slice", ], ) -def test_saved_baseline_must_match_fresh_samples(dataset: tuple[Path, Path], benchmark: str) -> None: - criterion, _manifest = dataset +def test_saved_baseline_must_match_fresh_samples(dataset: Path, benchmark: str) -> None: + criterion = dataset write_json(criterion / STORAGE[benchmark] / BASELINE / "sample.json", {"iters": [1.0] * 100, "times": [3.0] * 100}) result = verify_saved(criterion.parent.parent) assert result.returncode != 0 @@ -269,8 +115,8 @@ def test_saved_baseline_must_match_fresh_samples(dataset: tuple[Path, Path], ben @pytest.mark.parametrize("relocation", ["moved", "swapped"]) -def test_report_consumers_require_canonical_paths(dataset: tuple[Path, Path], relocation: str) -> None: - criterion, _manifest = dataset +def test_report_consumers_require_canonical_paths(dataset: Path, relocation: str) -> None: + criterion = dataset original = criterion / "d2/la_stack_dot" moved = original.rename(criterion / "d2/misplaced") if relocation == "swapped": @@ -354,7 +200,8 @@ def test_workflow_reuses_original_acquisition_and_isolates_write_credentials() - assert job["steps"][0]["with"]["cache-python"] is False verifier = jobs["verify"]["steps"] assert verifier[0]["with"] == {"ref": "${{ github.sha }}", "fetch-depth": 0, "persist-credentials": False} - assert verifier[1]["with"]["cache"] is False + assert verifier[1]["with"] == {"cache": False, "tool": "cargo"} + assert jobs["verify"]["timeout-minutes"] == 60 assert verifier[3]["with"]["artifact-ids"] == "${{ needs.fetch.outputs.artifact-id }}" assert verifier[4]["env"]["CANDIDATE_TRANSFER"] == "${{ inputs.candidate }}" assert 'release-receive "$RUNNER_TEMP/accepted-candidate" --incoming "$RUNNER_TEMP/incoming-candidate"' in verifier[4]["run"] diff --git a/tests/tooling/test_release_flow.py b/tests/tooling/test_release_flow.py index 22be119..18cdafb 100644 --- a/tests/tooling/test_release_flow.py +++ b/tests/tooling/test_release_flow.py @@ -8,6 +8,7 @@ import shlex import subprocess import sys +import tomllib from copy import deepcopy from pathlib import Path from typing import Any @@ -106,7 +107,7 @@ def source(settings: object, tag: str, *, commit: str) -> str: assert selected["run"]["head_sha"] == COMMIT -@pytest.mark.parametrize("outcome", ["success", "automatic", "dispatch-failure", "missing", "wrong-tag", "malformed"]) +@pytest.mark.parametrize("outcome", ["success", "automatic", "renewed", "dispatch-failure", "missing", "wrong-tag", "malformed"]) def test_benchmark_recipe_forwards_one_tag_and_independent_transfer(tmp_path: Path, outcome: str) -> None: transfer = tmp_path / "owner's transfer $literal.json" data = {"schema": 1, "target": {"repository": REPOSITORY, "tag": TAG, "expected_title": TAG}} @@ -123,21 +124,28 @@ def test_benchmark_recipe_forwards_one_tag_and_independent_transfer(tmp_path: Pa newline="\n", ) script = tmp_path / "dispatch.sh" + owner, selection = ((tmp_path / "original owner's $literal").as_posix(), "renewed-ci") if outcome == "renewed" else ("", "reviewed") script.write_text( f'gh() {{ {shlex.quote(Path(sys.executable).as_posix())} {shlex.quote(provider.as_posix())} "$@"; }}\n' - 'just() { [[ "$*" == "--quiet _release-candidate record transfer" ]] || return 90; ' + 'just() { [[ "$#" == 7 && "$1 $2 $3 $4" == "--quiet _release-candidate record transfer" ' + '&& "$5" == "$FIXTURE_OWNER" && "$6" == --selection && "$7" == "$FIXTURE_SELECTION" ]] || return 90; ' '[[ "$FIXTURE_AUTOMATIC" == true ]] || { echo "no original Step 1 owner selection" >&2; return 2; }; printf "%s\\n" "$FIXTURE_TRANSFER"; }\n' - + dry_run(ROOT, "release-benchmarks", [TAG]).stderr, + + dry_run(ROOT, "release-benchmarks", [TAG, *([owner, selection] if outcome == "renewed" else [])]).stderr, encoding="utf-8", newline="\n", ) env = {key: value for key, value in os.environ.items() if key not in {"BASH_ENV", "SHELLOPTS", "BASHOPTS", "CANDIDATE_TRANSFER_FILE"}} env.update(FIXTURE_CALLS=calls.as_posix(), FIXTURE_STATUS="17" if outcome == "dispatch-failure" else "0") - env.update(FIXTURE_AUTOMATIC=str(outcome == "automatic").lower(), FIXTURE_TRANSFER=transfer.as_posix()) - if outcome not in {"missing", "automatic"}: + env.update( + FIXTURE_AUTOMATIC=str(outcome in {"automatic", "renewed"}).lower(), + FIXTURE_TRANSFER=transfer.as_posix(), + FIXTURE_OWNER=owner, + FIXTURE_SELECTION=selection, + ) + if outcome not in {"missing", "automatic", "renewed"}: env["CANDIDATE_TRANSFER_FILE"] = transfer.as_posix() result = run_command("bash", ["--noprofile", "--norc", "-eu", script.as_posix()], cwd=tmp_path, env=env, check=False) - if outcome in {"success", "automatic", "dispatch-failure"}: + if outcome in {"success", "automatic", "renewed", "dispatch-failure"}: assert result.returncode == (17 if outcome == "dispatch-failure" else 0), result.stderr assert json.loads(calls.read_text(encoding="utf-8")) == [ "workflow", @@ -162,7 +170,7 @@ def test_benchmark_recipe_forwards_one_tag_and_independent_transfer(tmp_path: Pa def test_benchmark_dispatch_requires_an_argument() -> None: result = run_command("just", ["release-benchmarks"], cwd=ROOT, check=False) assert result.returncode == 1 - assert "got 0 positional arguments but takes 1" in result.stderr + assert "got 0 positional arguments but takes at least 1" in result.stderr @pytest.mark.parametrize("tag", ["", "main", "v01.2.3", "v1.2.3; touch injected"]) @@ -350,6 +358,27 @@ def test_actual_writer_creates_once_and_retains_exact_draft(draft_handoff: dict[ assert (target.tag, target.commit, target.release_id, target.expected_title) == (TAG, COMMIT, 42, TAG) +def test_release_launcher_selects_the_manifest_uv_and_preserves_arguments(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None: + arguments = ["release-stage", "", (tmp_path / "a target's $literal.json").as_posix(), "renewed-ci"] + script = tmp_path / "launch.py" + script.write_text(dry_run(ROOT, "release-run", arguments).stderr, encoding="utf-8") + monkeypatch.chdir(ROOT) + monkeypatch.setattr(sys, "argv", [str(script), *arguments]) + pin = tomllib.loads((ROOT / "pyproject.toml").read_text(encoding="utf-8"))["tool"]["uv"]["required-version"] + + def launch(command: str, args: list[str], *, timeout: float | None, check: bool) -> subprocess.CompletedProcess[None]: + assert command == "uvx" + assert args == ["--no-config", "--isolated", "--from", f"uv{pin}", "just", *arguments] + assert timeout is None + assert not check + return subprocess.CompletedProcess(args, 17) + + monkeypatch.setattr("research_repo_tools.process.run_command_live", launch) + with pytest.raises(SystemExit) as failure: + runpy.run_path(str(script), run_name="__main__") + assert failure.value.code == 17 + + @pytest.mark.parametrize( "failure", ["ref", "commit", "attempt", "attempt-spelling", "validated-attempt", "artifact", "digest", "expired", "history", "workflow", "native"] ) diff --git a/tests/tooling/test_release_publishing.py b/tests/tooling/test_release_publishing.py index 978825f..89ed1c9 100644 --- a/tests/tooling/test_release_publishing.py +++ b/tests/tooling/test_release_publishing.py @@ -13,12 +13,12 @@ import pytest import yaml -from research_repo_tools import changelog, config, dependency_provenance, release_publishing +from research_repo_tools import changelog, config, dependency_provenance, registry, release_publishing from research_repo_tools.cli import main from research_repo_tools.just_inspect import dry_run from research_repo_tools.process import run_command -from tests.tooling.support_evidence import PIN_JSON, install_clean_checkout +from tests.tooling.support_evidence import install_clean_checkout from tests.tooling.support_toolchain import TOOLING_REQUIREMENT REPO_ROOT = Path(__file__).resolve().parents[2] @@ -225,210 +225,6 @@ def test_workflow_requires_approval_revalidation_and_absence_before_oidc() -> No assert all(command[command.index("toolchain") :][:5] == ["toolchain", "run", "--tool", "cargo", "--"] for command in managed) -@pytest.fixture -def evidence_runner(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None: - """Keep real workflow shell, Just, uv, Python, verifier and output writer.""" - source = (REPO_ROOT / "justfile").read_text(encoding="utf-8") - runtime = f'[script("uvx", "--no-config", "--isolated", "--managed-python", "--python", "3.15", "--from", "{TOOLING_REQUIREMENT}", "python", "-I")]' - assert source.count(runtime) == 3 - # Run the exact recipe body/argument transport with the locked test runtime. - # The separate isolated-runtime smoke and pin test own uvx installation. - source = source.replace(runtime, '[script("uv", "run", "--locked", "--no-sync", "python", "-I", "fixture-bootstrap.py")]') - (tmp_path / "justfile").write_text(source, encoding="utf-8", newline="\n") - uv_pin = tomllib.loads((REPO_ROOT / "pyproject.toml").read_text(encoding="utf-8"))["tool"]["uv"]["required-version"] - (tmp_path / "pyproject.toml").write_text( - f'[project]\nname = "release-fixture"\nversion = "0.0.0"\nrequires-python = ">=3.15"\ndependencies = []\n[tool.uv]\nrequired-version = "{uv_pin}"\n', - encoding="utf-8", - newline="\n", - ) - (tmp_path / ".python-version").write_bytes((REPO_ROOT / ".python-version").read_bytes()) - (tmp_path / "Cargo.toml").write_text('[package]\nname = "la-stack"\nversion = "0.5.42"\n', encoding="utf-8") - (tmp_path / "tooling").mkdir() - (tmp_path / "tooling/release-evidence.toml").write_bytes((REPO_ROOT / "tooling/release-evidence.toml").read_bytes()) - for name in ("BASH_ENV", "SHELLOPTS", "BASHOPTS", "JUST_QUIET", "JUST_DRY_RUN", "FIXTURE_FAILURE", "FIXTURE_DIAGNOSTIC_NEWLINE", "PYTHONPATH"): - monkeypatch.delenv(name, raising=False) - monkeypatch.setenv("FIXTURE_ROOT", str(tmp_path)) - monkeypatch.setenv("FIXTURE_REPO_ROOT", str(REPO_ROOT)) - monkeypatch.setenv("FIXTURE_MODULE_ROOT", str(REPO_ROOT)) - monkeypatch.setenv("RUNNER_TEMP", tmp_path.as_posix()) - monkeypatch.setenv("UV_PROJECT", str(REPO_ROOT)) - monkeypatch.setenv("UV_PROJECT_ENVIRONMENT", sys.prefix) - (tmp_path / "fixture-bootstrap.py").write_text( - 'import os, sys\nsys.path[:0] = [os.environ["FIXTURE_REPO_ROOT"], os.environ["FIXTURE_MODULE_ROOT"]]\n' - "from tests.tooling.support_evidence import run_evidence_fixture\nsys.exit(run_evidence_fixture())\n", - encoding="utf-8", - newline="\n", - ) - - -def run_evidence_shell(script: str, root: Path) -> subprocess.CompletedProcess[str]: - """Execute workflow source from a file, as Actions does, with explicit env.""" - source = root / "workflow.sh" - source.write_text(script, encoding="utf-8", newline="\n") - # Windows putenv removes empty values from the inherited native environment. - # Build the child environment from the mapping to keep empty distinct from unset. - return run_command("bash", ["--noprofile", "--norc", "-eu", source.as_posix()], cwd=root, env=dict(os.environ), check=False, timeout=60) - - -@pytest.mark.usefixtures("evidence_runner") -@pytest.mark.parametrize("quiet", [False, True], ids=["normal", "quiet"]) -@pytest.mark.parametrize("outcome", ["valid", "failed-job", "missing-file", "directory", "unset-output", "empty-output"]) -def test_evidence_export_uses_real_just_and_installed_writer_without_stdout_capture( - tmp_path: Path, monkeypatch: pytest.MonkeyPatch, quiet: bool, outcome: str -) -> None: - script = 'just release-native-evidence --github-output "$GITHUB_OUTPUT"\n' - output = tmp_path / "github output" - original = b"prior=value\r\n" - if outcome == "directory": - output.mkdir() - elif outcome != "missing-file": - output.write_bytes(original) - monkeypatch.setenv("GITHUB_OUTPUT", "" if outcome == "empty-output" else output.as_posix()) - if outcome == "unset-output": - monkeypatch.delenv("GITHUB_OUTPUT") - monkeypatch.setenv("JUST_QUIET", str(quiet).lower()) - monkeypatch.setenv("FIXTURE_FAILURE", outcome) - marker = tmp_path / "verification-passed" - result = run_evidence_shell(script + f"\ntouch {shlex.quote(marker.as_posix())}", tmp_path) - assert result.returncode == (0 if outcome == "valid" else 1), result.stderr - assert marker.exists() == (outcome == "valid") - report = tmp_path / "verifier-result.json" - if outcome == "unset-output": - assert not report.exists() - assert "GITHUB_OUTPUT: unbound variable" in result.stderr - else: - assert report.exists(), result.stderr - observed = json.loads(report.read_text(encoding="utf-8")) - assert observed["arguments"][:1] == ["--github-output"] - assert len(observed["arguments"]) == 2 - if outcome == "empty-output": - assert observed["arguments"][1] == "" - else: - assert Path(observed["arguments"][1]) == output - assert observed["status"] == (0 if outcome == "valid" else 1) - rejection = { - "failed-job": "did not validate required step Verify default and exact Cargo packages", - "missing-file": repr(str(output)), - "directory": "release handoff must be a regular file without links", - "empty-output": "A publication transaction cannot contain overlapping target paths", - "valid": "", - }[outcome] - assert observed["diagnostic"] == "" if outcome == "valid" else rejection in observed["diagnostic"] - if outcome == "valid": - assert output.read_bytes() == original + f"identity={PIN_JSON}\ncommit={SHA}\n".encode() - if not quiet: - # Diagnostics are text; the command-file bytes above must stay LF. - assert result.stdout.splitlines() == ["fixture stdout diagnostic", "Saved verified release evidence."] - assert "fixture stderr diagnostic" in result.stderr - elif outcome == "directory": - assert output.is_dir() - assert list(output.iterdir()) == [] - elif outcome == "missing-file": - assert not output.exists() - else: - assert output.read_bytes() == original - - -@pytest.mark.usefixtures("evidence_runner") -@pytest.mark.parametrize( - ("import_root", "newline"), [(r"C:\agent\test dir\native", "\n"), (r"D:\build's root\new\repo", "\r\n")], ids=["backslashes-lf", "apostrophe-crlf"] -) -def test_evidence_bootstrap_keeps_windows_import_paths_as_environment_data( - tmp_path: Path, monkeypatch: pytest.MonkeyPatch, import_root: str, newline: str -) -> None: - # Exercise literal Windows path data on every host. The explicit harness - # root follows this nonexistent path because isolated Python ignores PYTHONPATH. - monkeypatch.setenv("FIXTURE_REPO_ROOT", import_root) - monkeypatch.setenv("PYTHONPATH", str(REPO_ROOT)) - monkeypatch.setenv("FIXTURE_DIAGNOSTIC_NEWLINE", newline) - output = tmp_path / "github output" - output.touch() - monkeypatch.setenv("GITHUB_OUTPUT", output.as_posix()) - script = 'just release-native-evidence --github-output "$GITHUB_OUTPUT"\n' - result = run_evidence_shell(script, tmp_path) - assert result.returncode == 0, result.stderr - assert result.stdout == "fixture stdout diagnostic" + newline + "Saved verified release evidence." + os.linesep - observed = json.loads((tmp_path / "verifier-result.json").read_text(encoding="utf-8")) - assert observed["status"] == 0 - assert observed["diagnostic"] == "" - assert observed["import_root"] == import_root - assert observed["arguments"][:1] == ["--github-output"] - assert len(observed["arguments"]) == 2 - assert Path(observed["arguments"][1]) == output - assert output.read_bytes() == f"identity={PIN_JSON}\ncommit={SHA}\n".encode() - - -@pytest.mark.usefixtures("evidence_runner") -@pytest.mark.parametrize("quiet", [False, True], ids=["normal", "quiet"]) -@pytest.mark.parametrize("pin", ["valid", "empty", "invalid", "changed"]) -def test_exported_identity_is_revalidated_by_real_just_before_registry_and_token( - tmp_path: Path, monkeypatch: pytest.MonkeyPatch, quiet: bool, pin: str -) -> None: - output = tmp_path / "github output" - output.touch() - monkeypatch.setenv("GITHUB_OUTPUT", output.as_posix()) - monkeypatch.setenv("JUST_QUIET", str(quiet).lower()) - exported = run_evidence_shell('just release-native-evidence --github-output "$GITHUB_OUTPUT"\n', tmp_path) - assert exported.returncode == 0, exported.stderr - report = tmp_path / "verifier-result.json" - assert json.loads(report.read_text(encoding="utf-8"))["status"] == 0 - report.unlink() - record = output.read_text(encoding="utf-8") - assert record == f"identity={PIN_JSON}\ncommit={SHA}\n" - identity = record.splitlines()[0].removeprefix("identity=") - variants = {"valid": identity, "empty": "", "invalid": "{", "changed": identity.replace('"run_attempt":2', '"run_attempt":1')} - monkeypatch.setenv("CI_EVIDENCE", variants[pin]) - monkeypatch.setenv("RELEASE_TAG", TAG) - registry = tmp_path / "registry-reached" - token = tmp_path / "token-reached" - # The other release and registry gates are independently covered below. - # Keep evidence verification real and stop before any credentials or upload. - runner = f'uv() {{\n [[ "$4 $5 $6" == "research-repo-tools release registry" ]] || return 90\n touch {shlex.quote(registry.as_posix())}\n}}\n' - runner += 'just() { if [[ "$1" == release-gate ]]; then return 0; fi; command just "$@"; }\n' - script = ( - "set -euo pipefail\n" - 'test -n "$CI_EVIDENCE"\n' - 'printf "%s\\n" "$CI_EVIDENCE" > "$RUNNER_TEMP/approved-evidence.json"\n' - 'just release-native-evidence --expected "$RUNNER_TEMP/approved-evidence.json"\n' - 'uv run --locked --no-sync research-repo-tools release registry "$RELEASE_TAG" --expect absent\n' - ) - result = run_evidence_shell(runner + script + f"\ntouch {shlex.quote(token.as_posix())}", tmp_path) - if pin != "empty": - assert report.exists(), result.stderr - observed = json.loads(report.read_text(encoding="utf-8")) - assert observed["arguments"][:1] == ["--expected"] - assert Path(observed["arguments"][1]) == tmp_path / "approved-evidence.json" - assert (tmp_path / "approved-evidence.json").read_text(encoding="utf-8") == variants[pin] + "\n" - assert result.returncode == (0 if pin == "valid" else 1), result.stderr - assert registry.exists() == (pin == "valid") - assert token.exists() == (pin == "valid") - if pin == "empty": - assert not report.exists() - else: - observed = json.loads(report.read_text(encoding="utf-8")) - assert observed["status"] == (0 if pin == "valid" else 1) - rejection = "Expecting property name" if pin == "invalid" else "selected run or attempt changed" - assert observed["diagnostic"] == "" if pin == "valid" else rejection in observed["diagnostic"] - - -@pytest.mark.usefixtures("evidence_runner") -@pytest.mark.parametrize("quiet", [False, True], ids=["normal", "quiet"]) -def test_explicit_empty_identity_cannot_select_fresh_evidence(tmp_path: Path, monkeypatch: pytest.MonkeyPatch, quiet: bool) -> None: - monkeypatch.setenv("JUST_QUIET", str(quiet).lower()) - output = tmp_path / "github output" - original = b"prior=value\n" - output.write_bytes(original) - monkeypatch.setenv("GITHUB_OUTPUT", output.as_posix()) - expected = tmp_path / "empty.json" - expected.write_bytes(b"") - result = run_evidence_shell('just release-native-evidence --expected empty.json --github-output "$GITHUB_OUTPUT"\n', tmp_path) - observed = json.loads((tmp_path / "verifier-result.json").read_text(encoding="utf-8")) - assert observed["arguments"][:2] == ["--expected", "empty.json"] - assert result.returncode == observed["status"] == 1 - assert "Expecting value" in observed["diagnostic"] - assert output.read_bytes() == original - - @pytest.mark.parametrize( ("failure", "expected_exit"), [("none", 0), ("dependency-builds", 1), ("evidence", 1), ("candidate", 1), ("present", 1), ("unavailable", 2)] ) @@ -606,6 +402,47 @@ def create(arguments: list[str]) -> int: assert (b"eligible" in data) == (source == "published") +@pytest.mark.parametrize("outcome", ["visible", "draft", "missing-asset", "incomplete-asset", "absent-version"]) +def test_release_visibility_checks_remote_state_without_local_release_preparation(tmp_path: Path, monkeypatch: pytest.MonkeyPatch, outcome: str) -> None: + script = tmp_path / "visibility.py" + script.write_text(dry_run(REPO_ROOT, "release-verify", [TAG]).stderr, encoding="utf-8") + monkeypatch.chdir(REPO_ROOT) + monkeypatch.setattr(sys, "argv", [str(script), TAG]) + calls: list[str] = [] + release = release_publishing.GitHubRelease( + repository="acgetchell/la-stack", + tag=TAG, + identifier=42, + draft=outcome == "draft", + immutable=outcome != "draft", + prerelease=False, + assets=() if outcome == "missing-asset" else ((f"la-stack-{TAG}-criterion-baseline.tar.gz", 7, 100, None),), + title=TAG, + asset_states=((7, "starter" if outcome == "incomplete-asset" else "uploaded"),), + ) + + def github(root: Path, repository: str, tag: str) -> release_publishing.GitHubRelease: + assert (root, repository, tag) == (REPO_ROOT, "acgetchell/la-stack", TAG) + calls.append("github") + return release + + def visible(destination: str, package: str, version: str, *, attempts: int) -> registry.RegistryVersion: + assert (destination, package, version, attempts) == ("crates-io", "la-stack", VERSION, 7) + calls.append("registry") + return registry.RegistryVersion("crates-io", package, version, outcome != "absent-version") + + monkeypatch.setattr("research_repo_tools.release_assets.lookup_release", github) + monkeypatch.setattr(registry, "wait_for_version", visible) + monkeypatch.setattr(dependency_provenance, "check_release_dependencies", lambda *_args, **_kwargs: pytest.fail("visibility repeated local provenance")) + monkeypatch.setattr(changelog, "notes", lambda *_args: pytest.fail("visibility regenerated local notes")) + if outcome == "visible": + runpy.run_path(str(script), run_name="__main__") + else: + with pytest.raises(SystemExit, match=r"immutable|Missing completed release assets|not visible"): + runpy.run_path(str(script), run_name="__main__") + assert calls == (["github", "registry"] if outcome in {"visible", "absent-version"} else ["github"]) + + def test_native_packaging_failure_stops_before_further_validation(tmp_path: Path) -> None: script = dry_run(REPO_ROOT, "publish-check").stderr calls = tmp_path / "calls" diff --git a/tests/tooling/test_security_integration.py b/tests/tooling/test_security_integration.py index 6048373..46af988 100644 --- a/tests/tooling/test_security_integration.py +++ b/tests/tooling/test_security_integration.py @@ -14,6 +14,7 @@ REPO_ROOT = Path(__file__).resolve().parents[2] FROZEN_RUN = "docs/performance-runs/runs/2e55909621d0aacbfa7670f678574ae750311ba29353e6e9ebb11461414876a2/run.json" +V054_RUN = "docs/performance-runs/runs/c71813e122e5fde26d26511b6a57ca21e5a24ed1b03bce2905029cf518ffd29e/run.json" LEAK_FOUND = 3 @@ -42,12 +43,18 @@ def test_historical_alias_exception_is_limited_to_its_assignment_and_path(tmp_pa @pytest.mark.parametrize("representation", ["direct", "chunk", "payload"]) @pytest.mark.parametrize( ("relative", "credential", "status"), - [(FROZEN_RUN, False, 0), (FROZEN_RUN, True, LEAK_FOUND), ("docs/performance-runs/other.json", False, LEAK_FOUND)], + [ + (FROZEN_RUN, False, 0), + (FROZEN_RUN, True, LEAK_FOUND), + (V054_RUN, False, 0), + (V054_RUN, True, LEAK_FOUND), + ("docs/performance-runs/other.json", False, LEAK_FOUND), + ], ) def test_frozen_statistics_exception_preserves_other_secret_detection( tmp_path: Path, representation: str, relative: str, *, credential: bool, status: int ) -> None: - """Only the frozen run's encoded numerical fields are exempted.""" + """Only the frozen runs' encoded numerical fields are exempted.""" fences = b"[23.01652962024839,23.323939759650607,24.143700131389842,24.451110270792054]" encoded = base64.b64encode(fences).decode("ascii") record = {} @@ -67,6 +74,22 @@ def test_frozen_statistics_exception_preserves_other_secret_detection( assert result.returncode == status, result.stderr +@pytest.mark.parametrize( + ("relative", "frozen", "status"), + [(V054_RUN, True, 0), (V054_RUN, False, LEAK_FOUND), ("docs/performance-runs/other.json", True, LEAK_FOUND)], +) +def test_truncated_tukey_field_exception_is_limited_to_the_frozen_value(tmp_path: Path, relative: str, *, frozen: bool, status: int) -> None: + """A clipped key is exempted only with its original value and report path.""" + original = b"[11.061047972370767,11.456482165636142,12.51097334767714,12.906407540942514]" + other = b"[23.01652962024839,23.323939759650607,24.143700131389842,24.451110270792054]" + encoded = base64.b64encode(original if frozen else other).decode("ascii") + source = tmp_path / relative + source.parent.mkdir(parents=True, exist_ok=True) + source.write_text(f'key.json": "{encoded}"\n', encoding="utf-8", newline="\n") + result = scan_secrets(tmp_path) + assert result.returncode == status, result.stderr + + def scan_secrets(root: Path) -> subprocess.CompletedProcess[str]: """Exercise the installed scanner with the real consumer policy.""" return run_command( diff --git a/tests/tooling/test_toolchain_integration.py b/tests/tooling/test_toolchain_integration.py index 4c7b05d..7558560 100644 --- a/tests/tooling/test_toolchain_integration.py +++ b/tests/tooling/test_toolchain_integration.py @@ -158,6 +158,9 @@ def test_source_build_policy_covers_native_dependencies_and_pinned_build_tools() @pytest.mark.parametrize("outcome", ["development", "published", "invalid-pin", "build-failure", "proof-failure"]) def test_ci_dependency_recipe_preserves_development_pins_and_propagates_failures(tmp_path: Path, monkeypatch: pytest.MonkeyPatch, outcome: str) -> None: recipe = inspect_justfile(REPO_ROOT).recipes["ci-dependencies"] + interpreter = next(attribute["script"] for attribute in recipe["attributes"] if "script" in attribute) + assert interpreter["command"] == "uv" + assert interpreter["arguments"][-7:] == ["toolchain", "run", "--tool", "cargo", "--", "python", "-I"] script = tmp_path / "native provenance.py" script.write_text("\n".join("".join(line) for line in recipe["body"]), encoding="utf-8", newline="\n") calls: list[list[str]] = [] @@ -230,7 +233,7 @@ def test_isolated_release_runtime_uses_the_same_selection_outside_checkout(tmp_p source = (REPO_ROOT / "justfile").read_text(encoding="utf-8") assert ( source.count(f'[script("uvx", "--no-config", "--isolated", "--managed-python", "--python", "3.15", "--from", "{TOOLING_REQUIREMENT}", "python", "-I")]') - == 3 + == 4 ) (tmp_path / "research_repo_tools.py").write_text('raise RuntimeError("untrusted checkout import")\n', encoding="utf-8") (tmp_path / "tooling").mkdir() diff --git a/tests/tooling/test_validation_graph.py b/tests/tooling/test_validation_graph.py index f89ff03..98f6be2 100644 --- a/tests/tooling/test_validation_graph.py +++ b/tests/tooling/test_validation_graph.py @@ -141,6 +141,7 @@ def test_managed_cache_contains_compilation_only_and_release_jobs_disable_it() - for step in job["steps"]: if step.get("uses") == "./.github/actions/setup-tools": assert str(step["with"]["cache"]).lower() == "false" + assert step["with"]["tool"] == "cargo" assert not step.get("uses", "").startswith("actions/cache@") diff --git a/tooling/README.md b/tooling/README.md index 5f072bb..4420a20 100644 --- a/tooling/README.md +++ b/tooling/README.md @@ -44,7 +44,7 @@ exit alone also accepts a broken import or shell. When quiet mode hides diagnostics, retain the verifier's arguments, exit status and diagnostic in a fixture-owned result file. -The candidate and native evidence recipes use Just's isolated uvx/Python script interpreter +The candidate recipes use Just's isolated uvx/Python script interpreter and the shared `isolated_release_runtime` context manager. Asset operations use the shared `release --isolated-runtime` CLI. The supplier owns managed-tool selection, checkout-path exclusion, and environment restoration; local recipes @@ -53,8 +53,8 @@ MSYS applies shell-like argument expansion when started by a native Windows program, which can corrupt JSON passed as Bash positional arguments; see [MSYS2 #522](https://github.com/msys2/MSYS2-packages/issues/522). The integration fixture keeps the real Just, uv and Python launch and substitutes only the -entry point's provider responses. It checks the exact received identity and -rejects an explicitly empty pin rather than selecting fresh evidence. +entry point's external responses. Candidate tests check that the exact +transfer arguments reach the isolated runtime. Semgrep scans and fixture checks share the root Python 3.15 environment and lockfile. Preserve its native-wheel requirement and compatibility overrides in `pyproject.toml`. @@ -105,13 +105,13 @@ the next release check after such changes. These receipts establish observed source/build provenance, not reproducible builds or publisher-signed wheels. See the supplier's [source-build contract](https://github.com/acgetchell/research-repo-tools/blob/v0.2.9/README.md#source-built-python-dependencies). -Native CI runs `just ci-dependencies` in the `dependencies` stage of the `native` -job alongside the Rust, Python, and candidate-acceptance stages after shared policy checks. Signed release evidence -requires every native stage. A verified exact development -tooling pin skips this release-only preparation; invalid pins and failed builds -or verification still fail. Release jobs with fresh project environments prepare -their own receipts before acquisition/acceptance verification. Local `just ci` -retains its ordinary validation scope. +Native CI runs `just ci-dependencies` in each `native-dependencies (OS)` +job after shared policy checks. Signed release evidence requires these jobs and +the Rust, Python, and candidate-acceptance jobs on all supported OSes. A +verified exact development tooling pin skips this release-only preparation. +Invalid pins and failed builds or verification still fail. Hosted release +verification jobs prepare their own receipts before checking acceptance. +Local `just ci` retains its ordinary validation scope. Normal `just update` preserves the included tooling group's exact supplier pin, any immutable source commit and inherited tool versions while updating unrelated @@ -321,14 +321,11 @@ report and plot rendering after scratch cleanup. Shared implementation matrices live upstream, including `tests/performance/public_complete_consumer.py` and `public_criterion_consumer.py`, exercised from wheel and sdist installations. -The shared package also owns `public_suites_consumer.py`, which covers suite selection, raw-file -digests, archive paths, original host retention and complete assembly failures. -Legacy suite archive consumer fixtures retain public `pack-suite` and -`assemble-suites` coverage; `bench-release-check-suite` remains diagnostic. -New releases derive archives from the original candidate through shared APIs. -There is no local suite verifier, comparison engine or archive merger. -Consumer tests retain independent scientific selections, actual recipe wiring, -saved archive round trips, publication boundaries and historical hashes. +The shared package also tests legacy suite archive packaging, extraction, +raw-file digests, and original host retention in `public_suites_consumer.py`. +Releases derive archives from the original candidate through shared APIs. +Consumer tests cover independent scientific selections, actual recipe wiring, +saved-baseline verification, publication boundaries and historical hashes. ## Changelog and release tooling @@ -345,9 +342,11 @@ explicit dates remain supported. Generation never advances citation metadata. The publishing declaration selects only `la-stack`, requires native platform and scientific checks on the exact commit, and requires the durable Criterion -release asset. `release-gate`, `release-publish` and `release-verify` -use the shared release contract; `publish-check` owns native default/exact -Cargo dry-runs. Main CI signs those packaging and native validation identities; +release asset. `release-publish` and the upload workflow enforce the shared +release policy. `release-verify` checks remote visibility of the immutable +release, required assets, and exact crates.io version. `publish-check` owns +native default/exact Cargo dry-runs. Main CI signs those packaging and native +validation identities. `just release-evidence [OWNER] [SELECTION]` binds the original acquisition, precise publisher receipt, final clean commit and signed native acceptance. Named review records are immutable; RRT retains the final policy and acceptance in one transaction. @@ -365,8 +364,8 @@ RRT's `stage_release_assets` owns the per-asset journal and exact-byte retries. Retain `staging.json` and `staged-assets.json` alongside the original transfer; `release-publication` adds canonical archive ID/hash assertions. Two maintainer dispatches use those -independent records. Write-scope hosted jobs execute no checkout code; -read-only verification authenticates full acceptance with an owner-reviewed +independent records. Hosted jobs that write GitHub release assets execute no +checkout code. Read-only verification authenticates full acceptance with an owner-reviewed SHA-256 and freezes its bytes in an immutable Actions artifact across approval. Explicit native-evidence renewal changes that reviewed receipt while retaining the original immutable release archive and asset selections. @@ -376,8 +375,8 @@ the original immutable release archive and asset selections. without registry credentials. The release guide owns retention, complete-rerun recovery and the distinction between reused checks and Cargo repackaging. `tests/tooling/test_release_flow.py` exercises the actual draft writer with the -installed verifier and draft API, plus canonical `release-benchmarks TAG` -forwarding with automatic original-owner lookup or explicit `CANDIDATE_TRANSFER_FILE`. +installed verifier and draft API, plus `release-benchmarks` forwarding with +automatic original-owner lookup, a named selection, or explicit `CANDIDATE_TRANSFER_FILE`. Step 1 retains the immutable external owner selection; routine Step 2 recipes need no `OWNER` or `RELEASE_COMMIT` shell variables. `release-upload` dispatches the existing reviewed publication selection without approving deployment.