diff --git a/.github/workflows/release-candidate.yml b/.github/workflows/release-candidate.yml index c28ae419..dad4a965 100644 --- a/.github/workflows/release-candidate.yml +++ b/.github/workflows/release-candidate.yml @@ -30,6 +30,7 @@ permissions: jobs: transfer: + if: github.ref == 'refs/heads/main' runs-on: ubuntu-latest permissions: contents: write # Draft asset access; this job never extracts or executes the bundle. @@ -81,6 +82,7 @@ jobs: minimum_host: needs: transfer + if: github.ref == 'refs/heads/main' # Provision this dedicated physical host in WP0; never substitute a moving hosted label. runs-on: [self-hosted, macOS, ARM64, jmlx-release-minimum] permissions: diff --git a/req/phase8-4-minimum-host-setup.md b/req/phase8-4-minimum-host-setup.md new file mode 100644 index 00000000..584633c8 --- /dev/null +++ b/req/phase8-4-minimum-host-setup.md @@ -0,0 +1,226 @@ +# Phase 8.4 minimum-host runner setup + +Provisioned and connectivity checked: 2026-11-16. No candidate has been executed. +This implements the runner prerequisites in +[the plan](plans/phase8-4-plan.md) and +[release workflow](../.github/workflows/release-candidate.yml). + +## Available host and existing runner + +Read-only local inspection found: + +| Item | Observed value | +| --- | --- | +| OS | macOS 27.2.1, build 26B131 | +| Architecture | arm64 | +| CPU and GPU model | Apple M5 Max | +| `kern.hv_vmm_present` | `0` | +| Existing repository runner | `local-m5-max`, runner ID 22, online and idle at inspection | +| Existing labels | `self-hosted`, `macOS`, `ARM64`, `self-macos-xl` | +| Existing service account | `ghrunner`, UID 502, not in the admin group | + +These observations establish an available host at the declared 27.2.x support floor. +They do not establish Metal execution of a signed candidate. The runner's online/idle +status is transient. No machine serial number or registration credential is retained here. + +The existing runner serves `tier-b.yml` and `vlm-first-use-smoke.yml`, including the latter's +same-repository PR-label trigger. It is not the dedicated manual-only release runner required +by the plan. Leave its registration and labels intact. Use a separate standard macOS account +and a separate runner installation; two installations under the same account would still +share that account's state. The owner approved creating `jmlxrunner`; it is now provisioned +with UID 503 and a private (`0700`) home. At provisioning its runner was +`jmlx-release-minimum-m5-max`, ID 23, with labels `self-hosted`, `macOS`, `ARM64`, +`jmlx-release-minimum`. The original runner's registration and labels were preserved. + +## Completed setup and operation + +The [retained evidence](plans/evidence/minimum-host-runner-2026-11-16/setup.json) +records host measurements made as `jmlxrunner`, account permission checks, runner package +identity and connectivity. GitHub runner v2.338.2 was downloaded from its official release +and SHA-256 checked before installation. The new listener connected and reached +`Listening for Jobs` under `jmlxrunner`; GitHub also reported it online and idle. +It was then stopped and GitHub reported it offline. No job was dispatched. + +The generated account password was not retained. The account is used through a non-root +service identity, rather than interactive password login; an administrator can reset its +password if interactive access is later needed. No owner profiles or credentials were copied. +Permission tests as the new account confirmed it cannot read the owner's Gradle properties +or traverse the owner's SSH and signing directories. Its own corresponding credential +locations are absent. These are scoped filesystem checks, not a machine-wide secret scan. + +The custom [launchd definition](plans/evidence/minimum-host-runner-2026-11-16/com.alipsa.jmlx-release-runner.plist) +is installed at `/Library/LaunchDaemons/com.alipsa.jmlx-release-runner.plist`. +The connectivity check used the documented `launchctl bootstrap` and `kickstart` commands, +including the configured log directory; it did not use `./run.sh`. +The service launches GitHub's `runsvc.sh` with `UserName=jmlxrunner` and an explicit account +home. `runsvc.sh` replaces launchd's PATH with the configuration-time `.path`; the listener +also restores `.env`. Inspection as the account found `.path` equal to the deliberately +supplied clean PATH and `.env` empty. Their digests are retained in +[the review evidence](plans/evidence/minimum-host-runner-2026-11-16/review.json). +Neither contains the owner's home or an inherited `JAVA_HOME`. Configuration used `env -i`, +not the owner's shell environment. Both `RunAtLoad` and `KeepAlive` are disabled. +The definition remains installed but unloaded; it will not start the worker on reboot. +GitHub's own runner authentication files are private to the account. Reinspect these saved +files before each release window; the plist alone does not control the effective environment. + +Python and Git resolve to **owner-managed Homebrew** installations under `/opt/homebrew`. +The review records selected/resolved executable paths, owners, groups, modes and versions. +This setup isolates release-account credentials; it does not isolate the toolchain from +the owner who can modify Homebrew. Upgrades can change executable paths and versions. +Resolve and record them again before each window and review any change before acceptance. + +The owner's Gradle properties file is now mode `0600`, rather than relying solely on +parent-directory permissions. The account still cannot read or write it. The sharing group +`com.apple.sharepoint.group.1` includes `everyone` through a nested group, explaining the +new account's membership. Inspection found a guest share configured; `smbd` was not loaded +at inspection. Public evidence retains only that boolean, without share identity or write mode. +No new share was created for `jmlxrunner`. This is not proof that File Sharing is globally +disabled or that all network sharing access has been audited; keep the private account home +and recheck sharing at window time. + +For a reviewed release verification window, a host administrator can start it with: + +```sh +sudo launchctl bootstrap system /Library/LaunchDaemons/com.alipsa.jmlx-release-runner.plist +sudo launchctl kickstart system/com.alipsa.jmlx-release-runner +``` + +After the job finishes, stop and unload it with: + +```sh +sudo launchctl bootout system/com.alipsa.jmlx-release-runner +``` + +These administrative commands manage launchd; the runner process itself runs as UID 503. +Recheck account isolation and the candidate workflow before each window. Exact-bundle Metal +execution, measured Java 21/25 consumer runtimes and acceptance reports remain outstanding. + +## Provisioning reference + +1. Have a host administrator create a **Standard** account with its own home. Do not enable + administrator access, passwordless sudo, iCloud synchronization or shared personal folders. + For interactive use, keep its password in the host's normal password manager, outside + release evidence. The current service-only setup uses an unretained generated password. +2. Run setup as that account. Provision Git and Python 3.11+ on its PATH. The workflow installs + Java 21 and 25 through `actions/setup-java`; it does not need the owner's JDK or Gradle home. + Provide network access for GitHub Actions, the Gradle wrapper and Maven dependencies. +3. Verify the account is non-root and non-admin with `id -u` and `id -Gn`. Confirm it cannot + read the owner's Gradle properties, SSH private keys or signing key material. Check access + using file permission tests, without printing their contents. Do not copy credentials or + shell profiles from the owner's account. Any failed isolation check leaves readiness open. +4. In the new account, use the current download and checksum commands from + [Alipsa/jmlx → Settings → Actions → Runners → New self-hosted runner](https://github.com/Alipsa/jmlx/settings/actions/runners/new), + selecting **macOS / ARM64**. Install into that account's own runner directory. + [GitHub's registration guide](https://docs.github.com/en/actions/how-tos/manage-runners/self-hosted-runners/add-runners) + explains the repository-admin requirement and short-lived registration token. Enter the token + locally; do not paste it into a PR, report or assistant message. +5. Register the runner as `jmlx-release-minimum-m5-max`, retaining the default + `self-hosted`, `macOS`, `ARM64` labels and adding **only** `jmlx-release-minimum` as its custom + label. Do not give it `self-macos-xl`. Restrict use to the reviewed candidate workflow; + labels route jobs but are not an authorization boundary. Preserve repository approval + controls and review changes that could route PR code onto the release runner. +6. Start it only for the reviewed release verification window. For an interactive session, + run `./run.sh` as the dedicated account. If using a service, follow + [GitHub's macOS service instructions](https://docs.github.com/en/actions/how-tos/manage-runners/self-hosted-runners/configure-the-application?platform=mac) + as that account, or use the custom launchd definition above. Do not register or run the + worker as root or the owner. + +Runner registration necessarily creates the runner's own authentication files. The account +must remain free of signing keys, Sonatype credentials, SSH keys and owner credentials. +The candidate job receives only read access; draft-asset access stays in its separate hosted +transfer job. The workflow uses checkout without persisted Git credentials and removes its +job-local Gradle home. Stop the runner after verification and review residual workspace and +temporary evidence before another candidate; retain reports outside disposable build output. + +## Verify registration, then execute the candidate + +GitHub [automatically removes persistent runners](https://docs.github.com/en/actions/how-tos/manage-runners/self-hosted-runners/remove-runners) +after more than 14 days without a connection (ephemeral registrations have a one-day limit). +The 2026-11-16 connection therefore does not reserve ID 23 beyond approximately 2026-11-30. +Keep the worker stopped; plan to re-register at window time if the registration has expired, +using GitHub's removal/re-registration instructions and a fresh short-lived token. +Record the replacement ID and repeat connectivity/identity checks. There is no periodic +keepalive job. Historical setup evidence and the checked support-floor decision remain historical. + +Check the repository runner list **before starting** and compare its ID with both the last +reviewed window record and the local `.runner` agent ID. A missing or different ID requires +re-registration or review, not silently treating ID 23 as current. Record labels, account and date: + +```sh +gh api repos/Alipsa/jmlx/actions/runners \ + --jq '.runners[] | {id,name,status,busy,labels:[.labels[].name]}' +``` + +Automatic runner updates remain enabled. The archive digest records the **initial install**, +not a permanently pinned running binary. GitHub documents its +[update behavior](https://docs.github.com/en/actions/reference/runners/self-hosted-runners#runner-software-updates-on-self-hosted-runners). +As the dedicated account, record `./bin/Runner.Listener --version` and its executable SHA-256 +before starting and again after connection or any update, before dispatch. An update may +still occur on job assignment: also retain the actual run's **Set up job** log and compare +its `Current runner version` line with the pre-dispatch version. If it differs, re-measure +the installed listener and digest and review the updated version before accepting the report. +The earlier binary digest must not be attributed to the updated runner; if the job-time binary +cannot be identified, repeat verification on an identified version. No actual candidate run +exists yet, so no job-time version comparison has been performed. +Review version changes alongside the saved environment and tool paths. Persistent registration +and manual workspace cleanup remain the chosen setup; ephemeral registration alone would not wipe files. + +List active workflow runs and their jobs matching the release label before bringing the +runner online. The following read-only commands paginate both collections and list matching +unfinished jobs that the API currently exposes. They also list approval-required runs even +when jobs or labels are not yet exposed. Jobs blocked on `needs:` may not yet be visible with +labels; this check does not claim to enumerate those jobs. Review the active workflows and +their possible downstream jobs before starting the runner, and do not approve fork runs +during the release window. + +```sh +python3 - <<'PY' +import json +import subprocess + +def gh(*args): + return subprocess.check_output(["gh", "api", "--paginate", *args], text=True, timeout=60) + +run_ids = set() +for status in ("queued", "in_progress", "waiting", "requested", "pending", "action_required"): + run_ids.update(gh(f"repos/Alipsa/jmlx/actions/runs?status={status}", + "--jq", ".workflow_runs[].id").split()) +for run_id in sorted(run_ids, key=int): + run = json.loads(gh(f"repos/Alipsa/jmlx/actions/runs/{run_id}")) + approval_required = (run.get("status") == "action_required" or + run.get("conclusion") == "action_required") + if approval_required: + print(json.dumps({key: run[key] for key in ("id", "path", "head_branch", "head_sha", "event")})) + print("Approval required: review this run even if job labels are not exposed.") + jobs = gh(f"repos/Alipsa/jmlx/actions/runs/{run_id}/jobs", "--jq", + '.jobs[] | select(.status != "completed") | ' + 'select(.labels | index("jmlx-release-minimum")) | {id,name,status,labels}') + if jobs.strip() and not approval_required: + print(json.dumps({key: run[key] for key in ("id", "path", "head_branch", "head_sha", "event")})) + if jobs.strip(): + print(jobs) +PY +``` + +Investigate every matching job; leave the worker offline if anything unexpected is queued. +Both jobs in the reviewed `release-candidate.yml` now require `github.ref == 'refs/heads/main'`. +Dispatch explicitly from `main`; review that workflow commit and the candidate tag separately. +The minimum-host report records workflow ref, event and `github.workflow_sha`, and the final +receipt checks their required form. Compare the recorded SHA with the actual reviewed GitHub +run; these local fields are operator attestations, not authenticated remote provenance. + +A main-branch guard protects this workflow's normal dispatch path. Another workflow, or +an edited branch copy that removes the guard, can still request the runner's labels. +Queue inspection is a snapshot, not an access-control boundary. This repository-level runner +therefore trusts repository writers during the window; preserve fork approval controls, +review workflow changes, and keep the online window short. A server-enforced workflow +allowlist would require an appropriately restricted organization runner group; this setup +does not claim that restriction is installed. + +Recheck Python, OS, architecture, chip/GPU and virtualization **as the dedicated account**. +Do not dispatch a placeholder candidate merely to test registration. Once readiness and tuple +review are complete, follow [the release runbook](../tools/release-all/README.md) to freeze, +sign and validate the real candidate, authorize draft transport, and dispatch +`release-candidate.yml` with its actual tag/SHA and both asset identities/digests. +Review the resulting `minimum-host.json`, log and measured runtime XML against that run. +Registration and host inspection alone cannot close exact-candidate acceptance. diff --git a/req/phase8-4-release-checklist.md b/req/phase8-4-release-checklist.md index eec67135..82af69e2 100644 --- a/req/phase8-4-release-checklist.md +++ b/req/phase8-4-release-checklist.md @@ -35,8 +35,13 @@ BellSoft 21.0.12.1; the matching-toolchain audit reproduces every JAR exactly. T - [x] Hosted PR #94 [CI run 43628489480](https://github.com/Alipsa/jmlx/actions/runs/43628489480) passed both Java and native jobs, including required-native-suite execution and artifact smoke. - [x] Owner approved raising the supported native minimum to macOS 27.2.x (2026-11-16). - The local physical Apple Silicon Mac runs 27.2.1; exact-candidate execution and the - dedicated credential-free runner setup remain required before release acceptance. + The local physical Apple Silicon Mac runs 27.2.1; exact-candidate execution remains + required before release acceptance. The dedicated + `jmlxrunner` account and runner registration were provisioned and connectivity checked + on 2026-11-16; the worker is stopped until the reviewed verification window. +- [ ] Revalidate minimum-host registration, saved environment, tool/runner versions and + queued jobs immediately before the window. ID 23 is historical: GitHub removes persistent + registrations after more than 14 offline days; re-register and record a new ID if necessary. - [ ] Complete native transitive-license audit, including compiled-in MLX dependencies. The [2026-11-16 source audit](phase8-4-native-license-audit.md) expands the packaged inventory to 26 entries. Two provenance findings (Juffa `erf`/`erfinv` and Cephes) @@ -63,8 +68,13 @@ The owner approved macOS 27.2 as the native support floor, including every 27.2. release and later versions. The available physical Apple Silicon host runs macOS 27.2.1 (build 26B131). The release job must still record chip/GPU identity, virtualization status, full OS version and successful Metal execution of the exact signed candidate. No candidate -has been frozen or tested yet. Provision its dedicated non-privileged runner account without -signing, release or SSH credentials before using the manual minimum-host workflow. +has been frozen or tested yet. The dedicated non-privileged `jmlxrunner` account has been +created without signing, release or SSH credentials. The +[runner setup and evidence](phase8-4-minimum-host-setup.md) records account isolation checks, +runner ID 23 and a successful connection under that account. Its label is +`jmlx-release-minimum`; it is stopped until a reviewed candidate is ready. The existing +`ghrunner` PR/Tier-B runner remains separate. Connectivity does not establish candidate +Metal execution or consumer acceptance. Bootstrap records `MACOS_SUPPORTED_MINIMUM="27.2"` independently of `MACOS_DEPLOYMENT_TARGET="26.2"`. Receipts and both minimum-host validators consume the diff --git a/req/plans/evidence/minimum-host-runner-2026-11-16/com.alipsa.jmlx-release-runner.plist b/req/plans/evidence/minimum-host-runner-2026-11-16/com.alipsa.jmlx-release-runner.plist new file mode 100644 index 00000000..583c868e --- /dev/null +++ b/req/plans/evidence/minimum-host-runner-2026-11-16/com.alipsa.jmlx-release-runner.plist @@ -0,0 +1,26 @@ + + + + + Labelcom.alipsa.jmlx-release-runner + UserNamejmlxrunner + GroupNamestaff + ProgramArguments + /Users/jmlxrunner/actions-runner/runsvc.sh + WorkingDirectory/Users/jmlxrunner/actions-runner + RunAtLoad + KeepAlive + SessionCreate + ProcessTypeInteractive + EnvironmentVariables + + HOME/Users/jmlxrunner + USERjmlxrunner + LOGNAMEjmlxrunner + PATH/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin + ACTIONS_RUNNER_SVC1 + + StandardOutPath/Users/jmlxrunner/Library/Logs/jmlx-release-runner/stdout.log + StandardErrorPath/Users/jmlxrunner/Library/Logs/jmlx-release-runner/stderr.log + + diff --git a/req/plans/evidence/minimum-host-runner-2026-11-16/review-release-selftests.log b/req/plans/evidence/minimum-host-runner-2026-11-16/review-release-selftests.log new file mode 100644 index 00000000..0037a8c6 --- /dev/null +++ b/req/plans/evidence/minimum-host-runner-2026-11-16/review-release-selftests.log @@ -0,0 +1,89 @@ +test_main_checks_environment_before_consumer_or_output_creation (test_bundle_smoke.BundleSmokeTest.test_main_checks_environment_before_consumer_or_output_creation) ... ok +test_main_explains_that_legacy_preliminary_records_must_be_regenerated (test_bundle_smoke.BundleSmokeTest.test_main_explains_that_legacy_preliminary_records_must_be_regenerated) ... ok +test_main_records_workflow_identity_and_rejects_branch_before_consumer (test_bundle_smoke.BundleSmokeTest.test_main_records_workflow_identity_and_rejects_branch_before_consumer) ... ok +test_minimum_host_accepts_patch_releases_and_rejects_other_minor_versions (test_bundle_smoke.BundleSmokeTest.test_minimum_host_accepts_patch_releases_and_rejects_other_minor_versions) ... ok +test_minimum_host_requires_physical_arm64_and_complete_identity (test_bundle_smoke.BundleSmokeTest.test_minimum_host_requires_physical_arm64_and_complete_identity) ... ok +test_other_macos_reports_require_at_least_supported_minor (test_bundle_smoke.BundleSmokeTest.test_other_macos_reports_require_at_least_supported_minor) ... ok +test_task_outcomes_and_configuration_cache_reuse (test_collector.CollectorTest.test_task_outcomes_and_configuration_cache_reuse) ... ok +test_class_and_documentation_changes_survive (test_compare_publications.ComparePublicationsTest.test_class_and_documentation_changes_survive) ... ok +test_cli_require_equal_writes_report_and_returns_verdict (test_compare_publications.ComparePublicationsTest.test_cli_require_equal_writes_report_and_returns_verdict) ... ok +test_dependency_and_gradle_provenance_changes_survive_normalization (test_compare_publications.ComparePublicationsTest.test_dependency_and_gradle_provenance_changes_survive_normalization) ... ok +test_duplicate_archive_entries_are_rejected (test_compare_publications.ComparePublicationsTest.test_duplicate_archive_entries_are_rejected) ... ok +test_expected_set_requires_all_five_files_per_module (test_compare_publications.ComparePublicationsTest.test_expected_set_requires_all_five_files_per_module) ... ok +test_extra_artifact_is_rejected (test_compare_publications.ComparePublicationsTest.test_extra_artifact_is_rejected) ... ok +test_missing_artifact_is_rejected (test_compare_publications.ComparePublicationsTest.test_missing_artifact_is_rejected) ... ok +test_missing_metadata_fields_have_context (test_compare_publications.ComparePublicationsTest.test_missing_metadata_fields_have_context) ... ok +test_nested_artifact_record_is_rejected (test_compare_publications.ComparePublicationsTest.test_nested_artifact_record_is_rejected) ... ok +test_normalization_never_deflates_even_for_deflated_inputs (test_compare_publications.ComparePublicationsTest.test_normalization_never_deflates_even_for_deflated_inputs) ... ok +test_only_archive_order_timestamps_and_matching_metadata_hashes_are_normalized (test_compare_publications.ComparePublicationsTest.test_only_archive_order_timestamps_and_matching_metadata_hashes_are_normalized) ... ok +test_pom_and_module_formatting_differences_survive (test_compare_publications.ComparePublicationsTest.test_pom_and_module_formatting_differences_survive) ... ok +test_publications_shape_is_validated (test_compare_publications.ComparePublicationsTest.test_publications_shape_is_validated) ... ok +test_stale_metadata_cannot_be_blessed_by_recomputed_hashes (test_compare_publications.ComparePublicationsTest.test_stale_metadata_cannot_be_blessed_by_recomputed_hashes) ... ok +test_unexpected_url_record_is_rejected (test_compare_publications.ComparePublicationsTest.test_unexpected_url_record_is_rejected) ... ok +test_wrong_checksum_is_rejected_even_when_size_matches (test_compare_publications.ComparePublicationsTest.test_wrong_checksum_is_rejected_even_when_size_matches) ... ok +test_zip_metadata_differences_survive (test_compare_publications.ComparePublicationsTest.test_zip_metadata_differences_survive) ... ok +test_actual_plugin_bundle_replacement_is_rejected_even_if_receipt_copy_is_verified (test_final_receipt.FinalReceiptTest.test_actual_plugin_bundle_replacement_is_rejected_even_if_receipt_copy_is_verified) ... ok +test_all_macos_acceptance_reports_require_supported_os (test_final_receipt.FinalReceiptTest.test_all_macos_acceptance_reports_require_supported_os) ... ok +test_cached_task_cannot_claim_passed (test_final_receipt.FinalReceiptTest.test_cached_task_cannot_claim_passed) ... ok +test_final_valid_and_preliminary_rejected (test_final_receipt.FinalReceiptTest.test_final_valid_and_preliminary_rejected) ... ok +test_minimum_host_requires_main_workflow_identity (test_final_receipt.FinalReceiptTest.test_minimum_host_requires_main_workflow_identity) ... ok +test_minimum_host_requires_supported_minor_and_accepts_patch_releases (test_final_receipt.FinalReceiptTest.test_minimum_host_requires_supported_minor_and_accepts_patch_releases) ... ok +test_missing_reports_changed_plan_and_logs_block_upload (test_final_receipt.FinalReceiptTest.test_missing_reports_changed_plan_and_logs_block_upload) ... ok +test_plugin_digests_are_reviewed_record_anchors_after_full_verification (test_final_receipt.FinalReceiptTest.test_plugin_digests_are_reviewed_record_anchors_after_full_verification) ... ok +test_plugin_digests_cli_stdout_contract (test_final_receipt.FinalReceiptTest.test_plugin_digests_cli_stdout_contract) ... ok +test_real_bundle_check_does_not_authorize_a_different_plugin_upload_file (test_final_receipt.FinalReceiptTest.test_real_bundle_check_does_not_authorize_a_different_plugin_upload_file) ... ok +test_receipt_cannot_select_a_different_upload_path (test_final_receipt.FinalReceiptTest.test_receipt_cannot_select_a_different_upload_path) ... ok +test_report_cannot_invent_runtime_properties (test_final_receipt.FinalReceiptTest.test_report_cannot_invent_runtime_properties) ... ok +test_answer_projection_decodes_longest_code_and_checks_full_body_digest (test_license_resolution.LicenseResolutionTest.test_answer_projection_decodes_longest_code_and_checks_full_body_digest) ... ok +test_cli_reports_incomplete_http_read_without_caching_partial_response (test_license_resolution.LicenseResolutionTest.test_cli_reports_incomplete_http_read_without_caching_partial_response) ... ok +test_cli_reports_missing_sources_and_unexpected_json_types_without_tracebacks (test_license_resolution.LicenseResolutionTest.test_cli_reports_missing_sources_and_unexpected_json_types_without_tracebacks) ... ok +test_comment_projection_has_exact_ascii_serialization_and_api_order (test_license_resolution.LicenseResolutionTest.test_comment_projection_has_exact_ascii_serialization_and_api_order) ... ok +test_comment_projection_rejects_partial_or_malformed_responses (test_license_resolution.LicenseResolutionTest.test_comment_projection_rejects_partial_or_malformed_responses) ... ok +test_extraction_starts_at_name_and_only_attached_signs_are_literals (test_license_resolution.LicenseResolutionTest.test_extraction_starts_at_name_and_only_attached_signs_are_literals) ... ok +test_non_string_source_urls_fail_before_cache_or_network_access (test_license_resolution.LicenseResolutionTest.test_non_string_source_urls_fail_before_cache_or_network_access) ... ok +test_url_bound_inputs_rehash_hits_and_never_cache_failed_projection (test_license_resolution.LicenseResolutionTest.test_url_bound_inputs_rehash_hits_and_never_cache_failed_projection) ... ok +test_all_three_artifacts_require_every_reviewed_text (test_native_licenses.NativeLicensesTest.test_all_three_artifacts_require_every_reviewed_text) ... ok +test_corrupt_cache_and_changed_wheel_fail (test_native_licenses.NativeLicensesTest.test_corrupt_cache_and_changed_wheel_fail) ... ok +test_distinct_urls_with_shared_digest_are_fetched_independently (test_native_licenses.NativeLicensesTest.test_distinct_urls_with_shared_digest_are_fetched_independently) ... ok +test_fragments_and_line_ranges_must_be_valid_and_in_the_component_section (test_native_licenses.NativeLicensesTest.test_fragments_and_line_ranges_must_be_valid_and_in_the_component_section) ... ok +test_github_rewrite_and_atomic_cache_write_then_read_only_hit (test_native_licenses.NativeLicensesTest.test_github_rewrite_and_atomic_cache_write_then_read_only_hit) ... ok +test_interrupted_cache_replace_leaves_no_partial_entry (test_native_licenses.NativeLicensesTest.test_interrupted_cache_replace_leaves_no_partial_entry) ... ok +test_inventory_cannot_drop_any_required_text (test_native_licenses.NativeLicensesTest.test_inventory_cannot_drop_any_required_text) ... ok +test_license_equals_rules_remain_inside_the_component_section (test_native_licenses.NativeLicensesTest.test_license_equals_rules_remain_inside_the_component_section) ... ok +test_main_jar_scans_other_entries_but_keeps_native_payload_validation_separate (test_native_licenses.NativeLicensesTest.test_main_jar_scans_other_entries_but_keeps_native_payload_validation_separate) ... ok +test_native_cli_checks_companion_notices_and_personal_paths (test_native_licenses.NativeLicensesTest.test_native_cli_checks_companion_notices_and_personal_paths) ... ok +test_native_main_missing_reviewed_text_fails_before_payload_parsing (test_native_licenses.NativeLicensesTest.test_native_main_missing_reviewed_text_fails_before_payload_parsing) ... ok +test_non_utf8_locale_reads_notices_as_utf8 (test_native_licenses.NativeLicensesTest.test_non_utf8_locale_reads_notices_as_utf8) ... ok +test_notice_hash_update_cannot_hide_missing_upstream_attribution (test_native_licenses.NativeLicensesTest.test_notice_hash_update_cannot_hide_missing_upstream_attribution) ... ok +test_require_clear_cli_writes_findings_and_exits_nonzero (test_native_licenses.NativeLicensesTest.test_require_clear_cli_writes_findings_and_exits_nonzero) ... ok +test_stack_exchange_body_and_unexpected_responses (test_native_licenses.NativeLicensesTest.test_stack_exchange_body_and_unexpected_responses) ... ok +test_valid_sources_and_texts_do_not_clear_unresolved_findings (test_native_licenses.NativeLicensesTest.test_valid_sources_and_texts_do_not_clear_unresolved_findings) ... ok +test_wheel_member_has_its_own_digest_and_packaged_text_check (test_native_licenses.NativeLicensesTest.test_wheel_member_has_its_own_digest_and_packaged_text_check) ... ok +test_unstaged_local_jar_succeeds_but_combined_publish_fails (test_native_publish.NativePublishTest.test_unstaged_local_jar_succeeds_but_combined_publish_fails) ... ok +test_reviewed_hashes_and_receipt_gate_protect_the_actual_upload (test_plugin_upload.PluginUploadTest.test_reviewed_hashes_and_receipt_gate_protect_the_actual_upload) ... ok +test_bundle_digest_tag_and_path_checks (test_release_inputs.ReleaseInputsTest.test_bundle_digest_tag_and_path_checks) ... ok +test_invalid_manifest_variants (test_release_inputs.ReleaseInputsTest.test_invalid_manifest_variants) ... ok +test_macho_minimum_and_malformed_commands (test_release_inputs.ReleaseInputsTest.test_macho_minimum_and_malformed_commands) ... ok +test_native_target_and_local_paths_are_blocking (test_release_inputs.ReleaseInputsTest.test_native_target_and_local_paths_are_blocking) ... ok +test_notice_wheel_digest_is_checked_against_bootstrap_not_only_its_inventory_hash (test_release_inputs.ReleaseInputsTest.test_notice_wheel_digest_is_checked_against_bootstrap_not_only_its_inventory_hash) ... ok +test_preflight_does_not_probe_until_local_versions_are_valid (test_release_inputs.ReleaseInputsTest.test_preflight_does_not_probe_until_local_versions_are_valid) ... ok +test_selection_and_duplicates (test_release_inputs.ReleaseInputsTest.test_selection_and_duplicates) ... ok +test_archive_filter_requirement_is_reported_before_io (test_reproduce_audit.ReproduceAuditTest.test_archive_filter_requirement_is_reported_before_io) ... ok +test_archive_requires_one_jdk_and_rejects_path_traversal (test_reproduce_audit.ReproduceAuditTest.test_archive_requires_one_jdk_and_rejects_path_traversal) ... ok +test_central_download_hash_is_checked (test_reproduce_audit.ReproduceAuditTest.test_central_download_hash_is_checked) ... ok +test_environment_removes_injection_and_controls_locale (test_reproduce_audit.ReproduceAuditTest.test_environment_removes_injection_and_controls_locale) ... ok +test_every_daemon_and_compiler_javadoc_identity_is_checked (test_reproduce_audit.ReproduceAuditTest.test_every_daemon_and_compiler_javadoc_identity_is_checked) ... ok +test_git_ignores_caller_config_and_environment_injection (test_reproduce_audit.ReproduceAuditTest.test_git_ignores_caller_config_and_environment_injection) ... ok +test_gradle_version_is_checked (test_reproduce_audit.ReproduceAuditTest.test_gradle_version_is_checked) ... ok +test_jdk_archive_is_verified_before_extraction (test_reproduce_audit.ReproduceAuditTest.test_jdk_archive_is_verified_before_extraction) ... ok +test_result_requires_exact_artifacts_and_verdict (test_reproduce_audit.ReproduceAuditTest.test_result_requires_exact_artifacts_and_verdict) ... ok +test_source_assignment_and_missing_source_no_fallback (test_resolution.ResolutionTest.test_source_assignment_and_missing_source_no_fallback) ... ok +test_extraction_failure_cleans_partial_repository (test_runner_cleanup.RunnerCleanupTest.test_extraction_failure_cleans_partial_repository) ... ok +test_clt_only_does_not_require_xcodebuild (test_runtime_evidence.RuntimeEvidenceTest.test_clt_only_does_not_require_xcodebuild) ... ok +test_explicit_java_home_returns_measured_vendor_build_and_path (test_runtime_evidence.RuntimeEvidenceTest.test_explicit_java_home_returns_measured_vendor_build_and_path) ... ok +test_xcodebuild_failure_falls_back_to_clt_metadata (test_runtime_evidence.RuntimeEvidenceTest.test_xcodebuild_failure_falls_back_to_clt_metadata) ... ok + +---------------------------------------------------------------------- +Ran 84 tests in 70.196s + +OK diff --git a/req/plans/evidence/minimum-host-runner-2026-11-16/review.json b/req/plans/evidence/minimum-host-runner-2026-11-16/review.json new file mode 100644 index 00000000..c1db3c3b --- /dev/null +++ b/req/plans/evidence/minimum-host-runner-2026-11-16/review.json @@ -0,0 +1,105 @@ +{ + "account": "jmlxrunner", + "savedPath": { + "value": "/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin", + "sha256": "879f57bf25438926a82cf2cc977c10bb418ec0e62a1d35dffef8650942abbcb0", + "containsOwnerHome": false + }, + "savedEnvironment": { + "keys": [], + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "containsOwnerHome": false + }, + "tools": { + "python3": { + "selected": { + "path": "/opt/homebrew/bin/python3", + "owner": "per", + "group": "admin", + "mode": "0o755" + }, + "resolved": { + "path": "/opt/homebrew/Cellar/python@3.15/3.15.2/Frameworks/Python.framework/Versions/3.15/bin/python3.15", + "owner": "per", + "group": "admin", + "mode": "0o755" + }, + "version": "Python 3.15.2" + }, + "git": { + "selected": { + "path": "/opt/homebrew/bin/git", + "owner": "per", + "group": "admin", + "mode": "0o555" + }, + "resolved": { + "path": "/opt/homebrew/Cellar/git/2.56.1/bin/git", + "owner": "per", + "group": "admin", + "mode": "0o555" + }, + "version": "git version 2.56.1" + } + }, + "runner": { + "id": 23, + "disableUpdate": false, + "ephemeral": false, + "listenerVersion": "2.338.2", + "listenerSha256": "732456cbedb8c09870b82a63c05ba5505ad5cc3fb536ee570879a0af1fdb5087" + }, + "ownerGradlePropertiesReadable": false, + "ownerGradlePropertiesWritable": false, + "recordedAt": "2026-11-16T21:29:53.238540+00:00", + "ownerManagedToolchain": true, + "toolchainTrust": "Python and Git are owner-managed Homebrew executables; account credential isolation does not isolate executable supply from the owner.", + "ownerGradlePropertiesModeAfterHardening": "0o600", + "fileSharingInspection": { + "sharepointGroup": "com.apple.sharepoint.group.1", + "nestedGroupGuid": "ABCDEFAB-CDEF-ABCD-EFAB-CDEF0000000C", + "nestedGroupName": "everyone", + "smbdLaunchdServiceLoaded": false, + "newReleaseAccountShareCreated": false, + "scope": "Group/share configuration and launchd state only; no remote/network access audit or global sharing changes.", + "guestShareConfigured": true + }, + "queueInspection": { + "commandSource": "req/phase8-4-minimum-host-setup.md", + "statuses": [ + "queued", + "in_progress", + "waiting", + "requested", + "pending", + "action_required" + ], + "unfinishedJobsMatchingReleaseLabel": [], + "scope": "Live paginated API snapshot of exposed jobs and approval-required runs; needs-blocked jobs/labels may be absent. Not an authorization boundary.", + "recordedAt": "2026-11-16T21:40:21.847256+00:00", + "baseCommit": "407c7be7ddcb7729ae0932e55a8c2de833454038", + "workingTree": "Documentation follow-up adding action_required and surfacing approval-required runs without exposed jobs.", + "output": "" + }, + "references": { + "runsvc": "https://github.com/actions/runner/blob/v2.338.2/src/Misc/layoutbin/runsvc.sh", + "updates": "https://docs.github.com/en/actions/reference/runners/self-hosted-runners#runner-software-updates-on-self-hosted-runners" + }, + "validation": { + "releaseSelftests": { + "command": "bash tools/release-all/selftest.sh", + "tests": 84, + "seconds": 70.196, + "result": "passed", + "log": "review-release-selftests.log", + "sha256": "05d1b998e27be63dba873a727d00100772b68e5f593c2e4742bde2c08f976e77" + }, + "workflowValidation": { + "command": "bash tools/release-all/check-workflows.sh", + "result": "passed" + }, + "queueCommand": "Refreshed successfully with action_required included; exact output retained in queueInspection.output. Operator attestation: a synthetic approval-required run with no visible jobs was reported in both status and conclusion forms; its test and output were not retained in the repository." + }, + "baseCommit": "7c9a057066e2777f664989382cd9256d8d7fe4ed", + "validatedWorkingTree": "Release selftests and actionlint ran on the working tree containing the code changes subsequently committed as 407c7be7ddcb7729ae0932e55a8c2de833454038. Queue inspection is refreshed separately under queueInspection." +} diff --git a/req/plans/evidence/minimum-host-runner-2026-11-16/setup.json b/req/plans/evidence/minimum-host-runner-2026-11-16/setup.json new file mode 100644 index 00000000..930f2178 --- /dev/null +++ b/req/plans/evidence/minimum-host-runner-2026-11-16/setup.json @@ -0,0 +1,85 @@ +{ + "recordedAt": "2026-11-16T21:15:47.934215+00:00", + "sourceCommit": "26765a18ece616441c98d58469b5069630b5298e", + "accountInspection": { + "account": "jmlxrunner", + "uid": 503, + "nonAdmin": true, + "homeMode": "0o700", + "osVersion": "27.2.1", + "osBuild": "26B131", + "architecture": "arm64", + "chip": "Apple M5 Max", + "virtualized": false, + "python": "3.15.2", + "git": "git version 2.56.1", + "ownerGradlePropertiesReadable": false, + "ownerSshDirectorySearchable": false, + "ownerSigningDirectorySearchable": false, + "accountSshDirectoryExists": false, + "accountSigningDirectoryExists": false, + "accountGradlePropertiesExists": false + }, + "runnerPackage": { + "version": "2.338.2", + "source": "https://github.com/actions/runner/releases/download/v2.338.2/actions-runner-osx-arm64-2.338.2.tar.gz", + "sha256": "25a065af409ffa317ab4d5a3b614dd15fc9c40f2172bc1b35a1b1258e919a388", + "digestMatchedBeforeExtraction": true, + "scope": "Initial downloaded archive only; automatic runner updates remain enabled. Re-measure listener version and digest at every window." + }, + "service": { + "definition": "com.alipsa.jmlx-release-runner.plist", + "sha256": "2a101a9a1ee71a0d35359d8f63dd5726745bc78e1c5280a498f51d2482322418", + "installedPath": "/Library/LaunchDaemons/com.alipsa.jmlx-release-runner.plist", + "user": "jmlxrunner", + "runAtLoad": false, + "keepAlive": false, + "stateAfterCheck": "unloaded", + "effectivePathSource": "GitHub runsvc.sh restores configuration-time .path over the launchd PATH.", + "savedEnvironmentReview": "review.json" + }, + "connectivity": { + "listenerUserObserved": "jmlxrunner", + "listenerMessageObserved": "Listening for Jobs", + "githubOnlineAndIdleObserved": true, + "stoppedAfterCheck": true, + "candidateJobDispatched": false, + "launchMethod": "launchctl bootstrap system /Library/LaunchDaemons/com.alipsa.jmlx-release-runner.plist; launchctl kickstart system/com.alipsa.jmlx-release-runner", + "logDirectoryPrecreated": true + }, + "repositoryRunnersAfterCheck": [ + { + "id": 23, + "name": "jmlx-release-minimum-m5-max", + "status": "offline", + "busy": false, + "labels": [ + "self-hosted", + "macOS", + "ARM64", + "jmlx-release-minimum" + ] + }, + { + "id": 22, + "name": "local-m5-max", + "status": "online", + "busy": false, + "labels": [ + "self-hosted", + "macOS", + "ARM64", + "self-macos-xl" + ] + } + ], + "registrationTokenFileRemoved": true, + "accountPasswordRetained": false, + "acceptance": "Provisioning and connectivity only; exact signed-candidate Metal execution and consumer reports remain pending.", + "registrationContinuity": { + "snapshotOnly": true, + "autoRemovalAfterOfflineDays": 14, + "source": "https://docs.github.com/en/actions/how-tos/manage-runners/self-hosted-runners/remove-runners", + "windowPolicy": "Compare current remote ID and local .runner agentId with the last reviewed record; if expired, re-register and record a new ID. No periodic keepalive is configured." + } +} diff --git a/tools/release-all/README.md b/tools/release-all/README.md index 9b9ad489..9783c044 100644 --- a/tools/release-all/README.md +++ b/tools/release-all/README.md @@ -42,6 +42,10 @@ are ignored for status-only recovery. Protect the journal against modification. bump. Record the new plugin's historical 8.1 regressions on an unpushed throwaway commit. 2. Merge the reviewed release-version PR. Anchor an annotated immutable `jmlx-phase8.4-rc.N` tag at that SHA and work from a clean detached checkout. Never move the tag. + Cut the candidate only after the minimum-host workflow-identity check + (`verify_minimum_host_workflow`) is on `main` and included in the tagged commit: + `bundle_smoke.py` runs from the candidate checkout. + An older tag cannot produce the workflow block now required by final-receipt verification. 3. Run root checks, shared-build checks and `bash tools/release-all/selftest.sh`. Normal candidate smoke publishes only manifest-local entries and resolves reused entries solely from Central. 4. Run `./releaseAll.sh --dry-run`, inspect the exact selected set, then set @@ -63,12 +67,20 @@ are ignored for status-only recovery. Protect the journal against modification. `JMLX_LINUX_CONTAINER_IMAGE_ID`. It requires network access for the pinned wrapper/toolchains. 8. Upload **both ZIP and preliminary JSON** as assets of a temporary draft GitHub Release on the candidate tag, after authorization for that external write. Dispatch - `release-candidate.yml` with both asset IDs/digests, Release ID and tag/peeled SHA. The transfer - job has draft-access permissions and never executes the bundle. The dedicated physical - minimum-host job has read-only repository access and checks tag object, HEAD, digests, + `release-candidate.yml` from `main` with both asset IDs/digests, Release ID and tag/peeled SHA. + The transfer job has draft-access permissions and never executes the bundle. The dedicated + physical minimum-host job has read-only repository access and checks tag object, HEAD, digests, native OS floor and actual packaged kernels. Provision its `jmlx-release-minimum` runner label before attempting this gate; a VM or moving hosted image cannot establish the floor. -9. Download minimum-host JSON/log evidence, then create the final receipt: + Use the [dedicated-account setup procedure](../../req/phase8-4-minimum-host-setup.md); + the existing `self-macos-xl` PR/Tier-B runner does not satisfy that isolation requirement. + Revalidate registration, saved environment, runner/tool versions and queued label-matching + jobs before starting the worker. Offline registrations can expire after more than 14 days. +9. Download minimum-host JSON/log evidence, including the actual run's **Set up job** log. + Compare its `Current runner version` with + the pre-dispatch measurement; resolve any update and record the actual version before + accepting the report, as described in the dedicated-account procedure. Then create the + final receipt: ```sh python3 tools/release-all/final_receipt.py --root "$PWD" \ @@ -80,7 +92,10 @@ python3 tools/release-all/final_receipt.py --root "$PWD" \ Each report's log and measured `.runtime.xml` must remain beside its JSON. The consumer JVM itself writes feature/version/runtime build/vendor/home; its file and digest are verified, -independently of the Java launcher on PATH. Only a **final** receipt can be submitted: +independently of the Java launcher on PATH. The minimum-host report also records the manual +workflow's main ref and SHA; review these against the actual GitHub run and reviewed workflow +commit. Job guards and recorded identity do not restrict other workflows from using its labels. +Only a **final** receipt can be submitted: ```sh ./releaseAll.sh --publish-verified build/releaseAll/verified.json diff --git a/tools/release-all/bundle_smoke.py b/tools/release-all/bundle_smoke.py index d453e11a..c85bb278 100644 --- a/tools/release-all/bundle_smoke.py +++ b/tools/release-all/bundle_smoke.py @@ -12,7 +12,8 @@ if sys.version_info < (3, 11): raise SystemExit("Python 3.11+ is required for bundle smoke") -from release_inputs import check_bundle, read_runtime, sha256, verify_smoke_environment +from release_inputs import (check_bundle, read_runtime, sha256, verify_smoke_environment, + verify_minimum_host_workflow) def output(*args): @@ -52,6 +53,12 @@ def main(): env = environment() verify_smoke_environment(args.kind, env, native["supportedMinimum"], os.environ.get("GITHUB_RUN_ID")) + workflow = None + if args.kind == "minimum-host": + workflow = {key: os.environ.get(variable) for key, variable in + (("ref", "GITHUB_REF"), ("event", "GITHUB_EVENT_NAME"), + ("workflowRef", "GITHUB_WORKFLOW_REF"), ("sha", "GITHUB_WORKFLOW_SHA"))} + verify_minimum_host_workflow(workflow) profile = "pure-java" if args.kind.endswith("pure") else "all" command = ["bash", str(root / "tools/release-smoke/run.sh"), "candidate", "--profile", profile, "--bundle", str(args.bundle.resolve()), "--bundle-record", str(args.preliminary.resolve()), @@ -74,6 +81,8 @@ def main(): "runId": os.environ.get("GITHUB_RUN_ID"), "identityAssurance": "Local measurements; workflow run ID and container image are operator attestations, not authenticated provenance", "outputs": {log.name: sha256(log), runtime_file.name: sha256(runtime_file)}} + if workflow is not None: + report["workflow"] = workflow with args.output.open("x") as stream: json.dump(report, stream, indent=2) stream.write("\n") diff --git a/tools/release-all/final_receipt.py b/tools/release-all/final_receipt.py index 8fb5f516..f03a606b 100644 --- a/tools/release-all/final_receipt.py +++ b/tools/release-all/final_receipt.py @@ -7,7 +7,7 @@ from pathlib import Path from release_inputs import (check_bundle, native_report, read_json, read_runtime, sha256, - verify_smoke_environment) + verify_smoke_environment, verify_minimum_host_workflow) from verify_native_tests import verify_events REQUIRED = {"macos-full", "macos-pure", "linux-pure", "minimum-host"} @@ -77,6 +77,8 @@ def verify(root, receipt_path): or read_runtime(Path(report_file["path"]).parent / runtime_file) != runtime): raise ValueError("consumer runtime measurement differs from its evidence file") verify_smoke_environment(kind, env, record["native"]["supportedMinimum"], report.get("runId")) + if kind == "minimum-host": + verify_minimum_host_workflow(report.get("workflow")) return receipt, record diff --git a/tools/release-all/release_inputs.py b/tools/release-all/release_inputs.py index 5d72156a..d8d9a48e 100644 --- a/tools/release-all/release_inputs.py +++ b/tools/release-all/release_inputs.py @@ -182,6 +182,17 @@ def native_report(directory, bootstrap, forbidden): return result +def verify_minimum_host_workflow(identity): + """Validate the reported manual workflow identity; review the actual run independently.""" + if (not isinstance(identity, dict) or identity.get("ref") != "refs/heads/main" + or identity.get("event") != "workflow_dispatch" + or identity.get("workflowRef") != + "Alipsa/jmlx/.github/workflows/release-candidate.yml@refs/heads/main" + or not isinstance(identity.get("sha"), str) + or not re.fullmatch(r"[0-9a-f]{40}", identity["sha"])): + raise ValueError("minimum-host workflow must identify the manual main-branch release workflow") + + def verify_smoke_environment(kind, env, supported_minimum, run_id=None): """Require supported macOS acceptance hosts and physical minimum-series execution.""" if kind == "linux-pure": diff --git a/tools/release-all/tests/test_bundle_smoke.py b/tools/release-all/tests/test_bundle_smoke.py index 2d8e00f8..6c1e815f 100644 --- a/tools/release-all/tests/test_bundle_smoke.py +++ b/tools/release-all/tests/test_bundle_smoke.py @@ -1,11 +1,14 @@ """Producer acceptance rejects unsupported hosts before launching the consumer.""" import copy +import io +import json import os import sys import tempfile import unittest from pathlib import Path +from contextlib import redirect_stdout from unittest.mock import patch sys.path.insert(0, str(Path(__file__).resolve().parents[1])) @@ -92,6 +95,43 @@ def test_main_explains_that_legacy_preliminary_records_must_be_regenerated(self) consumer.assert_not_called() self.assertFalse(output.exists()) + def test_main_records_workflow_identity_and_rejects_branch_before_consumer(self): + with tempfile.TemporaryDirectory() as temp: + root = Path(temp) + output = root / "report.json" + runtime = root / "tools/release-smoke/app/build/reports/consumer-runtime.xml" + runtime.parent.mkdir(parents=True) + runtime.write_text("fixture runtime measurement") + record = {"native": {"supportedMinimum": self.minimum}, + "tag": {"sha": "c" * 40}, "bundleSha256": "a" * 64} + argv = ["bundle_smoke.py", "--root", temp, "--bundle", str(root / "bundle.zip"), + "--preliminary", str(root / "preliminary.json"), + "--preliminary-sha256", "b" * 64, "--kind", "minimum-host", + "--output", str(output)] + env = {"GITHUB_RUN_ID": "42", "GITHUB_REF": "refs/heads/main", + "GITHUB_EVENT_NAME": "workflow_dispatch", "GITHUB_WORKFLOW_SHA": "d" * 40, + "GITHUB_WORKFLOW_REF": + "Alipsa/jmlx/.github/workflows/release-candidate.yml@refs/heads/main"} + with patch.object(sys, "argv", argv), \ + patch.object(B, "check_bundle", return_value=record), \ + patch.object(B, "environment", return_value=self.env), \ + patch.object(B, "read_runtime", return_value={"java.feature": "25"}), \ + patch.object(B.subprocess, "run") as consumer: + for ref in ("refs/heads/feature", "refs/tags/candidate", ""): + with self.subTest(ref=ref), patch.dict(os.environ, dict(env, GITHUB_REF=ref), clear=True): + with self.assertRaisesRegex(ValueError, "minimum-host workflow"): + B.main() + consumer.assert_not_called() + self.assertFalse(output.exists()) + self.assertFalse(output.with_suffix(".log").exists()) + with patch.dict(os.environ, env, clear=True), redirect_stdout(io.StringIO()): + B.main() + consumer.assert_called_once() + report = json.loads(output.read_text()) + self.assertEqual(report["workflow"], { + "ref": env["GITHUB_REF"], "event": env["GITHUB_EVENT_NAME"], + "sha": env["GITHUB_WORKFLOW_SHA"], "workflowRef": env["GITHUB_WORKFLOW_REF"]}) + if __name__ == "__main__": unittest.main() diff --git a/tools/release-all/tests/test_final_receipt.py b/tools/release-all/tests/test_final_receipt.py index 4dfde2ee..07f70313 100644 --- a/tools/release-all/tests/test_final_receipt.py +++ b/tools/release-all/tests/test_final_receipt.py @@ -77,6 +77,9 @@ def write(name, doc): report = write(kind + ".json", {"schema": "jmlx-bundle-smoke-1", "kind": kind, "passed": True, "bundleSha256": bundle_hash, "preliminarySha256": sha256(preliminary), "candidateSha": "c"*40, "runId": "42", "environment": env, + **({"workflow": {"ref": "refs/heads/main", "event": "workflow_dispatch", + "workflowRef": "Alipsa/jmlx/.github/workflows/release-candidate.yml@refs/heads/main", + "sha": "d" * 40}} if kind == "minimum-host" else {}), "outputs": {log.name: sha256(log), runtime_file.name: sha256(runtime_file)}, "consumerRuntime": runtime, "consumerRuntimeFile": runtime_file.name}) self.receipt["reports"][kind] = {"path": str(report), "sha256": sha256(report)} @@ -132,6 +135,21 @@ def test_minimum_host_requires_supported_minor_and_accepts_patch_releases(self): with self.assertRaisesRegex(ValueError, "minimum-host evidence"): F.verify(self.root, self.path) + def test_minimum_host_requires_main_workflow_identity(self): + path = self.root / "minimum-host.json" + original = json.loads(path.read_text()) + valid = original["workflow"] + for workflow in (None, {}, [], dict(valid, ref="refs/heads/feature"), + dict(valid, event="pull_request"), dict(valid, sha="bad"), + dict(valid, workflowRef=valid["workflowRef"].replace("main", "feature"))): + with self.subTest(workflow=workflow): + report = dict(original, workflow=workflow) + self.write(path.name, report) + self.receipt["reports"]["minimum-host"]["sha256"] = sha256(path) + self.write("final.json", self.receipt) + with self.assertRaisesRegex(ValueError, "minimum-host workflow"): + F.verify(self.root, self.path) + def test_all_macos_acceptance_reports_require_supported_os(self): for kind in ("macos-full", "macos-pure"): path = self.root / (kind + ".json")