fix(brownfield,cli): name the review step after init --from-code - #609
Conversation
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe brownfield flow now adds review guidance to generated proposals and reports ordered follow-up actions for non-apply ChangesBrownfield initialization review flow
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant run as CLI run
participant report as Brownfield next-action reporting
participant copy as copy.toml
participant output as Human or JSON output
run->>report: Execute non-apply init --from-code
report->>copy: Load init.from-code copy keys
copy-->>report: Return ordered next-action text
report->>output: Render change details and next_actions
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 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 |
todo.brownfield-init-review-handoff. The non-apply branch of `cairn init --from-code` was a dead end: it printed one sentence, ignored `--json` entirely, and the generated proposal presented a source-file-count confidence score with nothing to say it is not an architectural claim. At that point the agent pack and the cairn-dev skill are not installed yet, so the CLI is the only thing that can name the semantic review the brownfield model depends on. Success criterion: cargo test proves the human ladder leads with review before apply, that `--json` returns an envelope whose next_actions are the same steps in the same order, and that the generated proposal.md carries the review checklist and the confidence disclaimer. - New `init.from-code` copy: `done`, `next-steps-header`, and a single ordered `next-actions` list. Human output and the JSON envelope both render that one list, so the two orderings cannot drift. - `brownfield_init_report` honours `--json` on the non-apply branch, emitting schema_version, change_id, change_path, applied=false, and next_actions. One flag no longer means two behaviours on one command. - `write_change` appends a review checklist to every generated proposal, covering path ownership, grouping, edges, contracts, currency, and hierarchy, and states plainly that confidence is a structural signal. - todo.brownfield-one-step-first-map's 2026-07-12 resolution note covered the greenfield next-steps keys only; its body now records what this unit closed.
2af8e8a to
e6233b2
Compare
|
Pre-submit two-lens review applied (correctness + simplicity, run in parallel). Fixed:
Dropped, with reasons:
Both lenses confirmed all three acceptance items are met by the code, not just by test self-consistency. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@src/cli/mod.rs`:
- Around line 122-130: Add the required schema_version field to the non-apply
JSON envelope in the init command alongside command and status, using the
documented contract value. Update
test_cli_init_from_code_json_next_actions_match_human_output to assert the
emitted schema_version while preserving the existing next_actions assertions.
🪄 Autofix
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: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: cc109bb6-9828-4439-a3b5-a31adc0d24e2
📒 Files selected for processing (6)
docs/design-system/copy.tomlmap.jsonmeta/todos/todo.brownfield-init-review-handoff.mdmeta/todos/todo.brownfield-one-step-first-map.mdsrc/brownfield/mod.rssrc/cli/mod.rs
todo.brownfield-init-review-handoff(nodecairn.brownfield).Problem
The non-apply branch of
cairn init --from-codewas a dead end. It returned one sentence, ignored--json, and the generated proposal presented a source-file-count confidence score with nothing to say it is not an architectural claim. At that moment the agent pack and thecairn-devskill are not installed yet, so the CLI is the only surface that can name the semantic review the whole brownfield model depends on. An agent entering through the CLI could apply a plausible but structurally wrong hierarchy without ever learning a review step existed.Success criterion
cargo testproves the human ladder leads with review before apply, that--jsonreturns an envelope whosenext_actionsare the same steps in the same order as the human output, and that the generatedproposal.mdcarries the review checklist and the confidence disclaimer.Change
[init.from-code]table indocs/design-system/copy.toml:done,next-steps-header, and one orderednext-actionslist. The human ladder and the JSON array are both rendered from that single list, so the two orderings cannot drift.brownfield_init_reporthonours--jsonon the non-apply branch, emittingschema_version,command,change_id,change_path,applied: false, andnext_actions. One flag no longer means two behaviours on one command.write_changeappends a review checklist to every generated proposal: path ownership, grouping, edges, contracts, currency, hierarchy, plus a plain statement that confidence scores source-file count and is not a claim of architectural correctness, pointing atdocs/brownfield.md.todo.brownfield-one-step-first-map's 2026-07-12 resolution note covered the greenfieldinit.next-stepskeys only; its body now records that the from-code branch has its own ladder (acceptance item 4).Verification
cargo test: 1661 lib + all integration suites pass, including the two new CLI regression tests and the newwrite_changeproposal test.cargo clippy --all-targets --all-features -- -D warnings: clean.cairn scan --strict: exit 0 (30 standing Info findings, unchanged).cairn hook all: exit 0.scripts/check-file-sizes.sh,scripts/check-voice-markers.sh: clean.--jsonreturns a valid envelope whosenext_actionsmatch byte for byte;proposal.mdcarries the checklist.