Skip to content

feat(davinci-client): add BooleanCollector and refactor ReadOnlyCollector/AgreementCollector#697

Open
ancheetah wants to merge 1 commit into
mainfrom
SDKS-5174-update-collectors
Open

feat(davinci-client): add BooleanCollector and refactor ReadOnlyCollector/AgreementCollector#697
ancheetah wants to merge 1 commit into
mainfrom
SDKS-5174-update-collectors

Conversation

@ancheetah

@ancheetah ancheetah commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

JIRA Ticket

https://pingidentity.atlassian.net/browse/SDKS-5174

Description

What

Adds a BooleanCollector for non-required SINGLE_CHECKBOX fields, removing the need to use ValidatedBooleanCollector when no validation is needed. Also consolidates AgreementCollector into ReadOnlyCollector by adding an optional title field, eliminating a redundant collector type.

Why

SINGLE_CHECKBOX fields without required: true were incorrectly mapped to ValidatedBooleanCollector, implying validation constraints that don't exist. Separately, AgreementCollector was a one-off type with bespoke output shape that duplicated ReadOnlyCollector's responsibility — agreement content is read-only display text with an optional title.

Changes

  • New BooleanCollector typeSINGLE_CHECKBOX fields with required: false now produce a BooleanCollector instead of ValidatedBooleanCollector; the node reducer branches on required to pick the correct collector
  • AgreementCollector removedAGREEMENT fields are now handled by returnReadOnlyCollector, which conditionally sets title when titleEnabled is true; ReadOnlyCollector gains an optional title?: string output property
  • returnAgreementCollector deleted — its logic folded into returnReadOnlyCollector; AGREEMENT field type added to the LABEL branch in node.reducer.ts
  • New ValidatedCollectors union type — extracted from the inline Validator<T> default, now used as a proper constraint (T extends ValidatedCollectors)
  • E2E appagreement.ts and label.ts components deleted; replaced by a unified read-only.ts that handles ReadOnlyCollector (with optional title) and RichTextCollector; main.ts updated to route both BooleanCollector and ValidatedBooleanCollector through the same boolean component
  • API reports updated to reflect all type additions and removals
  • Tests — added returnBooleanCollector unit tests, updated agreement collector tests to assert ReadOnlyCollector output, added a full BooleanCollector describe block in node.reducer.test.ts, and fixed ValidatedBooleanCollector test fixtures to use required: true

Summary by CodeRabbit

Release Notes

  • New Features

    • Added support for unvalidated boolean collectors alongside validated variants.
    • Read-only collectors now support optional titles.
  • Refactor

    • Agreement field handling consolidated into read-only collector pattern, simplifying collector type system.

@changeset-bot

changeset-bot Bot commented Jun 18, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: f802fd8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

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

Click here to learn what changesets are, and how to add one.

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

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@ancheetah, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 39 minutes and 8 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 15444468-1b86-482d-99e1-0db997f4e8d9

📥 Commits

Reviewing files that changed from the base of the PR and between 0329782 and f802fd8.

📒 Files selected for processing (18)
  • .changeset/silent-ideas-joke.md
  • .changeset/single-checkbox.md
  • e2e/davinci-app/components/agreement.ts
  • e2e/davinci-app/components/boolean.ts
  • e2e/davinci-app/components/label.ts
  • e2e/davinci-app/components/read-only.ts
  • e2e/davinci-app/main.ts
  • 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.types.ts
  • packages/davinci-client/src/lib/collector.types.test-d.ts
  • packages/davinci-client/src/lib/collector.types.ts
  • packages/davinci-client/src/lib/collector.utils.test.ts
  • packages/davinci-client/src/lib/collector.utils.ts
  • packages/davinci-client/src/lib/node.reducer.test.ts
  • packages/davinci-client/src/lib/node.reducer.ts
  • packages/davinci-client/src/lib/node.types.test-d.ts
  • packages/davinci-client/src/lib/node.types.ts
📝 Walkthrough

Walkthrough

AgreementCollector is removed from the collector type system and replaced by extending ReadOnlyCollector with an optional title field. A new BooleanCollector is added for non-required SINGLE_CHECKBOX fields, while ValidatedBooleanCollector is retained for required ones. The node reducer, factory utilities, e2e rendering components, type-level tests, and generated API reports are all updated to reflect these changes.

Changes

Collector type system and e2e rendering refactor

