Skip to content

CLI surface correctness & agent ergonomics: get body parity, type-error path, comment edit/delete, validate dup-codes (GH-252/253/243/235) - #255

Merged
unbraind merged 3 commits into
mainfrom
feat/cli-surface-correctness-comments-validate
Jun 16, 2026
Merged

unbraind merged 3 commits into
mainfrom
feat/cli-surface-correctness-comments-validate

Conversation

@unbraind

Copy link
Copy Markdown
Owner

Summary

A cohesive pass on the CLI command-surface & agent-ergonomics epic (pm-mpbb), bundling four agent-facing correctness/completeness items. Two are fresh correctness bugs reported today (GH-252/253); two complete the command surface (GH-243/235).

GH-252 — pm get --json body parity (pm-hofv)

pm get --json placed body as a top-level sibling of item, while description/acceptance_criteria live inside item and pm list --include-body puts body inside each row. Agents reading .item.body got null. Now body lives inside item for both JSON and TOON (and MCP pm_get), so a single read exposes every field at a consistent path. Body is included at standard depth and above; --depth brief omits it.

GH-253 — invalid --type error path (pm-nd08)

The invalid---type rejection (create/update/config set governance-create-default-type) hardcoded .agents/pm/schema/types.json, ignoring the active --pm-path. New resolveItemTypesFilePath(pmRoot, schema) threads the real configured schema/types.json path into the hint — matching what pm schema add/remove-type already report.

GH-243 — pm comments --edit / --delete (pm-4swf)

Comments supported only list/add; long-lived agent trackers accumulate obsolete orchestration notes with no cleanup path. Added 1-based --edit <index> (replacement text from [text]/--add/--stdin/--file) and --delete <index>. New comment_edit/comment_delete history ops, ownership-aware (--allow-audit-comment honored, --force works); edit preserves created_at/author and stamps edited_at. Surfaced on CLI, MCP pm_comments, shell completions, flag contracts, and docs.

GH-235 — pm validate duplicate logical issue-codes (pm-rpag)

Trackers adopt title conventions like ISSUE-004: ...; two items sharing a code break auditability. New pure core/governance/issue-codes.ts (extractIssueCode/findDuplicateIssueCodes) drives an advisory validate warning (details.duplicate_issue_codes) with per-code ids/titles + remediation hint. Advisory, never fails an otherwise-clean tracker.

Also closed

Testing

  • Literal 100/100/100/100 all-source coverage (4362 tests pass).
  • Removed dead defensive branches in the new code rather than ignoring them; refactored resolveCommentInput to reuse the single resolveCommentTextSource path (no duplication).
  • Typecheck, static-quality gate, docs gates, contracts:check, changelog:pm:check all green.
  • Manual sandbox verification of all four features end-to-end with the built CLI.

🤖 Generated with Claude Code

… validate dup-codes (GH-252/253/243/235)

Cohesive CLI command-surface correctness & agent-ergonomics pass under the
pm-mpbb epic, bundling four agent-facing items:

- GH-252 (pm-hofv): pm get --json now returns `body` INSIDE the `item` object
  (.item.body), matching `pm list --include-body` and where description/
  acceptance_criteria live. Removed the top-level `result.body` sibling that
  agents kept missing. JSON + TOON + MCP pm_get all align.
- GH-253 (pm-nd08): the invalid `--type` error (create/update/config) now
  reflects the active `--pm-path` via new `resolveItemTypesFilePath(pmRoot,
  schema)`, instead of hardcoding `.agents/pm/schema/types.json`.
- GH-243 (pm-4swf): `pm comments --edit <index>` / `--delete <index>`
  (1-based) lifecycle commands for obsolete orchestration-note cleanup. New
  comment_edit/comment_delete ops (ownership-aware, --allow-audit-comment
  honored); edit preserves created_at/author and stamps edited_at. Surfaced on
  CLI, MCP pm_comments, completions, flag contracts, and docs. Refactored
  resolveCommentInput to reuse the single resolveCommentTextSource path.
- GH-235 (pm-rpag): `pm validate` detects duplicate logical issue-code
  prefixes (e.g. ISSUE-004 shared by 2+ items) via new
  core/governance/issue-codes.ts; advisory warning + details.duplicate_issue_codes.

Coverage held at literal 100/100/100/100 across all source. Contracts golden
regenerated; changelog regenerated from closed items.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@sourcery-ai sourcery-ai 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.

