Repository navigation
fix: surface runtime primary path nodes in answer-ready packs - #401
Conversation
Closes #399 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Warning Review limit reached
More reviews will be available in 9 minutes and 26 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 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR implements end-to-end promotion of runtime primary-path nodes in explain-mode context packs. Retrieval discovers nodes via execution-slice scope, compaction preserves them as expandable previews with explain follow-ups, diagnostics recognizes expandable previews as valid promotion evidence, and tests validate the behavior across fixtures and diagnostic assertions. ChangesRuntime primary-path promotion in explain mode
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
tests/unit/pack-quality-fixtures.test.ts (1)
202-210: ⚡ Quick winPrevent a vacuous pass when primary path labels are empty.
On Line 202, this assertion always passes if
primaryLabelsis[]. Add a guard thatprimaryLabelsis non-empty so this regression test actually verifies promotion behavior.Proposed test hardening
const primaryLabels = (payload.pack?.execution_slice?.primary_path?.steps ?? []) .flatMap((entry) => (typeof entry.label === 'string' && entry.label.length > 0 ? [entry.label] : [])) +expect(primaryLabels.length).toBeGreaterThan(0) const surfacedLabels = new Set([🤖 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 `@tests/unit/pack-quality-fixtures.test.ts` around lines 202 - 210, The test currently allows a vacuous pass when primaryLabels is empty; add a guard assertion before the existing equality check to ensure primaryLabels is non-empty (e.g., assert primaryLabels.length > 0 using expect(primaryLabels.length).toBeGreaterThan(0) or similar) so the comparison between primaryLabels and surfacedLabels (the existing expect([...surfacedLabels]).toEqual(expect.arrayContaining(primaryLabels))) actually verifies promotion behavior; update the test around the primaryLabels and surfacedLabels variables to include that non-empty check.
🤖 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/infrastructure/context-pack-command.ts`:
- Around line 222-259: The preview selection currently deduplicates and
preserves nodes using only record.label (variables/functions: primaryLabels,
keptLabels, matchedByLabel, preview, asJsonRecord, matchedNodes,
ANSWER_READY_MATCHED_NODE_CAP), which drops distinct runtime-path steps that
share labels across files; change the identity to a composite key (e.g., label +
source_file + line_number or node_id when available) everywhere you build and
check keys: compute a stable compositeKey for each record after asJsonRecord,
use that compositeKey in keptLabels (Set) and matchedByLabel (Map) instead of
record.label, and update the preview filter to lookup by compositeKey and
include source_file/line_number in the preview. Apply the same composite-key
logic to the other matching block mentioned (lines ~298-344).
In `@tests/unit/pack-quality-fixtures.test.ts`:
- Around line 227-239: The test builds workflowCenters from
workflowCenterEntries by reading only entry.label which is often missing, making
the check vacuous; update the logic that builds the set (workflowCenters) to use
entry.path or node id (e.g., entry.path or entry.id) when label is absent and
compare against warning.detail?.ids (not detail?.labels), and add an assertion
that the workflowCenters set is non-empty before asserting its intersection with
omittedLabels/ids is empty; adjust references to workflowCenterEntries,
workflowCenters, omittedLabels and payload.pack.routing.warnings accordingly.
---
Nitpick comments:
In `@tests/unit/pack-quality-fixtures.test.ts`:
- Around line 202-210: The test currently allows a vacuous pass when
primaryLabels is empty; add a guard assertion before the existing equality check
to ensure primaryLabels is non-empty (e.g., assert primaryLabels.length > 0
using expect(primaryLabels.length).toBeGreaterThan(0) or similar) so the
comparison between primaryLabels and surfacedLabels (the existing
expect([...surfacedLabels]).toEqual(expect.arrayContaining(primaryLabels)))
actually verifies promotion behavior; update the test around the primaryLabels
and surfacedLabels variables to include that non-empty check.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: f7d582c1-a4f8-4641-a93d-c493b910a47a
📒 Files selected for processing (5)
src/infrastructure/context-pack-command.tssrc/runtime/context-pack-diagnostics.tssrc/runtime/retrieve.tstests/unit/context-pack-diagnostics.test.tstests/unit/pack-quality-fixtures.test.ts
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Summary
slice_path_nodes_not_promoteddiagnosticsTesting
Closes #399
Summary by CodeRabbit
New Features
Bug Fixes
Tests