Skip to content

feat: include finished group results on early exit#1025

Open
dan-dr wants to merge 1 commit into
Viren070:mainfrom
dan-dr:include-finished-group-results
Open

feat: include finished group results on early exit#1025
dan-dr wants to merge 1 commit into
Viren070:mainfrom
dan-dr:include-finished-group-results

Conversation

@dan-dr

@dan-dr dan-dr commented Jun 18, 2026

Copy link
Copy Markdown

Summary

  • add a parallel group option to include already-finished group queries when an early-exit condition fails
  • persist/validate the new group setting and expose it in the addon fetching UI
  • document the parallel finished-results behavior
  • convert a few StreamContext/ExpressionContext imports to type-only imports while reviewing testability

Suggested follow-up tests

  • Core: add a focused parallel-groups test with three mocked addon timings to assert default early exit excludes settled fallback results and the new flag includes only already-settled results.
  • Frontend: add a small component test for the switch only if/when the frontend has an existing React component test harness; currently typecheck/build coverage is the lightweight fit.

Verification

  • pnpm -F core run build
  • pnpm -F frontend typecheck
  • pnpm -F frontend run build
  • git diff --check

Note: commands ran under Node v22.21.0, so pnpm printed the repo's Node >=24 engine warning.

Summary by CodeRabbit

Release Notes

New Features

  • Added "Always add results from finished queries" option for parallel group fetching. When enabled, results from completed queries are included in the output even if a group condition fails partway through execution, rather than discarding pending results entirely.

Documentation

  • Updated group fetching documentation to clarify behaviour when group conditions evaluate to false and explain the impact of the new finished results option.

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Adds an includeFinishedResultsOnEarlyExit optional boolean to UserData.groups, with migration defaults in both core and frontend contexts. The parallel group fetcher is refactored to read this flag and, when enabled, race settled group promises on early exit rather than discarding them. A frontend toggle exposes the option for parallel behaviour mode, and the groups documentation is expanded accordingly. Several unrelated import type conversions are also included.

Changes

includeFinishedResultsOnEarlyExit for Parallel Groups

Layer / File(s) Summary
Schema field and migration defaults
packages/core/src/db/schemas.ts, packages/core/src/utils/config.ts, packages/frontend/src/context/userData.tsx
UserDataSchema gains includeFinishedResultsOnEarlyExit?: boolean on the groups object; both core and frontend applyMigrations set it to false when converting legacy array-form groups config.
Parallel fetcher logic
packages/core/src/streams/fetcher.ts
Reads includeFinishedResultsOnEarlyExit from userData.groups. Introduces a mergeGroupResult helper and mergedGroups deduplication set. On a failed group condition, optionally races remaining group promises and merges any already-settled results rather than breaking early. StreamContext moved to type-only import.
Frontend toggle
packages/frontend/src/components/menu/addons/_components/addon-fetching-behavior.tsx
Adds a Switch component rendered only when behaviour === 'parallel', bound to userData.groups?.includeFinishedResultsOnEarlyExit and updated via setUserData.
Documentation
packages/docs/content/docs/guides/groups.mdx
Expands "How It Works" and "Parallel option: finished results" sections with explicit bullet points describing condition evaluation order, early-exit stopping behaviour, inclusion of already-finished groups, and non-waiting for pending groups.
Type-only import cleanups
packages/core/src/parser/streamExpression.ts, packages/core/src/streams/filterer.ts, packages/core/src/streams/precomputer.ts
Converts ExpressionContext, ExtendedMetadata/StreamContext, and StreamContext imports to import type across three modules to remove runtime import side-effects.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • Viren070

Poem

🐇 Hoppity-hop through the parallel lanes,
When one group falters, no result is slain —
The finished ones join with a Promise.race twist,
includeFinishedResultsOnEarlyExit — none missed!
A toggle, a schema, a doc newly bright,
The rabbit declares: early exit done 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main feature being introduced: enabling inclusion of finished group results when early exit occurs in parallel groups.
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

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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
`@packages/frontend/src/components/menu/addons/_components/addon-fetching-behavior.tsx`:
- Line 8: The relative import statement for Switch on line 8 is missing the
required `.js` extension per the repository's NodeNext import resolution rules.
Update the import path from '../../../ui/switch' to
'../../../ui/switch/index.js' to explicitly specify the full path to the module
entry point, since the switch directory contains an index.tsx that re-exports
the Switch component.
🪄 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: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: e92282a9-4d28-4cd5-b08d-1edeb3aff2da

📥 Commits

Reviewing files that changed from the base of the PR and between 5d1ae75 and cbebe76.

📒 Files selected for processing (9)
  • packages/core/src/db/schemas.ts
  • packages/core/src/parser/streamExpression.ts
  • packages/core/src/streams/fetcher.ts
  • packages/core/src/streams/filterer.ts
  • packages/core/src/streams/precomputer.ts
  • packages/core/src/utils/config.ts
  • packages/docs/content/docs/guides/groups.mdx
  • packages/frontend/src/components/menu/addons/_components/addon-fetching-behavior.tsx
  • packages/frontend/src/context/userData.tsx

import { TextInput } from '../../../ui/text-input';
import { Combobox } from '../../../ui/combobox';
import { IconButton } from '../../../ui/button';
import { Switch } from '../../../ui/switch';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify the concrete target file so the final import path uses the correct .js entry.
fd -i 'switch\.(ts|tsx|js|jsx)$' packages/frontend/src/components/ui
fd -i 'index\.(ts|tsx|js|jsx)$' packages/frontend/src/components/ui/switch

Repository: Viren070/AIOStreams

Length of output: 234


🏁 Script executed:

cat packages/frontend/src/components/ui/switch/index.tsx

Repository: Viren070/AIOStreams

Length of output: 89


Use the correct path with .js extension for the relative import.

Line 8 adds a relative import without an explicit .js extension, which violates the repository's NodeNext import rule for package-internal relative paths. Since the switch directory contains an index.tsx that re-exports from switch.tsx, the import should resolve to the index file.

Suggested patch
-import { Switch } from '../../../ui/switch';
+import { Switch } from '../../../ui/switch/index.js';

Per the coding guidelines, relative imports inside a package must include the .js extension (TypeScript NodeNext resolution), specifying the full path to the module entry point.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { Switch } from '../../../ui/switch';
import { Switch } from '../../../ui/switch/index.js';
🤖 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
`@packages/frontend/src/components/menu/addons/_components/addon-fetching-behavior.tsx`
at line 8, The relative import statement for Switch on line 8 is missing the
required `.js` extension per the repository's NodeNext import resolution rules.
Update the import path from '../../../ui/switch' to
'../../../ui/switch/index.js' to explicitly specify the full path to the module
entry point, since the switch directory contains an index.tsx that re-exports
the Switch component.

Source: Coding guidelines

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