Skip to content

feat(dev-workflow): add prmode parameter and reduce stop hook noise - #235

Merged
NTCoding merged 9 commits into
mainfrom
polish-complete-task
Jan 31, 2026
Merged

NTCoding merged 9 commits into
mainfrom
polish-complete-task

Conversation

@NTCoding

@NTCoding NTCoding commented Jan 31, 2026 •

Copy link
Copy Markdown
Owner

Changes

  • Add --prmode create/update to complete-task with validation (create fails if PR exists, update fails if no PR or feedback remaining > 0)
  • Restrict --reject-review-feedback to update mode only
  • Reduce stop hook output from 20 lines to 1-line file reference
  • Add Stop Checklist and Complete Task Modes sections to task-workflow.md
  • Add mergeability proof requirement (paste full JSON) to stop checklist
  • Remove redundant test target from verify-build step (already runs in pre-commit and CI)

Summary by CodeRabbit

  • New Features

    • complete-task adds two submission modes: create (new PR) and update (resolve feedback). --prmode, --pr-title required for create; update requires remaining-feedback = 0 and allows --reject-review-feedback.
  • Documentation

    • Workflow docs updated with mode-specific guidance, Stop Checklist, and proof-of-mergeability steps.
  • Changes

    • CI watch behavior replaced with a new watcher + retry rules.
    • Build verification no longer runs tests (only lint and typecheck).
  • Tests

    • Tests updated to reflect new modes, messages, and CI watcher behavior.

✏️ Tip: You can customize this high-level summary in your review settings.

Test and others added 2 commits January 31, 2026 19:12
Add --prmode create/update to complete-task with validation:
- create fails if PR exists, update fails if no PR
- update requires --feedback-items-resolved and --feedback-items-remaining
- remaining > 0 rejected to avoid expensive round-trip costs
- --reject-review-feedback restricted to update mode only

Reduce stop hook output from 20 lines to 1-line file reference.
Add Stop Checklist and Complete Task Modes sections to task-workflow.md.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Tests already run before complete-task, during pre-commit hook, and
on PR CI checks. Running them in verify-build is redundant.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jan 31, 2026 •

Copy link
Copy Markdown

Deploying living-architecture with  Cloudflare Pages  Cloudflare Pages

Latest commit: c064e4a
Status: ✅  Deploy successful!
Preview URL: https://130da7ea.living-architecture.pages.dev
Branch Preview URL: https://polish-complete-task.living-architecture.pages.dev

View logs

@coderabbitai

coderabbitai Bot commented Jan 31, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@NTCoding has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 9 minutes and 5 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📝 Walkthrough

Walkthrough

Adds explicit PR submission modes ("create" and "update") to the complete-task workflow, extends the complete-task context/schema with prMode and feedback counts, routes CI watching through a new ghCli.watchCI, refactors submit-pull-request to resolve/create PRs by mode, and simplifies Stop handler messaging and tests.

Changes

