✨ feat(owner-step): required-checks requires the shared Guard once it has passed

Merged
AT
15d ago
+350-11

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)

  • sharedGuard reads 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.yml pins;
    • it is on the default branch;
    • niyam-guard / judge reported success on the head of the last pull request merged there (passedOnPull, as --check uses), from GitHub Actions (app 15368).
  • 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_target policy step (policySteps).

  • --check niyam-guard / judge takes 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, Guard gives way to it, as process-rules / … gives way to niyam / ….

    • If both are required, Guard is dropped.
    • The plan, before and after, shows the swap, and the write is verified: the check is present and Guard is gone.
    • Until the check has passed, Guard stays.
  • README owner-step section and a docs/decisions.md record (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 Guard is swapped: only in veda-hq/niyam. Guard is a common check name, and the step keeps every other check, so a client's Guard stays.
  • 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 check passes: 2116 CLI tests and 96 script tests, 0 failures, typecheck and lint clean. owner-step.ts 99.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 Guard kept, read from a CRLF caller;
    • niyam's Guard swapped, alone and beside a required check;
    • no proof asked when nothing would change, or when there is no caller;
    • 10 ✗ shapes, which keep Guard and write nothing;
    • the public policy wording;
    • the --check lookalike refused, and a missing caller named;
    • a caller read that returns HTTP 502;
    • an edit made during the plan kept;
    • results that still require Guard or lack the check refused.

🤖 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 / judge takes 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 onboard writes, on the default branch, at the release niyam.yml pins.
  • 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 a pull_request_target policy 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.md records.