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
8 changes: 6 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,15 @@ jobs:
run: python3 scripts/check_toolchain.py
- name: Clone leaves + runner at pinned tags
run: |
git clone --depth 1 --branch v0.7.5 https://github.com/jc1122/repo-audit-skills.git /tmp/leaves
git clone --depth 1 --branch v0.8.0 https://github.com/jc1122/repo-audit-skills.git /tmp/leaves
(cd /tmp/leaves && npm ci) # jscpd for the duplication leaf (L1)
test -x /tmp/leaves/node_modules/.bin/jscpd || (echo "jscpd missing" && exit 1)
git clone --depth 1 --branch v0.9.0 https://github.com/jc1122/repo-audit-refactor-optimize.git /tmp/runner
git clone --depth 1 --branch v0.11.0 https://github.com/jc1122/repo-audit-refactor-optimize.git /tmp/runner
echo "/tmp/leaves/node_modules/.bin" >> "$GITHUB_PATH"
- name: Runner pin-coherence gate (#8)
env:
WAVE_RUNNER: /tmp/runner/scripts/run_diagnosis_wave.py
run: python3 scripts/check_runner_pin.py
- name: Convergence gate (Tier-1 wave)
env:
WAVE_RUNNER: /tmp/runner/scripts/run_diagnosis_wave.py
Expand Down
13 changes: 13 additions & 0 deletions .repo-audit/accept.json
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,19 @@
"applies": [
"report"
]
},
{
"match": {
"kind": "finding",
"leaf": "hotspot",
"path": "CHANGELOG.md",
"symbol": "CHANGELOG.md",
"metric": "churn_complexity_product"
},
"reason": "hotspot/churn_complexity_product on CHANGELOG.md: per-release changelog growth is inherent release activity (crossed the churn threshold at v0.6.0), not a refactor target; the file has no functions to decompose.",
"applies": [
"report"
]
}
]
}
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Changelog

## 0.6.0 - 2026-06-15

Dogfood gap remediation — Wave C (scope / deploy parity). Closes the cross-repo
pin-coherence gap so a stale runner pin can never silently run an old runner and
pass the wave gate:

- **#8 runner pin-coherence gate.** New `scripts/check_runner_pin.py` +
`scripts/runner_requirements.json` (`min_version` 0.11.0, capabilities
`lane-error-gate`/`metric-ceiling`/`lane-timeout`). The gate invokes
`$WAVE_RUNNER --capabilities`, parses the advertised `{version, capabilities}`,
and fails (exit 1) when the pinned runner is below the minimum version, is
missing any required capability, or `WAVE_RUNNER` is unset/unparseable. Pure
`version_ok` / `missing_caps` helpers are unit-tested. Wired into CI before the
convergence gate.
- **Runner re-pin v0.9.0 → v0.11.0**, the tag that advertises the required
capability surface.
- **Leaf re-pin v0.7.5 → v0.8.0** (`repo-audit-skills`), bringing repo-A lane
parity (perf-smell/hotspot/exec gates) and the standalone-deploy fixes.

## 0.5.0 - 2026-06-15

Dogfood gap remediation — Wave A (trustworthy green). Mirrors the convergence-gate
Expand Down
2 changes: 1 addition & 1 deletion SKILL.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: perf-benchmark
version: 0.5.0
version: 0.6.0
description: >
Use when profiling Linux Python or C workloads for algorithmic scaling,
cache, branch, memory, or ASM bottlenecks, or when comparing a benchmark run
Expand Down
94 changes: 94 additions & 0 deletions scripts/check_runner_pin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#!/usr/bin/env python3
"""Runner pin-coherence gate (#8): assert the tag-pinned WAVE_RUNNER actually
meets the version + capability requirements perf-benchmark depends on, so a
stale pin can never silently run an old runner and pass the wave gate."""

from __future__ import annotations

import json
import os
import subprocess # nosec B404: fixed argv, shell=False
import sys
from collections.abc import Iterable
from pathlib import Path
from typing import Any

REQUIREMENTS = Path(__file__).with_name("runner_requirements.json")


def version_ok(actual: str, minimum: str) -> bool:
"""True when semver ``actual`` >= ``minimum`` (stdlib-only X.Y.Z parse)."""
return _parse_version(actual) >= _parse_version(minimum)


def _parse_version(text: str) -> tuple[int, ...]:
return tuple(int(part) for part in text.strip().split("."))


def missing_caps(advertised: Iterable[str], required: Iterable[str]) -> list[str]:
"""Required capabilities absent from the advertised set, sorted."""
have = set(advertised)
return sorted(cap for cap in required if cap not in have)


def _advertised(runner: str) -> dict[str, Any]:
proc = subprocess.run( # nosec B603: fixed argv, shell=False
[sys.executable, runner, "--capabilities"],
check=False,
capture_output=True,
text=True,
timeout=60,
)
return json.loads(proc.stdout)