Layer / File(s) Summary
Collector type contracts
packages/davinci-client/src/lib/collector.types.ts, packages/davinci-client/src/lib/client.types.ts
Removes AgreementCollector interface and its NoValueCollectorTypes/union entries; adds BooleanCollector interface to SingleValueCollectorTypes and SingleValueCollectors; adds optional title to ReadOnlyCollector.output; introduces ValidatedCollectors alias; updates Validator generic default and broadens CollectorValueType boolean branch to include BooleanCollector.
Collectors union
packages/davinci-client/src/lib/node.types.ts, packages/davinci-client/src/lib/node.types.test-d.ts
Updates exported Collectors union to include BooleanCollector and remove AgreementCollector; updates corresponding type-level test assertions.
Collector factories
packages/davinci-client/src/lib/collector.utils.ts
Adds returnBooleanCollector factory (delegating to returnSingleValueCollector with appearance and normalized richContent); extends returnReadOnlyCollector to accept AgreementField and conditionally output title; removes standalone returnAgreementCollector.
Node reducer routing
packages/davinci-client/src/lib/node.reducer.ts
Routes LABEL and AGREEMENT fields to returnReadOnlyCollector; selects returnBooleanCollector vs returnValidatedBooleanCollector for SINGLE_CHECKBOX based on field.required; broadens node/update boolean assignment to cover both collector variants.
Tests
packages/davinci-client/src/lib/collector.types.test-d.ts, packages/davinci-client/src/lib/collector.utils.test.ts, packages/davinci-client/src/lib/node.reducer.test.ts
Replaces AgreementCollector type tests with ReadOnlyCollector assertions for AGREEMENT; adds returnBooleanCollector test suite covering structure, appearance, and richContent normalization; adds BooleanCollector reducer describe block; updates ValidatedBooleanCollector fixtures to required: true with expected validation rule.
Generated API reports
packages/davinci-client/api-report/davinci-client.api.md, packages/davinci-client/api-report/davinci-client.types.api.md
Reflects all public surface changes: removes AgreementCollector, adds BooleanCollector, updates Collectors/CollectorValueType/NoValueCollectors/SingleValueCollectorTypes/ValidatedCollectors/Validator, adds title to ReadOnlyCollector, and adjusts RTK Query cache error field typing.
E2e rendering
e2e/davinci-app/components/read-only.ts, e2e/davinci-app/components/boolean.ts, e2e/davinci-app/main.ts
Removes label.ts and agreement.ts; introduces read-only.ts rendering ReadOnlyCollector (with optional <h3> title) and RichTextCollector; widens booleanComponent to handle BooleanCollector with an early-return path bypassing validation; wires both boolean types in a single renderForm branch.
Changeset notes
.changeset/silent-ideas-joke.md, .changeset/single-checkbox.md
Updates descriptions to reference ReadOnlyCollector with title for agreements and BooleanCollector for non-validated single checkboxes.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • ForgeRock/ping-javascript-sdk#579: This PR directly supersedes and replaces the AgreementCollector/returnAgreementCollector additions from that PR, consolidating agreement handling into ReadOnlyCollector with an added title field.
  • ForgeRock/ping-javascript-sdk#629: This PR builds on that PR's ValidatedBooleanCollector work by splitting SINGLE_CHECKBOX handling into BooleanCollector (non-required) vs ValidatedBooleanCollector (required) and widening the e2e booleanComponent accordingly.
  • ForgeRock/ping-javascript-sdk#568: This PR removes the label.ts component that the retrieved PR introduced/modified for ReadOnlyCollector rich-text rendering, replacing it with the new unified read-only.ts.

Suggested reviewers

  • cerebrl
  • ryanbas21
  • vatsalparikh

Poem

🐇 Hop hop, the agreement's reborn,
No AgreementCollector left to mourn!
A BooleanCollector joins the pack,
ReadOnlyCollector picks up the slack—
With a title field tucked in its output today,
The rabbit refactored the old types away! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: adding a BooleanCollector and refactoring ReadOnlyCollector/AgreementCollector, which are the core transformations in this PR.
Description check ✅ Passed The description comprehensively covers the objectives, changes, and rationale. It follows the repository template with JIRA ticket and detailed description sections, though 'changeset' mention is implicit in file changes rather than explicit.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch SDKS-5174-update-collectors

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

nx-cloud Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit 0329782

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 52s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-06-18 21:56:53 UTC

@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

🧹 Nitpick comments (1)
packages/davinci-client/src/lib/collector.utils.ts (1)

617-625: 💤 Low value

Minor JSDoc inaccuracy: SingleCheckboxField does not have a validation property.

The comment mentions "validation" as one of the field properties, but SingleCheckboxField only contains required, errorMessage, appearance, and richContent for validation-adjacent concerns.

📝 Suggested doc fix
 /**
  * `@function` returnBooleanCollector - Creates a BooleanCollector (no validation).
- * `@param` {SingleCheckboxField} field - The field object containing key, label, type, required, and validation.
+ * `@param` {SingleCheckboxField} field - The field object containing key, label, type, required, appearance, and optional richContent.
  * `@param` {number} idx - The index to be used in the id of the BooleanCollector.
  * `@returns` {BooleanCollector} The constructed BooleanCollector object.
  */
