✨ feat(owner-step): required-checks requires the shared Guard once it has passed
Slice: #471
niyam owner-step required-checks <repo> <ruleset> requires the shared Guard's check, niyam-guard / judge, once that check has proved it runs. In niyam's own ruleset it swaps Guard for it.
What changes (src/owner-step.ts)
-
sharedGuardreads the default branch's.github/workflows/niyam-guard.yml. It allows the check only when all of these hold:- the file is the caller onboard writes (
callerAt, from #470); - it is at the release
niyam.ymlpins; - it is on the default branch;
niyam-guard / judgereportedsuccesson the head of the last pull request merged there (passedOnPull, as--checkuses), from GitHub Actions (app 15368).
- the file is the caller onboard writes (
-
The check is required from GitHub Actions. Otherwise it is a ✗ with the reason:
- an edited or foreign caller, another release or another branch;
- no run, a failed run, another app, or two apps.
Each ✗ also says that Guard first reports on the pull request after the one that adds the caller. In a public repository it also names the
pull_request_targetpolicy step (policySteps). -
--check niyam-guard / judgetakes this path, never--check's. Any one app passes--check's proof, and a lookalike app is exactly what the shared Guard exists to stop. -
In niyam's ruleset (
PRODUCT), once the check has passed,Guardgives way to it, asprocess-rules / …gives way toniyam / ….- If both are required,
Guardis dropped. - The plan, before and after, shows the swap, and the write is verified: the check is present and
Guardis gone. - Until the check has passed,
Guardstays.
- If both are required,
-
README owner-step section and a
docs/decisions.mdrecord (2026-11-19).
Choices to check:
- Gate: it is gated on the caller file, not on
work-rules. A repository with no caller is told nothing unless the owner names the check, so clients that have not re-onboarded see no new ✗. Doctor already marks them. - Where
Guardis swapped: only inveda-hq/niyam.Guardis a common check name, and the step keeps every other check, so a client'sGuardstays. - Other branches: the caller runs on pull requests into the default branch alone. The step notes that a ruleset also targeting other branches would hold theirs. It does not read the ruleset's conditions to refuse that.
Evidence
pnpm checkpasses: 2116 CLI tests and 96 script tests, 0 failures, typecheck and lint clean.owner-step.ts99.75% lines, 96.56% branches; its two uncovered lines (180–181) predate this.- The 31 existing owner-step tests pass unchanged.
- 9 new tests:
- a client's check added from Actions with its own
Guardkept, read from a CRLF caller; - niyam's
Guardswapped, alone and beside a required check; - no proof asked when nothing would change, or when there is no caller;
- 10 ✗ shapes, which keep
Guardand write nothing; - the public policy wording;
- the
--checklookalike refused, and a missing caller named; - a caller read that returns HTTP 502;
- an edit made during the plan kept;
- results that still require
Guardor lack the check refused.
- a client's check added from Actions with its own
🤖 Generated with Claude Code
Summary by cubic
owner-step required-checks now requires the shared Guard's check, niyam-guard / judge, once that check has passed on the last pull request merged into the default branch, reported by GitHub Actions alone. Until it passes, the step refuses with a reason; in niyam's own ruleset the check takes Guard's place once passed, while clients keep their own Guard.
- Proof is GitHub Actions-only:
--check's proof accepts any one app, which is exactly the spoof the shared Guard exists to stop, so--check niyam-guard / judgetakes this path and never--check's. A ruleset already requiring the check from another app, or from any, is bound to GitHub Actions on the same proof; without it, that entry stays and the✗says so. - The caller must be what
onboardwrites, on the default branch, at the releaseniyam.ymlpins. - A
✗says why not — no run, failed run, another app, two apps, edited or foreign caller, or another release or branch — and that Guard first reports on the pull request after the one adding the caller; public repositories also need apull_request_targetpolicy from 2026-12-02. - A repository with no caller is told nothing unless the check is named, so clients that have not re-onboarded see no new
✗. - Adds README and
docs/decisions.mdrecords.