Skip to content

Release v0.22.5 - #151

Merged
mohanagy merged 4 commits into
mainfrom
broad-generation-routing
May 12, 2026
Merged

mohanagy merged 4 commits into
mainfrom
broad-generation-routing

Conversation

@mohanagy

@mohanagy mohanagy commented May 12, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Bump package metadata to v0.22.5 and move the broad-routing changelog entry into the v0.22.5 release section.
  • Add retrieval-gate runtime-generation vs frontend-display signals and use them in retrieval scoring/slice-v1 anchor selection.
  • Add realistic ReportFooter frontend-noise regression coverage while preserving frontend display prompt routing.

Verification

  • npm run typecheck
  • npm run build
  • npm run test:run
  • npm pack --dry-run
  • Real GoValidate pack checks for backend report generation and frontend report UI display prompts

Release

  • Tag pushed: v0.22.5
  • npm publishing will be handled manually after merge.

Summary by CodeRabbit

  • New Features

    • Retrieval now signals generation intent and target domain to route prompts to backend runtime vs frontend display, and uses intent-aware anchoring for better source selection.
  • Bug Fixes / Improvements

    • Scoring and anchor prioritization reduce noisy frontend matches for backend-generation prompts while preserving display/UI prompts.
  • Tests

    • Added intent-routing tests and fixtures; some tests now skip on Windows.
  • Chores

    • Version bumped to 0.22.5.
  • Documentation

    • Changelog entry for 0.22.5.

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

This PR extends the retrieval gate with generation intent and target domain hint signals to distinguish runtime report generation from frontend display rendering. Retrieval scoring and slice anchor selection use these signals to adjust relevance and demote frontend-only anchors for backend-generation prompts. Tests and fixtures validate end-to-end routing and a package/version release entry was added.

Changes

Intent-Aware Report Retrieval Routing

Layer / File(s) Summary
Retrieval gate signal contracts
src/contracts/retrieval-gate.ts
Adds RetrievalGenerationIntent and RetrievalTargetDomainHint union types and extends RetrievalGateSignals with optional generation_intent and target_domain_hint fields.
Generation intent detection and classification
src/runtime/retrieval-gate.ts
Re-exports new contract types and extends classifyRetrievalLevel to derive generationIntent/targetDomainHint. Adds detectGenerationIntent and targetDomainHintForGenerationIntent helpers.
Intent-aware anchor selection in slicing
src/runtime/retrieve/slicing.ts
Extends SliceOptions with generationIntent/targetDomainHint, broadens runtime/pipeline detection regex, adds frontend-display detection and anchor scoring helpers, refactors buildAnchors for intent-aware ranking, and updates sliceCandidatesForRetrieve to pass options.
Domain-aware retrieval scoring and promotion
src/runtime/retrieve.ts
Adds retrieval-intent scoring helpers, computes domainAdjustment and runtime-generation penalties, optionally demotes source-path evidence for backend-runtime intents, integrates adjustments into seed and expanded node scoring, and refactors structural slice promotion gating.
ReportFooter component and fixture configuration
tests/fixtures/.../ReportFooter.tsx, tests/fixtures/.../tsconfig.json
Introduces ReportFooter, pickGeneratedAt, pickPipelineLabel helpers and updates fixture TS config to include platform/**/*.tsx.
Unit and integration tests for intent routing
tests/unit/retrieval-gate.test.ts, tests/unit/spi-nest-di-runtime-calls-realistic.test.ts, tests/unit/benchmark-*.test.ts
Adds tests asserting classifyRetrievalLevel yields generation_intent/target_domain_hint for runtime vs display prompts, integration tests verifying backend-runtime routing excludes frontend footer helpers for generation prompts and includes them for display prompts, and guards some benchmark tests on Windows.
Release notes and version bump
CHANGELOG.md, package.json
Adds CHANGELOG entry for 0.22.5 describing prompt routing updates and bumps package version to 0.22.5.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰 I hopped through prompts at break of day,
sniffed backend paths where generators play,
footers whisper softly in frontend light,
anchors move when intents take flight,
Hoppy routing, all tucked right.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title "Release v0.22.5" clearly and concisely summarizes the main change—a package version release bump to 0.22.5, which aligns with the changelog entry, version update in package.json, and overall PR objectives.
Description check ✅ Passed The PR description covers all key aspects: a clear Summary section explaining the three main changes, comprehensive Verification steps matching the template requirements, and Release notes. All required checklist items from the template are addressed through the Verification section and Summary.
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 broad-generation-routing

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: 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 `@src/runtime/retrieval-gate.ts`:
- Around line 207-213: The current routing requires both generationShaped and
explanationShaped to mark runtime generation, which misclassifies broad
generation prompts; change the logic in the function that returns
'runtime_generation' so that a true generationShaped alone (without requiring
explanationShaped) returns 'runtime_generation' (i.e., check generationShaped
first and return 'runtime_generation'), keep the displayShaped check afterwards
to return 'display_rendering', and fall back to 'unknown' otherwise; update
references to generationShaped, explanationShaped, and displayShaped
accordingly.
🪄 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: e1a62b9a-947a-4743-a9bf-cab35b4139fc

📥 Commits

Reviewing files that changed from the base of the PR and between e81fe04 and 6d07af7.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (10)
  • CHANGELOG.md
  • package.json
  • src/contracts/retrieval-gate.ts
  • src/runtime/retrieval-gate.ts
  • src/runtime/retrieve.ts
  • src/runtime/retrieve/slicing.ts
  • tests/fixtures/spi/nest-di-runtime-calls-realistic/platform/src/features/idea-detail/components/ReportFooter.tsx
  • tests/fixtures/spi/nest-di-runtime-calls-realistic/tsconfig.json
  • tests/unit/retrieval-gate.test.ts
  • tests/unit/spi-nest-di-runtime-calls-realistic.test.ts

Comment thread src/runtime/retrieval-gate.ts Resolved
mohanagy and others added 3 commits May 12, 2026 19:40
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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: 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/unit/spi-nest-di-runtime-calls-realistic.test.ts`:
- Around line 316-317: The test's frontend-noise exclusion uses frontendLabels =
['ReportFooter', 'pickGeneratedAt', 'pickPipelineLabel'] while the assertions
elsewhere compare labels with parentheses (e.g. 'ReportFooter()'), causing false
negatives; fix by making the formats consistent: either update frontendLabels to
include the parentheses (e.g. 'ReportFooter()', 'pickGeneratedAt()',
'pickPipelineLabel()') or normalize both sides during comparison (strip trailing
"()" from asserted labels before matching) so the checks around the frontend
helper exclusions (the assertions that currently compare with "()") correctly
detect helper nodes.
🪄 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: 3d742e30-f601-49c1-b51c-839688a3f4c9

📥 Commits

Reviewing files that changed from the base of the PR and between bf41074 and 3162a97.

📒 Files selected for processing (1)
  • tests/unit/spi-nest-di-runtime-calls-realistic.test.ts

Comment on lines +316 to +317
const frontendLabels = ['ReportFooter', 'pickGeneratedAt', 'pickPipelineLabel']

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Frontend-noise exclusion checks use mismatched label format and can miss regressions.

Line 316 defines bare names, but labels in this file are asserted with () (see Line 350). Because of this, Line 327 and Line 334 can pass even if frontend helper nodes are present.

Suggested fix
-    const frontendLabels = ['ReportFooter', 'pickGeneratedAt', 'pickPipelineLabel']
+    const frontendLabels = new Set(['ReportFooter', 'pickGeneratedAt', 'pickPipelineLabel'])
+    const normalizeLabel = (label: string) => label.replace(/\(\)$/, '')

@@
-    expect(labels.filter((label) => frontendLabels.includes(label))).toHaveLength(0)
+    expect(labels.filter((label) => frontendLabels.has(normalizeLabel(label)))).toHaveLength(0)
@@
-    expect(result.slice?.anchors.some((anchor) => frontendLabels.includes(anchor.label))).toBe(false)
+    expect(
+      result.slice?.anchors.some((anchor) => frontendLabels.has(normalizeLabel(anchor.label))),
+    ).toBe(false)

Also applies to: 327-327, 334-334

🤖 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/spi-nest-di-runtime-calls-realistic.test.ts` around lines 316 -
317, The test's frontend-noise exclusion uses frontendLabels = ['ReportFooter',
'pickGeneratedAt', 'pickPipelineLabel'] while the assertions elsewhere compare
labels with parentheses (e.g. 'ReportFooter()'), causing false negatives; fix by
making the formats consistent: either update frontendLabels to include the
parentheses (e.g. 'ReportFooter()', 'pickGeneratedAt()', 'pickPipelineLabel()')
or normalize both sides during comparison (strip trailing "()" from asserted
labels before matching) so the checks around the frontend helper exclusions (the
assertions that currently compare with "()") correctly detect helper nodes.

@mohanagy
mohanagy merged commit 2403c49 into main May 12, 2026
7 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