Sorry @unbraind, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@unbraind

Copy link
Copy Markdown
Owner Author

@coderabbitai full review
@codex review
/gemini review
@gemini-code-assist review

@coderabbitai

coderabbitai Bot commented Jun 16, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@unbraind, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 24 minutes and 29 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, 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 include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 01108128-fcc2-41e5-85bd-65f5e15e01e1

📥 Commits

Reviewing files that changed from the base of the PR and between 0447c6e and 7fada84.

📒 Files selected for processing (49)
  • .agents/pm/features/pm-4swf.toon
  • .agents/pm/features/pm-rpag.toon
  • .agents/pm/history/pm-4swf.jsonl
  • .agents/pm/history/pm-hofv.jsonl
  • .agents/pm/history/pm-nd08.jsonl
  • .agents/pm/history/pm-php4.jsonl
  • .agents/pm/history/pm-rpag.jsonl
  • .agents/pm/issues/pm-hofv.toon
  • .agents/pm/issues/pm-nd08.toon
  • .agents/pm/plans/pm-php4.toon
  • CHANGELOG.md
  • docs/COMMANDS.md
  • src/cli/commands/annotation-command.ts
  • src/cli/commands/comments.ts
  • src/cli/commands/completion.ts
  • src/cli/commands/config.ts
  • src/cli/commands/create.ts
  • src/cli/commands/get.ts
  • src/cli/commands/update.ts
  • src/cli/commands/validate.ts
  • src/cli/help-content.ts
  • src/cli/register-mutation.ts
  • src/core/governance/issue-codes.ts
  • src/core/schema/item-types-file.ts
  • src/core/schema/runtime-schema.ts
  • src/core/store/item-store.ts
  • src/mcp/server.ts
  • src/mcp/tool-definitions.ts
  • src/sdk/cli-contracts.ts
  • src/sdk/cli-contracts/tool-parameter-tables.ts
  • tests/fixtures/contracts/full.json
  • tests/integration/cli-inprocess-runner.integration.spec.ts
  • tests/integration/cli.integration.spec.ts
  • tests/integration/copy-command.spec.ts
  • tests/integration/help-runtime.spec.ts
  • tests/integration/mcp-handshake.spec.ts
  • tests/integration/release-readiness-runtime.spec.ts
  • tests/unit/commands/comments-command.spec.ts
  • tests/unit/commands/completion-command.spec.ts
  • tests/unit/commands/get-append-command.spec.ts
  • tests/unit/commands/register-commands.spec.ts
  • tests/unit/commands/restore-command.spec.ts
  • tests/unit/commands/update-command.spec.ts
  • tests/unit/commands/validate-command.spec.ts
  • tests/unit/core/governance/issue-codes.spec.ts
  • tests/unit/core/schema/item-types-file.spec.ts
  • tests/unit/core/schema/runtime-schema-command-flags.spec.ts
  • tests/unit/packages/beads-command.spec.ts
  • tests/unit/packages/todos-extension.spec.ts
📝 Walkthrough

Walkthrough

Delivers four independent features: (1) pm comments --edit <index> and --delete <index> lifecycle commands wired through annotation-command, CLI/MCP surfaces, SDK contracts, and shell completion; (2) pm get --json body field moved from top-level result.body to result.item.body; (3) invalid --type errors now reference the active --pm-path schema location; (4) pm validate detects duplicate logical issue-code prefixes with advisory warnings.

Changes

Comment edit/delete lifecycle (GH-243)

