Skip to content

Commit def7adb

Browse files
Enforce version sync and parallelize ready eval DAG stages (#39)
* Enforce Cargo version sync Co-authored-by: EvalOpsBot <EvalOpsBot@users.noreply.github.com> * Parallelize ready eval DAG stages Co-authored-by: EvalOpsBot <EvalOpsBot@users.noreply.github.com> * Fix DAG parallel test harness Co-authored-by: EvalOpsBot <EvalOpsBot@users.noreply.github.com> * Preserve DAG order for disabled nodes Co-authored-by: EvalOpsBot <EvalOpsBot@users.noreply.github.com> * Fix lint formatting and workflow actions Co-authored-by: EvalOpsBot <EvalOpsBot@users.noreply.github.com> * Use stage hints in postprocess graph description * Enable eval DAG batching --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: EvalOpsBot <EvalOpsBot@users.noreply.github.com>
1 parent 85f3af8 commit def7adb

File tree

14 files changed

+844
-260
lines changed

14 files changed

+844
-260
lines changed
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
#!/usr/bin/env python3
2+
3+
from __future__ import annotations
4+
5+
import argparse
6+
import subprocess
7+
import sys
8+
import tomllib
9+
from pathlib import Path
10+
11+
12+
def parse_args() -> argparse.Namespace:
13+
parser = argparse.ArgumentParser(
14+
description="Verify Cargo.toml version is aligned with git tags."
15+
)
16+
parser.add_argument(
17+
"--cargo-toml",
18+
default="Cargo.toml",
19+
help="Path to the Cargo.toml file to validate.",
20+
)
21+
parser.add_argument(
22+
"--tag",
23+
help="Require Cargo.toml to match this exact git tag (for release workflows).",
24+
)
25+
return parser.parse_args()
26+
27+
28+
def normalize_version(raw: str) -> str:
29+
value = raw.strip()
30+
return value[1:] if value.startswith("v") else value
31+
32+
33+
def parse_version(raw: str) -> tuple[int, ...]:
34+
normalized = normalize_version(raw)
35+
parts = normalized.split(".")
36+
if not parts or any(not part.isdigit() for part in parts):
37+
raise ValueError(
38+
f"Unsupported version '{raw}'. Expected dotted numeric versions like 0.5.26."
39+
)
40+
return tuple(int(part) for part in parts)
41+
42+
43+
def read_cargo_version(cargo_toml: Path) -> str:
44+
with cargo_toml.open("rb") as handle:
45+
data = tomllib.load(handle)
46+
try:
47+
return str(data["package"]["version"])
48+
except KeyError as error:
49+
raise KeyError(f"Missing [package].version in {cargo_toml}") from error
50+
51+
52+
def latest_release_tag() -> str | None:
53+
completed = subprocess.run(
54+
["git", "tag", "--list", "v*", "--sort=-v:refname"],
55+
check=True,
56+
capture_output=True,
57+
text=True,
58+
)
59+
for line in completed.stdout.splitlines():
60+
candidate = line.strip()
61+
if candidate:
62+
return candidate
63+
return None
64+
65+
66+
def main() -> int:
67+
args = parse_args()
68+
cargo_toml = Path(args.cargo_toml)
69+
cargo_version = read_cargo_version(cargo_toml)
70+
cargo_tuple = parse_version(cargo_version)
71+
72+
if args.tag:
73+
tag_version = normalize_version(args.tag)
74+
if cargo_version != tag_version:
75+
print(
76+
f"Cargo.toml version {cargo_version} does not match release tag {args.tag}.",
77+
file=sys.stderr,
78+
)
79+
return 1
80+
print(f"Cargo.toml version {cargo_version} matches release tag {args.tag}.")
81+
return 0
82+
83+
latest_tag = latest_release_tag()
84+
if latest_tag is None:
85+
print(f"Cargo.toml version {cargo_version} validated (no release tags found).")
86+
return 0
87+
88+
latest_tuple = parse_version(latest_tag)
89+
if cargo_tuple < latest_tuple:
90+
print(
91+
(
92+
f"Cargo.toml version {cargo_version} is behind the latest tag {latest_tag}. "
93+
"Bump [package].version before merging."
94+
),
95+
file=sys.stderr,
96+
)
97+
return 1
98+
99+
print(
100+
f"Cargo.toml version {cargo_version} is aligned with latest tag {latest_tag}."
101+
)
102+
return 0
103+
104+
105+
if __name__ == "__main__":
106+
raise SystemExit(main())

.github/workflows/ci.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,22 @@ env:
1010
CARGO_TERM_COLOR: always
1111

1212
jobs:
13+
version:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v5
17+
with:
18+
fetch-depth: 0
19+
- name: Verify Cargo version is not behind tags
20+
run: python3 .github/scripts/check_version_sync.py
21+
1322
lint:
1423
runs-on: ubuntu-latest
1524
steps:
16-
- uses: actions/checkout@v4
25+
- uses: actions/checkout@v5
1726
- name: Lint GitHub Actions
1827
uses: raven-actions/actionlint@v2
19-
- uses: actions/setup-node@v4
28+
- uses: actions/setup-node@v5
2029
with:
2130
node-version: '20'
2231
- name: Build frontend
@@ -33,7 +42,7 @@ jobs:
3342
security:
3443
runs-on: ubuntu-latest
3544
steps:
36-
- uses: actions/checkout@v4
45+
- uses: actions/checkout@v5
3746
- uses: dtolnay/rust-toolchain@1.88.0
3847
- uses: Swatinem/rust-cache@v2
3948
- name: Install cargo-audit
@@ -47,8 +56,8 @@ jobs:
4756
matrix:
4857
os: [ubuntu-latest, macos-latest, windows-latest]
4958
steps:
50-
- uses: actions/checkout@v4
51-
- uses: actions/setup-node@v4
59+
- uses: actions/checkout@v5
60+
- uses: actions/setup-node@v5
5261
with:
5362
node-version: '20'
5463
- name: Build frontend

.github/workflows/diffscope.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
runs-on: ubuntu-latest
1717
if: github.event.pull_request.head.repo.full_name == github.repository && !github.event.pull_request.draft
1818
steps:
19-
- uses: actions/checkout@v4
19+
- uses: actions/checkout@v5
2020
with:
2121
fetch-depth: 0
2222
ref: ${{ github.event.pull_request.head.sha }}

.github/workflows/eval.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
echo "configured=false" >> "$GITHUB_OUTPUT"
3333
fi
3434
35-
- uses: actions/checkout@v4
35+
- uses: actions/checkout@v5
3636
if: ${{ steps.secret-check.outputs.configured == 'true' }}
3737
with:
3838
fetch-depth: 0

.github/workflows/release.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ jobs:
2121
contents: write
2222
steps:
2323
- name: Checkout code
24-
uses: actions/checkout@v4
24+
uses: actions/checkout@v5
25+
- name: Verify Cargo version matches tag
26+
run: python3 .github/scripts/check_version_sync.py --tag "${{ github.ref_name }}"
2527

2628
- name: Extract version
2729
id: get_version
@@ -99,10 +101,10 @@ jobs:
99101

100102
steps:
101103
- name: Checkout code
102-
uses: actions/checkout@v4
104+
uses: actions/checkout@v5
103105

104106
- name: Install Node.js
105-
uses: actions/setup-node@v4
107+
uses: actions/setup-node@v5
106108
with:
107109
node-version: '20'
108110

@@ -215,7 +217,7 @@ jobs:
215217
runs-on: ubuntu-latest
216218
steps:
217219
- name: Checkout code
218-
uses: actions/checkout@v4
220+
uses: actions/checkout@v5
219221

220222
- name: Set up Docker Buildx
221223
uses: docker/setup-buildx-action@v3

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "diffscope"
3-
version = "0.5.3"
3+
version = "0.5.26"
44
edition = "2021"
55
rust-version = "1.88"
66
authors = ["Jonathan Haas <jonathan@haas.holdings>"]

src/commands/eval/runner/execute.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub(in super::super) async fn run_eval_fixture(
4040
EvalFixtureDagConfig {
4141
repro_validate,
4242
repro_max_comments,
43-
artifact_context,
43+
artifact_context: artifact_context.cloned(),
4444
},
4545
)
4646
.await?;

0 commit comments

Comments
 (0)