feat(davinci-client): send FIDO errors to DaVinci#728
Conversation
🦋 Changeset detectedLatest commit: 5165254 The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 packages
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 |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
View your CI Pipeline Execution ↗ for commit 5165254
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
@forgerock/davinci-client
@forgerock/device-client
@forgerock/journey-client
@forgerock/oidc-client
@forgerock/protect
@forgerock/sdk-types
@forgerock/sdk-utilities
@forgerock/iframe-manager
@forgerock/sdk-logger
@forgerock/sdk-oidc
@forgerock/sdk-request-middleware
@forgerock/storage
commit: |
Codecov Report❌ Patch coverage is ❌ Your project status has failed because the head coverage (23.73%) 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 @@
## SDKS-5100-metadata-collector #728 +/- ##
================================================================
+ Coverage 23.26% 23.73% +0.47%
================================================================
Files 161 162 +1
Lines 25667 25718 +51
Branches 1626 1661 +35
================================================================
+ Hits 5971 6104 +133
+ Misses 19696 19614 -82
🚀 New features to boost your workflow:
|
|
Deployed cbc6c62 to https://ForgeRock.github.io/ping-javascript-sdk/pr-728/cbc6c624f4639f45580dbe657cceeec5aac73016 branch gh-pages in ForgeRock/ping-javascript-sdk |
📦 Bundle Size Analysis📦 Bundle Size Analysis🚨 Significant Changes🔺 @forgerock/davinci-client - 56.9 KB (+2.5 KB, +4.5%) 🆕 New Packages🆕 @forgerock/journey-client - 92.6 KB (new) ➖ No Changes➖ @forgerock/sdk-types - 9.1 KB 14 packages analyzed • Baseline from latest Legend🆕 New package ℹ️ How bundle sizes are calculated
🔄 Updated automatically on each push to this PR |
8693a1d to
a2cae19
Compare
cerebrl
left a comment
There was a problem hiding this comment.
It seems this PR is based on the Metadata PR. If I look at just the FIDO related commit, it looks good. But, this also contains the other unrelated changes for Metadata, so I'm hesitate to approve as this may be a mistake.
|
Edit: I just saw in the description that wiring up the flow is in TODO. I'll do another review when that's done. |
|
Sorry about that everyone, I am about to push up the part where we send the payload to DaVinci. Looks like my rebase got messed up because metadata shouldn't be in here. Let me fix and let you know when it's ready again. |
79ba07f to
acd6de3
Compare
There was a problem hiding this comment.
Important
At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.
Nx Cloud is proposing a fix for your failed CI:
We restored the collector-based formData building in transformActionRequest that was inadvertently removed by the FIDO error PR. Without it, the MetadataCollector's value was never sent to the server, so DaVinci had no payload to echo back — causing both metadata e2e assertions ("status":"succeeded" and "code":"ERROR_CODE") to fail. This fix re-aligns transformActionRequest with transformSubmitRequest's collector filtering, ensuring metadata values are included in action submissions while leaving the new FIDO error actionKey routing intact.
Tip
✅ We verified this fix by re-running @forgerock/davinci-suites:e2e-ci--src/metadata.test.ts.
Suggested Fix changes
diff --git a/packages/davinci-client/src/lib/davinci.utils.ts b/packages/davinci-client/src/lib/davinci.utils.ts
index b637234..db14770 100644
--- a/packages/davinci-client/src/lib/davinci.utils.ts
+++ b/packages/davinci-client/src/lib/davinci.utils.ts
@@ -88,7 +88,26 @@ export function transformActionRequest(
action: string,
logger: ReturnType<typeof loggerFn>,
): DaVinciRequest {
+ // Filter out ActionCollectors as they do not collect values
+ const collectors = node.client?.collectors?.filter(
+ (collector) =>
+ collector.category === 'MultiValueCollector' ||
+ collector.category === 'SingleValueCollector' ||
+ collector.category === 'ValidatedSingleValueCollector' ||
+ collector.category === 'ObjectValueCollector' ||
+ collector.category === 'SingleValueAutoCollector' ||
+ collector.category === 'ObjectValueAutoCollector',
+ );
+
+ const formData = collectors?.reduce<{
+ [key: string]: DaVinciRequestValueTypes | Record<string, unknown>;
+ }>((acc, collector) => {
+ acc[collector.input.key] = collector.input.value;
+ return acc;
+ }, {});
+
logger.debug('Transforming action request', { node, action });
+
return {
id: node.server.id || '',
eventName: node.server.eventName || '',
@@ -97,7 +116,7 @@ export function transformActionRequest(
eventType: 'action',
data: {
actionKey: action || node.client?.action || '',
- formData: {},
+ ...(Object.keys(formData ?? {}).length && { formData: formData }),
},
},
};
Or Apply changes locally with:
npx nx-cloud apply-locally Q90f-8hXj
Apply fix locally with your editor ↗ View interactive diff ↗
🎓 Learn more about Self-Healing CI on nx.dev
acd6de3 to
5165254
Compare
JIRA Ticket
https://pingidentity.atlassian.net/browse/SDKS-4480
Description
Most of this was taken from #503.
TODO: wire up flow for FIDO errors and write e2e tests
Note: This also fixes a false positive from password validation test and corrects some wiring in the registration node in the flow.