šŸ› fix: work rules see a late addition when GITHUB_TOKEN hides which slice was added

Merged
AT
1mo ago
+74-11

Slice: #94

State #114 of P-39, a fix filed under the slice it fixes (P-40), reported by the 0114 coordinator.

On a private repository a workflow's GITHUB_TOKEN reads a work item's sub_issue_added events with sub_issue: null. Work rules matched additions by that number, so they found no late addition, owed nothing and passed: athya_mono #2547 passed on v0.5.9 for slice #2541, added 40 s after its work item's approval. Pre-push, with the agent's token, refused it.

  • src/work.ts: readSlice reads the slice's own timeline too. Its parent_issue_added events are the slice's own, so GITHUB_TOKEN can tell when it was last added even with the parent hidden. The latest of those and any named addition counts. When an addition after approval names no issue and the slice records none, the check fails closed: "cannot tell when #N was added to work item #P…".
  • Tests: the fake serves the slice's own timeline. New cases cover a late addition seen only from the slice's timeline, and the fail-closed case. The old "ignores the add of another slice" test, which treated a null sub_issue as another slice, now has the slice's own record beside it.

Proof, sandbox (private) runs as GITHUB_TOKEN:

  • 41331946314: work item #1's additions read sub_issue: null; slice #4's own timeline has parent_issue_added at the addition's time.
  • 41332290514, sliceProblems for #4 (approved) and #21 (planted, added after approval, not approved):
    • v0.5.12: #4 [], #21 [], which passes the planted case.
    • this fix: #4 [], and #21 is refused: "#21 was added to work item #1 after its approval…".

No version bump; the coordinator releases it as 0.5.13.

šŸ¤– Generated with Claude Code


Summary by cubic

Fixes work rules missing late slice additions on private repositories, where a workflow's GITHUB_TOKEN reads sub_issue_added events with sub_issue: null and can't tell which slice was added.

  • Reads the slice's own parent_issue_added timeline events to determine when it was last added, alongside named additions.
  • A hidden addition after approval is put down to a sibling slice only when that sibling's own timeline records an addition at the same moment; otherwise it counts as this slice's addition and owes the owner's say, instead of passing.