Repository navigation
ci(pypi): qualify local wheelhouse installs with a fail-closed aggregate (#4631) #4827
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1e8ece8
ci(pypi): qualify local wheelhouse installs with a fail-closed aggreg…
cursoragent e0a1588
fix(xtask): export wheelhouse module and borrow report paths (#4631)
cursoragent 97e5636
test(xtask): pin uppercase digest letters and the quoted pip install …
cursoragent 86c02ba
fix(xtask): mark wheelhouse qualify as CI-enforced and drop unused in…
cursoragent 176cac3
fix(xtask): satisfy clippy on wheelhouse matrix checks and workflow p…
cursoragent 2ab9f0b
merge origin/main into wheelhouse qualification candidate (#4631)
cursoragent 4142151
fix(ci): probe wheelhouse network and checkout honestly (#4631)
cursoragent File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,128 @@ | ||
| name: Python Wheelhouse Qualification | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| candidate_sha: | ||
| description: "Immutable candidate commit SHA (40 hexadecimal characters)" | ||
| required: true | ||
| type: string | ||
|
|
||
| # Credential-free wheelhouse rehearsal for #4631. No registry write, OIDC, | ||
| # secret, tag, or release permission exists on this workflow. | ||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: python-wheelhouse-qualification-${{ inputs.candidate_sha }} | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| qualify: | ||
| name: local wheelhouse pip and uv rows | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 60 | ||
| env: | ||
| CANDIDATE_SHA: ${{ inputs.candidate_sha }} | ||
| CARGO_TERM_COLOR: always | ||
| steps: | ||
| - name: Initialize receipt root | ||
| run: | | ||
| set -euo pipefail | ||
| base="${RUNNER_TEMP}/ripr-python-wheelhouse" | ||
| mkdir -p "${base}/receipts/rows" "${base}/wheelhouse" "${base}/consumer" "${base}/decoy" | ||
| echo "QUAL_ROOT=${base}/receipts" >> "$GITHUB_ENV" | ||
| echo "WHEELHOUSE=${base}/wheelhouse" >> "$GITHUB_ENV" | ||
| echo "CONSUMER_ROOT=${base}/consumer" >> "$GITHUB_ENV" | ||
| echo "DECOY_ROOT=${base}/decoy" >> "$GITHUB_ENV" | ||
|
|
||
| - name: Checkout immutable candidate | ||
| uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 | ||
| with: | ||
| ref: ${{ inputs.candidate_sha }} | ||
| fetch-depth: 1 | ||
| persist-credentials: false | ||
|
|
||
| - name: Verify candidate identity | ||
| run: | | ||
| set -euo pipefail | ||
| [[ "${CANDIDATE_SHA}" =~ ^[0-9a-fA-F]{40}$ ]] | ||
| test "$(git rev-parse HEAD)" = "${CANDIDATE_SHA,,}" | ||
| test "$(git rev-parse HEAD^{tree})" | ||
| python3 -c "import json,os,pathlib,subprocess; p=pathlib.Path(os.environ['QUAL_ROOT'])/'candidate-identity.json'; p.write_text(json.dumps({'source_commit':subprocess.check_output(['git','rev-parse','HEAD'],text=True).strip(),'source_tree':subprocess.check_output(['git','rev-parse','HEAD^{tree}'],text=True).strip(),'limitations':[],'non_claims':['no PyPI publication','no compatibility-floor claim','no support-tier promotion']},indent=2)+'\n')" | ||
|
|
||
| - name: Set up Rust | ||
| uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4 # 1.95 | ||
| with: | ||
| toolchain: 1.95.0 | ||
|
|
||
| - name: Stage local wheelhouse | ||
| run: | | ||
| set -euo pipefail | ||
| shopt -s nullglob | ||
| cp dist/wheels/*.whl "${WHEELHOUSE}/" 2>/dev/null || true | ||
| cp packaging/python/dist/*.whl "${WHEELHOUSE}/" 2>/dev/null || true | ||
| python3 -m pip install --user uv | ||
| printf '%s\n' '#!/bin/sh' 'echo planted-wrong-path' > "${DECOY_ROOT}/ripr" | ||
| chmod +x "${DECOY_ROOT}/ripr" | ||
|
|
||
| - name: Isolated pip and uv wheelhouse installs | ||
| run: | | ||
| set -euo pipefail | ||
| cd "${CONSUMER_ROOT}" | ||
| export PIP_NO_INDEX=1 UV_OFFLINE=1 | ||
| if python3 -c "import urllib.request; urllib.request.urlopen('https://pypi.org', timeout=5)"; then network=false; else network=true; fi | ||
| export PATH="${CONSUMER_ROOT}/venv/bin:${CONSUMER_ROOT}/uv/bin:${DECOY_ROOT}:/usr/bin:/bin" | ||
| cargo_ok=false; ambient=false; planted=false; source_ok=false | ||
| if command -v cargo >/dev/null || command -v rustc >/dev/null; then cargo_ok=true; fi | ||
| if [ -x /usr/bin/ripr ] || [ -x /bin/ripr ]; then ambient=true; fi | ||
| if [ "$(command -v ripr 2>/dev/null || true)" = "${DECOY_ROOT}/ripr" ] && [ "$(ripr)" = "planted-wrong-path" ]; then planted=true; fi | ||
| if test -r "${GITHUB_WORKSPACE}/Cargo.toml"; then source_ok=true; fi | ||
| shopt -s nullglob | ||
| wheels=("${WHEELHOUSE}"/*.whl) | ||
| if [ ${#wheels[@]} -ne 1 ]; then | ||
| echo "need exactly one staged wheel; required pip/uv rows stay missing pending #4490" >&2 | ||
| exit 0 | ||
| fi | ||
| python3 -m venv "${CONSUMER_ROOT}/venv" | ||
| "${CONSUMER_ROOT}/venv/bin/pip" install --no-index --find-links "${WHEELHOUSE}" ripr-rs | ||
| mkdir -p "${CONSUMER_ROOT}/uv/bin" | ||
| PATH="${HOME}/.local/bin:${PATH}" UV_TOOL_BIN_DIR="${CONSUMER_ROOT}/uv/bin" UV_TOOL_DIR="${CONSUMER_ROOT}/uv/tools" UV_FIND_LINKS="${WHEELHOUSE}" HOME="${CONSUMER_ROOT}" uv tool install --offline ripr-rs | ||
| pip_bin="${CONSUMER_ROOT}/venv/bin/ripr" | ||
| uv_bin="${CONSUMER_ROOT}/uv/bin/ripr" | ||
| test -x "${pip_bin}" && test "${pip_bin}" != "${DECOY_ROOT}/ripr" | ||
| test -x "${uv_bin}" && test "${uv_bin}" != "${DECOY_ROOT}/ripr" | ||
| test "$(command -v ripr)" != "${DECOY_ROOT}/ripr" | ||
| python3 - "$pip_bin" "$uv_bin" "$cargo_ok" "$source_ok" "$ambient" "$planted" "$network" "${wheels[0]}" <<'PY' | ||
| import hashlib, json, os, pathlib, sys | ||
| wheel = pathlib.Path(sys.argv[8]) | ||
| sha = hashlib.sha256(wheel.read_bytes()).hexdigest() | ||
| root = pathlib.Path(os.environ["QUAL_ROOT"]) / "rows" | ||
| root.mkdir(parents=True, exist_ok=True) | ||
| def digest(path): | ||
| return hashlib.sha256(pathlib.Path(path).read_bytes()).hexdigest() | ||
| def flag(index): | ||
| return sys.argv[index] == "true" | ||
| def write(client, binary): | ||
| row = {"client": client, "os": "linux", "arch": "x86_64", "status": "failed", | ||
| "wheel_filename": wheel.name, "wheel_sha256": sha, "payload_sha256": digest(binary), | ||
| "subject_count": 0, "cargo_reachable": flag(3), "source_checkout_reachable": flag(4), | ||
| "ambient_ripr_reachable": flag(5), "planted_wrong_path_detected": flag(6), | ||
| "network_disabled_after_staging": flag(7), | ||
| "limitations": ["installed-use analysis is owned by #4626; subject_count stays 0 so this row cannot pass"]} | ||
| (root / f"{client}.json").write_text(json.dumps(row, indent=2) + "\n") | ||
| write("pip", sys.argv[1]); write("uv", sys.argv[2]) | ||
| PY | ||
|
|
||
| - name: Evaluate wheelhouse aggregate | ||
| if: always() | ||
| run: cargo xtask qualify-python-wheelhouse --receipts "${QUAL_ROOT}" | ||
|
|
||
| - name: Upload Actions-only receipts | ||
| if: always() | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 | ||
| with: | ||
| name: python-wheelhouse-qualification-${{ inputs.candidate_sha }} | ||
| path: ${{ runner.temp }}/ripr-python-wheelhouse/receipts | ||
| if-no-files-found: error | ||
| retention-days: 5 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| # Python wheelhouse qualification | ||
|
|
||
| `Python Wheelhouse Qualification` is an Actions-only rehearsal lane for | ||
| [#4631](https://github.com/EffortlessMetrics/ripr-swarm/issues/4631). It | ||
| installs candidate wheels from a local wheelhouse with pip and uv, then | ||
| evaluates a fail-closed aggregate. It is not a publisher and does not replace | ||
| [#4490](https://github.com/EffortlessMetrics/ripr-swarm/issues/4490), | ||
| [#4626](https://github.com/EffortlessMetrics/ripr-swarm/issues/4626), or the | ||
| generic cross-channel DTO in | ||
| [#4630](https://github.com/EffortlessMetrics/ripr-swarm/issues/4630). | ||
|
|
||
| ## Invocation | ||
|
|
||
| Dispatch `.github/workflows/python-wheelhouse-qualification.yml` with: | ||
|
|
||
| - `candidate_sha`: the full 40-character immutable candidate commit SHA. | ||
|
|
||
| The job checks out that SHA with `contents: read` and `persist-credentials: | ||
| false`, stages `dist/wheels` or `packaging/python/dist` when present, installs | ||
| through isolated pip and uv consumers, and retains receipts as an Actions | ||
| artifact for 5 days. Staging must yield exactly one wheel; zero or mixed | ||
| filenames leave the required rows missing. The workflow hashes that one staged | ||
| path rather than the first glob match. | ||
|
|
||
| Network isolation is an independent `urllib.request.urlopen('https://pypi.org')` | ||
| probe after `PIP_NO_INDEX`/`UV_OFFLINE` are set. Source-checkout reachability | ||
| is whether `${GITHUB_WORKSPACE}/Cargo.toml` is readable from the consumer | ||
| working directory. This lane does not add a sandbox or filesystem unmount, so | ||
| those probes typically remain true on GitHub-hosted runners and fail closed. | ||
|
|
||
| ## Gate | ||
|
|
||
| `cargo xtask qualify-python-wheelhouse --receipts <file-or-dir>` is the | ||
| authority. A required linux/x86_64 pip or uv row can pass only when it records | ||
| exact wheel and payload digests, a matching wheel filename across required | ||
| passed rows, a nonzero subject count, no Cargo/source checkout/ambient `ripr` | ||
| escape, a detected planted wrong-PATH binary, and network disabled after | ||
| staging. Failed, `not_run`, unsupported, missing, zero-subject, or mismatched | ||
| rows cannot satisfy the aggregate. | ||
|
|
||
| When this candidate has no staged wheels, or more than one, the required rows | ||
| stay missing and the aggregate cannot pass. That is the honest result until | ||
| #4490 produces a single wheelhouse artifact. Installed-use analysis remains | ||
| #4626; a wheel install without a nonzero discriminator still cannot pass. | ||
|
|
||
| ## Claim boundary | ||
|
|
||
| A passing run would establish that the named candidate's selected linux/x86_64 | ||
| wheel installed from a local wheelhouse through pip and uv with the isolation | ||
| controls above. It does not establish PyPI publication, a compatibility floor, | ||
| a support-tier promotion, or the five-target matrix. A green pip `--no-index` | ||
| install is not network isolation; a PATH that omits the checkout is not a | ||
| source-checkout barrier. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| schema_version = "1.0" | ||
| policy_state = "credential-free-rehearsal" | ||
| enforcement = "workflow_dispatch_only" | ||
| owner = "repo-maintainers" | ||
| workflow = ".github/workflows/python-wheelhouse-qualification.yml" | ||
| issues = [4631, 4493] | ||
| channel = "pypi-wheelhouse" | ||
| publication = "forbidden" | ||
| secrets = "forbidden" | ||
| receipt_transport = "actions_artifact_only" | ||
| max_artifact_retention_days = 5 | ||
| admitted_os = "linux" | ||
| admitted_arch = "x86_64" | ||
| required_clients = ["pip", "uv"] | ||
|
|
||
| # This lane qualifies local-wheelhouse installs for the selected OS/arch. | ||
| # It does not build the ripr-rs adapter, claim compatibility floors, or | ||
| # authorize publication. Missing, skipped, zero-subject, or mismatched rows | ||
| # cannot pass the aggregate. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.