Cohort / File(s) Summary
Docs
/.claude/commands/complete-task.md, docs/workflow/task-workflow.md
Introduce --prmode create/update, new flags/validation, Stop Checklist and proof-of-mergeability guidance; update workflow text and examples.
Complete Task Command & Tests
tools/dev-workflow/features/complete-task/commands/complete-task.ts, .../complete-task.spec.ts
Parse/validate --prmode, numeric arg parsing, mode-specific context building, enforce --reject-review-feedback only in update mode, wire ghCli.watchCI, add/adjust tests and add prMode to context.
Context Schema & Types
tools/dev-workflow/features/complete-task/domain/task-to-complete.ts
Export prModeSchema/PRMode; extend completeTaskContextSchema with prMode, optional prTitle/prBody, and optional feedback counts.
Submit PR & CI flow
tools/dev-workflow/features/complete-task/domain/steps/submit-pull-request.ts, tools/dev-workflow/platform/infra/external-clients/gh-cli.ts, .../gh-cli.spec.ts
Add ghCli.watchCI(prNumber), remove headSha dependency, add resolvePR helper to fetch-or-create PR by mode, update CI watch call and tests.
Remove github.watchCI
tools/dev-workflow/platform/infra/external-clients/github-rest-client.ts, .../github-rest-client.spec.ts
Remove previous github REST client CI polling and its tests; replace with gh-cli watcher module and tests.
Verify build change
tools/dev-workflow/features/complete-task/domain/steps/verify-build.ts, .../verify-build.spec.ts
Stop running test target in verify-build; run only ['lint','typecheck'].
Stop handler & tests
tools/dev-workflow/features/claude-hooks/domain/handlers/stop-handler.ts, .../stop-handler.spec.ts, .../claude-hooks.spec.ts
Simplify STOP_REMINDER text to reference Stop Checklist; update tests to expect "Stop blocked" in blocking messages.
Test fixtures & minor tests
tools/dev-workflow/features/complete-task/..., tools/dev-workflow/shell/index.spec.ts
Add prMode: 'create' defaults to many CompleteTaskContext fixtures; update tests for create/update branches, remove headSha mocks, and wire ghCli stubs.

Sequence Diagram(s)

sequenceDiagram
  participant CLI as Client CLI
  participant CT as CompleteTask Command
  participant GH as GitHub REST Client
  participant GHCLI as gh CLI Wrapper
  participant CI as CI System

  CLI->>CT: invoke complete-task --prmode=create|update + flags
  CT->>GH: check/get existing PR (if update)
  alt create mode
    CT->>GH: create PR (title/body)
    GH-->>CT: PR info
  else update mode
    GH-->>CT: existing PR info
  end
  CT->>GHCLI: watchCI(prNumber)
  GHCLI->>CI: poll/check PR checks
  CI-->>GHCLI: checks status (pass/fail)
  GHCLI-->>CT: CIResult {failed, output}
  CT->>CLI: report outcome / next steps
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

Review effort 4/5

Poem

🐰 I hopped from create to update with cheer,
Titles in paw and feedback held near.
gh watches checks while branches take flight,
Stop Checklist readies the final sight.
Thump—merge! The meadow's code is clear.

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the main objectives of the changeset: adding a prmode parameter to complete-task and reducing verbose output from the stop handler.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch polish-complete-task

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Fix all issues with AI agents
In @.claude/commands/complete-task.md:
- Around line 29-35: Update the verification bullet in the complete-task command
description to reflect that verify-build no longer runs tests: change the line
that currently reads "Runs local verification (lint, typecheck, test)" to say
"Runs local verification (lint, typecheck)" and ensure any surrounding text
mentioning verify-build or local verification is consistent with this change
(look for the phrase "verify-build" and the bullet under the 10-minute timeout
header to locate the content).

In `@docs/workflow/task-workflow.md`:
- Around line 194-200: The docs state that Create Mode (`--prmode create`)
"Requires `--pr-title`" too strictly; update the wording around the `--prmode
create` section (the example for pnpm nx run dev-workflow:complete-task --
--prmode create --pr-title ...) to clarify that `--pr-title` is required only
when the task/PR is not backed by an existing issue or task, and that for
issue-backed tasks PR title/details are derived automatically and `--pr-title`
is optional; keep the example but add a note explaining the conditional
requirement.

In `@tools/dev-workflow/features/complete-task/commands/complete-task.spec.ts`:
- Around line 275-285: The test "context builder rejects non-integer
feedback-items-remaining" mismatches its setup: mockCli.requireArg currently
returns an invalid value for '--feedback-items-resolved' instead of
'--feedback-items-remaining'; update the mockCli.requireArg implementation used
in this test (the block around executeCompleteTask()/getContextBuilder()) to
return 'abc' for the '--feedback-items-remaining' flag (or alternatively rename
the test to reference '--feedback-items-resolved') so the input and test name
align; ensure you reference the same call sites (mockCli.requireArg,
executeCompleteTask, getContextBuilder) when making the change.

