feat(edit): support acceptance criterion replacement - #43
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (8)
📒 Files selected for processing (15)
🚧 Files skipped from review as they are similar to previous changes (8)
📝 WalkthroughWalkthroughThe edit system now supports replacing indexed work-item acceptance criteria. It parses category prefixes, preserves checklist status, supports literal ChangesAcceptance criterion editing
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant WorkEditCLI
participant TargetResolver
participant ChangelogParser
participant WorkItemTOML
User->>WorkEditCLI: Set acceptance_criteria[index]
WorkEditCLI->>TargetResolver: Resolve indexed target
TargetResolver->>WorkEditCLI: Return acceptance-criterion mode
WorkEditCLI->>ChangelogParser: Parse replacement text
ChangelogParser->>WorkItemTOML: Provide text and optional category
WorkEditCLI->>WorkItemTOML: Preserve status and save criterion
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 5
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
gov/rfc/RFC-0002/clauses/C-EDIT-FIELD-CONTRACT.toml (1)
63-71: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winAdd a language marker to the command fence.
The generated
docs/rfc/RFC-0002.mdfence at line 916 violates markdownlint MD040. Change this opening fence to ````text`, then regenerate the RFC projection.Proposed fix
-``` +```text govctl <resource> edit <id> <scalar-list-path>[<index>] --set <value>🤖 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 `@gov/rfc/RFC-0002/clauses/C-EDIT-FIELD-CONTRACT.toml` around lines 63 - 71, Update the command fence in C-EDIT-FIELD-CONTRACT.toml to use the text language marker, then regenerate the RFC projection so the corresponding fence in RFC-0002.md is also emitted as ```text.Source: Linters/SAST tools
🤖 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.md`:
- Line 220: Update the acceptance-criteria example around the command `govctl
work edit` to invoke the repository tool through `cargo run --quiet --` instead
of relying on a globally installed `govctl`, while preserving the existing
arguments and behavior.
In `@gov/rfc/RFC-0002/rfc.toml`:
- Line 8: Advance RFC-0002’s phase from impl to test before retaining the added
verification code, then regenerate its governed projections and signature using
the repository’s standard process.
- Around line 51-55: Remove the duplicate consecutive [[changelog]] header in
the RFC changelog so the 3.6.0 fields belong to a single entry. Then regenerate
the sealed RFC content signature and rendered RFC artifacts using the
repository’s established generation workflow, preserving gov/ as authoritative.
In `@src/cli/resources/work.rs`:
- Line 74: Quote every indexed path in the new copyable shell examples to
prevent glob expansion: update src/cli/resources/work.rs lines 74-74 for
"acceptance_criteria[0]", docs/guide/getting-started.md lines 285-285 for
"acceptance_criteria[0]", docs/guide/work-items.md lines 98-99 for both indexed
paths and line 262 for "acceptance_criteria[0]", and
.claude/skills/wi-writer/SKILL.md lines 66-67 for "acceptance_criteria[N]".
In `@src/cmd/edit/engine/resolve.rs`:
- Line 139: Add a nearby RFC citation comment at the `object_set_mode`
assignment in the edit resolution logic, explicitly referencing
RFC-0002:C-EDIT-FIELD-CONTRACT and identifying that it documents the special
target-mode exception for applying `--set` to an indexed structured acceptance
criterion.
---
Outside diff comments:
In `@gov/rfc/RFC-0002/clauses/C-EDIT-FIELD-CONTRACT.toml`:
- Around line 63-71: Update the command fence in C-EDIT-FIELD-CONTRACT.toml to
use the text language marker, then regenerate the RFC projection so the
corresponding fence in RFC-0002.md is also emitted as ```text.
🪄 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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 7e92c71a-8b05-456a-aa73-b0be74ee59c0
⛔ Files ignored due to path filters (2)
tests/snapshots/test_help__work_edit_help.snapis excluded by!**/*.snaptests/snapshots/test_help__work_root_help.snapis excluded by!**/*.snap
📒 Files selected for processing (25)
.claude/skills/wi-writer/SKILL.mdAGENTS.mdCHANGELOG.mdbuild.rsbuild_support/edit_ops_spec.rsdocs/guide/getting-started.mddocs/guide/work-items.mddocs/rfc/RFC-0002.mdgov/rfc/RFC-0002/clauses/C-EDIT-FIELD-CONTRACT.tomlgov/rfc/RFC-0002/rfc.tomlgov/schema/edit-ops.jsongov/schema/edit-ops.schema.jsongov/work/2026-08-02-support-item-level-acceptance-criterion-replacement.tomlsrc/cli/help.rssrc/cli/resources/work.rssrc/cmd/edit/engine/mod.rssrc/cmd/edit/engine/resolve.rssrc/cmd/edit/engine/tests.rssrc/cmd/edit/rules.rssrc/cmd/edit/runtime/nested/mod.rssrc/cmd/edit/toml_target/set.rssrc/model/changelog.rssrc/write/changelog/mod.rssrc/write/mod.rstests/edit_tests/work_tests/acceptance.rs
| # Nested field editing (path-based per ADR-0029) | ||
| govctl adr edit ADR-0001 alternatives[0].text --set "Updated option" | ||
| govctl adr edit ADR-0001 alternatives[0].pros --add "New advantage" | ||
| govctl work edit WI-001 acceptance_criteria[0] --set "fix: Correct criterion" |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Use the repository command form.
Line 220 assumes that govctl is installed on PATH. Use cargo run --quiet -- so agents can run this command from a repository checkout.
Based on learnings: invoke the tool with cargo run --quiet -- instead of govctl when developing in this repository.
Proposed fix
-govctl work edit WI-001 acceptance_criteria[0] --set "fix: Correct criterion"
+cargo run --quiet -- work edit WI-001 acceptance_criteria[0] --set "fix: Correct criterion"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| govctl work edit WI-001 acceptance_criteria[0] --set "fix: Correct criterion" | |
| cargo run --quiet -- work edit WI-001 acceptance_criteria[0] --set "fix: Correct criterion" |
🤖 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.md` at line 220, Update the acceptance-criteria example around the
command `govctl work edit` to invoke the repository tool through `cargo run
--quiet --` instead of relying on a globally installed `govctl`, while
preserving the existing arguments and behavior.
Sources: Coding guidelines, Learnings
| [[changelog]] | ||
| version = "3.6.0" | ||
| date = "2026-08-02" | ||
| notes = "Make acceptance-criterion text correction ergonomic" | ||
| added = ["Define item-level acceptance-criterion replacement with category-prefix parsing"] |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Remove the duplicate [[changelog]] header.
Line 51 starts two consecutive array-table entries. The first entry is empty, and the 3.6.0 fields apply only to the second entry. Keep one header, then regenerate the sealed signature and rendered RFC.
Proposed fix
[[changelog]]
-[[changelog]]
version = "3.6.0"As per coding guidelines, files under gov/ are authoritative and RFC content signatures must remain sealed.
🤖 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 `@gov/rfc/RFC-0002/rfc.toml` around lines 51 - 55, Remove the duplicate
consecutive [[changelog]] header in the RFC changelog so the 3.6.0 fields belong
to a single entry. Then regenerate the sealed RFC content signature and rendered
RFC artifacts using the repository’s established generation workflow, preserving
gov/ as authoritative.
Source: Coding guidelines
| }, | ||
| index, | ||
| item_kind: map_nested_kind(item_node.kind), | ||
| object_set_mode: item_node.object_set_mode, |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Cite the RFC clause for this special target mode.
object_set_mode carries the exception that permits --set on an indexed structured acceptance criterion. Add a nearby reference to RFC-0002:C-EDIT-FIELD-CONTRACT so this invariant remains traceable.
As per coding guidelines, src/**/*.rs must cite RFC clauses when implementing invariants. Based on learnings, implementation constraints must remain traceable by citing RFCs.
🤖 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/cmd/edit/engine/resolve.rs` at line 139, Add a nearby RFC citation
comment at the `object_set_mode` assignment in the edit resolution logic,
explicitly referencing RFC-0002:C-EDIT-FIELD-CONTRACT and identifying that it
documents the special target-mode exception for applying `--set` to an indexed
structured acceptance criterion.
Sources: Coding guidelines, Learnings
Summary by CodeRabbit
New Features
work edit --set..textediting and separate status updates with--tick.Documentation