Skip to content

fix(journey-client): align config with DaVinci and OIDC clients#557

Open
ryanbas21 wants to merge 1 commit intomainfrom
fix-jc-missing-properties
Open

fix(journey-client): align config with DaVinci and OIDC clients#557
ryanbas21 wants to merge 1 commit intomainfrom
fix-jc-missing-properties

Conversation

@ryanbas21
Copy link
Collaborator

@ryanbas21 ryanbas21 commented Mar 24, 2026

Summary

  • Extend JourneyClientConfig from AsyncLegacyConfigOptions so the same config object can be shared across journey-client, davinci-client, and oidc-client
  • Properties like clientId, scope, and redirectUri are now accepted but ignored — a warning is logged when they are provided
  • serverConfig.wellknown remains required

Test plan

  • Type tests verify JourneyClientConfig extends AsyncLegacyConfigOptions
  • Type tests verify serverConfig.wellknown is required (negative @ts-expect-error test)
  • Unit test verifies warning is logged when ignored properties are provided (multiple and single)
  • Unit test verifies no warning for minimal config
  • All 193 existing + new tests pass
  • Lint passes (0 errors)
  • Build passes (typecheck clean)

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features

    • Journey client configuration can now be shared across multiple ForgeRock clients
    • Added optional timeout property for configuring request timeouts
    • Warning messages alert users when unsupported config properties are provided
  • Documentation

    • Clarified that serverConfig.wellknown is required

…gOptions

Allow the same config object to be shared across journey-client,
davinci-client, and oidc-client. Properties like clientId, scope,
and redirectUri are accepted but not used — a warning is logged
when they are provided.
@changeset-bot
Copy link

changeset-bot bot commented Mar 24, 2026

🦋 Changeset detected

Latest commit: d78e883

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

This PR includes changesets to release 12 packages
Name Type
@forgerock/journey-client Patch
@forgerock/davinci-client Patch
@forgerock/device-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

coderabbitai bot commented Mar 24, 2026

📝 Walkthrough

Walkthrough

This change aligns JourneyClientConfig with AsyncLegacyConfigOptions to support a shared config object across multiple ForgeRock clients. The implementation adds runtime validation that logs warnings when ignored properties are provided, alongside comprehensive type-level tests to ensure config structure correctness.

Changes

Cohort / File(s) Summary
Changelog
.changeset/journey-client-config-alignment.md
New Changesets entry documenting patch release for journey-client with config alignment and runtime warnings for ignored properties.
Type Definitions
packages/journey-client/src/lib/config.types.ts, packages/journey-client/src/lib/config.types.test-d.ts
Extended JourneyClientConfig to inherit AsyncLegacyConfigOptions; added optional timeout field to JourneyServerConfig. New type-level test assertions validate config structure, required fields, and inherited property behavior.
Runtime Implementation
packages/journey-client/src/lib/client.store.ts, packages/journey-client/src/lib/client.store.test.ts
Added validation logic in journey() to detect and warn about ignored config properties (clientId, scope, redirectUri). New test suite verifies warning behavior for various config combinations and confirms no warning when only required properties are provided.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • cerebrl
  • ancheetah

Poem

🐰 A config so unified, across the clients wide,
Shared properties now ride, with warnings as our guide,
Types declared with care, each assertion fresh and fair,
What once was scattered there, now gathers everywhere! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: aligning journey-client configuration with DaVinci and OIDC clients by extending AsyncLegacyConfigOptions.
Description check ✅ Passed The description is well-structured with a clear summary, detailed explanation of changes, and comprehensive test plan. However, it does not include a JIRA ticket reference as specified in the template.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ 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 fix-jc-missing-properties

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
Contributor

nx-cloud bot commented Mar 24, 2026

View your CI Pipeline Execution ↗ for commit d78e883

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

☁️ Nx Cloud last updated this comment at 2026-03-24 18:55:21 UTC