In `@tools/dev-workflow/features/complete-task/commands/complete-task.ts`:
- Around line 33-48: Replace the manual validation in parsePRMode and
parseNumberArg with Zod safeParse usage: export and import the existing
prModeSchema from task-to-complete.ts and use
prModeSchema.safeParse(cli.requireArg('--prmode')) inside parsePRMode to
validate/throw WorkflowError on parse.error; create and export a Zod schema for
non-negative integers (e.g., nonNegIntSchema) and use
nonNegIntSchema.safeParse(cli.requireArg(flag)) inside parseNumberArg to
validate/throw WorkflowError on parse.error, removing the Number.isInteger/ < 0
manual checks.

Comment thread .claude/commands/complete-task.md
Comment thread docs/workflow/task-workflow.md
Comment thread tools/dev-workflow/features/complete-task/commands/complete-task.ts
Test and others added 3 commits January 31, 2026 19:35
…k watching

Custom Octokit polling only checked Check Runs API, missing commit
statuses (used by CodeRabbit). New approach uses gh CLI which handles both.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Update mode reuses existing PR — no title/body needed.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
…tion

gh CLI exits with error when checks haven't registered yet after push.
Retry up to 6 times with 10s delay. Also makes PR title/body optional
in update mode since existing PR doesn't need them.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@tools/dev-workflow/platform/infra/external-clients/gh-cli.spec.ts`:
- Around line 73-83: The test for ghCli.watchCI doesn't assert that the retry
loop ran the expected number of times; update the spec to assert
mockExecFileSync was called exactly MAX_RETRIES times (or 6 if MAX_RETRIES
constant is 6) after the failure case. Locate the test using mockExecFileSync
and ghCli.watchCI and add an expectation verifying
mockExecFileSync.mock.calls.length (or toHaveBeenCalledTimes) equals the retry
constant (MAX_RETRIES) so regressions in the retry logic are caught.

In `@tools/dev-workflow/platform/infra/external-clients/gh-cli.ts`:
- Around line 3-6: Export the CIResult interface so consumers can import the
return type of the public watchCI function; locate the CIResult declaration in
gh-cli.ts and add an export to it (i.e., change/interface name CIResult to
exported CIResult) so callers of ghCli.watchCI can reference the type, ensuring
any other public types used by watchCI are also exported if needed.

Comment thread tools/dev-workflow/platform/infra/external-clients/gh-cli.spec.ts
Comment thread tools/dev-workflow/platform/infra/external-clients/gh-cli.ts
- Update verify bullet to reflect lint+typecheck only (no test)
- Clarify --pr-title conditional requirement in docs
- Fix test data mismatch for feedback-items-remaining
- Use Zod safeParse for prMode and number validation
- Add retry count assertion to CI check tests
- Export CIResult interface for consumers

Co-Authored-By: Claude Opus 4.5 <[email protected]>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@tools/dev-workflow/features/complete-task/commands/complete-task.ts`:
- Around line 133-138: The check in resolveSkipReview currently compares
cli.parseArg('--prmode') as a raw string; replace that with a call to
parsePRMode() so the value is validated by the Zod schema. Specifically, inside
resolveSkipReview call parsePRMode() to get prMode, and if hasFlag && prMode !==
'update' throw the existing WorkflowError('--reject-review-feedback can only be
used with --prmode update'); ensure parsePRMode is imported/available in the
file and let any validation errors propagate as before.

Comment thread tools/dev-workflow/features/complete-task/commands/complete-task.ts Outdated
Test and others added 3 commits January 31, 2026 20:04
When mergeableState is not 'clean', fetches check runs and includes
failedChecks array showing which checks failed or are pending.
Prevents misdiagnosing 'blocked' state as human review requirement.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
No consumers yet — re-export when needed.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@sonarqubecloud

Copy link
Copy Markdown

@NTCoding
NTCoding merged commit 8f0c851 into main Jan 31, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant