Skip to content

fix(davinci-client): fix collector value types and simplify node reducer imports#637

Open
ancheetah wants to merge 1 commit into
mainfrom
update-davinci-types
Open

fix(davinci-client): fix collector value types and simplify node reducer imports#637
ancheetah wants to merge 1 commit into
mainfrom
update-davinci-types

Conversation

@ancheetah
Copy link
Copy Markdown
Collaborator

@ancheetah ancheetah commented May 19, 2026

JIRA Ticket

Description

client.types.ts

  • Renamed CollectorInputTypesCollectorValueTypes.
  • Rewrote CollectorValueType<T> conditional type: grouped branches by return type (string, boolean, string[], specialized, category catch-alls), fixed DeviceAuthenticationCollector to return DeviceValue instead of string, added never for ActionCollector and NoValueCollector, and added a SingleValueAutoCollector catch-all.

node.reducer.ts / client.store.ts

  • Replaced ~30 individual collector type imports with Collectors (from node.types) and CollectorValueTypes (from client.types), collapsing verbose inline union annotations to single-type references.

updater-narrowing.types.test-d.ts

  • Deleted

API reports

  • Updated to reflect the renamed CollectorInputTypesCollectorValueTypes export.

Summary by CodeRabbit

  • Refactor

    • Centralized and simplified collector value typing into a shared union, streamlining payload typings and reducer/update flows across the client API.
  • Documentation

    • Added a changeset and updated API docs to reflect the new collector value typing and exported type adjustments.
  • Chores

    • Added .gitignore entries to exclude Polaris-related files.
  • Tests

    • Removed an internal type-narrowing test file.

Review Change Stack

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 19, 2026

🦋 Changeset detected

Latest commit: fcca96c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 12 packages
Name Type
@forgerock/davinci-client Patch
@forgerock/device-client Patch
@forgerock/journey-client Patch
@forgerock/oidc-client Patch
@forgerock/protect Patch
@forgerock/sdk-types Patch
@forgerock/sdk-utilities Patch
@forgerock/iframe-manager Patch
@forgerock/sdk-logger Patch
@forgerock/sdk-oidc Patch
@forgerock/sdk-request-middleware Patch
@forgerock/storage Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 19, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 591bd1db-3bc8-46e8-ab0f-10b80a34c0ba

📥 Commits

Reviewing files that changed from the base of the PR and between db80c05 and fcca96c.

📒 Files selected for processing (9)
  • .changeset/little-lamps-float.md
  • .gitignore
  • packages/davinci-client/api-report/davinci-client.api.md
  • packages/davinci-client/api-report/davinci-client.types.api.md
  • packages/davinci-client/src/lib/client.store.ts
  • packages/davinci-client/src/lib/client.types.test-d.ts
  • packages/davinci-client/src/lib/client.types.ts
  • packages/davinci-client/src/lib/node.reducer.ts
  • packages/davinci-client/src/lib/updater-narrowing.types.test-d.ts
💤 Files with no reviewable changes (1)
  • packages/davinci-client/src/lib/updater-narrowing.types.test-d.ts
✅ Files skipped from review due to trivial changes (2)
  • .gitignore
  • packages/davinci-client/api-report/davinci-client.types.api.md

📝 Walkthrough

Walkthrough

This PR centralizes collector value typing by adding CollectorValueTypes and rewriting CollectorValueType<T>, then updates API reports, the node reducer, client store, and tests to use the new centralized types and simplified reducer typing.

Changes

Collector Value Type System Refactoring

Layer / File(s) Summary
Core type system redefinition
packages/davinci-client/src/lib/client.types.ts
Adds exported CollectorValueTypes union and rewrites CollectorValueType<T> conditional mapping to use type/category discriminants; action/no-value collectors resolve to never, fallback to CollectorValueTypes.
API report and exported types update
packages/davinci-client/api-report/davinci-client.api.md, packages/davinci-client/api-report/davinci-client.types.api.md
Auto-generated reports: remove CollectorInputTypes, add CollectorValueTypes, update CollectorValueType<T> branches, simplify nodeCollectorReducer to Reducer<Collectors[]>, retype updateCollectorValues payload to CollectorValueTypes, and reorder several return-type unions.
Reducer state and action integration
packages/davinci-client/src/lib/node.reducer.ts
Imports CollectorValueTypes and Collectors; updateCollectorValues payload value is CollectorValueTypes; initialCollectorValues typed as Collectors[]; Device auth/registration branches validate and use local inputValue derived from the payload.
Client store API integration
packages/davinci-client/src/lib/client.store.ts
Updates collector type imports and adds CollectorValueTypes import; update updater callback value parameter now typed as CollectorValueTypes.
Tests and changeset documentation
packages/davinci-client/src/lib/client.types.test-d.ts, .changeset/little-lamps-float.md
Type tests updated to assert CollectorValueTypes usage; changeset documents the type refactor and import simplifications.
Configuration and housekeeping
.gitignore
Adds .playwright-mcp and .polaris/ to .gitignore.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • cerebrl
  • ryanbas21
  • vatsalparikh

