Skip to content

Release v0.22.4 - #150

Merged
mohanagy merged 3 commits into
mainfrom
release-0-22-4
May 12, 2026
Merged

mohanagy merged 3 commits into
mainfrom
release-0-22-4

Conversation

@mohanagy

@mohanagy mohanagy commented May 12, 2026 •

Copy link
Copy Markdown
Owner

Summary

Testing

  • npm run test:run
  • npm run typecheck
  • npm run build
  • npm pack --dry-run (if packaging or install behavior changed)

Checklist

  • I updated docs for any user-visible change
  • I added or updated tests when behavior changed
  • I did not commit secrets, private corpora, or accidental generated artifacts
  • I kept this PR focused on a single change or tightly related set of changes

Related issues

Summary by CodeRabbit

  • New Features

    • Added a diagnostic warning for omitted runtime path nodes in compacted retrievals.
  • Bug Fixes

    • Improved runtime-path compaction to preserve direct pipeline/runtime nodes.
    • Suppressed irrelevant backward or hub fan-in paths for exact pipeline retrievals.
    • Improved method-anchor matching and runtime/pipeline detection for more accurate slicing.
  • Tests

    • Added regression and unit tests covering pipeline slice selection and compaction accuracy.
  • Chores

    • Bumped package version and updated changelog.

Review Change Stack

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented May 12, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Version 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.

Changes

Slice-v1 Runtime Path Handling and Diagnostics

Layer / File(s) Summary
Slice Path Omission Diagnostic
src/contracts/context-pack-diagnostics.ts, src/runtime/context-pack-diagnostics.ts, tests/unit/context-pack-diagnostics.test.ts
Introduces slice_path_nodes_not_promoted diagnostic kind. Detects when selected call-path targets are omitted from final pack (excluding policy/logger nodes) and emits warn-level diagnostic with omitted node IDs and labels. Test validates diagnostic emission for synthetic pack scenarios.
Method Anchor Normalization and Call-Chain Detection
src/runtime/context-pack-diagnostics.ts
Improves anchor matching via symbol/method normalization (backtick/parenthesis stripping, () removal, lowercasing). Adds runtimeSliceCallChainPresent to detect forward call-chain signals with cross-file and pipeline-runtime-like node heuristics. Updates missingRuntimePipeline to suppress when call-chain signal is present.
Runtime-Flow-Only Slicing Policy
src/runtime/retrieve/slicing.ts
Adds runtime_flow_only flag to slicing policy. Refactors effectivePolicy to detect exact method anchors and runtime/pipeline prompts, conditionally adjusting relations, depth bounds, and enabling runtime-flow-only mode. Extends traversal with depth-based pruning and selective runtime node expansion via helper predicates. Adds addAnchorPredecessors for backward-path expansion constrained by the backward relation set.
Selective Node Promotion During Compaction
src/runtime/retrieve.ts
Implements structuralSliceNodeIds via bounded forward-call traversal with bridge detection. Updates buildRetrieveResultFromOrderedCandidates to assign evidence_class: 'structural' to structural-slice nodes. Adds augmentSliceCandidateIdsForDebug for slice-v1 debug expansion. Conditionally applies slice promotion in compactRetrieveResult: when promoted nodes exist, uses kind: 'review' with seed nodes and max_supporting_nodes: 0; otherwise retains kind: 'retrieve' behavior.
Production Validation Tests
tests/unit/retrieve-production-correctness.test.ts, tests/unit/spi-nest-di-runtime-calls-realistic.test.ts
Adds buildBidirectionalHubGraph helper constructing realistic hub-graph with forward/backward edges. Regression test for exact method prompt asserts slice-v1 keeps forward call-chain paths while suppressing fan-in, backward edges, and shared-hub transitions. Compaction test validates direct runtime-path node preservation while filtering test/benchmark/fixture domains.
Release Metadata
package.json, CHANGELOG.md
Bumps version to 0.22.4 with changelog entry documenting slice-v1 runtime-path compaction alignment, shared-hub fan-in suppression, and omitted slice path diagnostics.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • mohanagy/graphify-ts#148: Both PRs modify runtime slicing and context-pack diagnostics with pipeline-oriented heuristics and new diagnostic rules.
  • mohanagy/graphify-ts#144: Both PRs change slice-v1 retrieval, slicing, and compaction behaviors with runtime-aware heuristics and diagnostics integration.
  • mohanagy/graphify-ts#121: Related prior work on context-pack diagnostics that this PR extends with a new diagnostic kind and suppression logic.

Poem

🐰 I hop through labels, strip and mend,

I follow forward calls until the end,
I flag the nodes the compactor dropped,
Promote the paths the pipeline topped,
v0.22.4 — a rabbit's small commend.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description follows the required template structure but the Summary section is entirely empty with only HTML comments, providing no meaningful information about what changed and why. Complete the Summary section by describing the key changes included in v0.22.4, including the new slice-v1 runtime-path compaction features, diagnostics, and improvements mentioned in the CHANGELOG.
Docstring Coverage ⚠️ Warning Docstring coverage is 2.38% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Release v0.22.4' clearly and concisely identifies the main purpose of the changeset, which is to release version 0.22.4 as evidenced by the version bump in package.json and CHANGELOG entry.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch release-0-22-4

Comment @coderabbitai help to get the list of available commands and usage tips.

@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: 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

📥 Commits

Reviewing files that changed from the base of the PR and between 0008d2d and a42eff0.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (9)
  • CHANGELOG.md
  • package.json
  • src/contracts/context-pack-diagnostics.ts
  • src/runtime/context-pack-diagnostics.ts
  • src/runtime/retrieve.ts
  • src/runtime/retrieve/slicing.ts
  • tests/unit/context-pack-diagnostics.test.ts
  • tests/unit/retrieve-production-correctness.test.ts
  • tests/unit/spi-nest-di-runtime-calls-realistic.test.ts

Comment thread src/runtime/context-pack-diagnostics.ts Resolved
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@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: 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

📥 Commits

Reviewing files that changed from the base of the PR and between a42eff0 and 2ff0d7f.

📒 Files selected for processing (2)
  • src/runtime/context-pack-diagnostics.ts
  • tests/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

Comment thread src/runtime/context-pack-diagnostics.ts Resolved
Comment thread src/runtime/context-pack-diagnostics.ts Resolved
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@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.

🧹 Nitpick comments (1)
tests/unit/context-pack-diagnostics.test.ts (1)

616-636: ⚡ Quick win

Use unique synthetic node_id values 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

📥 Commits

Reviewing files that changed from the base of the PR and between 2ff0d7f and d5e808c.

📒 Files selected for processing (2)
  • src/runtime/context-pack-diagnostics.ts
  • tests/unit/context-pack-diagnostics.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/runtime/context-pack-diagnostics.ts

@mohanagy
mohanagy merged commit e81fe04 into main May 12, 2026
7 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request May 12, 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