Skip to content

Composition over configuration for FeatureTrainingContent - #97222

Merged
tgolen merged 35 commits into
Expensify:mainfrom
gijoe0295:refactor/composition-over-configuration-feature-training
Aug 27, 2026
Merged

tgolen merged 35 commits into
Expensify:mainfrom
gijoe0295:refactor/composition-over-configuration-feature-training

Conversation

@gijoe0295

@gijoe0295 gijoe0295 commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

Refactor the FeatureTrainingContent components to follow composition over configuration rule. Also fix several bugs from the AIFeaturesPromoModal.

Fixed Issues

$ #90820
$ #95853
PROPOSAL:

Tests

  1. Go to /home/ai-features-promo
  2. Verify the buttons, illustrations and texts work correctly
  • Verify that no errors appear in the JS console

Offline tests

None

QA Steps

Same as tests

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Screen.Recording.2026-08-13.at.03.23.49.mov
Android: mWeb Chrome
Screen.Recording.2026-08-13.at.03.25.00.mov
iOS: Native
Screen.Recording.2026-08-13.at.03.21.57.mov
iOS: mWeb Safari
Screen.Recording.2026-08-13.at.03.20.02.mov
Simulator Screenshot - iPhone 17 - 2026-08-13 at 03 20 30
MacOS: Chrome / Safari
Screen.Recording.2026-08-13.at.03.19.23.mov

@codecov

codecov Bot commented Jul 28, 2026 •

Copy link
Copy Markdown

@quinthar quinthar added the #ai label Aug 11, 2026

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 85562f583f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/components/AIFeaturesPromoModal.tsx Resolved
@ShridharGoel

Copy link
Copy Markdown
Contributor

I'll review since this is a part of #90820

@ShridharGoel
ShridharGoel self-requested a review August 12, 2026 21:23
@quinthar quinthar removed the #ai label Aug 13, 2026
Comment on lines +81 to +82
shouldCloseOnConfirm = true,
shouldUseScrollView = false,

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.

Looks like here also we need to use composition instead of config flags.

@gijoe0295 gijoe0295 Aug 13, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'd have a small push back on shouldUseScrollView:

  • ScrollView is not just opted in by consumers but also controlled by provider while isInLandscapeMode
  • It also wraps the hidden ProbePage layer in FeatureTrainingCarousel so we can't easily extract it
  • Extracting also causes confusion for future engineers when to use it

I'd categorize it as these exclusion rules:

- The optional prop is used for logic beyond just conditional rendering (e.g., computing derived values, passed to callbacks, used in multiple places within the component)
- The component is a thin wrapper around a platform primitive (e.g., wrapping `TextInput`, `ScrollView`, `Pressable`) — these naturally pass through configuration props

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.

Ok, @tgolen thoughts?

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.

It looks like this doesn't exist anymore?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I removed shouldCloseOnConfirm but kept shouldUseScrollView here

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.

Ah, I see. The exception is probably OK in this instance.

@garrettmknight
garrettmknight removed their request for review August 13, 2026 09:47
@ShridharGoel

Copy link
Copy Markdown
Contributor

#95856

Can we remove this from the "Fixed issues" list based on this?

@ShridharGoel

Copy link
Copy Markdown
Contributor

@MelvinBot review

@MelvinBot

Copy link
Copy Markdown
Contributor

🤖 Reviewed the refactor. Overall this is a clean, well-executed composition-over-config split — the primitives are small and single-purpose, state/actions are cleanly separated into two contexts, and behavior looks preserved against the old FeatureTrainingContent. All real CI is green (only the checklist / Check independent approval gates are red, which are the expected human/approval checks, not code failures).

✅ The Codex P2 double-close is resolved. In AIFeaturesPromoModal.tsx:62-64 onConfirm={confirmAndCloseModal} and onClose={closeModal} no longer both fire on confirm: shouldCloseOnConfirm was dropped and the carousel's handleConfirm now only calls onConfirm (it doesn't self-close), so confirm and X are mutually exclusive. Good.

Two minor, non-blocking notes:

  1. Carousel handleConfirm hardcodes the willShowAgain arg to false (FeatureTrainingCarousel.tsx:161-163) whereas single-page FeatureTraining.handleConfirm forwards the live willShowAgain. Harmless today (carousels have no DismissOption, and all current consumers ignore the arg), but the bare false reads as a magic value — a one-line comment noting "carousels have no dismiss checkbox" would save a future reader the trip.

  2. Height-lock probe silently no-ops if a Page has no BodyText. The probe only renders/measures pages whose bodyText != null (FeatureTrainingCarousel.tsx:226-227) but the completion gate compares against the full pageCountRef, so a BodyText-less page leaves contentMinHeight undefined forever and the minHeight lock never engages. This is not a regression — the old carousel had the identical < pages.length gate — but the new composition API makes a BodyText-less Page much easier to author accidentally, so gating on the count of measurable pages (or a dev warning) would harden it.

The CONSISTENCY-13 prop-doc nits from the bot look already addressed in commit 14c6dcf.

Note: I reviewed statically and did not run a live smoke test (the CI session couldn't sign in this run); the author's cross-platform screenshots and green CI cover the runtime side.


view run

@ShridharGoel

ShridharGoel commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
Android: mWeb Chrome
iOS: HybridApp
Screen.Recording.2026-08-21.at.4.16.34.PM.mov
Simulator.Screen.Recording.-.iPhone.16.Pro.-.2026-08-21.at.16.25.04.mov
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-08-21.at.9.16.28.AM.mov

@ShridharGoel

Copy link
Copy Markdown
Contributor

@mjasikowski Gentle bump for review here

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

@gijoe0295 @ShridharGoel there are some small testing gaps that could be improved, but for the sake of not making this PR any larger LGTM

@tgolen
tgolen merged commit 6266095 into Expensify:main Aug 27, 2026
37 of 47 checks passed
@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@github-actions

Copy link
Copy Markdown
Contributor

🚧 tgolen has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify OSBotify mentioned this pull request Aug 27, 2026
65 tasks done
@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/tgolen in version: 9.4.63-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@MelvinBot

Copy link
Copy Markdown
Contributor

🤖 No help site changes required — I did not open a docs PR.

This PR is a pure code-architecture refactor with no change to customer-facing behavior or copy:

  • FeatureTraining / FeatureTrainingContent primitives — restructured to follow the composition-over-configuration rule. This swaps a config pages array for composed child components; the rendered onboarding/feature-training UI is unchanged.
  • AIFeaturesPromoModal — migrated from the old FeatureTrainingCarousel config API to the new FeatureTraining composition API and fixes internal bugs. The titles, descriptions, animations, and button labels are the same strings as before (sourced from src/languages/*), just wired differently in code.

The 40 changed files are all React components, pages, and one test — none introduce or rename a user-facing feature, workspace setting, tab, or button. Help site articles under App/docs/articles document product features and workflows for customers, and none of them describe these internal onboarding-modal components, so there's nothing to update.

@gijoe0295, if you believe any of these modals changed user-visible copy or flow that a help article covers, let me know which article and I'll draft the update.


view run

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/AndrewGable in version: 9.4.63-1 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

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.

7 participants