"🐰
I nibbled through unions, one by one,
Gathered values until they shone like the sun,
Tucked phone and FIDO and options in a heap,
Now reducer and store share types neat and deep,
Hooray — a carrot for tidy types! 🥕"

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: fixing collector value types and simplifying imports in the node reducer, which aligns with the PR's primary objectives.
Description check ✅ Passed The PR description provides clear details about changes across multiple files, including type renames, conditional type rewrites, and import simplifications, though it lacks a JIRA ticket reference.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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 update-davinci-types

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.

@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud Bot commented May 19, 2026

View your CI Pipeline Execution ↗ for commit fcca96c

Command Status Duration Result
nx run-many -t build --no-agents ✅ Succeeded <1s View ↗
nx affected -t build lint test typecheck e2e-ci ✅ Succeeded 2m 51s View ↗

☁️ Nx Cloud last updated this comment at 2026-05-21 22:46:36 UTC

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

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 @.changeset/little-lamps-float.md:
- Around line 1-3: The changeset currently marks '`@forgerock/davinci-client`' as
'patch' but you renamed a public TypeScript export from CollectorInputTypes to
CollectorValueTypes which is a breaking API change; update the changeset entry
to use a breaking bump (change the release type from 'patch' to 'major' for
'`@forgerock/davinci-client`') and include a short note in the changeset text
explaining the exported type rename (mention CollectorInputTypes →
CollectorValueTypes) so release tooling and consumers are aware it's a breaking
change.

In `@packages/davinci-client/src/lib/node.reducer.ts`:
- Around line 52-55: The reducer handling the DeviceAuthenticationCollector must
handle action payloads where action.payload.value can be a DeviceValue object
instead of a string; currently DeviceAuthenticationCollector still compares
option.value (a string) directly to action.payload.value which throws when value
is an object. Update the DeviceAuthenticationCollector reducer (the branch that
processes updateCollectorValues) to normalize the incoming value: if typeof
action.payload.value === 'object' (a DeviceValue), use its id (e.g.
action.payload.value.id) to find the matching option, otherwise use the string
value; then proceed with the existing update logic. Ensure you reference
updateCollectorValues and option.value in your change so valid DeviceValue
payloads resolve by id rather than failing the direct comparison.
🪄 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

Run ID: a91301c6-6773-4427-b0aa-ef1c2ae1d581

📥 Commits

Reviewing files that changed from the base of the PR and between 9f93d5e and eaae82b.

📒 Files selected for processing (9)
  • .changeset/little-lamps-float.md
  • .gitignore
  • packages/davinci-client/api-report/davinci-client.api.md
  • packages/davinci-client/api-report/davinci-client.types.api.md
  • packages/davinci-client/src/lib/client.store.ts
  • packages/davinci-client/src/lib/client.types.test-d.ts
  • packages/davinci-client/src/lib/client.types.ts
  • packages/davinci-client/src/lib/node.reducer.ts
  • packages/davinci-client/src/lib/updater-narrowing.types.test-d.ts
💤 Files with no reviewable changes (1)
  • packages/davinci-client/src/lib/updater-narrowing.types.test-d.ts

Comment on lines +1 to +3
---
'@forgerock/davinci-client': patch
---
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot May 19, 2026

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

Use a breaking-change bump for this release.

Line 2 sets this as a patch, but this PR removes/renames a public exported type (CollectorInputTypesCollectorValueTypes). That is a compile-time breaking API change for TypeScript consumers.

Suggested changeset fix
 ---
-'`@forgerock/davinci-client`': patch
+'`@forgerock/davinci-client`': major
 ---
📝 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
---
'@forgerock/davinci-client': patch
---
---
'`@forgerock/davinci-client`': major
---
🤖 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 @.changeset/little-lamps-float.md around lines 1 - 3, The changeset currently
marks '`@forgerock/davinci-client`' as 'patch' but you renamed a public TypeScript
export from CollectorInputTypes to CollectorValueTypes which is a breaking API
change; update the changeset entry to use a breaking bump (change the release
type from 'patch' to 'major' for '`@forgerock/davinci-client`') and include a
short note in the changeset text explaining the exported type rename (mention
CollectorInputTypes → CollectorValueTypes) so release tooling and consumers are
aware it's a breaking change.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

