✨ feat(guard): the Guard caller's pin only moves forward to a niyam release (#512)

Merged
AT
10d ago
+139-8

Slice: #512

The shared Guard now refuses a Guard caller pinned off a niyam release, or moved backwards, whatever the slice names. Alok, 2026-11-20: "file the slice to narrow CODEOWNERS", then approved #512.

Why. The caller's pin picks which Guard judges every pull request. isCaller took any v tag or any commit sha there. So a pull request whose approved slice named the caller could pin an older, weaker Guard, or an unreleased commit. Only niyam's CODEOWNERS caught that; veda and athya_mono own no caller.

What changes, in scripts/guard.mjs:

  • pinsIn reads the refs a workflow calls shared-guard.yml at.
  • judge refuses a changed workflow whose caller is pinned at:
    • anything but a vX.Y.Z tag;
    • a tag tagOnMain does not place on niyam's main;
    • a release newer places before the one the default branch's copy of that file pins.
  • These join the refusals no Guards: line passes, so they hold with work rules off too.
  • onboard writes only @vX.Y.Z, moving forward, so its pull requests pass.

The README's Guard section and docs/decisions.md say so.

Checked:

  • pnpm check passes (output below).
  • New tests cover:
    • a forward move, including v0.8.0 → v0.10.0, compared as numbers, which passes;
    • the same release, which passes;
    • a new caller, which passes;
    • a move backwards;
    • a commit sha;
    • a tag off niyam's main;
    • a default branch copy pinned at no release;
    • pinsIn on other jobs, YAML that does not parse, and a null job.
  • The existing caller test now has its tags on niyam's main.
pnpm check: exit 0
pnpm test:          tests 2117, pass 2117, fail 0
pnpm test:scripts:  tests 113,  pass 113,  fail 0
  guard.mjs  | line 100.00 | branch 96.51 | funcs 100.00

After merge: clients get it with the next release. Once niyam's own caller pins that release, #513 drops the caller from niyam's CODEOWNERS.

Guards: scripts/guard.mjs, scripts/guard.test.mjs. scripts/guard.mjs is code-owned by Alok, so this waits for his review. Guard needs his Decision: on #512 too: a šŸ‘ counts for the work rules only.

šŸ¤– Generated with Claude Code


Summary by cubic

The shared Guard now refuses a pull request whose caller pins an older or unreleased Guard, regardless of what an approved slice names.

  • A caller pinned at anything but a vX.Y.Z tag on niyam's main, or at a release older than the default branch's copy pins, is refused even when a **Guards:** line names the file.
  • onboard writes only forward moves to a release, so its pull requests pass.
  • Whether a niyam tag sits on main is checked once per run, however many callers or onboard lines name it.
  • README and docs/decisions.md document the rule, and tests cover forward, backward, same-release, sha, off-main, and unparseable cases.