šŸ› fix(work): Work rules puts an unnamed late addition down to an issue that has left the work item

Merged
AT
1d ago
+109-5

Slice: #714

Work rules no longer blames a slice for a sub-issue that has since left its work item. This is the one slice of #713, which Alok approved with the approved label. Page: https://claude.ai/artifact/CrjmGsPordMFgj24A8tmJm

The bug:

  • On a private repository, a workflow's GITHUB_TOKEN reads a work item's sub_issue_added events with sub_issue: null.
  • Work rules put such an addition, made after the approval, down to another sub-issue only when that one's own timeline recorded it, and it looked only among the current sub-issues. Any other addition counted as the slice's own.
  • athya-hq/athya-rules#213 sat under #116 from 10:46:32Z to 10:48:25Z on 2026-11-27. So Work rules dated slice athya-hq/athya-rules#203's latest addition after Alok's šŸ‘, though #203 had been under #116 since the day before, and refused athya-hq/athya-rules#214. It cleared only with a second proposal and a second šŸ‘.

Change (src/work.ts):

  • The slice is under the work item now, and an issue can be added again only after it leaves. So an unnamed late addition can be the slice's only when:
    • the slice has no addition on record, or
    • the work item records a removal (unnamed, or naming the slice) after the slice's latest addition on record and by this addition. A re-addition needs a removal after the last one, so this stays sound.
  • Otherwise it is another issue's, and the slice owes nothing for it.
  • An addition that can be the slice's is still put down to a current sibling whose own timeline records it at the same moment, as before.
  • Times compare as instants (instant, #639). One that does not parse counts against the slice.
  • The rule reads only the work item's timeline, which Work rules already reads, and asks for a sibling's timeline less often.

Tests (src/work.test.ts):

  • The athya-rules#214 case.
  • Owe nothing: a removal after the addition, one naming another issue, one at the slice's own addition, and one before the slice's second addition.
  • Still refuse:
    • a removal naming no issue, or naming the slice, between the two additions, also beside one that names another issue;
    • one at the moment of the addition;
    • a slice with no addition on record;
    • each time that does not parse.
  • Five existing hidden-addition tests now record a removal first, so their "the slice may have left and come back" case still holds and each still kills its mutants.

Evidence:

  • pnpm check passes: 3261 + 209 tests, lint and typecheck.
  • Run against main's src/work.ts, the new #214 test fails and every other test passes.
  • The src mutation lane kills all 1825 mutants in src/work.ts (run locally with CI's own command).

šŸ¤– Generated with Claude Code