Skip to content

IS-11495 Resolve WebAuthn attachment copy in the element component#261

Merged
aleixsuau merged 4 commits into
devfrom
fix/dev/IS-11495-webauthn-attachment-typing
Jul 21, 2026
Merged

IS-11495 Resolve WebAuthn attachment copy in the element component#261
aleixsuau merged 4 commits into
devfrom
fix/dev/IS-11495-webauthn-attachment-typing

Conversation

@aleixsuau

@aleixsuau aleixsuau commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Jira: https://curity.atlassian.net/browse/IS-11495

Follow-up refactor to the WebAuthn attachment-selection cards (shipped in #254). It refactors the WebAuthn Any Device Registration attachment card to resolve its copy (kind / title / description) from the current step's metadata.viewData.messages.

@aleixsuau
aleixsuau marked this pull request as ready for review July 15, 2026 09:24

Copilot AI 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.

Pull request overview

Refactors the HAAPI Stepper WebAuthn “any-device” registration attachment-selection UI so the element component resolves its own localized copy from the current step’s metadata.viewData.messages (via useHaapiStepper), rather than relying on step-data formatting to pre-shape WebAuthn-specific data onto actions.

Changes:

  • Removes WebAuthn-specific webauthn shaping from formatNextStepData and from HaapiStepperClientOperationAction typing.
  • Introduces getWebAuthnRegistrationAttachment alongside the WebAuthn card component and relocates tests accordingly.
  • Replaces a duplicate type guard with a generic isAnyDeviceWebAuthnRegistrationClientOperation<T> that preserves the caller’s type on narrowing.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/haapi-react-sdk/haapi-stepper/feature/stepper/haapi-stepper.types.ts Removes formatter-produced WebAuthn data from client-operation action typing.
src/haapi-react-sdk/haapi-stepper/feature/stepper/data-formatters/webauthn-data.spec.ts Deletes resolver spec previously tied to the data-formatters layer.
src/haapi-react-sdk/haapi-stepper/feature/stepper/data-formatters/format-next-step-data.ts Removes WebAuthn-specific enrichment while keeping WebAuthn action splitting.
src/haapi-react-sdk/haapi-stepper/feature/stepper/data-formatters/format-next-step-data.spec.ts Deletes formatter-level assertions for WebAuthn enrichment that no longer exists.
src/haapi-react-sdk/haapi-stepper/feature/actions/client-operation/operations/webauthn/webauthn-registration-attachment.ts Adds/moves resolver to the WebAuthn operations layer and returns the attachment model directly.
src/haapi-react-sdk/haapi-stepper/feature/actions/client-operation/operations/webauthn/webauthn-registration-attachment.spec.ts Adds unit tests for the moved resolver.
src/haapi-react-sdk/haapi-stepper/feature/actions/client-operation/operations/webauthn/utils.ts Updates the any-device WebAuthn registration type guard to be generic and type-preserving.
src/haapi-react-sdk/haapi-stepper/feature/actions/client-operation/operations/webauthn/HaapiStepperWebAuthnRegistrationAttachmentCard.tsx Updates the card to resolve its copy via useHaapiStepper + resolver and changes props to accept the action.
src/haapi-react-sdk/haapi-stepper/feature/actions/client-operation/operations/webauthn/HaapiStepperWebAuthnRegistrationAttachmentCard.spec.tsx Updates card tests to drive copy through a mocked useHaapiStepper.
src/haapi-react-sdk/haapi-stepper/feature/actions/client-operation/HaapiStepperClientOperationUI.tsx Switches card rendering condition from action.webauthn to a WebAuthn any-device type guard.
src/haapi-react-sdk/haapi-stepper/feature/actions/client-operation/HaapiStepperClientOperationUI.spec.tsx Updates client-operation UI tests to rely on mocked stepper messages instead of action-attached WebAuthn data.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vahag-curity vahag-curity 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.

👋 @aleixsuau — a review pass on this refactor, flagging a few things for you to weigh in on / handle if needed.

Verification: tsc --noEmit is clean, all 20 affected specs pass, the removed symbols leave no dangling references, and the default HAAPI stepper flow is not broken. So nothing here blocks the shipped path — the notes are about the API/altitude of moving copy resolution into the exported card.

Main theme (inline on HaapiStepperWebAuthnRegistrationAttachmentCard.tsx): resolving copy inside the exported presentational card via useHaapiStepper() couples it to the provider. That produces two effects — (1) the card now throws if reused standalone, which contradicts its own "reusable" doc comment (the same concern Copilot raised), and (2) a latent wrong-step-copy risk for consumers rendering non-current-step actions. Both are fixed by resolving at the HaapiStepperClientOperationUI call site (already inside the provider, already holding action + currentStep) and passing the attachment down as a prop.

Two more that aren't inline-able / are trivial:

  • Barrel exportoperations/webauthn/index.ts re-exports every sibling helper except the moved ./webauthn-registration-attachment, so getAnyDeviceWebAuthnRegistrationAttachment isn't on the public surface. Combined with the card no longer being standalone, consumers have no supported way to build the copy. Worth adding the export (or consciously keeping it internal).
  • Typo…AttachmentCard.spec.tsx:43: the test name should read step's but uses a backtick instead of an apostrophe (already flagged by Copilot).

None are hard blockers — your call on how deep to go.

@luisgoncalves luisgoncalves 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.

Skimmed on the changes and manually tested.

aleixsuau and others added 4 commits July 21, 2026 12:40
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@aleixsuau
aleixsuau force-pushed the fix/dev/IS-11495-webauthn-attachment-typing branch from e7f0b27 to f3c006e Compare July 21, 2026 10:42
@aleixsuau
aleixsuau merged commit 860eca8 into dev Jul 21, 2026
4 checks passed
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.

4 participants