Layer / File(s) Summary
AnnotationEntry/Input/Config types and runAnnotationCommand branches
src/cli/commands/annotation-command.ts
Adds edited_at to AnnotationEntry, edit/delete modes plus index to AnnotationInput, editOp/deleteOp to AnnotationCommandConfig, implements delete (splice) and edit (replace with edited_at) branches in runAnnotationCommand, and exports resolveAnnotationIndex.
CommentsCommandOptions, input resolution, runComments
src/cli/commands/comments.ts
Adds edit/delete to CommentsCommandOptions, introduces resolveCommentTextSource for single-source text resolution, rewrites resolveCommentInput for mutual-exclusivity enforcement, and updates runComments to select parsed vs. raw text by mode.
CLI registration, MCP, SDK contracts, completion, item-store, docs
src/cli/register-mutation.ts, src/mcp/server.ts, src/mcp/tool-definitions.ts, src/sdk/cli-contracts.ts, src/sdk/cli-contracts/tool-parameter-tables.ts, src/cli/commands/completion.ts, src/core/store/item-store.ts, docs/COMMANDS.md
Registers --edit/--delete with parsePositiveIntOption, updates MCP listing-mode detection, extends SDK flag contracts and tool-parameter tables, updates bash/zsh completion, extends bypassesAssigneeConflict for comment_edit/comment_delete, and documents the new workflows.
Tests and contract fixture
tests/unit/commands/comments-command.spec.ts, tests/unit/commands/completion-command.spec.ts, tests/unit/commands/register-commands.spec.ts, tests/fixtures/contracts/full.json
Adds resolveAnnotationIndex tests, full runComments edit/delete suite, parsePositiveIntOption coercion tests, completion flag assertions, and contract fixture updates.
PM tracker records (GH-243)
.agents/pm/features/pm-4swf.toon, .agents/pm/history/pm-4swf.jsonl
Closes the pm-4swf feature record with resolution and history entries.

pm get --json body shape fix (GH-252)

Layer / File(s) Summary
GetResult interface and runGet assignment
src/cli/commands/get.ts, docs/COMMANDS.md
Removes top-level body?: string from GetResult, adds body?: string inside item, and updates runGet to write to result.item.body.
Test updates across all affected specs
tests/unit/commands/get-append-command.spec.ts, tests/unit/commands/restore-command.spec.ts, tests/unit/commands/update-command.spec.ts, tests/integration/cli.integration.spec.ts, tests/integration/cli-inprocess-runner.integration.spec.ts, tests/integration/copy-command.spec.ts, tests/integration/help-runtime.spec.ts, tests/integration/mcp-handshake.spec.ts, tests/integration/release-readiness-runtime.spec.ts, tests/unit/packages/beads-command.spec.ts, tests/unit/packages/todos-extension.spec.ts
Replaces all json.body / result.body assertions with json.item.body / result.item.body across unit and integration test suites.
PM tracker records (GH-252)
.agents/pm/issues/pm-hofv.toon, .agents/pm/history/pm-hofv.jsonl
Adds the pm-hofv issue record and JSONL history.

Invalid-type error uses active --pm-path (GH-253)

Layer / File(s) Summary
resolveItemTypesFilePath helper and hint/error signatures
src/core/schema/runtime-schema.ts, src/core/schema/item-types-file.ts
Adds resolveItemTypesFilePath(pmRoot, schema) and updates buildInvalidTypeHint/buildInvalidTypeError to accept an optional typesFilePath.
create/update/config error construction and tests
src/cli/commands/create.ts, src/cli/commands/update.ts, src/cli/commands/config.ts, tests/unit/core/schema/item-types-file.spec.ts, tests/unit/core/schema/runtime-schema-command-flags.spec.ts
Threads resolveItemTypesFilePath into invalid-type error calls in all three commands; tests verify path threading and fallback behavior.
PM tracker records (GH-253)
.agents/pm/issues/pm-nd08.toon, .agents/pm/history/pm-nd08.jsonl
Adds the pm-nd08 issue record and JSONL history.

Duplicate issue-code advisory in pm validate (GH-235)

Layer / File(s) Summary
issue-codes.ts module
src/core/governance/issue-codes.ts, tests/unit/core/governance/issue-codes.spec.ts
Defines IssueCodeItem, DuplicateIssueCode, extractIssueCode, and findDuplicateIssueCodes with deterministic duplicate grouping; tests cover extraction edge cases and aggregation behavior.
validate.ts integration and tests
src/cli/commands/validate.ts, tests/unit/commands/validate-command.spec.ts
Adds summarizeDuplicateIssueCodes (capped rows, advisory warning token), wires it into metadata check warningTokens/details, exposes via _testOnlyValidateCommand, and tests empty/single/truncated/verbose scenarios.
PM tracker records (GH-235)
.agents/pm/features/pm-rpag.toon, .agents/pm/history/pm-rpag.jsonl
Closes the pm-rpag feature record with resolution and history entries.

Changelog, plan closure, and docs

