✨ feat: P-20 the owner approves with a reaction

Merged
AT
1mo ago
+532-61

Slice: #67

The owner can now approve a slice with one tap. Before this, the only way to approve a slice added after its work item's approval, or a State dropped after it, was to type a Decision: comment.

  • process-rules propose <issue> is a new command for agent sessions. Given a slice, it posts one Proposal: comment on it as the agent for each decision the slice owes: its addition after approval, and each State dropped after approval. Given a State, it posts that state's proposal alone. Each proposal mentions the owner, so it reaches their GitHub notifications. The command then labels the slice needs-owner, which puts it in the Needs you view. Run again, it posts nothing twice. Once everything is approved, it takes the label off. It refuses to post unless the session's token is the agent's.
  • Work rules count the owner's πŸ‘ on the agent's proposal the same way they count a Decision: comment. A πŸ‘ counts only when all of these hold:
    • it comes from the owner;
    • it is on the agent's comment starting Proposal:, and that comment's first #N is the slice or state being approved;
    • it was made after the proposal's last edit;
    • for an added slice, it was made after the slice's latest addition.
  • GraphQL reads each Reaction's user and createdAt, and each comment's lastEditedAt. Reactions are read only for proposals that could still settle something, at most 100 comment ids per query.
  • The refusal message tells the owner to react πŸ‘ on the agent's proposal or to comment Decision:. When no proposal exists yet, it also gives the agent the propose command to run.
  • A typed Decision: comment still works, unchanged.
  • Version: a patch release, 0.5.2, after 0.5.1 (#70), bumped the way #64 did (package.json and the README's install line).

docs/decisions.md records why each proposal goes on the slice. A dropped State is closed, and the Needs you view shows open issues only. It also records the rule that a proposal approves the first #N it names, the edit and time rules, and that a reaction triggers no workflow. So a πŸ‘ made after the PR's checks ran shows up only when Work rules runs again, or at pre-push.

Proof against the sandbox (athya-hq/process-rules-sandbox, this build, as AthyaBot):

  • Before: sliceProblems on #4, which was added after #1's approval, gave #4 was added to work item #1 after its approval; AlokBansal8 reacts πŸ‘ on AthyaBot's proposal on #4, or adds a "Decision:" comment naming #4; AthyaBot proposes it with: process-rules propose 4. On #2, the State #7 that was closed as not planned gave the matching message for the state.
  • propose 4 posted the proposal on #4 and labeled #4 needs-owner.
  • propose '#7' posted the state's proposal on #2 and labeled #2.
  • Running propose 4 again printed #4: proposed on #4, waiting on AlokBansal8's πŸ‘ and posted nothing. propose 9 (an open State) printed #9 needs no decision from AlokBansal8.
  • AthyaBot's own πŸ‘ on the #4 proposal did not count: the refusal stayed, now without the propose hint.
  • Still to do: the owner's πŸ‘ on those two proposals, to show that it passes. Unit tests cover it (src/work.test.ts, "the owner's πŸ‘ on the agent's proposal").
  • The sandbox's slices are not items on its Project, so the Needs you view there cannot show them. In a client using board, slices are on the Project.

pnpm check passes (546 tests, after rebasing on #70). The secret scans are clean.

πŸ€– Generated with Claude Code