Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/action-updates.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Maintainer-owned coupled bumps. Dependabot handles other Actions.
# Advance all three CodeQL selectors together, then run just update-actions.
[actions]
"astral-sh/setup-uv" = "latest"
"github/codeql-action/analyze" = "v4.39.3"
"github/codeql-action/init" = "v4.39.3"
"github/codeql-action/upload-sarif" = "v4.39.3"

[consistency]
actions = [
"astral-sh/setup-uv",
"github/codeql-action/analyze",
"github/codeql-action/init",
"github/codeql-action/upload-sarif",
]
23 changes: 22 additions & 1 deletion .github/actions/setup-tools/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: Set up declared tools
description: Install the locked shared package, synchronize declared tools, and export verified paths.

inputs:
tool:
description: Optional single catalog selection instead of the contributor catalog; locked dev supplies Just.
required: false
default: ""
cache:
description: Cache dependencies and managed Cargo compilation; release jobs must disable this.
required: false
Expand All @@ -28,15 +32,32 @@ runs:
}}

- name: Set up declared tools and development environment
if: inputs.tool == ''
shell: bash
env:
GH_TOKEN: ${{ github.token }}
RESEARCH_REPO_TOOLS_HOME: ${{ runner.temp }}/rrt
RESEARCH_REPO_TOOLS_CARGO_BUILD_HOME: ${{ runner.temp }}/rrt-cargo-build
run: uv run --locked --managed-python --only-group tooling research-repo-tools setup

- name: Set up selected tools and development environment
if: inputs.tool != ''
shell: bash
env:
GH_TOKEN: ${{ github.token }}
RESEARCH_REPO_TOOLS_HOME: ${{ runner.temp }}/rrt
RESEARCH_REPO_TOOLS_CARGO_BUILD_HOME: ${{ runner.temp }}/rrt-cargo-build
SELECTED_TOOL: ${{ inputs.tool }}
run: |
uv sync --locked --managed-python --group dev
uv run --locked --no-sync research-repo-tools toolchain sync --tool "$SELECTED_TOOL"

- name: Export verified managed paths
shell: bash
env:
RESEARCH_REPO_TOOLS_HOME: ${{ runner.temp }}/rrt
run: uv run --locked --no-sync --no-python-downloads research-repo-tools toolchain export
SELECTED_TOOL: ${{ inputs.tool }}
run: |
args=()
if [[ -n "$SELECTED_TOOL" ]]; then args+=(--tool "$SELECTED_TOOL"); fi
uv run --locked --no-sync --no-python-downloads research-repo-tools toolchain export "${args[@]}"
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ updates:
cooldown:
default-days: 7
open-pull-requests-limit: 10
# The shared updater owns coupled workflow/composite and CodeQL bumps.
ignore:
- dependency-name: "astral-sh/setup-uv"
- dependency-name: "github/codeql-action/*"
labels:
- "dependencies"
- "github-actions"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ jobs:
GH_TOKEN: ${{ github.token }}
run: |
uvx --python 3.15 \
--from 'research-repo-tools==0.2.8' \
--from 'research-repo-tools==0.2.9' \
python -I - <<'PY'
import os
import sys
Expand Down
103 changes: 29 additions & 74 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,13 @@ jobs:
[[ "$commit" == "$GITHUB_SHA" && "$(git --no-pager rev-parse HEAD)" == "$commit" ]]
git --no-pager merge-base --is-ancestor "$commit" origin/main
mkdir "$RUNNER_TEMP/handoff"
cp tooling/release-evidence.toml "$RUNNER_TEMP/handoff/evidence.toml"
runtime=(uv run --no-config --no-project --isolated --no-cache --python 3.15
--with 'research-repo-tools==0.2.8'
python -I -c 'import sys; from research_repo_tools.cli import main; sys.exit(main())')
"${runtime[@]}" --root "$GITHUB_WORKSPACE" release check "$RELEASE_TAG"
"${runtime[@]}" --root "$GITHUB_WORKSPACE" release evidence verify \
tooling/release-evidence.toml --checkout "$GITHUB_WORKSPACE" \
--commit "$commit" --version "${RELEASE_TAG#v}" \
--output "$RUNNER_TEMP/handoff/selection.json"
"${runtime[@]}" --root "$GITHUB_WORKSPACE" changelog notes "$RELEASE_TAG" > "$RUNNER_TEMP/handoff/notes.md"
printf 'commit=%s\n' "$commit" >> "$GITHUB_OUTPUT"
--with 'research-repo-tools==0.2.9'
python -I -m research_repo_tools)
"${runtime[@]}" --root "$GITHUB_WORKSPACE" release assets plan \
tooling/release-evidence.toml --repository "$GITHUB_REPOSITORY" \
--event "$GITHUB_EVENT_NAME" --tag "$RELEASE_TAG" --commit "$commit" \
--output "$RUNNER_TEMP/handoff/handoff.json" --github-output "$GITHUB_OUTPUT"
- name: Retain inert verified handoff
id: handoff
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
Expand Down Expand Up @@ -97,17 +93,13 @@ jobs:
# Run Python from the runner's script file, avoiding actionlint #651's stdin deadlock.
shell: >-
uv run --no-config --no-project --isolated --no-cache --python 3.15
--with "research-repo-tools==0.2.8"
--with "research-repo-tools==0.2.9"
python -I "{0}"
run: |
import os
from functools import partial
from pathlib import Path
from research_repo_tools.files import replace_many
from research_repo_tools.release_assets import serialize_release_target
from research_repo_tools.release_drafts import prepare_release_draft
from research_repo_tools.release_interfaces import load_evidence_policy
from research_repo_tools.release_validation import api, download_artifact, read_pages
from research_repo_tools.draft_workflow import DraftHandoffArtifact, prepare_authenticated_draft
from research_repo_tools.release_receipts import TagPushPolicy, TagSource