Layer / File(s) Summary
CHANGELOG entries and pm-php4 plan closure
CHANGELOG.md, .agents/pm/plans/pm-php4.toon, .agents/pm/history/pm-php4.jsonl
Adds CHANGELOG bullets for GH-235, GH-243, GH-252, GH-253, and GH-241/242/236; closes the pm-php4 plan record referencing PR #251.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • unbraind/pm-cli#57: Directly modifies the same src/cli/commands/annotation-command.ts infrastructure that this PR extends with edit/delete branches and resolveAnnotationIndex.
  • unbraind/pm-cli#37: Touches the same src/cli/commands/comments.ts option parsing and MCP runAction "comments" listing-mode logic that this PR rewrites and extends.
  • unbraind/pm-cli#49: Modifies the same src/core/schema/item-types-file.ts hint/error functions that this PR extends with the optional typesFilePath parameter.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 35.71% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the four main changes (get body parity, type-error path, comment edit/delete, validate dup-codes) with their issue numbers, covering the core objectives of the changeset.
Description check ✅ Passed The description provides a comprehensive overview of the four interconnected features being implemented, explaining the motivation, implementation details, and testing approach. It is directly related to the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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


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.

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@coderabbitai

coderabbitai Bot commented Jun 16, 2026 •

Copy link
Copy Markdown

@unbraind Sure, I'll kick off a full review of PR #255 now.

✅ Action performed

Full review finished.

@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

1 similar comment
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@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: 8

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/unit/commands/completion-command.spec.ts (1)

227-248: ⚠️ Potential issue | 🟡 Minor

Add zsh and fish assertions for --edit and --delete flag descriptions.

