Skip to content

feat(edit): support acceptance criterion replacement - #43

Merged
lucifer1004 merged 2 commits into
mainfrom
feat/acceptance-criterion-replacement
Aug 2, 2026
Merged

feat(edit): support acceptance criterion replacement#43
lucifer1004 merged 2 commits into
mainfrom
feat/acceptance-criterion-replacement

Conversation

@lucifer1004

@lucifer1004 lucifer1004 commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Added support for replacing or correcting an indexed work-item acceptance criterion with work edit --set.
    • Recognized category prefixes can update criterion text and category while preserving checklist status.
    • Added literal .text editing and separate status updates with --tick.
    • Unrecognized prefixes are treated as literal text; empty or invalid values are rejected.
  • Documentation

    • Updated CLI help, guides, RFC documentation, examples, and changelog entries.
    • Added guidance for quoting indexed paths and safely editing rich-text values.

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8df50abd-84f3-47ab-a33d-02a43827d8c7

📥 Commits

Reviewing files that changed from the base of the PR and between af76e67 and 32cbd49.

⛔ Files ignored due to path filters (8)
  • tests/snapshots/test_help__adr_edit_help.snap is excluded by !**/*.snap
  • tests/snapshots/test_help__adr_get_help.snap is excluded by !**/*.snap
  • tests/snapshots/test_help__adr_reject_help.snap is excluded by !**/*.snap
  • tests/snapshots/test_help__adr_root_help.snap is excluded by !**/*.snap
  • tests/snapshots/test_help__rfc_edit_help.snap is excluded by !**/*.snap
  • tests/snapshots/test_help__work_edit_help.snap is excluded by !**/*.snap
  • tests/snapshots/test_help__work_get_help.snap is excluded by !**/*.snap
  • tests/snapshots/test_help__work_root_help.snap is excluded by !**/*.snap
📒 Files selected for processing (15)
  • .claude/skills/wi-writer/SKILL.md
  • AGENTS.md
  • README.md
  • docs/guide/adrs.md
  • docs/guide/getting-started.md
  • docs/guide/recommended-workflows.md
  • docs/guide/rfcs.md
  • docs/guide/work-items.md
  • docs/rfc/RFC-0002.md
  • gov/rfc/RFC-0002/rfc.toml
  • src/cli/help.rs
  • src/cli/resources/adr.rs
  • src/cli/resources/guard.rs
  • src/cli/resources/rfc.rs
  • src/cli/resources/work.rs
🚧 Files skipped from review as they are similar to previous changes (8)
  • gov/rfc/RFC-0002/rfc.toml
  • docs/guide/work-items.md
  • AGENTS.md
  • src/cli/help.rs
  • docs/rfc/RFC-0002.md
  • src/cli/resources/work.rs
  • .claude/skills/wi-writer/SKILL.md
  • docs/guide/getting-started.md

📝 Walkthrough

Walkthrough

The edit system now supports replacing indexed work-item acceptance criteria. It parses category prefixes, preserves checklist status, supports literal .text updates, rejects empty values, and documents the new CLI behavior.

Changes

Acceptance criterion editing

Layer / File(s) Summary
Edit contract and generated rules
gov/schema/*, build_support/edit_ops_spec.rs, build.rs, src/cmd/edit/rules.rs
Nested rules support acceptance-criterion object modes and non-empty string validation. Recursive validation and generated runtime rules enforce the configuration.
Target resolution and value parsing
src/cmd/edit/engine/*, src/model/changelog.rs, src/write/changelog/*, src/write/mod.rs, src/cmd/edit/runtime/nested/mod.rs
Indexed targets carry object-set metadata. Changelog parsing recognizes more prefixes and supports literal fallback. Empty nested scalar values are rejected.
Criterion update and validation
src/cmd/edit/toml_target/set.rs, tests/edit_tests/work_tests/acceptance.rs, src/cmd/edit/engine/tests.rs
Acceptance-criterion targets use dedicated parsing and update logic. Tests cover categories, status preservation, literal text, invalid input, invalid indexes, and atomicity.
Contract, release, and usage guidance
docs/rfc/*, gov/rfc/*, docs/guide/*, src/cli/*, CHANGELOG.md, README.md, AGENTS.md, .claude/skills/wi-writer/*, gov/work/*
RFCs, schemas, CLI help, guides, changelog entries, examples, agent guidance, and the completed work item describe the replacement behavior and quoted paths.

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
Loading

Possibly related PRs

  • govctl-org/govctl#7: Both changes extend nested edit rules and acceptance-criteria targeting.
  • govctl-org/govctl#41: Both changes modify Work Item acceptance-criteria handling and related CLI and schema behavior.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 74.07% 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: support for acceptance criterion replacement during edits.
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.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/acceptance-criterion-replacement

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.

@codecov

codecov Bot commented Aug 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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

Add a language marker to the command fence.

The generated docs/rfc/RFC-0002.md fence 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

📥 Commits

Reviewing files that changed from the base of the PR and between 98266de and af76e67.

⛔ Files ignored due to path filters (2)
  • tests/snapshots/test_help__work_edit_help.snap is excluded by !**/*.snap
  • tests/snapshots/test_help__work_root_help.snap is excluded by !**/*.snap
📒 Files selected for processing (25)
  • .claude/skills/wi-writer/SKILL.md
  • AGENTS.md
  • CHANGELOG.md
  • build.rs
  • build_support/edit_ops_spec.rs
  • docs/guide/getting-started.md
  • docs/guide/work-items.md
  • docs/rfc/RFC-0002.md
  • gov/rfc/RFC-0002/clauses/C-EDIT-FIELD-CONTRACT.toml
  • gov/rfc/RFC-0002/rfc.toml
  • gov/schema/edit-ops.json
  • gov/schema/edit-ops.schema.json
  • gov/work/2026-08-02-support-item-level-acceptance-criterion-replacement.toml
  • src/cli/help.rs
  • src/cli/resources/work.rs
  • src/cmd/edit/engine/mod.rs
  • src/cmd/edit/engine/resolve.rs
  • src/cmd/edit/engine/tests.rs
  • src/cmd/edit/rules.rs
  • src/cmd/edit/runtime/nested/mod.rs
  • src/cmd/edit/toml_target/set.rs
  • src/model/changelog.rs
  • src/write/changelog/mod.rs
  • src/write/mod.rs
  • tests/edit_tests/work_tests/acceptance.rs

Comment thread AGENTS.md Outdated
# 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"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 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.

Suggested change
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

Comment thread gov/rfc/RFC-0002/rfc.toml Outdated
Comment thread gov/rfc/RFC-0002/rfc.toml
Comment on lines +51 to +55
[[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"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ 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

Comment thread src/cli/resources/work.rs Outdated
},
index,
item_kind: map_nested_kind(item_node.kind),
object_set_mode: item_node.object_set_mode,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 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

@lucifer1004
lucifer1004 merged commit 18bf5ae into main Aug 2, 2026
8 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