mach10 icon indicating copy to clipboard operation
mach10 copied to clipboard

Add task tracking to pr-pre-merge

Open LeanAndMean opened this issue 7 months ago • 5 comments

Summary

Add TaskCreate/TaskUpdate progress tracking to the pr-pre-merge command. This is the most complex non-delegating command (7 steps) with a 5-item checklist, branch merge decision logic, and user interactions for version bump level. Task tracking will make checklist progress visible and ensure no items are skipped.

Part of #81 (Tier 1 -- VERY HIGH priority). See #81 for task tracking conventions and overall context.

File: commands/pr-pre-merge.md

What Is Task Tracking?

mach10 commands should use TaskCreate and TaskUpdate to establish visible progress checkpoints. Tasks are created upfront after input parsing, then transitioned to in_progress / completed as work proceeds. This makes long-running commands observable and forces the execution to explicitly pass through each checkpoint. See #81 for the full conventions.

Task Graph

All 4 tasks are created in a single block after Step 1 (input parsing). Each task starts as pending.

Task Subject activeForm in_progress completed
T1 Check branch freshness Checking branch freshness Before Step 4 After Step 4 (branch freshness resolved, including any merge)
T2 Run pre-merge checklist Running pre-merge checklist Before Step 5 After Step 5 (all checklist items done)
T3 Commit checklist changes Committing checklist changes Before Step 6 After Step 6 (changes pushed)
T4 Present pre-merge report Presenting report Before Step 7 After Step 7

Notes:

  • Steps 2-3 (read contributing guide, checkout) are preparatory and fold into pre-T1 setup.
  • T1 encompasses the entire branch freshness flow including the user interaction (merge/skip/cancel) and any conflict resolution.
  • T2 covers all of Step 5 (docs, version, changelog, tests) as a single unit -- these are sub-steps of one conceptual task.
  • If no changes were made during the checklist, T3 transitions quickly (noting no changes to commit).

Delegation Notes

No skill or subagent delegation. All work is direct.

Acceptance Criteria

  • [ ] All 4 tasks are created after input parsing, before any work begins
  • [ ] Each task transitions in_progress -> completed at the boundaries described above
  • [ ] If user cancels at branch freshness, T1 remains in_progress, T2-T4 remain pending
  • [ ] The 5 checklist items (5a-5e) are collectively tracked by T2
  • [ ] allowed-tools in frontmatter includes Task (if not already present)

LeanAndMean avatar Apr 09 '26 17:04 LeanAndMean

Note: The task tracking conventions have been revised (see comment on issue 81). The task graph in this issue body follows the old "3-5 compound tasks" convention and is now stale. When implementing this sub-issue, derive the task graph using 1-to-1 step mapping: one task per command step, with a Step 0 that handles input parsing and task list creation. See the updated CLAUDE.md conventions and commands/pr-review.md for the reference implementation.

LeanAndMean avatar Apr 13 '26 19:04 LeanAndMean

Independent Assessment

Summary