The completion source generates descriptions for --edit and --delete in both zsh and fish shells, but the test only asserts descriptions for --stdin and --file. For consistent test coverage, add assertions for the new flags:

  • Zsh: expect(zshScript).toContain("--edit[Replace the comment at 1-based index"); and expect(zshScript).toContain("--delete[Delete the comment at 1-based index");
  • Fish: expect(fishScript).toContain("-l edit -d 'Replace the comment at 1-based index"); and expect(fishScript).toContain("-l delete -d 'Delete the comment at 1-based index");
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/unit/commands/completion-command.spec.ts` around lines 227 - 248, The
test "includes comments mutation metadata flags in bash completion" currently
checks for description assertions only for the --stdin and --file flags in zsh
and fish shell completions, but is missing assertions for the newly added --edit
and --delete flags. Add four additional expect statements after the existing zsh
and fish assertions: two for zsh completion (one for --edit with "Replace the
comment at 1-based index" and one for --delete with "Delete the comment at
1-based index"), and two for fish completion (one for --edit with "-l edit -d
'Replace the comment at 1-based index'" and one for --delete with "-l delete -d
'Delete the comment at 1-based index'") to ensure these flags are properly
represented in both shell completions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.agents/pm/features/pm-rpag.toon:
- Around line 12-17: The actual_result field contradicts the close_reason by
still describing the pre-fix defect (duplicate codes went undetected) instead of
the current working behavior. Update actual_result to reflect that duplicate
logical issue-code prefixes are now successfully detected via the
extractIssueCode and findDuplicateIssueCodes functions in
core/governance/issue-codes.ts, with advisory warnings displayed through
buildMetadataCheck and the details.duplicate_issue_codes projection. Then verify
the comments[1] history entry is consistent with the closed state and update the
audit log entry if needed to ensure metadata aligns with the shipped
functionality and close_reason.

In `@src/cli/commands/completion.ts`:
- Around line 362-363: The fish shell completion block for the comments command
is missing the --edit and --delete flags that were added to the bash/zsh
completions. Locate the fish completion block (which handles the comments
command similar to the bash/zsh block shown) and add both the --edit and
--delete flags to the completion options list to maintain parity across all
supported shells. Ensure the flag list in the fish completion matches the
updated bash/zsh flags.

In `@src/cli/commands/get.ts`:
- Around line 48-51: The GetResult type in the get command now nests body inside
item (as item.body), but the runtime help text still documents the old structure
with body as a top-level field. Find where the help text for the get command is
defined (likely as a help string constant or documentation in the same file or a
related help module) and update it to document the new JSON shape where body is
located at .item.body instead of as a top-level sibling to item, linked,
claim_state, and children. Ensure the documented structure precisely matches the
actual GetResult type definition to prevent misleading agent consumers.

In `@src/core/governance/issue-codes.ts`:
- Around line 39-41: The docblock comment describing the regex pattern behavior
in the issue-codes.ts file incorrectly states that `ISSUE-004foo` extracts
`ISSUE-004` with the `\b` word boundary anchor. Word boundaries do not match
between numeric and alphabetic characters, so this case would not match at all.
Update the comment around the example to accurately describe the word boundary
behavior and correct the misleading example, either by removing the incorrect
case or replacing it with a case that actually demonstrates how the word
boundary works as intended.

In `@src/sdk/cli-contracts.ts`:
- Around line 306-307: The COMMENTS_FLAG_CONTRACTS now exposes the --edit and
--delete flags, but PM_TOOL_ACTION_SCHEMA_CONTRACTS.comments.optional does not
include these keys in its schema definition, causing a mismatch between the
runtime flag contracts and the strict schema contract. Add the --edit and
--delete flag entries to the PM_TOOL_ACTION_SCHEMA_CONTRACTS.comments.optional
array to ensure the schema accurately reflects all available flags at runtime.

In `@src/sdk/cli-contracts/tool-parameter-tables.ts`:
- Around line 275-276: The edit and delete parameter definitions use type
"number" which allows invalid values like decimals, zero, and negative numbers
that violate 1-based integer semantics. Change the type from "number" to
"integer" for both the edit and delete properties, and add a minimum constraint
of 1 to each to enforce that only 1-based positive integer values are accepted.

In `@tests/fixtures/contracts/full.json`:
- Line 20464: The allowAuditComment field descriptions at lines 20464 and 20570
in tests/fixtures/contracts/full.json incorrectly reference "For comments
action" when these fields actually appear in the notes and learnings action
schemas respectively. Update the description at line 20464 to correctly describe
the notes action behavior instead of comments action, and update the description
at line 20570 to correctly describe the learnings action behavior instead of
comments action. Ensure each description accurately reflects its respective
action schema context.
- Around line 1562-1567: The comments action schema around line 19882+ is
missing the edit and delete field definitions that correspond to the --edit and
--delete flags added to the comments action in the fixture at lines 1563 and
1566. Update the strict action schema for comments to include edit and delete
fields that match the flags being added in the fixture, ensuring the schema and
fixture definitions remain in sync for contract validation.

---

Outside diff comments:
In `@tests/unit/commands/completion-command.spec.ts`:
- Around line 227-248: The test "includes comments mutation metadata flags in
bash completion" currently checks for description assertions only for the
--stdin and --file flags in zsh and fish shell completions, but is missing
assertions for the newly added --edit and --delete flags. Add four additional
expect statements after the existing zsh and fish assertions: two for zsh
completion (one for --edit with "Replace the comment at 1-based index" and one
for --delete with "Delete the comment at 1-based index"), and two for fish
completion (one for --edit with "-l edit -d 'Replace the comment at 1-based
index'" and one for --delete with "-l delete -d 'Delete the comment at 1-based
index'") to ensure these flags are properly represented in both shell
completions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: f137662c-0b27-44a5-8b7b-3ec92c1eb0c8

📥 Commits

Reviewing files that changed from the base of the PR and between 0447c6e and 72f31e2.

📒 Files selected for processing (48)
  • .agents/pm/features/pm-4swf.toon
  • .agents/pm/features/pm-rpag.toon
  • .agents/pm/history/pm-4swf.jsonl
  • .agents/pm/history/pm-hofv.jsonl
  • .agents/pm/history/pm-nd08.jsonl
  • .agents/pm/history/pm-php4.jsonl
  • .agents/pm/history/pm-rpag.jsonl
  • .agents/pm/issues/pm-hofv.toon
  • .agents/pm/issues/pm-nd08.toon
  • .agents/pm/plans/pm-php4.toon
  • CHANGELOG.md
  • docs/COMMANDS.md
  • src/cli/commands/annotation-command.ts
  • src/cli/commands/comments.ts
  • src/cli/commands/completion.ts
  • src/cli/commands/config.ts
  • src/cli/commands/create.ts
  • src/cli/commands/get.ts
  • src/cli/commands/update.ts
  • src/cli/commands/validate.ts
  • src/cli/register-mutation.ts
  • src/core/governance/issue-codes.ts
  • src/core/schema/item-types-file.ts
  • src/core/schema/runtime-schema.ts
  • src/core/store/item-store.ts
  • src/mcp/server.ts
  • src/mcp/tool-definitions.ts
  • src/sdk/cli-contracts.ts
  • src/sdk/cli-contracts/tool-parameter-tables.ts
  • tests/fixtures/contracts/full.json
  • tests/integration/cli-inprocess-runner.integration.spec.ts
  • tests/integration/cli.integration.spec.ts
  • tests/integration/copy-command.spec.ts
  • tests/integration/help-runtime.spec.ts
  • tests/integration/mcp-handshake.spec.ts
  • tests/integration/release-readiness-runtime.spec.ts
  • tests/unit/commands/comments-command.spec.ts
  • tests/unit/commands/completion-command.spec.ts
  • tests/unit/commands/get-append-command.spec.ts
  • tests/unit/commands/register-commands.spec.ts
  • tests/unit/commands/restore-command.spec.ts
  • tests/unit/commands/update-command.spec.ts
  • tests/unit/commands/validate-command.spec.ts
  • tests/unit/core/governance/issue-codes.spec.ts
  • tests/unit/core/schema/item-types-file.spec.ts
  • tests/unit/core/schema/runtime-schema-command-flags.spec.ts
  • tests/unit/packages/beads-command.spec.ts
  • tests/unit/packages/todos-extension.spec.ts

Comment on lines +12 to +17
resolution: New core/governance/issue-codes.ts + metadata-check advisory warning (details.duplicate_issue_codes).
expected_result: validate flags codes like ISSUE-004 shared by 2+ items.
actual_result: duplicate logical codes went undetected.
comments[1]{created_at,author,text}:
"2026-06-16T19:30:11.283Z",maintainer-agent,"Integration (lead): validate dup issue-code detection shipped via new core/governance/issue-codes.ts (extractIssueCode/findDuplicateIssueCodes) + buildMetadataCheck advisory warning + summarizeDuplicateIssueCodes projection (details.duplicate_issue_codes). Added summarize unit test for truncation/verbose branches."
close_reason: "Added: pm validate detects duplicate logical issue-code prefixes (advisory)."

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Closed feature outcome is internally inconsistent (actual_result still states the bug).

For a closed item, actual_result should describe the shipped behavior, not the pre-fix defect. Please update actual_result to reflect detection now works, then regenerate/update the corresponding history entry so metadata and audit log remain consistent.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.agents/pm/features/pm-rpag.toon around lines 12 - 17, The actual_result
field contradicts the close_reason by still describing the pre-fix defect
(duplicate codes went undetected) instead of the current working behavior.
Update actual_result to reflect that duplicate logical issue-code prefixes are
now successfully detected via the extractIssueCode and findDuplicateIssueCodes
functions in core/governance/issue-codes.ts, with advisory warnings displayed
through buildMetadataCheck and the details.duplicate_issue_codes projection.
Then verify the comments[1] history entry is consistent with the closed state
and update the audit log entry if needed to ensure metadata aligns with the
shipped functionality and close_reason.

Comment thread src/cli/commands/completion.ts Resolved
Comment thread src/cli/commands/get.ts
Comment on lines +48 to +51
// `body` lives inside `item` (alongside `description`/`acceptance_criteria`)
// for parity with `pm list --include-body`, so agents reliably find it at
// `.item.body` in JSON output instead of a top-level sibling.
item: Partial<ItemFrontMatter> & { body?: string };

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Update runtime help contract to .item.body to match this new JSON shape.

GetResult now nests body under item, but runtime help text still documents { item, body, linked, claim_state, children } with top-level body. That cross-layer mismatch will mislead agent consumers.

Suggested docs/help wording update
- JSON output shape is { item, body, linked, claim_state, children }; body is top-level (not item.body), and children appears for requested/container rollups.
+ JSON output shape is { item, linked, claim_state, children }; body is nested at item.body (parity with list --include-body), and children appears for requested/container rollups.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/cli/commands/get.ts` around lines 48 - 51, The GetResult type in the get
command now nests body inside item (as item.body), but the runtime help text
still documents the old structure with body as a top-level field. Find where the
help text for the get command is defined (likely as a help string constant or
documentation in the same file or a related help module) and update it to
document the new JSON shape where body is located at .item.body instead of as a
top-level sibling to item, linked, claim_state, and children. Ensure the
documented structure precisely matches the actual GetResult type definition to
prevent misleading agent consumers.

