Skip to content

feat(recipes): evidence chains on high-judgment recipe rows#174

Merged
SutuSebastian merged 7 commits into
mainfrom
feat/evidence-chains-boundary
Jun 10, 2026
Merged

feat(recipes): evidence chains on high-judgment recipe rows#174
SutuSebastian merged 7 commits into
mainfrom
feat/evidence-chains-boundary

Conversation

@SutuSebastian

@SutuSebastian SutuSebastian commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add reason and evidence_json columns to boundary-violations, deprecated-symbols, and unimported-exports so agents can cite detection path before apply or manual edits (Plan 1 / PR #B).
  • boundary-violations: stable reason=boundary_deny_match + rule tuple in evidence.
  • deprecated-symbols: has_callers / no_callers + up to three AST caller hops (E.3 truncation marker when capped).
  • unimported-exports: no_direct_import / reexport_chain_possible + barrel hops from re_export_chains (includes chain truncated flag).
  • Served agent rule one-liner; golden fixtures + docs/golden-queries.md contract; patch changeset.

Test plan

  • bun run test:golden
  • bun test scripts/query-golden-coverage-matrix.test.mjs
  • Spot-check: bun src/index.ts query --recipe boundary-violations --json --root fixtures/minimal
  • Spot-check: bun src/index.ts query --recipe deprecated-symbols --json --root fixtures/minimal
  • Spot-check: bun src/index.ts query --recipe unimported-exports --json --root fixtures/minimal

Summary by CodeRabbit

  • New Features

    • Recipe results for boundary violations, deprecated symbols, and unimported exports now include reason and evidence fields
    • Evidence fields provide detection details: boundary rules, caller information (up to 3 hops), and re-export chains
  • Documentation

    • Updated recipe guidance and templates to describe the new evidence fields and their contents

Add reason and evidence_json to boundary-violations SQL; golden + golden-queries
contract; agent-enrichment-wave tracer doc for plans 1-4.
reason has_callers/no_callers plus bounded evidence_json from calls; golden
updated; document name-only callee match caveat.
Rows get reason (no_direct_import | reexport_chain_possible) and
evidence_json barrel hops from re_export_chains when a false positive
may be explained by barrel re-exports.
Completes Plan 1 evidence chains on recipe rows for PR #B.
Filter deprecated-symbols callers to AST provenance; append truncated
marker when evidence subqueries cap at 3; surface re_export_chains.truncated
on unimported-exports hops; align recipe docs and changeset for PR #B.
@changeset-bot

changeset-bot Bot commented Jun 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 76b5d51

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@stainless-code/codemap Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

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

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

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: b4fabc7a-fd0e-4038-a9f5-7df748604157

📥 Commits

Reviewing files that changed from the base of the PR and between 86062e2 and 76b5d51.

📒 Files selected for processing (24)
  • docs/architecture.md
  • docs/plans/agent-enrichment-wave.md
  • fixtures/golden/minimal/call-resolution-stats.json
  • fixtures/golden/minimal/components-touching-deprecated.json
  • fixtures/golden/minimal/coverage-rows-after-ingest.json
  • fixtures/golden/minimal/deprecated-symbols.json
  • fixtures/golden/minimal/files-hashes.json
  • fixtures/golden/minimal/files-largest.json
  • fixtures/golden/minimal/find-export-sites.json
  • fixtures/golden/minimal/find-jsx-usages.json
  • fixtures/golden/minimal/find-symbol-definitions.json
  • fixtures/golden/minimal/index-summary.json
  • fixtures/golden/minimal/index-table-stats.json
  • fixtures/golden/minimal/migrate-deprecated.json
  • fixtures/golden/minimal/migrate-jsx-prop-product-card.json
  • fixtures/golden/minimal/refactor-risk-ranking.json
  • fixtures/golden/minimal/rename-preview-product-card.json
  • fixtures/golden/minimal/stale-imports.json
  • fixtures/minimal/src/components/shop/ProductCard.tsx
  • templates/agent-content/skill/10-recipes-context.md
  • templates/recipes/deprecated-symbols.md
  • templates/recipes/deprecated-symbols.sql
  • templates/recipes/unimported-exports.md
  • templates/recipes/unimported-exports.sql
📝 Walkthrough

Walkthrough

This PR extends three high-judgment recipes with reason and evidence_json output columns to support agent evidence citation. The agent-enrichment-wave plan locks shared conventions, then boundary-violations, deprecated-symbols, and unimported-exports recipes are each enhanced with SQL query logic and documentation to emit factual detection paths and evidence for agents to reason about before applying changes.

Changes

Evidence chains on recipe rows

Layer / File(s) Summary
Plan definition and schema consensus
docs/plans/agent-enrichment-wave.md, docs/plans/evidence-chains-on-recipe-rows.md, .changeset/evidence-chains-recipes.md
Establishes the agent-enrichment-wave plan structure and locks shared conventions (required reason and evidence_json fields). Updates evidence-chains-on-recipe-rows plan with completed acceptance checklist and locked implementation decisions for wave 2026-06. Records changeset entry for patch release.
Boundary-violations recipe enhancement
templates/recipes/boundary-violations.sql, templates/recipes/boundary-violations.md, fixtures/golden/minimal/boundary-violations.json
Extends SQL query to emit fixed reason field (boundary_deny_match) and evidence_json payload containing matched rule tuple (name, from_glob, to_glob). Updates recipe documentation and golden fixture.
Deprecated-symbols recipe enrichment
templates/recipes/deprecated-symbols.sql, templates/recipes/deprecated-symbols.md, fixtures/golden/minimal/deprecated-symbols.json
Computes reason field from caller existence (AST provenance) and evidence_json field as JSON array of up to three caller hops with truncation marker. Updates documentation with caller evidence guidance and homonym collision caveats, and updates fixture with caller evidence data.
Unimported-exports recipe with re-export evidence
templates/recipes/unimported-exports.sql, templates/recipes/unimported-exports.md, fixtures/golden/minimal/unimported-exports.json
Refactors query into direct_uses and unimported CTEs, computes reason detecting re-export chain matches, and builds evidence_json from re-export-chain hops (limited to three with truncation). Updates documentation on revised V1 limitations and re-export false positives, and fixture with per-entry reasons and evidence chains.
Cross-recipe guidance and documentation updates
docs/golden-queries.md, templates/agent-content/rule/00-full.md
Clarifies that high-judgment recipes emit optional reason and evidence_json columns as factual detection paths. Updates Codemap agent-content template to document the new output fields.

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • stainless-code/codemap#66: Introduced the unimported-exports recipe SQL template; this PR builds on that by extending the recipe to emit reason and evidence_json (re-export chain evidence) per row.
  • stainless-code/codemap#72: Implemented config-driven boundary_rules and the initial boundary-violations recipe; this PR extends that recipe output to include reason and evidence_json for matched boundary rules.

Suggested labels

documentation

🐰 A wave of wisdom flows through the recipes now,
With reason and evidence_json to show—
Boundaries, symbols, exports aligned,
Each detection path factually signed! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and clearly describes the main change: adding evidence chains (reason and evidence_json columns) to high-judgment recipe rows (boundary-violations, deprecated-symbols, unimported-exports).
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.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/evidence-chains-boundary

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.

Use json('true') for list-cap markers; exercise >3 caller branch via
ProductCard now() fixture; fix stale unimported-exports action text;
add architecture + skill evidence lines; refresh affected goldens.
@SutuSebastian SutuSebastian merged commit a11242e into main Jun 10, 2026
11 checks passed
@SutuSebastian SutuSebastian deleted the feat/evidence-chains-boundary branch June 10, 2026 09:29
@github-actions github-actions Bot mentioned this pull request Jun 10, 2026
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