Add TaskCreate/TaskUpdate progress tracking to pr-pre-merge, following the 1-to-1 step mapping convention established in CLAUDE.md and demonstrated in pr-review (PR #105) and pr-review-fix (PR #106).

Current State

commands/pr-pre-merge.md is a 152-line, self-contained command (no Skill/subagent delegation) with 7 steps (Steps 1-7). No task tracking exists -- TaskCreate/TaskUpdate are absent from both allowed-tools and the command body.

Revised Task Graph (1-to-1 Step Mapping)

The issue body's task graph uses the old "3-5 compound tasks" convention and is stale per the comment above. Under the current 1-to-1 convention, current Step 1 (Parse Input) folds into Step 0, and current Steps 2-7 become Steps 1-6:

Task Subject activeForm
Step 0 Step 0: Parse input and create task list Parsing input
Step 1 Step 1: Read contributing guidelines Reading contributing guidelines
Step 2 Step 2: Check out and prepare Checking out PR branch
Step 3 Step 3: Check branch freshness Checking branch freshness
Step 4 Step 4: Run pre-merge checklist Running pre-merge checklist
Step 5 Step 5: Commit checklist changes Committing checklist changes
Step 6 Step 6: Present pre-merge report Presenting report

7 tasks total. Step 4's four sub-steps (docs, version, changelog, tests) are tracked as a single task since they are sub-sections within one ##-level step, consistent with how reference implementations map tasks to ## headings.

Gaps

  • No TaskCreate/TaskUpdate in allowed-tools frontmatter
  • No Step 0 bootstrap -- command starts at Step 1
  • No in_progress/completed transitions anywhere
  • Multiple hard-stop error paths in Steps 2-3 (checkout failures, merge conflicts) need to leave tasks in_progress on failure

Scope

Small-to-medium. One file change (commands/pr-pre-merge.md). Mechanical transformation following the established pattern -- add Step 0 bootstrap with task table, renumber steps, add transition lines. Main complexity is renumbering internal cross-references (e.g., "continue to Step 5" becomes "continue to Step 4").

Risks

  • Step renumbering must update all internal cross-references within the command
  • Error/early-exit paths in checkout and branch freshness steps must leave current task in_progress (not artificially completed)
  • No CLAUDE.md sync bullets reference pr-pre-merge.md for task tracking, so no cross-file updates needed

LeanAndMean avatar Apr 14 '26 00:04 LeanAndMean

Implementation Plan: Add Task Tracking to pr-pre-merge

Stage 1: Add task tracking to pr-pre-merge

What it accomplishes: Adds TaskCreate/TaskUpdate progress tracking to the pr-pre-merge command following the 1-to-1 step mapping convention established in CLAUDE.md and demonstrated in pr-review and pr-review-fix.

Files modified:

  • commands/pr-pre-merge.md -- add Step 0 bootstrap, renumber steps, add task transitions
  • .claude-plugin/plugin.json -- version bump

Changes:

  1. Frontmatter: Add TaskCreate, TaskUpdate to allowed-tools

  2. Step 0 (replaces current Step 1): Parse input + create task list with bootstrap table:

    Task Subject activeForm
    Step 0 Step 0: Parse input and create task list Parsing input
    Step 1 Step 1: Read contributing guidelines Reading contributing guidelines
    Step 2 Step 2: Check out and prepare Checking out PR branch
    Step 3 Step 3: Check branch freshness Checking branch freshness
    Step 4 Step 4: Run pre-merge checklist Running pre-merge checklist
    Step 5 Step 5: Commit checklist changes Committing checklist changes
    Step 6 Step 6: Present pre-merge report Presenting report
  3. Steps 1-6 (renumbered from current Steps 2-7): Each step gets Mark Step N as in_progress using TaskUpdate. at the top and Mark Step N as completed using TaskUpdate. at the bottom. Error/exit paths leave tasks in_progress per convention.

  4. Cross-reference updates: 3 instances of "continue to Step 5" in Step 3 (current Step 4) become "continue to Step 4"

  5. Sub-step renumbering: 5a-5d become 4a-4d

  6. Version bump: Bump plugin.json version

Error path handling:

  • Step 2 (checkout): gh pr checkout or git pull failure leaves Step 2 in_progress
  • Step 3 (branch freshness): Multiple hard stops (fetch failure, user cancel, push failure, non-trivial conflicts, merge failure) all leave Step 3 in_progress
  • Step 5 (commit): Push failure reports error but does not artificially complete

Verification checklist:

  • No remaining stale step references (grep for "Step 5", "Step 6", "Step 7" in step bodies)
  • All 7 tasks have balanced in_progress/completed pairs on success paths
  • Error paths leave tasks in_progress without completed calls
  • Sub-steps are 4a-4d (not 5a-5d)
  • Three "continue to Step 4" cross-references are correct

This comment will guide staged implementation via /mach10:issue-implement 92 1.

LeanAndMean avatar Apr 14 '26 01:04 LeanAndMean

Implementation Plan: Add Task Tracking to pr-pre-merge

Stage 1: Add task tracking to pr-pre-merge

What it accomplishes: Adds TaskCreate/TaskUpdate progress tracking to the pr-pre-merge command following the 1-to-1 step mapping convention established in CLAUDE.md and demonstrated in pr-review and pr-review-fix.

Files modified:

  • commands/pr-pre-merge.md -- add Step 0 bootstrap, renumber steps, add task transitions
  • .claude-plugin/plugin.json -- version bump

Changes:

  1. Frontmatter: Add TaskCreate, TaskUpdate to allowed-tools

  2. Step 0 (replaces current Step 1): Parse input + create task list with bootstrap table. If input parsing fails (ambiguous input, user asked to clarify), no tasks are created -- the task creation block must come after successful input extraction, per CLAUDE.md convention.

    Task Subject activeForm
    Step 0 Step 0: Parse input and create task list Parsing input
    Step 1 Step 1: Read contributing guidelines Reading contributing guidelines
    Step 2 Step 2: Check out and prepare Checking out PR branch
    Step 3 Step 3: Check branch freshness Checking branch freshness
    Step 4 Step 4: Run pre-merge checklist Running pre-merge checklist
    Step 5 Step 5: Commit checklist changes Committing checklist changes
    Step 6 Step 6: Present pre-merge report Presenting report
  3. Steps 1-6 (renumbered from current Steps 2-7): Each step gets Mark Step N as in_progress using TaskUpdate. at the top and Mark Step N as completed using TaskUpdate. at the bottom. Error/exit paths leave tasks in_progress per convention.

  4. Cross-reference updates: 3 instances of "continue to Step 5" in Step 3 (current Step 4) become "continue to Step 4"

  5. Sub-step renumbering: 5a-5d become 4a-4d (heading format: ### 4a., ### 4b., etc.)

  6. Push-failure continuation in Step 5 (Commit): If the push fails, leave Step 5 in_progress but still proceed to Step 6 (Report) so the user receives the summary. This matches the precedent in pr-review.md where Step 7 failures proceed to Step 8 anyway.

  7. Version bump: Bump plugin.json version

Error path handling:

  • Step 2 (checkout): gh pr checkout or git pull failure leaves Step 2 in_progress
  • Step 3 (branch freshness): Multiple hard stops (fetch failure, user cancel, push failure, non-trivial conflicts, merge failure) all leave Step 3 in_progress
  • Step 5 (commit): Push failure leaves Step 5 in_progress but execution continues to Step 6

Verification checklist:

  • Grep for continue to Step [567] -- should have zero matches (all three should now say "continue to Step 4")
  • Grep for Step 7 -- should not exist anywhere after renumbering (headings or prose)
  • All 7 tasks have balanced in_progress/completed pairs on success paths
  • Error paths leave tasks in_progress without completed calls
  • Sub-steps are 4a-4d (not 5a-5d)
  • Three "continue to Step 4" cross-references are correct
  • Task creation block in Step 0 comes after input extraction (before task creation, parsing failure exits cleanly)

This comment will guide staged implementation via /mach10:issue-implement 92 1.

LeanAndMean avatar Apr 14 '26 01:04 LeanAndMean

Stage 1 Progress

Stage 1 (task tracking for pr-pre-merge) implemented and pushed.

Changes (commit 7e11ce6):

  • Added TaskCreate/TaskUpdate to allowed-tools frontmatter
  • Added Step 0 bootstrap with 7-task table (Steps 0-6)
  • Renumbered Steps 2-7 to Steps 1-6 with in_progress/completed transitions at each boundary
  • Updated 3 cross-references ("continue to Step 5" to "continue to Step 4")
  • Renumbered sub-steps 5a-5d to 4a-4d
  • Added 8 error-path instructions to leave tasks in_progress on failure
  • Step 5 push failure proceeds to Step 6 so user receives the summary
  • Normalized heading case to match bootstrap table subjects (sentence case)
  • Updated CLAUDE.md task-tracking instruction sync bullet to mention pr-pre-merge
  • Version bump: 1.19.0 to 1.20.0

Files modified: commands/pr-pre-merge.md, .claude-plugin/plugin.json, CLAUDE.md

LeanAndMean avatar Apr 14 '26 03:04 LeanAndMean