Comment thread src/core/governance/issue-codes.ts Resolved
Comment thread src/sdk/cli-contracts.ts Resolved
Comment thread tests/fixtures/contracts/full.json Resolved
Comment thread tests/fixtures/contracts/full.json Outdated
},
"allowAuditComment": {
"description": "For comments action, allow non-owner append-only comment audits without requiring --force.",
"description": "For comments action, allow non-owner append-only comment audits (add/edit/delete) without requiring --force.",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

allowAuditComment descriptions are incorrect in non-comments schemas

Line 20464 and Line 20570 are under notes/learnings action schemas, but the description says “For comments action ... (add/edit/delete)”. That text is misleading for these actions.

Also applies to: 20570-20570

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/fixtures/contracts/full.json` at line 20464, The allowAuditComment
field descriptions at lines 20464 and 20570 in
tests/fixtures/contracts/full.json incorrectly reference "For comments action"
when these fields actually appear in the notes and learnings action schemas
respectively. Update the description at line 20464 to correctly describe the
notes action behavior instead of comments action, and update the description at
line 20570 to correctly describe the learnings action behavior instead of
comments action. Ensure each description accurately reflects its respective
action schema context.

- get help-content: document JSON shape with body nested at item.body (was top-level)
- cli-contracts: add edit/delete to strict PM_TOOL_ACTION_SCHEMA_CONTRACTS.comments.optional
- tool-parameter-tables: constrain edit/delete to integer minimum 1; revert shared
  allowAuditComment description (it is reused by notes/learnings schemas)
- completion: add fish completions for comments --edit/--delete (shell parity)
- issue-codes: correct the \b word-boundary docblock (ISSUE-004foo does NOT match);
  make the boundary test explicit (toBeNull) instead of self-referential
- contracts golden regenerated

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@unbraind

Copy link
Copy Markdown
Owner Author

Addressed CodeRabbit's findings in b21e546:

  • ✅ get help-content now documents item.body (not top-level)
  • ✅ edit/delete added to strict PM_TOOL_ACTION_SCHEMA_CONTRACTS.comments.optional (+ golden regenerated)
  • ✅ edit/delete param schema constrained to integer, minimum 1
  • ✅ reverted the shared allowAuditComment description (it's reused by notes/learnings schemas)
  • ✅ fish completions for --edit/--delete
  • ✅ corrected the \b docblock + made the boundary test explicit

Declined (with rationale): the pm-rpag.toon actual_result finding. Across this tracker the expected_result/actual_result pair documents the bug report at close time (expected = desired behavior, actual = the observed defect), consistent with the other items closed in this PR (pm-hofv/pm-nd08/pm-4swf) and the broader corpus. The close_reason/resolution fields carry the shipped-behavior summary. Changing only this item would make it inconsistent with its siblings.

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jun 16, 2026 •

Copy link
Copy Markdown

@unbraind Thanks for the detailed update! All six addressed items look solid:

  • Moving body documentation to item.body in get help-content is the right ergonomic fix for agents.
  • Constraining edit/delete to integer, minimum 1 in the param schema is a good tightening — prevents ambiguous zero/negative indexes at the schema validation layer.
  • Reverting the shared allowAuditComment description to avoid divergence across notes/learnings schemas is the correct call.
  • Fish completions round out the shell completion surface nicely.

The rationale for declining the pm-rpag.toon actual_result finding is well-reasoned. The expected_result/actual_result convention as a bug-report snapshot (expected = desired behavior, actual = observed defect) is consistent with the sibling items (pm-hofv, pm-nd08, pm-4swf) and the broader tracker corpus — changing only this one would introduce an inconsistency. The close_reason/resolution fields are the right home for the shipped-behavior summary.

Kicking off the full review now.

✅ Action performed

Full review finished.

…deRabbit)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@unbraind

Copy link
Copy Markdown
Owner Author

Pushed 7fada84: added zsh + fish completion assertions for --edit/--delete descriptions (addresses the outside-diff finding). All prior findings now resolved or declined-with-rationale.

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jun 16, 2026 •

Copy link
Copy Markdown

@unbraind Thanks for the follow-through on the zsh + fish completion assertion coverage for --edit/--delete — that rounds out the test surface nicely.

Kicking off the full review now.

✅ Action performed

Full review finished.

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