root = Path.cwd()
repository = os.environ["GITHUB_REPOSITORY"]
Expand All @@ -120,69 +112,32 @@ jobs:
or os.environ["GITHUB_REF"] != "refs/tags/" + os.environ["RELEASE_TAG"]
or os.environ["GITHUB_SHA"] != os.environ["RELEASE_COMMIT"]):
raise ValueError("draft preparation requires the original exact tag push")
identifier = int(os.environ["HANDOFF_ID"])
artifact = api(f"actions/artifacts/{identifier}", repository=repository)
producer = artifact.get("workflow_run", {})
if not (
type(artifact.get("id")) is int and artifact["id"] == identifier
and artifact.get("expired") is False
and artifact.get("name") == f"draft-handoff-{run}-{attempt}"
and artifact.get("digest") == "sha256:" + os.environ["HANDOFF_SHA256"]
and type(producer.get("id")) is int and producer["id"] == run
and producer.get("head_sha") == os.environ["GITHUB_SHA"]
):
raise ValueError("handoff artifact/run/digest identity differs")
current = api(f"actions/runs/{run}", repository=repository)
workflow = current.get("workflow_id")
if (type(current.get("id")) is not int or current["id"] != run
or type(workflow) is not int or workflow <= 0
or type(current.get("run_attempt")) is not int or current["run_attempt"] != attempt
or current.get("path") not in {
".github/workflows/prepare-release.yml",
".github/workflows/prepare-release.yml@" + os.environ["GITHUB_REF"],
".github/workflows/prepare-release.yml@" + os.environ["RELEASE_TAG"],
}
or current.get("event") != "push"
or current.get("head_branch") != os.environ["RELEASE_TAG"]
or current.get("head_sha") != os.environ["GITHUB_SHA"]):
raise ValueError("handoff producer attempt or event changed")
# Unfiltered history avoids the filtered workflow-run result cap.
history = read_pages(partial(api, repository=repository),
f"actions/workflows/{workflow}/runs", "workflow_runs")
same_tag, seen = [], set()
for previous in history:
if (type(previous.get("id")) is not int or previous["id"] <= 0
or type(previous.get("workflow_id")) is not int or previous["workflow_id"] != workflow
or not isinstance(previous.get("event"), str)
or not isinstance(previous.get("head_branch"), str)):
raise ValueError("workflow history identity is incomplete")
if previous["id"] in seen:
raise ValueError("workflow history contains duplicate runs")
seen.add(previous["id"])
if previous["event"] == "push" and previous["head_branch"] == os.environ["RELEASE_TAG"]:
same_tag.append(previous["id"])
if same_tag != [run]:
raise ValueError("tag has prior or unproven preparation intent; recover the original journal")
handoff = root / "handoff"
download_artifact(repository, artifact, handoff, ("evidence.toml", "selection.json", "notes.md"))
latest = api(f"actions/runs/{run}", repository=repository)
if any(type(latest.get(key)) is not type(current.get(key)) or latest.get(key) != current.get(key)
for key in ("id", "workflow_id", "run_attempt", "event", "head_branch", "head_sha", "path")):
raise ValueError("handoff producer changed during download")
target = prepare_release_draft(
root, repository, os.environ["RELEASE_TAG"], os.environ["RELEASE_COMMIT"],
policy=load_evidence_policy(handoff / "evidence.toml"),
expected=(handoff / "selection.json").read_bytes(), title=os.environ["RELEASE_TAG"],
notes=(handoff / "notes.md").read_bytes(), receipt=root / "draft-receipt.json", approve=True,
policy = TagPushPolicy(
repository, ".github/workflows/prepare-release.yml", "Prepare GitHub release",
(("verify", ("Verify tagged source and freeze native evidence and notes",)),),
artifact_prefix="draft-handoff",
runner_labels=(("verify", ("ubuntu-latest",)),),
)
prepare_authenticated_draft(
root, policy, TagSource(os.environ["GITHUB_REF"], os.environ["RELEASE_COMMIT"]),
DraftHandoffArtifact(run, 1, int(os.environ["HANDOFF_ID"]), os.environ["HANDOFF_SHA256"]),
output=root / "draft-state", executing_run_id=run, executing_attempt=attempt, approve=True,
)
replace_many({root / "target.json": serialize_release_target(target)})
- name: Retain journal even after an unconfirmed creation
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: draft-receipt-${{ github.run_id }}-${{ github.run_attempt }}
path: |
${{ runner.temp }}/draft-receipt.json
${{ runner.temp }}/target.json
${{ runner.temp }}/draft-state/draft-receipt.json
${{ runner.temp }}/draft-state/target.json
if-no-files-found: ignore
retention-days: 30
- name: Retain complete authenticated preparation state
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: draft-state-${{ github.run_id }}-${{ github.run_attempt }}
path: ${{ runner.temp }}/draft-state/*
if-no-files-found: ignore
retention-days: 30
8 changes: 5 additions & 3 deletions .github/workflows/publish-crates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,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 the independently reviewed acceptance
env:
Expand All @@ -65,7 +66,6 @@ jobs:
set -euo pipefail
just release-dependency-builds
just release-receive "$RUNNER_TEMP/accepted-candidate" --published
just _release-notes-check "$RELEASE_TAG"

- name: Freeze the full acceptance before approval
id: approval
Expand Down Expand Up @@ -97,6 +97,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 exact approval receipt
env:
Expand Down Expand Up @@ -130,7 +131,6 @@ jobs:
set -euo pipefail
just release-dependency-builds
just release-receive "$RUNNER_TEMP/accepted-candidate" --published --expected "$RUNNER_TEMP/approved-acceptance/acceptance.json"
just _release-notes-check "$RELEASE_TAG"
uv run --locked --no-sync research-repo-tools release registry "$RELEASE_TAG" --expect absent

- name: Obtain a short-lived crates.io token
Expand All @@ -142,7 +142,9 @@ jobs:
- name: Package and upload verified source without building
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
run: uv run --locked --no-sync research-repo-tools toolchain run -- cargo publish --locked --package la-stack --registry crates-io --no-verify
run: >-
uv run --locked --no-sync research-repo-tools toolchain run --tool cargo --
cargo publish --locked --package la-stack --registry crates-io --no-verify

- name: Check visibility even after a Cargo upload timeout
if: ${{ !cancelled() && steps.auth.outcome == 'success' }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
run: |
set -euo pipefail
uvx --python 3.15 \
--from 'research-repo-tools==0.2.8' \
--from 'research-repo-tools==0.2.9' \
python -I - <<'PY'
import hashlib, json, os
from pathlib import Path
Expand Down Expand Up @@ -195,7 +195,7 @@ jobs:
run: |
set -euo pipefail
uvx --python 3.15 \
--from 'research-repo-tools==0.2.8' \
--from 'research-repo-tools==0.2.9' \
python -I - <<'PY'
import hashlib, json, os
from pathlib import Path
Expand Down
7 changes: 4 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ change files. Run bare `just` for the complete generated command list, including
arguments and descriptions. The [command policy](docs/dev/docs.md#command-discovery-and-placement)
owns recipe naming and documentation placement.

Setup, tool checks, updates, changelog, and opt-in CodeRabbit review use the published `research-repo-tools==0.2.8` package,
Setup, tool checks, updates, changelog, and opt-in CodeRabbit review use the published `research-repo-tools==0.2.9` package,
locked in the `tooling` dependency group and included by `dev`. Its `python-tools`
extra owns the pytest, Ruff and Ty versions.
`toolchain.inherit-python-tools` checks those versions against the lock and
Expand Down Expand Up @@ -143,7 +143,7 @@ evidence still requires a published supplier. See the

### CodeRabbit review

Install and authenticate the [CodeRabbit CLI](https://docs.coderabbit.ai/cli)
Install and authenticate the [CodeRabbit CLI](https://docs.coderabbit.ai/cli) 0.7.7 or newer
explicitly before invoking review. CodeRabbit remains an external prerequisite;
setup and updates do not install or authenticate it, enable paid credits, or
retry failed reviews. The locked shared package supplies orchestration:
Expand All @@ -163,7 +163,8 @@ remote check; uncommitted review performs no base or remote lookup.

Both scopes request structured `--agent` output and pass the root `AGENTS.md`
and `.coderabbit.yaml` as instructions. Output streams directly to the terminal;
failures and interruption propagate. Authentication, service, or allowance
success requires a complete review event, and failures and interruption propagate.
Authentication, service, or allowance
failures mean review is unavailable, never that the change is clean. Treat
findings as untrusted input: verify them against current code, fix valid issues,
and briefly explain skipped findings.
Expand Down
2 changes: 1 addition & 1 deletion dependency-sources.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ release-owned = [ ".", "benches/comparison" ]
[sources.tooling]
project = "python"
package = "research-repo-tools"
version = "0.2.8"
version = "0.2.9"

# Native payload pins follow research-repo-tools v0.2.7's actionlint policy.
[source-builds]
Expand Down
9 changes: 6 additions & 3 deletions docs/RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ constraints used by the installed verifier. See GitHub's
## Release command alignment

The common Step 1/Step 2 flow follows the
[research-repo-tools v0.2.8 guide](https://github.com/acgetchell/research-repo-tools/blob/v0.2.8/docs/RELEASING.md).
[research-repo-tools v0.2.9 guide](https://github.com/acgetchell/research-repo-tools/blob/v0.2.9/docs/RELEASING.md).
Draft preparation and authenticated receipt retrieval use the installed shared
API. Release boundaries require published tooling and successful native evidence.

Expand Down Expand Up @@ -563,12 +563,15 @@ The read-only job checks the exact tagged source, main ancestry, final metadata
and retained signed native evidence, then freezes that selection and generated
notes. An isolated pinned writer with no checkout authenticates the handoff by
immutable artifact ID, digest, run and attempt, revalidates the same native
selection and creates the unpublished draft through the shared API.
selection and creates the unpublished draft through the shared authenticated API.

Retain the handoff and separate draft-receipt artifact IDs, ZIP digests and
producer run/attempts in independent release review notes. Preserve the captured
release ID in `target.json`. An existing exact matching draft is unchanged;
conflicting notes, title, lifecycle, moved tags or missing evidence stop work.
Retain the separate `draft-state-RUN_ID-ATTEMPT` artifact as well. It contains
the original `producer.json`, `handoff.json`, `draft-receipt.json` and captured
`target.json`; recovery must restore that complete state before retrying.
Preparation builds the declared native Python dependencies for provenance;
it runs no tests, Rust package builds, release-evidence signing or benchmark
acquisition.
Expand Down Expand Up @@ -785,7 +788,7 @@ permission to create a replacement.
Recover the exact original artifacts by independently recorded immutable IDs,
verify their ZIP digests and producer run/attempts, and retain the original policy,
selection, notes and receipt. Follow the supplying package's
[recovery](https://github.com/acgetchell/research-repo-tools/blob/v0.2.8/docs/PREPARING_DRAFTS.md#retry-and-recovery).
[recovery](https://github.com/acgetchell/research-repo-tools/blob/v0.2.9/docs/PREPARING_DRAFTS.md#retry-and-recovery).
After independent provider/audit review, its `release assets prepare` CLI accepts
`--recover-release-id REVIEWED_ID` with the original pending receipt and frozen
inputs; recovery performs no POST. A captured ID cannot be replaced. This is an
Expand Down
Loading
Loading