Skip to content
Open
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
23 changes: 23 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Advisory. @lazyxeon is named on these paths. Review is not required to merge.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The header says review is not required to merge. Ruleset 7941616 still has require_code_owner_review: true, required_approving_review_count 2, and bypass_actors null. GitHub reads CODEOWNERS from the base branch, so this pull request is uncovered. After this file is on main, a later pull request that touches these paths requests @lazyxeon, and the author cannot approve that request.

Set the flag to false before this file reaches the default branch. The live rule did not stop the last owner merge: #728 head 8bd9fa4d had reviewDecision REVIEW_REQUIRED and no APPROVED review, and @lazyxeon squash-merged it at 2026-11-10T00:36:44Z. The header describes the flag this pull request asks him to set. The live value is still true.

# No other ownership rule. Patterns are root-anchored and do not overlap.
/.github/ @lazyxeon
/.cargo/ @lazyxeon
/scripts/ci/ @lazyxeon
/rust-toolchain.toml @lazyxeon
/CLAUDE.md @lazyxeon
/GROK.md @lazyxeon
/.cursor/rules/ @lazyxeon
/deny.toml @lazyxeon
/AGENTS.md @lazyxeon
/.config/nextest.toml @lazyxeon
/Cargo.toml @lazyxeon
/docs/scripts/generate-sitemap.sh @lazyxeon
/scripts/aravath-sha256.sh @lazyxeon
/scripts/check-aravath-network.sh @lazyxeon
/scripts/check_benchmark_thresholds.ps1 @lazyxeon
/scripts/export_benchmark_history.sh @lazyxeon
/scripts/export_benchmark_jsonl.ps1 @lazyxeon
/scripts/generate_benchmark_graphs.py @lazyxeon
/scripts/tsan_suppressions.txt @lazyxeon
/tools/xtask/src/fetch_assets.rs @lazyxeon
/tools/xtask/src/main.rs @lazyxeon
Comment on lines +22 to +23

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pack-guard.yml runs cargo run -p xtask -- ci-guard. That compiles the crate. tools/xtask/src/lib.rs is pub mod fetch_assets, and main.rs calls xtask::fetch_assets::ci_guard. A #[path] on that module, or a [lib] path / [[bin]] path edit in tools/xtask/Cargo.toml, points the required check at a file this list does not name.

git check-ignore matches these two files. It does not match tools/xtask/src/lib.rs, tools/xtask/Cargo.toml, tools/xtask/tests/fetch_assets.rs, or tools/xtask/build.rs. /.github/ and /scripts/ci/ are directory patterns for this reason. /tools/xtask/ is the same shape. The sentence that says these paths cover the pack-guard xtask sources is ahead of this list. The policy tuple has to change with the pattern.

55 changes: 51 additions & 4 deletions docs/current/CI_ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ A new push cancels the previous pull-request run. Pushes to main, tags, and sche

These path-filtered workflows are not in the required set because a filter would skip them and leave a check pending: trace sync, doc-truth lint, docs, and Miri job `miri-ecs-hotpath` (`miri.yml`; paths `astraweave-ecs/src/blob_vec.rs`, `sparse_set.rs`, and `archetype.rs`). That Miri job is not required. `net-tests.yml` still triggers on every pull request; its job is scope-conditional (`--scope net`), not path-filtered (see below). Pack guard and OpenSSF Scorecard run on every pull request. PBR, Editor CI, and AW Editor tests do not run on pull requests.

`PR Rust checks` is the status to require for the Rust rows. The heavy jobs are skipped on a docs-only pull request (they do not compile). GitHub treats a skipped required check as missing, which blocks the merge. The rollup runs on every pull request: it fails if the gate failed or if a crate change left a test job red, and it passes when the heavy jobs were correctly skipped.
`PR Rust checks` is the status to require for the Rust rows. The heavy jobs are skipped on a docs-only pull request (they do not compile). GitHub counts a job skipped by its `if:` as passing, so a required heavy job would pass on any skip, including after a failed archive build. A skipped matrix job reports only its unexpanded name, so the per-partition names would never report. The rollup runs on every pull request: it fails if the gate failed or if a crate change left a test job red, and it passes when the heavy jobs were correctly skipped.

