✨ feat: an organisation's enabled issue types are the work model's alone
Slice: athya-hq/athya_mono#27
State: athya-hq/athya_mono#237
Builds State athya-hq/athya_mono#237 of P-05. Closes athya-hq/athya_mono#237.
athya-hq has GitHub's default Task, Bug and Feature enabled beside the work model's five, and athya_mono#3409 was filed as Task. onboard only ever added missing types. Now it makes an organisation's enabled issue types exactly the work model's, handling the issues that hold another type first.
What changes
src/issue-types.ts(new;ISSUE_TYPESmoves here, re-exported fromboard.ts):typesPlanreads the organisation's types and, when any type outside the work model exists (enabled or disabled), lists every repository (/orgs/{org}/repos?type=all) and each repo's issues of that type, open and closed (/repos/{r}/issues?type=T&state=all). It keeps only rows GitHub shows holding the type, so an ignored filter retypes nothing. Each issue gets a type from GitHub's facts: parent is a Work item → Slice; has sub-issues → Work item; otherwise → Brief. A parent that is itself being retyped is read as its new type (a Task with Task sub-issues → Work item with Slices).applyTypesadds missing work model types, enables disabled ones, retypes every issue (PATCH /repos/{r}/issues/{n}withtype, checking GitHub's answer), and only then disables the other types.typesDriftis doctor's check.
setUpBoard: the issue types step reads the plan again as the owner (who sees every repo), asks once ("Issue types are an organisation-wide setting…"), and applies it.onboard's plan: reads as the agent before the plan and shows, under GitHub:
The first ten issues are named; the step's log, and so the pull request's description, names them all. If the agent cannot read the types:│ issue types org-wide: retype 1, disable 3 │ athya_mono#3409 Task → Brief │ disable Task, Bug, Featureorg-wide, read once signed in.doctor(Mac), in a repo whose settings turn the board on, in an organisation: ▲ for an enabled type outside the model, a missing or disabled model type, and issues here holding another type → "the owner reruns niyam onboard".- README "Issue types" section; decision record in
docs/decisions.md.
Where this departs from the design, and why
- PUT, not PATCH: GitHub's update endpoint is
PUT /orgs/{org}/issue-types/{id}withnameandis_enabledrequired (REST docs), soonboardsends the type's name, description and colour back withis_enabled: false. - Disable, never delete: GitHub's docs say a disabled type "will not be shown and it won't be possible to set an issue to that type", and that re-enabling shows it again on issues that had it; they do not say what deleting does to issues (Managing issue types). Retyping first means no issue is left holding a hidden type.
- Per-repo listing, not search: search caps at 1000 results and lags its index (on athya-hq,
no:typesearch said 350 open; REST listing said 38). - Archived repositories are read-only: their issues keep their type, that type stays enabled, and "By hand:" says to unarchive and rerun. Repos with issues turned off (forks; GitHub answers 410) are skipped.
- Disabled non-model types are swept each run too, so a rerun is idempotent and catches a type someone re-enabled or a new GitHub default.
- Tokens: retyping needs the owner's
repo(write on the repo), disabling needsadmin:org(organisation owner); both are already in the owner's one-run sign-in (ownerScopes). Nothing runs as the agent but the read for the plan.
Agent filing
decisions.ts (the weekly job's undo issue) is the CLI's only issue creation and sets Brief; propose and the asks job only comment and label. athya_mono#3409 was filed outside the CLI. Disabling Task stops a repeat; doctor catches drift.
Checked live (read-only, as AthyaBot)
typesPlan on athya-hq: retype athya-hq/athya-rules#255 Task → Brief ("it has no parent and no sub-issues"); disable Task (34774838), Bug (34774839), Feature (34774840). A no-op PATCH … type=Brief on a sandbox Brief confirmed the field is accepted.
No version bump; the coordinator releases. After release the owner reruns niyam onboard in athya_mono (rebased on the niyam rename, athya-hq/athya_mono#234).
🤖 Generated with Claude Code