πŸ› fix(needs-owner): a closed issue or pull request never keeps needs-owner

Merged
AT
12h ago
+274-25

Slice: #639

Work item: https://github.com/veda-hq/niyam/issues/638. Alok added its approved label at 2026-11-25T11:59:29Z. The slice was added before that approval, so it needs no proposal of its own: niyam propose 639 printed propose: #639 needs no decision from AlokBansal8.

Why: the hourly sweep listed only open issues labelled needs-owner. The owner's πŸ‘ sends no event, and GitHub runs the hourly schedule only every few hours. So a slice that was πŸ‘'d and then closed by its merge before the next sweep kept the label for good, as https://github.com/veda-hq/niyam/issues/604 and https://github.com/veda-hq/niyam/issues/578 did. Closed issues labelled needs-owner on 2026-11-25:

RepositoryCount
niyam28
veda65
athya_mono27
athya-rules1

What it does

  • The sweep (src/asks.ts) now also takes needs-owner off every closed issue and pull request labelled with it, whether or not it was answered. Its first run after a repository moves its pin backfills that repository.
  • The needs-owner job in .github/workflows/checks.yml now also runs when an issue is reopened. This file is named under the slice's Guards:.
    • A reopened issue is labelled again only where an ask on it still waits: no answer counts, and the owner put no approved label on it after the ask.
    • An issue that still has the label is left alone.
  • src/instant.ts is new. It reads ISO 8601 times strictly: an offset is required, and impossible dates are refused.
    • The reopened check compares instants, not text, because shuddhi's strict-scalar-parse refuses both string > and Date.parse.
    • A time it cannot read counts against the approval, so the issue gets labelled.
  • README (Needs you), the niyam needs-owner help line, and docs/decisions.md say so. The Decision also records why an issues: closed trigger was rejected: the sweep already covers it, and closing would race the merge.

Consumers: no consumer workflow changes. veda, athya_mono, athya-rules and niyam-sandbox get the fix when their pin moves to the release that carries it, which is 0.7.21, next after #640. This pull request releases nothing.

Evidence: pnpm check exits 0 locally. Pre-push ran it again on the branch after rebasing onto 6101176.

  • pnpm test: 2265 of 2265 pass, and pnpm test:scripts: 138 of 138.
  • New tests in src/asks.test.ts:
    • the sweep clears closed issues and a closed PR, tolerating a 404 on delete, and fails on a 403 on the closed list;
    • a reopened issue is labelled again, or left unlabelled after a πŸ‘, a later owner approval, or no ask;
    • an agent's approval, an earlier approval, an unreadable time, or a +12:00 time before the ask still relabels;
    • an already labelled reopened issue makes no requests.
  • New tests in src/instant.test.ts: UTC, fractions, offsets east and west, ordering that text gets wrong, leap days, and rejection of missing offsets, impossible dates, times and offsets.
  • Coverage: src/asks.ts 100% lines and 96.18% branches; src/instant.ts 100% lines and 95.65% branches.

πŸ€– Generated with Claude Code


Summary by cubic

Fixes needs-owner sticking to closed issues and pull requests, since the owner's πŸ‘ sends no event and the hourly sweep only listed open ones.

  • The sweep now takes needs-owner off every closed issue or pull request, answered or not, and its first run after release clears the backlog.
  • The needs-owner job now also runs when an issue is reopened, labelling it again only when an ask still waits: no counted answer and no owner approved label after the latest ask. An issue still labelled is left alone; a reopened pull request is not judged again.
  • Adds src/instant.ts, a strict ISO 8601 parser that issue-types.ts now shares, so both compare time instants rather than text; a time it cannot read counts against the approval.