🤖 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/collector.utils.ts` around lines 617 - 625,
The JSDoc comment for the returnBooleanCollector function incorrectly lists
"validation" as a property of SingleCheckboxField. Update the `@param` description
for the field parameter to remove the mention of "validation" and instead
accurately list the actual properties that SingleCheckboxField contains:
required, errorMessage, appearance, and richContent. This ensures the
documentation matches the actual type definition.
🤖 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 `@e2e/davinci-app/main.ts`:
- Around line 292-297: The booleanComponent function call at lines 292-297
unconditionally passes davinciClient.validate(collector), but should follow the
PasswordCollector pattern shown at lines 249-251. Add a conditional check to
only call davinciClient.validate(collector) when collector.type equals
'ValidatedBooleanCollector', otherwise pass undefined. This ensures validate()
is only invoked for collectors in validated categories, preventing errors from
calling validate() on a standard BooleanCollector which is not supported by the
validation API.

---

Nitpick comments:
In `@packages/davinci-client/src/lib/collector.utils.ts`:
- Around line 617-625: The JSDoc comment for the returnBooleanCollector function
incorrectly lists "validation" as a property of SingleCheckboxField. Update the
`@param` description for the field parameter to remove the mention of "validation"
and instead accurately list the actual properties that SingleCheckboxField
contains: required, errorMessage, appearance, and richContent. This ensures the
documentation matches the actual type definition.
🪄 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: 856b6b4d-4202-41ed-a52c-0a93e2e5c47c

📥 Commits

Reviewing files that changed from the base of the PR and between 35816b4 and 0329782.

📒 Files selected for processing (18)
  • .changeset/silent-ideas-joke.md
  • .changeset/single-checkbox.md
  • e2e/davinci-app/components/agreement.ts
  • e2e/davinci-app/components/boolean.ts
  • e2e/davinci-app/components/label.ts
  • e2e/davinci-app/components/read-only.ts
  • e2e/davinci-app/main.ts
  • 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.types.ts
  • packages/davinci-client/src/lib/collector.types.test-d.ts
  • packages/davinci-client/src/lib/collector.types.ts
  • packages/davinci-client/src/lib/collector.utils.test.ts
  • packages/davinci-client/src/lib/collector.utils.ts
  • packages/davinci-client/src/lib/node.reducer.test.ts
  • packages/davinci-client/src/lib/node.reducer.ts
  • packages/davinci-client/src/lib/node.types.test-d.ts
  • packages/davinci-client/src/lib/node.types.ts
💤 Files with no reviewable changes (2)
  • e2e/davinci-app/components/agreement.ts
  • e2e/davinci-app/components/label.ts

Comment thread e2e/davinci-app/main.ts
@pkg-pr-new

pkg-pr-new Bot commented Jun 18, 2026

Copy link
Copy Markdown

Open in StackBlitz

@forgerock/davinci-client

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

@forgerock/device-client

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

@forgerock/journey-client

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

@forgerock/oidc-client

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

@forgerock/protect

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

@forgerock/sdk-types

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

@forgerock/sdk-utilities

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

@forgerock/iframe-manager

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

@forgerock/sdk-logger

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

@forgerock/sdk-oidc

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

@forgerock/sdk-request-middleware

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

@forgerock/storage

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

commit: f802fd8

@codecov-commenter

codecov-commenter commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 22.03%. Comparing base (eafe277) to head (f802fd8).
⚠️ Report is 32 commits behind head on main.

❌ Your project status has failed because the head coverage (22.03%) 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     #697      +/-   ##
==========================================
+ Coverage   18.07%   22.03%   +3.95%     
==========================================
  Files         155      157       +2     
  Lines       24398    25206     +808     
  Branches     1203     1479     +276     
==========================================
+ Hits         4410     5554    +1144     
+ Misses      19988    19652     -336     
Files with missing lines Coverage Δ
packages/davinci-client/src/lib/client.types.ts 100.00% <ø> (ø)
packages/davinci-client/src/lib/collector.types.ts 100.00% <ø> (ø)
packages/davinci-client/src/lib/collector.utils.ts 86.38% <100.00%> (+1.22%) ⬆️
packages/davinci-client/src/lib/node.reducer.ts 72.03% <100.00%> (+1.54%) ⬆️
packages/davinci-client/src/lib/node.types.ts 100.00% <ø> (ø)

... and 15 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Deployed da67c92 to https://ForgeRock.github.io/ping-javascript-sdk/pr-697/da67c92fc39236205e4ae356b46eb003a87dbf6a branch gh-pages in ForgeRock/ping-javascript-sdk

@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

📦 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 (-93.0 KB, -100.0%)

📊 Minor Changes

📉 @forgerock/davinci-client - 53.8 KB (-0.0 KB)
📉 @forgerock/device-client - 10.0 KB (-0.0 KB)

➖ No Changes

@forgerock/oidc-client - 35.2 KB
@forgerock/sdk-types - 7.9 KB
@forgerock/sdk-utilities - 11.9 KB
@forgerock/journey-client - 93.0 KB
@forgerock/protect - 144.6 KB
@forgerock/iframe-manager - 3.2 KB
@forgerock/sdk-logger - 1.6 KB
@forgerock/storage - 1.5 KB
@forgerock/sdk-request-middleware - 4.6 KB
@forgerock/sdk-oidc - 5.7 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

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.

2 participants