⨠feat(guard): the Guard caller's pin only moves forward to a niyam release (#512)
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:
pinsInreads the refs a workflow callsshared-guard.ymlat.judgerefuses a changed workflow whose caller is pinned at:- anything but a
vX.Y.Ztag; - a tag
tagOnMaindoes not place on niyam'smain; - a release
newerplaces before the one the default branch's copy of that file pins.
- anything but a
- These join the refusals no Guards: line passes, so they hold with work rules off too.
onboardwrites only@vX.Y.Z, moving forward, so its pull requests pass.
The README's Guard section and docs/decisions.md say so.
Checked:
pnpm checkpasses (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;
pinsInon other jobs, YAML that does not parse, and a null job.
- a forward move, including
- 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.Ztag on niyam'smain, or at a release older than the default branch's copy pins, is refused even when a**Guards:**line names the file. onboardwrites only forward moves to a release, so its pull requests pass.- Whether a niyam tag sits on
mainis checked once per run, however many callers or onboard lines name it. - README and
docs/decisions.mddocument the rule, and tests cover forward, backward, same-release, sha, off-main, and unparseable cases.