CollectorInputTypes hasn't been released yet so this is non-breaking. The patch covers the fix for the DeviceAuthenticationCollector

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@ancheetah, that makes sense — if CollectorInputTypes was never part of a published release, renaming it carries no breaking-change risk for consumers, and a patch bump is the right level for the DeviceAuthenticationCollector fix. Thanks for the context!

Comment on lines 52 to 55
export const updateCollectorValues = createAction<{
id: string;
value:
| string
| string[]
| boolean
| PhoneNumberInputValue
| PhoneNumberExtensionInputValue
| FidoRegistrationInputValue
| FidoAuthenticationInputValue;
value: CollectorValueTypes;
index?: number;
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot May 19, 2026

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

Device-auth updater now rejects valid DeviceValue payloads.

Line 54 now allows DeviceValue, but the DeviceAuthenticationCollector reducer path still compares option.value (string) to action.payload.value directly. When update() is narrowed to DeviceValue, that comparison fails and throws “No option found matching value to update” for valid inputs.

Suggested reducer fix (accept `DeviceValue` and resolve by id)
       if (collector.type === 'DeviceAuthenticationCollector') {
-        if (typeof action.payload.id !== 'string') {
-          throw new Error('Index argument must be a string');
-        }
-        // Iterate through the options object and find option to update
-        const option = collector.output.options.find(
-          (option) => option.value === action.payload.value,
-        );
+        const selectedId =
+          typeof action.payload.value === 'string'
+            ? action.payload.value
+            : typeof action.payload.value === 'object' &&
+                action.payload.value !== null &&
+                'id' in action.payload.value &&
+                typeof action.payload.value.id === 'string'
+              ? action.payload.value.id
+              : null;
+
+        if (!selectedId) {
+          throw new Error('Value argument must be a valid device selection');
+        }
+
+        const option = collector.output.options.find((option) => option.value === selectedId);
 
         if (!option) {
           throw new Error('No option found matching value to update');
         }
 
         // Remap values back to DaVinci spec
         collector.input.value = {
           type: option.type,
           id: option.value,
           value: option.content,
         };
+        return;
       }
🤖 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/davinci-client/src/lib/node.reducer.ts` around lines 52 - 55, The
reducer handling the DeviceAuthenticationCollector must handle action payloads
where action.payload.value can be a DeviceValue object instead of a string;
currently DeviceAuthenticationCollector still compares option.value (a string)
directly to action.payload.value which throws when value is an object. Update
the DeviceAuthenticationCollector reducer (the branch that processes
updateCollectorValues) to normalize the incoming value: if typeof
action.payload.value === 'object' (a DeviceValue), use its id (e.g.
action.payload.value.id) to find the matching option, otherwise use the string
value; then proceed with the existing update logic. Ensure you reference
updateCollectorValues and option.value in your change so valid DeviceValue
payloads resolve by id rather than failing the direct comparison.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thank you, I need to investigate this further. I am not sure what the input type should be. This may be a bug.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧩 Analysis chain

Good call to investigate further — the key question is what shape the caller is expected to pass when updating a DeviceAuthenticationCollector. Let me pull up the relevant type definitions to help clarify.


🏁 Script executed:

#!/bin/bash
# Find DeviceValue type definition
rg -n "DeviceValue" --type ts -C 5

echo "---"

# Find DeviceAuthenticationCollector definition and its options shape
rg -n "DeviceAuthenticationCollector" --type ts -C 5

echo "---"

# Find the options shape for object select collectors
rg -n "returnObjectSelectCollector" --type ts -C 10

Length of output: 37404


@ancheetah — happy to help clarify what's happening here. The codebase tells a clear story:

The original contract (and existing test)

node.reducer.test.ts (line 595) passes value: '42036625-37a5-4c7a-b7c4-ef778838c8e1' — a plain string (the device UUID). The reducer then:

  1. Looks up the option whose option.value matches that string.
  2. Constructs the DeviceValue object ({ type, id, value }) from the matched option.
  3. Stores it into collector.input.value.

So the original design intent was: caller passes a string, reducer builds the DeviceValue.

What this PR changed

CollectorValueType<DeviceAuthenticationCollector> was changed from stringDeviceValue in client.types.ts. That type is now exposed through the narrowed Updater<DeviceAuthenticationCollector>, so TypeScript would tell callers to pass a DeviceValue object — but the reducer still does a string comparison (option.value === action.payload.value), which breaks at runtime when an object is passed.

The two design paths you need to choose between:

Caller passes Reducer does Type change needed
A — original intent string (device UUID) Looks it up → builds DeviceValue Revert CollectorValueType<DeviceAuthenticationCollector> back to string
B — caller-constructed DeviceValue object Stores it directly (or matches by .id) Keep DeviceValue, but update the reducer to not do a string comparison

Option A matches the existing test and the reducer's current lookup/construction logic. Option B would be a breaking change to the public update() API for this collector type.

Would you like to open a follow-up issue to track this so it doesn't get lost, or do you expect to address it in this PR?

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 19, 2026

Open in StackBlitz

@forgerock/davinci-client

pnpm add https://pkg.pr.new/@forgerock/davinci-client@637

@forgerock/device-client

pnpm add https://pkg.pr.new/@forgerock/device-client@637

@forgerock/journey-client

pnpm add https://pkg.pr.new/@forgerock/journey-client@637

@forgerock/oidc-client

pnpm add https://pkg.pr.new/@forgerock/oidc-client@637

@forgerock/protect

pnpm add https://pkg.pr.new/@forgerock/protect@637

@forgerock/sdk-types

pnpm add https://pkg.pr.new/@forgerock/sdk-types@637

@forgerock/sdk-utilities

pnpm add https://pkg.pr.new/@forgerock/sdk-utilities@637

@forgerock/iframe-manager

pnpm add https://pkg.pr.new/@forgerock/iframe-manager@637

@forgerock/sdk-logger

pnpm add https://pkg.pr.new/@forgerock/sdk-logger@637

@forgerock/sdk-oidc

pnpm add https://pkg.pr.new/@forgerock/sdk-oidc@637

@forgerock/sdk-request-middleware

pnpm add https://pkg.pr.new/@forgerock/sdk-request-middleware@637

@forgerock/storage

pnpm add https://pkg.pr.new/@forgerock/storage@637

commit: fcca96c

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 19, 2026

Codecov Report

❌ Patch coverage is 70.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 18.20%. Comparing base (eafe277) to head (fcca96c).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
packages/davinci-client/src/lib/node.reducer.ts 77.77% 2 Missing ⚠️
packages/davinci-client/src/lib/client.store.ts 0.00% 1 Missing ⚠️

❌ Your project status has failed because the head coverage (18.20%) is below the target coverage (40.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #637      +/-   ##
==========================================
+ Coverage   18.07%   18.20%   +0.12%     
==========================================
  Files         155      155              
  Lines       24398    24434      +36     
  Branches     1203     1212       +9     
==========================================
+ Hits         4410     4448      +38     
+ Misses      19988    19986       -2     
Files with missing lines Coverage Δ
packages/davinci-client/src/lib/client.types.ts 100.00% <ø> (ø)
packages/davinci-client/src/lib/client.store.ts 0.28% <0.00%> (+<0.01%) ⬆️
packages/davinci-client/src/lib/node.reducer.ts 70.94% <77.77%> (+0.45%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 19, 2026

Deployed 1a373ab to https://ForgeRock.github.io/ping-javascript-sdk/pr-637/1a373abdbff338811daa70864cc2c98ef6961b64 branch gh-pages in ForgeRock/ping-javascript-sdk

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 19, 2026

📦 Bundle Size Analysis

📦 Bundle Size Analysis

🚨 Significant Changes

🔻 @forgerock/device-client - 0.0 KB (-10.0 KB, -100.0%)
🔻 @forgerock/journey-client - 0.0 KB (-91.9 KB, -100.0%)

📊 Minor Changes

📉 @forgerock/davinci-client - 53.9 KB (-0.3 KB)

➖ No Changes

@forgerock/storage - 1.5 KB
@forgerock/sdk-request-middleware - 4.5 KB
@forgerock/iframe-manager - 2.4 KB
@forgerock/sdk-oidc - 4.8 KB
@forgerock/sdk-logger - 1.6 KB
@forgerock/sdk-types - 7.9 KB
@forgerock/protect - 144.6 KB
@forgerock/device-client - 10.0 KB
@forgerock/sdk-utilities - 11.2 KB
@forgerock/oidc-client - 25.2 KB
@forgerock/journey-client - 91.9 KB


14 packages analyzed • Baseline from latest main build

Legend

🆕 New package
🔺 Size increased
🔻 Size decreased
➖ No change

ℹ️ How bundle sizes are calculated
  • Current Size: Total gzipped size of all files in the package's dist directory
  • Baseline: Comparison against the latest build from the main branch
  • Files included: All build outputs except source maps and TypeScript build cache
  • Exclusions: .map, .tsbuildinfo, and .d.ts.map files

🔄 Updated automatically on each push to this PR

Copy link
Copy Markdown
Collaborator

@ryanbas21 ryanbas21 left a comment

Choose a reason for hiding this comment

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

My main concern here is the affect on the public api

}

// @public (undocumented)
export type CollectorInputTypes = string | string[] | boolean | PhoneNumberInputValue | PhoneNumberExtensionInputValue | FidoRegistrationInputValue | FidoAuthenticationInputValue;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

hmm, this would be a breaking change, no?

category: 'SingleValueAutoCollector';
} ? string : T extends {
category: 'MultiValueCollector';
} ? string[] : CollectorInputTypes;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

also seems to have been removed here?

}

// @public (undocumented)
export type CollectorInputTypes = string | string[] | boolean | PhoneNumberInputValue | PhoneNumberExtensionInputValue | FidoRegistrationInputValue | FidoAuthenticationInputValue;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

also removed here?


export type InitFlow = () => Promise<FlowNode | InternalErrorResponse>;

export type CollectorInputTypes =
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This could also be breaking?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is just changing the name of a type that hasn't been released yet. I think I introduced CollectorInputTypes in the single checkbox feature PR. Here I am just renaming it to CollectorValueTypes. So it's aliasing this union as a new type. Is that still considered breaking?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If it hasn't been released yet we're good.

@ancheetah ancheetah force-pushed the update-davinci-types branch from eaae82b to db80c05 Compare May 21, 2026 21:23
@ancheetah ancheetah requested a review from ryanbas21 May 21, 2026 21:24
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/davinci-client/src/lib/node.reducer.ts (1)

39-40: ⚡ Quick win

Use import type for CollectorValueTypes/Collectors in node.reducer.ts.

In packages/davinci-client/src/lib/node.reducer.ts (lines 39-40), CollectorValueTypes and Collectors are imported as runtime values but are declared/exported as type aliases (export type ...) and only used in type positions in this file. Converting them to type-only imports avoids any runtime import emission/retention in stricter TS/module setups.

💡 Proposed fix
-import { CollectorValueTypes } from './client.types.js';
-import { Collectors } from './node.types.js';
+import type { CollectorValueTypes } from './client.types.js';
+import type { Collectors } from './node.types.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/davinci-client/src/lib/node.reducer.ts` around lines 39 - 40, Change
the imports of the type-only symbols to type-only imports: replace the runtime
imports of CollectorValueTypes and Collectors with type-only imports (import
type { CollectorValueTypes } from '...'; import type { Collectors } from '...')
in node.reducer.ts so those aliases are only emitted for TypeScript
type-checking and not as runtime/ESM imports; ensure these imports remain used
only in type positions in functions/types within the file (e.g., where
CollectorValueTypes or Collectors are referenced).
🤖 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 `@packages/davinci-client/src/lib/node.reducer.ts`:
- Around line 39-40: Change the imports of the type-only symbols to type-only
imports: replace the runtime imports of CollectorValueTypes and Collectors with
type-only imports (import type { CollectorValueTypes } from '...'; import type {
Collectors } from '...') in node.reducer.ts so those aliases are only emitted
for TypeScript type-checking and not as runtime/ESM imports; ensure these
imports remain used only in type positions in functions/types within the file
(e.g., where CollectorValueTypes or Collectors are referenced).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d50e7841-0470-4f58-9d09-d8c5851b86c8

📥 Commits

Reviewing files that changed from the base of the PR and between eaae82b and db80c05.

📒 Files selected for processing (9)
  • .changeset/little-lamps-float.md
  • .gitignore
  • packages/davinci-client/api-report/davinci-client.api.md
  • packages/davinci-client/api-report/davinci-client.types.api.md
  • packages/davinci-client/src/lib/client.store.ts
  • packages/davinci-client/src/lib/client.types.test-d.ts
  • packages/davinci-client/src/lib/client.types.ts
  • packages/davinci-client/src/lib/node.reducer.ts
  • packages/davinci-client/src/lib/updater-narrowing.types.test-d.ts
💤 Files with no reviewable changes (1)
  • packages/davinci-client/src/lib/updater-narrowing.types.test-d.ts
✅ Files skipped from review due to trivial changes (1)
  • .gitignore

Comment on lines +237 to +239
const inputValue = action.payload.value;
if (typeof inputValue !== 'string') {
throw new Error('Value argument must be a string');
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I know we shouldn't throw here but adding anyways so when we rebase the reducer refactoring we don't miss this.

@ancheetah ancheetah force-pushed the update-davinci-types branch from db80c05 to fcca96c Compare May 21, 2026 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants