✨ feat: every open issue in an organisation has a work model type (State #241)

Merged
AT
24d ago
+768-102

Slice: #27
State: #241

Builds State #241 of P-05. Closes #241.

#238 made onboard's issue types step retype issues holding a type outside the work model. 38 open issues across athya-hq have no type at all; the owner wants them typed in the same run and kept from coming back.

What changes

  • src/issue-types.ts
    • typeFor, the one rule the plan and the new job share: parent Work item → Slice; parent Slice → State (new); has sub-issues → Work item; else Brief.
    • typesPlan now always lists the organisation's repositories and each one's open issues with ?type=none&state=open (rows kept only where GitHub shows no type). They join retype with from: 'no type', so withinApproved, archived-repo holds and late work as before. A repository's Approvals issue ("approvals" in its .github/niyam.json / .github/process-rules.json on the default branch, read only for repos with untyped issues) goes to exempt and keeps no type. Closed untyped issues are not read.
    • Plan rows: every issue is shown (the cap of ten stays only in the question); consecutive issues typed alike collapse to one row. Then closed, no type left as they are.
    • issueType, the new niyam issue-type command: on issues opened/reopened, in an organisation, with board on, re-reads the issue (so a parent set at creation counts), skips one with a type, a pull request and the Approvals issue, types it, and checks GitHub's answer (GitHub drops a type silently where a token may not set it).
    • typesDrift (doctor) also warns of open issues here with no type, minus the Approvals issue.
  • onboard: signs the owner in before the plan when there is anything to type, not only when another type exists.
  • Client workflow (process-rules.yml template): issues: types: [labeled, opened, reopened], and the process-rules-asks job (already issues: write) also starts on opened/reopened. A 0.6.3 workflow is upgraded by that one trigger line and one condition line (types: true in the repin; plan says "issue types for new issues"); a client-edited issues: trigger is left alone.
  • checks.yml: new Issue type job (no permissions block: it takes the caller's issues: write), on issues opened/reopened and on the asks job's hourly cron (41 * * * *), where issue-type sweeps every open issue in the repository with no type (see below); needs-owner now runs on the labeled issue event alone, not every issue event.
  • onboard writes the workflow for board alone too (Cubic): the Needs you labels and the new issue types both come from the asks job, which a board-only adopter never had.
  • README (Issue types, upgrade paragraph), decision record.

Can the job's token set a type?

Yes. PATCH /repos/{r}/issues/{n} with type needs write access to issues, the same as labels. Evidence: the weekly job's GITHUB_TOKEN (contents: read, issues: write) opened its undo issues with type: 'Brief': process-rules-sandbox#15 and athya_mono#2514, both by github-actions[bot], both typed Brief. The job also fails loudly if GitHub answers without the type.

Fork and permission rules: issue events never come from forks; the job reads settings from the default branch and runs the CLI from the pinned release, so whoever opens an issue changes nothing but that issue's type. Pull request runs stay read-only; the merged job is still the only PR run that writes to issues.

athya_mono's rotate-secrets.yml files its monthly reminder with github.rest.issues.create and the default GITHUB_TOKEN. GitHub starts no workflow run for an event that token causes, so opened never fires for it; the hourly sweep types it (Brief) within the hour, once athya_mono's workflow is on this release. The same covers any issue another workflow's token files. athya_mono is not edited.

Known limit (README): an issue made as a Brief and only later linked as a sub-issue keeps Brief, since no event starts the job then.

athya-hq, read-only as AthyaBot against this branch

issue types           org-wide: retype 1, type 37, disable 3
  athya_mono#59         no type → Brief   (and #70, #76, #140, #172, #175, #181, #198, #208, #249, #342, #813,
                                            #1232, #1250, #1364, #1380, #1384, #1408, #1428, #1435, #1448,
                                            #2384, #2431, #2534, #3163, #3174: one row each)
  athya_mono#3120–#3128 no type → Slice: its parent #3116 is a Work item
  athya_mono#3409       Task → Brief
  process-rules-sandbox#19–#20  no type → Brief
  athya_mono#3376       keeps no type: its repository's Approvals issue
  closed, no type       left as they are
  disable               Task, Bug, Feature

Checks

pnpm typecheck, pnpm test (1223 pass; coverage 99.5% lines, 97.6% branches), pnpm build && pnpm smoke, actionlint on checks.yml.

🤖 Generated with Claude Code