### Main, nightly, workflow_dispatch

Expand Down Expand Up @@ -178,12 +178,59 @@ The 2026-10-15 measurement was 8 allocs and 4112 bytes on a settled `PhysicsWorl

## Required status checks

Set these on `main`. Names are the job `name:` values. After this pull request's first check run, confirm them against `gh pr checks` and adjust if GitHub prefixes the workflow name.
Ruleset 7941616 (Admin Authorization) on `main` requires three contexts that do not report on `pull_request`: `Code coverage` (integration 15368), `CodeQL` (integration 57789), and `Analyze (rust)` (integration 15368). `strict_required_status_checks_policy` is true. This file does not change that ruleset. There is no check run named `Code coverage`. `coverage.yml` runs on push to `main`, schedule, and `workflow_dispatch`; its job name is `Generate Code Coverage`. `CodeQL` was not a check run on pull-request heads, and it was not a check run on main `d01720a8` after `Analyze (rust)` succeeded. `Analyze (rust)` is the CodeQL Actions job (app id 15368). It reports on push to `main`. It does not report on `pull_request`.

The rollup check-run name is `PR Rust checks`. The app id is 15368 (`github-actions`). The job `if` is `always() && github.event_name == 'pull_request'`, so the check is created on every pull request. A docs-only pull request does not skip it. Pull request #700 (head `f2949be1`, only `docs/sitrep_log.md`) run `42123942320` (`pull_request`) completed check run `127583654852` as success. Pull request #597 (head `58621da5`, `AGENTS.md` only) run `40965117538` completed check run `123771336889` as success. On a push to `main` the same job is skipped. Required checks read the pull-request head, so that push skip does not leave a pull request pending.

`gh pr checks` prints the check-run `name`. It does not prefix the workflow name. The compare job's check-run name is `compare`, not `determinism-replay / compare`.
Comment thread
cursor[bot] marked this conversation as resolved.
Resolved

`.github/CODEOWNERS` is advisory. It names @lazyxeon on `/.github/`, `/.cargo/`, `/scripts/ci/`, `/rust-toolchain.toml`, `/CLAUDE.md`, `/GROK.md`, `/.cursor/rules/`, `/deny.toml`, `/AGENTS.md`, `/.config/nextest.toml`, `/Cargo.toml`, `/tools/xtask/src/fetch_assets.rs`, `/tools/xtask/src/main.rs`, `/scripts/check-aravath-network.sh`, `/scripts/aravath-sha256.sh`, `/scripts/check_benchmark_thresholds.ps1`, `/scripts/export_benchmark_history.sh`, `/scripts/export_benchmark_jsonl.ps1`, `/scripts/generate_benchmark_graphs.py`, `/scripts/tsan_suppressions.txt`, and `/docs/scripts/generate-sitemap.sh`. Those paths cover the workflows, composite actions, CI scripts, pack-guard xtask sources, nextest `ci-pr*` profiles, workspace MSRV, benchmark and Aravath helper scripts, the audit ignore file, the Linux replay rustflags, the toolchain pin, and the constitution files. The file does not block a merge. On the `pull_request` rule, set `require_code_owner_review` to false and leave the other parameters on that rule as they are. The owner applies that with the status-check swap below. This file does not edit ruleset 7941616.

Require these contexts, each with integration id 15368. On the #700 head every one of them completed success, and none of the three ruleset contexts above was present. The same nine were success on docs-only #597 and #616 and on `.github/dependabot.yml` pull request #645.

```json
{
"strict_required_status_checks_policy": true,
"do_not_enforce_on_create": false,
"required_status_checks": [
{"context": "PR Rust checks", "integration_id": 15368},
{"context": "compare", "integration_id": 15368},
{"context": "hash (ubuntu-latest)", "integration_id": 15368},
{"context": "hash (windows-latest)", "integration_id": 15368},
{"context": "hash (macos-latest)", "integration_id": 15368},
{"context": "Cargo Deny Check", "integration_id": 15368},
{"context": "Security Audit (cargo-audit)", "integration_id": 15368},
{"context": "pack-managed paths untracked + ignore surfaces current", "integration_id": 15368},
{"context": "OpenSSF Scorecard Analysis", "integration_id": 15368}
Comment thread
cursor[bot] marked this conversation as resolved.
Resolved
]
}
```

`OpenSSF Scorecard Analysis` requests `security-events: write` and uploads SARIF (`github/codeql-action/upload-sarif@v4` in `scorecard.yml`). A pull request from a fork does not receive that permission. The upload step has no `continue-on-error`, so the job fails and this required context fails with it. Same-repository pull requests are the flow this list is for.

That object replaces `parameters` on the `required_status_checks` rule. The owner applies it. Drop the status-check contexts `Code coverage`, `CodeQL`, and `Analyze (rust)`. Keep the separate `code_scanning` rule on the same ruleset. That rule is the alert gate: CodeQL at `errors` / `high_or_higher`, and Scorecard at the same thresholds. It is not in the JSON above.

On the `pull_request` rule, replace `parameters` with the live object and `require_code_owner_review` set to false:

```json
{
"allowed_merge_methods": ["merge", "squash", "rebase"],
"dismiss_stale_reviews_on_push": true,
"require_code_owner_review": false,
"require_extra_approval_for_unattributed_changes": true,
"require_last_push_approval": true,
"required_approving_review_count": 2,
"required_review_thread_resolution": true,
"required_reviewers": []
}
```

The only change from the live `pull_request` parameters is `require_code_owner_review`. Do not change the `code_scanning` rule. This file does not edit ruleset 7941616.

Require:

- `PR Rust checks`
- `determinism-replay / compare`
- `compare`
- `hash (ubuntu-latest)`
- `hash (windows-latest)`
- `hash (macos-latest)`
Expand All @@ -192,7 +239,7 @@ Require:
- `pack-managed paths untracked + ignore surfaces current`
- `OpenSSF Scorecard Analysis`

Do not require the individual `Test (ubuntu, N/3)`, `Test (windows, N/3)`, or `Gate` names as branch-protection checks. On a docs-only pull request the archive and partition jobs are skipped, and a skipped required check blocks the merge. `Gate (fmt, clippy, check)` still runs (player-facing name check and workflow policy); only its `Rust CI setup` step is conditional (`.github/workflows/ci.yml:122`). `PR Rust checks` is the rollup.
Do not require the individual `Test (ubuntu, N/3)`, `Test (windows, N/3)`, or `Gate` names as branch-protection checks. On a docs-only pull request the archive and partition jobs are skipped by their job `if:`. GitHub counts a skipped required check as passing, so requiring them would not catch a failed archive build: the partitions behind it are skipped too. A skipped matrix job also reports only its unexpanded name, such as `Test (ubuntu, ${{ matrix.partition }}/3)`, so `Test (ubuntu, 1/3)` would never report and would leave docs-only (matrix-skipped) pull requests pending. `Gate (fmt, clippy, check)` still runs (player-facing name check and workflow policy); only its `Rust CI setup` step is conditional (`.github/workflows/ci.yml:122`). `PR Rust checks` is the rollup.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test (ubuntu, 1/3) reports when the partition runs. On #728 head 8bd9fa4dde57861dd7a4c3aa5fa04f28937cd3e1 these check runs completed success at app 15368: Test (ubuntu, 1/3), Test (ubuntu, 2/3), Test (ubuntu, 3/3), Test (windows, 1/3), Test (windows, 2/3), and Test (windows, 3/3).

On docs-only f2949be1 the skipped check is Test (ubuntu, ${{ matrix.partition }}/3) (and the Windows twin), conclusion skipped. Requiring the expanded name leaves that pull request pending. It does not leave a pull request pending when the partitions run.

This sentence now limits the pending effect to docs-only pull requests, and it still says Test (ubuntu, 1/3) would never report. Those clauses disagree. Line 53 still says the per-partition names would never report. The expanded name is absent on the skipped run and present when the job runs.


Do not require `Test (ubuntu, build archive)`, `Test (windows, build archive)`, or either platform's `Test (*, N/3)` jobs individually. The rollup fails if an archive build fails or any partition fails. Do not require scope- or path-gated jobs individually: `net-tests` (every pull request; job skipped when scope is cold), trace sync, doc-truth, docs, Miri `miri-ecs-hotpath`. PBR, Editor CI, and AW Editor tests do not run on pull requests.

Expand Down
85 changes: 85 additions & 0 deletions scripts/ci/test_workflow_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,70 @@ def _broken_action_ref_violation(old: str, new: str):
return _exec_action_ref_violation_from_source(source)


CODEOWNERS_FILE = ROOT / ".github" / "CODEOWNERS"
CODEOWNERS_OWNER = "@lazyxeon"
CODEOWNERS_ADVISORY = (
"Advisory. @lazyxeon is named on these paths. Review is not required to merge."
)
# File order. These patterns do not overlap; last-match would not change the owner.
CODEOWNERS_PATHS = (
"/.github/",
"/.cargo/",
"/scripts/ci/",
"/rust-toolchain.toml",
"/CLAUDE.md",
"/GROK.md",
"/.cursor/rules/",
"/deny.toml",
"/AGENTS.md",
"/.config/nextest.toml",
"/Cargo.toml",
"/docs/scripts/generate-sitemap.sh",
"/scripts/aravath-sha256.sh",
"/scripts/check-aravath-network.sh",
"/scripts/check_benchmark_thresholds.ps1",
"/scripts/export_benchmark_history.sh",
"/scripts/export_benchmark_jsonl.ps1",
"/scripts/generate_benchmark_graphs.py",
"/scripts/tsan_suppressions.txt",
"/tools/xtask/src/fetch_assets.rs",
"/tools/xtask/src/main.rs",
)


def codeowners_rules(text: str) -> list[tuple[str, tuple[str, ...]]]:
rules: list[tuple[str, tuple[str, ...]]] = []
for line_no, raw in enumerate(text.splitlines(), start=1):
line = raw.strip()
if not line or line.startswith("#"):
continue
parts = line.split()
if len(parts) < 2:
raise AssertionError(f".github/CODEOWNERS:{line_no}: owner missing")
rules.append((parts[0], tuple(parts[1:])))
return rules


def assert_codeowners(text: str) -> None:
rules = codeowners_rules(text)
expected = [(path, (CODEOWNERS_OWNER,)) for path in CODEOWNERS_PATHS]
if rules != expected:
raise AssertionError(f"CODEOWNERS rules {rules!r} != {expected!r}")


def _exec_assert_codeowners(source: str):
namespace: dict[str, object] = {
"CODEOWNERS_OWNER": CODEOWNERS_OWNER,
"CODEOWNERS_PATHS": CODEOWNERS_PATHS,
"codeowners_rules": codeowners_rules,
}
exec(compile(source, "<assert_codeowners>", "exec"), namespace)
fn = namespace.get("assert_codeowners")
if not callable(fn):
raise RuntimeError("assert_codeowners missing after exec")
return fn


def workflow_texts() -> dict[str, str]:
return {path.name: path.read_text(encoding="utf-8") for path in sorted(WORKFLOWS.glob("*.yml"))}

Expand Down Expand Up @@ -1149,6 +1213,27 @@ def test_benchmark_alert_issue_runs_after_failed_regression_check(self) -> None:
with self.assertRaises(AssertionError):
assert_alert_followup_runs(mutant)

def test_codeowners_is_only_the_policy_paths(self) -> None:
text = CODEOWNERS_FILE.read_text(encoding="utf-8")
self.assertIn(CODEOWNERS_ADVISORY, text)
assert_codeowners(text)
missing = text.replace("/AGENTS.md @lazyxeon\n", "", 1)
self.assertNotEqual(missing, text)
with self.assertRaises(AssertionError):
assert_codeowners(missing)
extra = text + "/README.md @lazyxeon\n"
with self.assertRaises(AssertionError):
assert_codeowners(extra)
source = inspect.getsource(assert_codeowners)
guard = "\n if rules != expected:\n"
self.assertIn(guard, source)
weakened = source.replace(guard, "\n if False and rules != expected:\n", 1)
self.assertNotEqual(weakened, source)
self.assertNotIn(guard, weakened)
broken = _exec_assert_codeowners(weakened)
broken(missing)
broken(extra)


if __name__ == "__main__":
unittest.main()
Loading