Repository navigation
Release v0.22.4 - #150
Release v0.22.4#150
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
📝 WalkthroughWalkthroughVersion 0.22.4 adds a diagnostic for omitted slice-path nodes, refines slicing to be runtime-aware via method-anchor normalization and traversal filtering, implements selective node promotion during compaction, and validates the behavior with production-style tests covering exact method prompts and forward-only pipeline paths. ChangesSlice-v1 Runtime Path Handling and Diagnostics
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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/runtime/context-pack-diagnostics.ts`:
- Around line 476-481: The logic in directAnchorEdge and included conflates
nodes by falling back to label checks even when a from_id/to_id exists but
doesn't match; change the checks to give precedence to IDs: for directAnchorEdge
compute it as (typeof path.from_id === 'string' ? anchorIds.has(path.from_id) :
anchorLabels.has(path.from)) and likewise compute included as (typeof path.to_id
=== 'string' ? includedIds.has(path.to_id) : includedLabels.has(path.to)),
keeping the supportingPolicyOrLoggerLabel(path.to) short-circuit as before so
label checks are only used when the corresponding id is absent.
In `@tests/unit/retrieve-production-correctness.test.ts`:
- Around line 203-209: The negative-path assertion on
result.slice?.selected_paths is too weak because a single
expect.arrayContaining(...) wrapping multiple forbidden edges only fails if all
forbidden edges appear together; change it to assert each forbidden edge
independently by replacing the single combined assertion with one assertion per
forbidden path (e.g., for each of the object shapes { from: '.createIdea()', to:
'.generateFromProblem()', relation: 'calls' }, { from: '.exportIdeaToPdf()', to:
'requireIdeasUserId', relation: 'calls' }, { from: '.publishIdea()', to:
'requireIdeasUserId', relation: 'calls' }, { from: '.queueLetsBuild()', to:
'.addJob()', relation: 'calls' }, { from: '.callLlm()', to: '.resolve()',
relation: 'calls' } assert that result.slice?.selected_paths does not contain
that object—use separate assertions like
expect(result.slice?.selected_paths).not.toContainEqual(expect.objectContaining(...))
or a short loop that calls the same negative assertion for each forbidden
object).
🪄 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: e9890c0a-5bbd-447b-8104-0491901a82cf
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (9)
CHANGELOG.mdpackage.jsonsrc/contracts/context-pack-diagnostics.tssrc/runtime/context-pack-diagnostics.tssrc/runtime/retrieve.tssrc/runtime/retrieve/slicing.tstests/unit/context-pack-diagnostics.test.tstests/unit/retrieve-production-correctness.test.tstests/unit/spi-nest-di-runtime-calls-realistic.test.ts
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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/runtime/context-pack-diagnostics.ts`:
- Around line 472-494: The current loop only checks first-hop edges from anchors
(selectedPaths iteration with path.from checked against anchorIds/anchorLabels),
so deeper omitted nodes in call chains are missed; replace this with a
traversal: build an adjacency map of forward 'calls' edges from selectedPaths,
then for each anchor start (anchorIds/anchorLabels) perform a DFS/BFS following
that adjacency map and for every reachable node check
supportingPolicyOrLoggerLabel(node) and inclusion using
includedIds/includedLabels and, if neither true, add the node to omitted (using
the same key/id/label construction currently used). Keep the existing omitted
map logic and key formatting, but populate it from discovered reachable nodes
rather than only edges whose from is an anchor.
- Around line 579-592: The loop currently only resolves endpoints by id (using
nodesById) so label-only selected paths are skipped; update the resolution logic
in the for loop over pack.slice.selected_paths so that if fromNode or toNode is
undefined after the nodesById lookup you fallback to finding the node in
pack.nodes by its label/name (e.g. compare path.from_label/path.from or
path.to_label/path.to against node.label or node.name) before skipping; keep
references to nodesById, fromNode, toNode and the for loop over
pack.slice.selected_paths when adding the fallback search.
🪄 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: d8b7f8aa-b787-4138-aa5f-7ba56883598e
📒 Files selected for processing (2)
src/runtime/context-pack-diagnostics.tstests/unit/retrieve-production-correctness.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- tests/unit/retrieve-production-correctness.test.ts
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/unit/context-pack-diagnostics.test.ts (1)
616-636: ⚡ Quick winUse unique synthetic
node_idvalues in this fixture.Using
node_id: ''for multiple nodes makes the test depend on duplicate/empty-ID behavior. Keep the slice label-only, but assign distinct node ids so the assertion focuses only on runtime-chain suppression logic.Proposed test-fixture tweak
makeNode({ - node_id: '', + node_id: 'route', label: '.generateFromProblem()', source_file: '/repo/src/idea-generation.controller.ts', framework_role: 'nest_route', node_kind: 'route', }), makeNode({ - node_id: '', + node_id: 'start', label: '.startPipeline()', source_file: '/repo/src/pipeline-trigger.service.ts', framework_role: 'provider', node_kind: 'method', }), makeNode({ - node_id: '', + node_id: 'add-job', label: '.addJob()', source_file: '/repo/src/queue-registry.service.ts', framework_role: 'provider', node_kind: 'method', }),🤖 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/context-pack-diagnostics.test.ts` around lines 616 - 636, The fixture uses duplicate empty node_id values which makes the test rely on empty/duplicate-ID behavior; update the makeNode calls in this test to give each synthetic node a unique node_id (e.g., distinct strings) while keeping the label-only slice behavior intact—specifically change the nodes with labels '.generateFromProblem()', '.startPipeline()', and '.addJob()' to have unique node_id values so the assertion targets runtime-chain suppression logic rather than ID collisions.
🤖 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.
Nitpick comments:
In `@tests/unit/context-pack-diagnostics.test.ts`:
- Around line 616-636: The fixture uses duplicate empty node_id values which
makes the test rely on empty/duplicate-ID behavior; update the makeNode calls in
this test to give each synthetic node a unique node_id (e.g., distinct strings)
while keeping the label-only slice behavior intact—specifically change the nodes
with labels '.generateFromProblem()', '.startPipeline()', and '.addJob()' to
have unique node_id values so the assertion targets runtime-chain suppression
logic rather than ID collisions.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 24e03a54-819b-45b5-8338-dc834483d478
📒 Files selected for processing (2)
src/runtime/context-pack-diagnostics.tstests/unit/context-pack-diagnostics.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- src/runtime/context-pack-diagnostics.ts
Summary
Testing
npm run test:runnpm run typechecknpm run buildnpm pack --dry-run(if packaging or install behavior changed)Checklist
Related issues
Summary by CodeRabbit
New Features
Bug Fixes
Tests
Chores