πŸ› fix: P-39 work rules read a slice's parent as CI can

Merged
AT
1mo ago
+48-10

Slice: #94

On a private repository, a workflow's GITHUB_TOKEN reads an issue's parent_issue_url as null. So, with the sandbox on v0.5.7, Work rules refused sandbox #6 and #3: "#4 / #2 is not a sub-issue of a Work item". Both are sub-issues of Work item #1. Sandbox debug run 41246830189, using that token, got parent_issue_url: null from GET /issues/4 and 200 with #1 (type Work item) from GET /issues/4/parent.

  • src/work.ts: parentOf reads GET /issues/{n}/parent, still REST only. A 404 "No parent issue found" means no parent. Any other failure stops the check with could not read #N's parent (HTTP …), never "not a sub-issue". propose uses the same read for a State.
  • Tests: the fake now always returns parent_issue_url: null, as GITHUB_TOKEN does, so the existing passes prove the endpoint is used. New cases: a parent that isn't a Work item, parent reads that fail (403, an unexplained 404, 502), and propose on a State whose parent can't be read.
  • No version bump: the batch release PR does that.

Proof after release: re-run Work rules on sandbox #6, which should pass on the owner's πŸ‘ on #4, and on #3, which should fail for its own reasons.

πŸ€– Generated with Claude Code


Summary by cubic

Fixes Work rules refusing valid slices on private repositories, where a workflow's GITHUB_TOKEN reads an issue's parent_issue_url as null. Work rules now read a slice's parent from GitHub's parent endpoint instead, and a parent that cannot be read fails closed naming the failed read rather than "not a sub-issue of a Work item". The same read backs propose on a State.