Skip to content

Fix "Home - No "The maximum comment length is 15,000 characters" error on Concierge prompt box" - #99548

Open
Guccio163 wants to merge 6 commits into
Expensify:mainfrom
software-mansion-labs:Guccio163/15kcharacters
Open

Fix "Home - No "The maximum comment length is 15,000 characters" error on Concierge prompt box"#99548
Guccio163 wants to merge 6 commits into
Expensify:mainfrom
software-mansion-labs:Guccio163/15kcharacters

Conversation

@Guccio163

@Guccio163 Guccio163 commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

Wires ConciergePromptBox into the same useDebouncedCommentMaxLengthValidation hook the report composer uses, so the 15,000 character limit is enforced inline (red border, error text, disabled send) instead of only after send.

Fixed Issues

$ #99483
PROPOSAL:

Tests

  1. Open "Home" page
  2. Enter some short text into Concierge input - check if it stays green and possible to submit.
  3. Enter long message (15000+ characters) - check if it turns red with an error message "The maximum content legth is 15,000 characters." and is disabled.
  4. Shorten the test to a <15000 character length - check if it turns back green and is possible to submit.
  • Verify that no errors appear in the JS console

Offline tests

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 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 shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • 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)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • 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)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • 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 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.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • 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
Android: mWeb Chrome
iOS: Native
Screen.Recording.2026-08-26.at.13.06.04.mov
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-08-26.at.12.10.14.mov

Wires ConciergePromptBox into the same useDebouncedCommentMaxLengthValidation
hook the report composer uses, so the 15,000 character limit is enforced
inline (red border, error text, disabled send) instead of only after send.

Fixes Expensify#99483
@Guccio163
Guccio163 marked this pull request as ready for review August 26, 2026 10:19
@Guccio163
Guccio163 requested review from a team as code owners August 26, 2026 10:19
@melvin-bot
melvin-bot Bot requested a review from ZhenjaHorbach August 26, 2026 10:20
@melvin-bot

melvin-bot Bot commented Aug 26, 2026

Copy link
Copy Markdown

@ZhenjaHorbach Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot
melvin-bot Bot requested review from heyjennahay and removed request for a team August 26, 2026 10:20
Comment thread src/pages/home/ForYouSection/ConciergePromptBox.tsx Outdated

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

ℹ️ 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/pages/home/ForYouSection/ConciergePromptBox.tsx Outdated
Comment thread src/pages/home/ForYouSection/ConciergePromptBox.tsx
…eEffect

PERF-8: handling a user-typed value change inside a useEffect adds an
extra render cycle and obscures the direct relationship between typing
and validation. Call the debounced validation from onChangeText, same
pattern as ComposerInput's onValueChange.
The Home prompt sends directly through askConcierge/addComment and
never interprets task syntax the way the report composer does. Without
isEditing: true, any prompt starting with "[] " was misread as a task
title and blocked past 100 characters, well under the 15,000-character
comment limit.
@ZhenjaHorbach

Copy link
Copy Markdown
Contributor

@Guccio163
Can you fix comments, please?

@Guccio163

Copy link
Copy Markdown
Contributor Author

Sure, I'm already working on them - should be done very soon, I'll ping you once it's ready

…ength

The "+" attachment button's confirm modal unconditionally called
askConciergeWithAttachment with the current comment text, bypassing
the max-length guard that gates the normal send button. Match the main
report composer's pattern (ComposerActionMenu's
shouldDisableAttachmentItem): disable the trigger itself instead of
guarding the send call.
@Guccio163

Guccio163 commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

@ZhenjaHorbach all comments are addressed, one thing that caught my attention is green button's flicker after pasting the text and before validation - the same effect is occurring also in chats, so it isn't this PR's fault, but we could potentially delay the button 'green-ing' till after the validation. Food for thought, LMKWDYT @ZhenjaHorbach and I'll post a proposal in Slack once I find the fix. Nevertheless I'll handle it separately, so this PR alone is ready for review 👀

Screen.Recording.2026-08-26.at.13.51.57.mov

@ZhenjaHorbach

Copy link
Copy Markdown
Contributor

@ZhenjaHorbach all comments are addressed, one thing that caught my attention is green button's flicker after pasting the text and before validation - the same effect is occurring also in chats, so it isn't this PR's fault, but we could potentially delay the button 'green-ing' till after the validation. Food for thought, LMKWDYT @ZhenjaHorbach and I'll post a proposal in Slack once I find the fix. Nevertheless I'll handle it separately, so this PR alone is ready for review 👀

Screen.Recording.2026-08-26.at.13.51.57.mov

I suppose we need to have the same behaviour as in the input in the inbox chat

@Guccio163

Copy link
Copy Markdown
Contributor Author

Yeah we do right now, I'll work on fixing them both in a separate PR

@ZhenjaHorbach

Copy link
Copy Markdown
Contributor

Yeah we do right now, I'll work on fixing them both in a separate PR

Since it's not a hotfix, I think we can fix all issues here
Plus, in this case, it will be a bit easier for testing

@Guccio163

Copy link
Copy Markdown
Contributor Author

Sure, I think we could do it here

@Guccio163

Guccio163 commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

@ZhenjaHorbach circling back to the proposed fix, I think we should actually let it go: It is possible to avoid the button turning green, but then we have to base it on the debounced length value, which of course is delayed and this makes button look bad in every other normal use-case:

Screen.Recording.2026-08-26.at.17.08.45.mov

That being said, it's ready for a review 😃

@ZhenjaHorbach

Copy link
Copy Markdown
Contributor

I don't mind leaving this as it is
@Guccio163
But can you fix conflicts, please?

@Guccio163

Copy link
Copy Markdown
Contributor Author

@ZhenjaHorbach ready

@ZhenjaHorbach

ZhenjaHorbach commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Actually, let's wait for this PR
Since we updated the styles for the error text in this PR
#99543

@grgia

grgia commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

merged the above, please merge main cc @Guccio163 @ZhenjaHorbach

@ZhenjaHorbach

Copy link
Copy Markdown
Contributor

merged the above, please merge main cc @Guccio163 @ZhenjaHorbach

Yeah
And let's reuse the component that we already have for error texts!

@Guccio163

Copy link
Copy Markdown
Contributor Author

@ZhenjaHorbach I think that we can close this PR then - when merging main a superset of our logic was already there ✨

@ZhenjaHorbach

ZhenjaHorbach commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Oh
Sorry for the confusion 😅
Didn't notice that we already had this logic
Let's close this!

@GCyganek
Can you add a test case from this PR in your PR, please?

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.

3 participants