Skip to content

test(brownfield): exercise the decision drafting flow end to end - #677

Merged
George-RD merged 1 commit into
mainfrom
loop/todo.brownfield-extraction-drafting-test
Aug 10, 2026
Merged

test(brownfield): exercise the decision drafting flow end to end#677
George-RD merged 1 commit into
mainfrom
loop/todo.brownfield-extraction-drafting-test

Conversation

@George-RD

Copy link
Copy Markdown
Collaborator

Closes todo.brownfield-extraction-drafting-test (node cairn.brownfield).

Success criterion

A test drives the shipped extraction flow end to end against a fresh temp fixture, in the order .claude/skills/cairn-dev/references/task-brownfield-decision-extraction.md names: cairn onboard decisions --json, hand-author the fixture's own method: primary research artefact, then cairn decision new <slug> --node <id> --informed-by <research-id> with the node a bound entry published, verbatim. It asserts on the drafted artefact: its nodes: binding names a node the fixture blueprint declares (proved by cairn get <node> inside the fixture) and its status is exactly proposed.

Why

The report side is already covered by todo.brownfield-onboard-decisions-index. What was uncovered is that a bound entry carries through the writer into a decision artefact with a real binding and a non-accepted status.

Fixture

A temp root (not a checked-in tree, same shape as the existing onboard coverage) carrying ordinary project material only: a docs/adr/ document, a README Decision section, an // invariant: source comment, plus the cairn.blueprint the flow requires, whose System block declares decisions and research. No cairn artefact directory exists before the run; the flow creates it. Nothing is written inside this repository.

Mutation check

Reading detail (the path-derived discovery candidate id) instead of node fails the test, so the binding assertion defends a real contract.

Gates

cargo fmt --check, cargo clippy --all-targets --all-features -- -D warnings, cargo test (full suite, unpiped, exit 0), cairn scan --strict (exit 0), cairn hook all (exit 0) all pass.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@George-RD, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 46 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

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.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 83807777-63d7-4cb7-87f5-3b8f641615ac

📥 Commits

Reviewing files that changed from the base of the PR and between afe411f and 5517375.

📒 Files selected for processing (1)
  • tests/kernel.rs
📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Improved support for extracting decision evidence and drafting bound decisions.
    • Generated decisions now preserve linked evidence references and an initial proposed status.
    • Decision nodes can be resolved successfully after creation.
  • Tests

    • Added end-to-end coverage for evidence discovery, research artefact creation, decision drafting, and node resolution.
  • Chores

    • Marked the related brownfield extraction drafting task as complete.

Walkthrough

The pull request adds an end-to-end test for brownfield decision extraction and drafting. It creates a configured fixture, indexes evidence, drafts a bound decision, verifies proposed frontmatter, and confirms node resolution. It marks the related todo as complete.

Changes

Brownfield decision flow

Layer / File(s) Summary
Brownfield fixture setup
tests/kernel.rs
The fixture creates ADR documentation, source evidence, and blueprint declarations for decision and research artefact directories.
Extraction and drafting validation
tests/kernel.rs, meta/todos/todo.brownfield-extraction-drafting-test.md
The test indexes evidence, creates research metadata, runs decision new, verifies the bound node and proposed status, confirms node resolution, and marks the todo as done.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

Possibly related PRs

Poem

A rabbit checked the nodes in line,
Then drafted decisions, neat and fine.
Evidence indexed, bindings stayed,
proposed fronts were clearly made.
The todo hops to done today.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the end-to-end brownfield decision drafting test.
Description check ✅ Passed The description explains the test flow, fixture, assertions, and success criteria for the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch loop/todo.brownfield-extraction-drafting-test

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.

@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

🤖 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 `@tests/kernel.rs`:
- Around line 1982-1983: Update the test setup around temp_root and
write_extraction_flow_fixture to create the fixture directory with
tempfile::TempDir, retain the TempDir in scope for RAII cleanup, and pass its
.path() wherever a filesystem path is required.
🪄 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: 67ba42a4-0d6c-4281-a22a-91cef61c39f7

📥 Commits

Reviewing files that changed from the base of the PR and between b766744 and afe411f.

📒 Files selected for processing (2)
  • meta/todos/todo.brownfield-extraction-drafting-test.md
  • tests/kernel.rs

Comment thread tests/kernel.rs
Closes todo.brownfield-extraction-drafting-test.

Success criterion: a test drives the shipped extraction flow (onboard
decisions --json, hand-authored `method: primary` research, `cairn
decision new --node --informed-by`) against a fresh temp fixture and
asserts the drafted artefact binds the `node` a bound entry published,
verbatim, with status exactly `proposed`.

The report side of the flow is already covered; what was uncovered is
that a bound entry carries through the writer into an artefact with a
real binding. Assertions read parsed frontmatter fields rather than
scanning lines, so a draft with an empty `nodes:` list cannot pass on an
unrelated body line, and the node identity is proved by `--json get`
returning that exact id: bare `get` also resolves names and unique
dotted suffixes, so its exit status alone would accept a label.
`informed_by` is asserted too, because the writer accepting the flag and
dropping it would otherwise exit 0.

The fixture is a temp root carrying ordinary project material only (a
docs/adr document, a README Decision section, an `// invariant:`
comment) plus the blueprint the flow requires, and it carries no cairn
artefact directory until the flow creates one.
@George-RD
George-RD force-pushed the loop/todo.brownfield-extraction-drafting-test branch from afe411f to 5517375 Compare August 10, 2026 14:01
@George-RD
George-RD merged commit dc45072 into main Aug 10, 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