✨ feat(pr-signals): pr-signals says when no CI has run, as on a conflicted pull request (#585)

Merged
AT
3d ago
+108-22

Slice: #585

Part of https://github.com/veda-hq/niyam/issues/394 (spec v1). The lesson is pr-green-needs-ci-runs: veda docs/lessons/github-actions.md, "A conflicted PR runs no CI." (read 2026-11-24 at baa73ff).

What it does

  • niyam pr-signals <pr> now says when no CI has run on a pull request, so an empty list of failures is not read as green. Before this, a conflicted pull request printed signals: [] with nothing to say that CI never ran.
  • Its JSON gains ci: { mergeable, checkRuns, actionsRuns }, --ci-only included:
    • mergeable is the pull request's mergeable_state, from the two readPull reads it already makes. It takes the later read, unless GitHub still says unknown there, in which case it takes the first. It is null when GitHub gives neither.
    • checkRuns and actionsRuns count the head's check runs, all of them and GitHub Actions' alone. Both come from the list ciSignals already reads, so no request is added.
  • It prints one warning line on standard error:
    • dirty: ⚠ #N has merge conflicts, so GitHub runs no pull_request workflows on it: merge the base and push before reading it as clear. This one wins, since merging the base fixes both cases.
    • no GitHub Actions check run on the head: ⚠ no CI has run on <sha> yet: no GitHub Actions check run is on it, so no failure listed is not a pass.
  • signals is unchanged. The README's pr-signals section describes ci and the warning.

Out of scope: the lesson's "two consecutive settled polls" is for a CI watcher, which niyam does not have, so it stays a doc.

Evidence

  • New tests in src/pr-signals.test.ts:
    • a dirty pull request with no check runs gives ci {dirty, 0, 0}, signals: [] and the conflict line;
    • a head where only Cubic ran gives actionsRuns: 0 and the no-CI line;
    • the later read's mergeable_state stands unless it is unknown or missing;
    • ciSignals returns its counts (5 check runs, 4 from Actions).
  • The session() fixture now has one passing Actions run, so the other tests still print no warning.
  • Full gate on e92d37b: pnpm provenance && pnpm typecheck && pnpm lint && pnpm test && pnpm test:scripts && pnpm pins && pnpm pariksha && pnpm hooks:check && pnpm build && pnpm smoke exited 0.
    • pnpm test: 2192 of 2192 pass. pr-signals.ts coverage is 100% lines, 96.68% branches and 100% functions.
    • pnpm test:scripts: 138 of 138 pass.

🤖 Generated with Claude Code


Summary by cubic

pr-signals now reports when no CI has run on a pull request, so an empty list of failures is not read as green. Before, a conflicted pull request printed signals: []; it now prints a warning and carries ci in its JSON.

What changed

  • ci holds the pull request's mergeable_state, its check-run count, and the GitHub Actions run count, with no extra request.
  • The later read's mergeable_state stands only when the head is unchanged and GitHub does not still say unknown; otherwise the first read's stands.
  • A dirty pull request's warning wins over the no-GitHub-Actions one, since merging the base fixes both.
  • signals is unchanged, and the README describes ci and the warning.