Copy link

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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/journey-client/src/lib/client.store.ts`:
- Around line 89-110: The code currently warns only for top-level ignored keys
via ignoredProperties/providedIgnored, so serverConfig.timeout is silently
ignored; update the check to detect nested serverConfig.timeout (e.g., inspect
config.serverConfig?.timeout) and include it in the warning (or add 'timeout' to
ignoredProperties when appropriate) so that the log.warn call reports when
timeout is provided but not used by journey-client; reference the existing
identifiers ignoredProperties, providedIgnored, config and the
wellknown/serverConfig usage to locate where to add the nested check and include
the key in the joined warning string.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 67c4f0be-178a-450f-92f1-0c7cf246840d

📥 Commits

Reviewing files that changed from the base of the PR and between e09904f and d78e883.

📒 Files selected for processing (5)
  • .changeset/journey-client-config-alignment.md
  • packages/journey-client/src/lib/client.store.test.ts
  • packages/journey-client/src/lib/client.store.ts
  • packages/journey-client/src/lib/config.types.test-d.ts
  • packages/journey-client/src/lib/config.types.ts

Comment on lines +89 to +110
const ignoredProperties = [
'callbackFactory',
'clientId',
'middleware',
'oauthThreshold',
'platformHeader',
'prefix',
'realmPath',
'redirectUri',
'scope',
'tokenStore',
'tree',
'type',
] as const;

const providedIgnored = ignoredProperties.filter((prop) => config[prop] !== undefined);

if (providedIgnored.length > 0) {
log.warn(
`The following configuration properties are not used by journey-client and will be ignored: ${providedIgnored.join(', ')}`,
);
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

serverConfig.timeout is silently ignored without a warning.

JourneyServerConfig now accepts timeout, but this warning path only checks top-level keys. Since only wellknown is read later, timeout is effectively ignored with no signal to callers.

🔧 Proposed fix
   const ignoredProperties = [
     'callbackFactory',
     'clientId',
     'middleware',
     'oauthThreshold',
     'platformHeader',
     'prefix',
     'realmPath',
     'redirectUri',
     'scope',
     'tokenStore',
     'tree',
     'type',
   ] as const;
 
-  const providedIgnored = ignoredProperties.filter((prop) => config[prop] !== undefined);
+  const providedIgnored = ignoredProperties.filter(
+    (prop) => Object.prototype.hasOwnProperty.call(config, prop) && config[prop] !== undefined,
+  );
+
+  if (config.serverConfig?.timeout !== undefined) {
+    providedIgnored.push('serverConfig.timeout' as (typeof ignoredProperties)[number]);
+  }
 
   if (providedIgnored.length > 0) {
     log.warn(
       `The following configuration properties are not used by journey-client and will be ignored: ${providedIgnored.join(', ')}`,
     );
   }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/journey-client/src/lib/client.store.ts` around lines 89 - 110, The
code currently warns only for top-level ignored keys via
ignoredProperties/providedIgnored, so serverConfig.timeout is silently ignored;
update the check to detect nested serverConfig.timeout (e.g., inspect
config.serverConfig?.timeout) and include it in the warning (or add 'timeout' to
ignoredProperties when appropriate) so that the log.warn call reports when
timeout is provided but not used by journey-client; reference the existing
identifiers ignoredProperties, providedIgnored, config and the
wellknown/serverConfig usage to locate where to add the nested check and include
the key in the joined warning string.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 24, 2026

Open in StackBlitz

@forgerock/davinci-client

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/davinci-client@557

@forgerock/device-client

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/device-client@557

@forgerock/journey-client

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/journey-client@557

@forgerock/oidc-client

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/oidc-client@557

@forgerock/protect

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/protect@557

@forgerock/sdk-types

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/sdk-types@557

@forgerock/sdk-utilities

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/sdk-utilities@557

@forgerock/iframe-manager

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/iframe-manager@557

@forgerock/sdk-logger

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/sdk-logger@557

@forgerock/sdk-oidc

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/sdk-oidc@557

@forgerock/sdk-request-middleware

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/sdk-request-middleware@557

@forgerock/storage

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/storage@557

commit: d78e883

@github-actions
Copy link
Contributor

Deployed fa4a263 to https://ForgeRock.github.io/ping-javascript-sdk/pr-557/fa4a263c34ee6242fc9edcc0765a404a62f6445a branch gh-pages in ForgeRock/ping-javascript-sdk

@github-actions
Copy link
Contributor

📦 Bundle Size Analysis

📦 Bundle Size Analysis

🆕 New Packages

🆕 @forgerock/journey-client - 89.1 KB (new)
🆕 @forgerock/journey-client - 0.0 KB (new)

➖ No Changes

@forgerock/sdk-logger - 1.6 KB
@forgerock/sdk-request-middleware - 4.5 KB
@forgerock/iframe-manager - 2.4 KB
@forgerock/sdk-oidc - 4.8 KB
@forgerock/storage - 1.5 KB
@forgerock/sdk-types - 7.9 KB
@forgerock/protect - 150.1 KB
@forgerock/device-client - 9.2 KB
@forgerock/davinci-client - 41.3 KB
@forgerock/sdk-utilities - 11.2 KB
@forgerock/oidc-client - 24.9 KB


13 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

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 14.83%. Comparing base (5d6747a) to head (d78e883).
⚠️ Report is 10 commits behind head on main.

❌ Your project status has failed because the head coverage (14.83%) 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     #557       +/-   ##
===========================================
- Coverage   70.90%   14.83%   -56.08%     
===========================================
  Files          53      153      +100     
  Lines        2021    26282    +24261     
  Branches      377     1057      +680     
===========================================
+ Hits         1433     3899     +2466     
- Misses        588    22383    +21795     
Files with missing lines Coverage Δ
packages/journey-client/src/lib/client.store.ts 80.45% <100.00%> (+7.08%) ⬆️
packages/journey-client/src/lib/config.types.ts 100.00% <ø> (ø)

... and 100 files with indirect coverage changes

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

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