def main() -> int:
requirements = json.loads(REQUIREMENTS.read_text(encoding="utf-8"))
runner = os.environ.get("WAVE_RUNNER")
if not runner:
print(json.dumps({"status": "fail", "reason": "WAVE_RUNNER unset"}))
return 1
try:
advertised = _advertised(runner)
except (OSError, ValueError, subprocess.SubprocessError) as exc:
print(
json.dumps(
{
"status": "fail",
"reason": "capabilities probe failed",
"error": str(exc),
}
)
)
return 1
actual_version = str(advertised.get("version", "0.0.0"))
min_version = str(requirements["min_version"])
gaps = missing_caps(advertised.get("capabilities", ()), requirements["capabilities"])
if not version_ok(actual_version, min_version) or gaps:
print(
json.dumps(
{
"status": "fail",
"reason": "runner pin incoherent",
"runner_version": actual_version,
"min_version": min_version,
"missing_capabilities": gaps,
},
indent=2,
)
)
return 1
print(
json.dumps(
{
"status": "pass",
"runner_version": actual_version,
"min_version": min_version,
}
)
)
return 0


if __name__ == "__main__":
sys.exit(main())
4 changes: 4 additions & 0 deletions scripts/runner_requirements.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"min_version": "0.11.0",
"capabilities": ["lane-error-gate", "metric-ceiling", "lane-timeout"]
}
81 changes: 81 additions & 0 deletions tests/test_check_runner_pin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
from __future__ import annotations

import importlib
import json
import sys
from pathlib import Path

SCRIPTS_DIR = Path(__file__).resolve().parents[1] / "scripts"
if str(SCRIPTS_DIR) not in sys.path:
sys.path.insert(0, str(SCRIPTS_DIR))

mod = importlib.import_module("check_runner_pin")


def test_version_ok_equal():
assert mod.version_ok("0.11.0", "0.11.0") is True


def test_version_ok_greater():
assert mod.version_ok("0.12.0", "0.11.0") is True


def test_version_ok_lower():
assert mod.version_ok("0.10.5", "0.11.0") is False


def test_missing_caps_full_set():
advertised = ("lane-error-gate", "metric-ceiling", "lane-timeout")
required = ("lane-error-gate", "metric-ceiling", "lane-timeout")
assert mod.missing_caps(advertised, required) == []


def test_missing_caps_one_missing():
advertised = ("lane-error-gate", "metric-ceiling")
required = ("lane-error-gate", "metric-ceiling", "lane-timeout")
assert mod.missing_caps(advertised, required) == ["lane-timeout"]


_ALL_CAPS = ["lane-error-gate", "metric-ceiling", "lane-timeout"]


def _fake_runner(tmp_path, payload):
"""Write a fake runner that prints *payload* as JSON for --capabilities."""
script = tmp_path / "fake_runner.py"
script.write_text(f"import json\nprint(json.dumps({payload!r}))\n", encoding="utf-8")
return str(script)


def test_main_passes_with_compliant_runner(tmp_path, monkeypatch, capsys):
runner = _fake_runner(tmp_path, {"version": "0.11.0", "capabilities": _ALL_CAPS})
monkeypatch.setenv("WAVE_RUNNER", runner)
assert mod.main() == 0
assert json.loads(capsys.readouterr().out)["status"] == "pass"


def test_main_fails_when_wave_runner_unset(monkeypatch, capsys):
monkeypatch.delenv("WAVE_RUNNER", raising=False)
assert mod.main() == 1
assert json.loads(capsys.readouterr().out)["reason"] == "WAVE_RUNNER unset"


def test_main_fails_on_low_version(tmp_path, monkeypatch, capsys):
runner = _fake_runner(tmp_path, {"version": "0.1.0", "capabilities": _ALL_CAPS})
monkeypatch.setenv("WAVE_RUNNER", runner)
assert mod.main() == 1
assert json.loads(capsys.readouterr().out)["reason"] == "runner pin incoherent"


def test_main_fails_on_missing_capability(tmp_path, monkeypatch, capsys):
runner = _fake_runner(tmp_path, {"version": "0.11.0", "capabilities": ["lane-error-gate"]})
monkeypatch.setenv("WAVE_RUNNER", runner)
assert mod.main() == 1
assert "metric-ceiling" in json.loads(capsys.readouterr().out)["missing_capabilities"]


def test_main_fails_on_probe_error(tmp_path, monkeypatch, capsys):
bad = tmp_path / "bad.py"
bad.write_text("import sys\nsys.exit(3)\n", encoding="utf-8") # no stdout -> JSON parse fails
monkeypatch.setenv("WAVE_RUNNER", str(bad))
assert mod.main() == 1
assert json.loads(capsys.readouterr().out)["reason"] == "capabilities probe failed"