Skip to content

fix: limit feedback message length - #8973

Open
llirik0 wants to merge 7 commits into
getsentry:mainfrom
llirik0:fix/feedback-message-limit
Open

llirik0 wants to merge 7 commits into
getsentry:mainfrom
llirik0:fix/feedback-message-limit

Conversation

@llirik0

@llirik0 llirik0 commented Sep 8, 2026

Copy link
Copy Markdown

📜 Description

  • Limit managed user-feedback messages to 4096 Unicode scalars, matching the backend's Python code-point validation.
  • Show an accessible live character counter below the message field.
  • Highlight the counter and present a specific validation error when the limit is exceeded.

💡 Motivation and Context

The Sentry backend rejects feedback messages longer than 4096 code points. The iOS managed feedback form currently allows those messages to be submitted without warning, so feedback can be dropped after the user finishes the form.

Unicode-scalar counting intentionally matches backend len(message) behavior for precomposed and decomposed input.

Fixes #4680

💚 How did you test it?

./scripts/sentry-xcodebuild.sh \
  --platform iOS \
  --command test \
  --configuration Test \
  --ref fix/feedback-message-limit \
  --destination 'platform=iOS Simulator,id=50ED21A6-2279-4432-B0F0-09E8928CC1EE' \
  --only-testing 'SentryTests/SentryFeedbackTests'

Result: 38 tests passed with 0 failures on iOS 26.2. Coverage includes exact 4096/4097 Unicode-scalar boundaries for decomposed input, nil UIKit text handling, missing-required-field precedence, theme font customization, counter accessibility, and submit-error presentation. A sabotage run using Swift grapheme-cluster counting made the 4097-scalar decomposed regression test fail, then pass after restoring Unicode-scalar counting.

make format
make lint
make analyze
make build-ios FOR_AGENTS=true \
  IOS_SIMULATOR_OS=26.2 \
  IOS_DEVICE_NAME='Sentry OSS iPhone 17 Pro'

All commands passed. The destination overrides are required because this machine does not have the repository-default iOS 18.4 runtime.

📝 Checklist

  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.
  • If I added a new public API, I also added it to the SentryObjC wrapper.

Demo:

Simulator.Screen.Recording.-.Sentry.OSS.iPhone.17.Pro.-.2026-09-09.at.23.51.12.mov

@llirik0
llirik0 marked this pull request as ready for review September 8, 2026 05:58
@llirik0
llirik0 force-pushed the fix/feedback-message-limit branch from ea870b1 to 2bfe1b6 Compare September 8, 2026 20:09
@NinjaLikesCheez NinjaLikesCheez added the run-full-ci Allows gated GitHub Action workflows to run for a labelled pull request label Sep 10, 2026
@NinjaLikesCheez

Copy link
Copy Markdown
Member

Overall this looks good - thank you for your contribution! I've kicked off the CI and there's a merge conflict to resolve, could you attach a screenshot of the UI so we can see what it looks like? I'll try get to testing it on device later today either so if I get there first I'll add a screenshot for others.

Thanks again!

Validate managed feedback messages against the backend 4096 Unicode-scalar limit. Show an accessible live counter and preserve existing missing-field validation precedence.
@llirik0
llirik0 force-pushed the fix/feedback-message-limit branch from 2bfe1b6 to 74e8f39 Compare September 10, 2026 06:38
@llirik0

llirik0 commented Sep 10, 2026

Copy link
Copy Markdown
Author

Overall this looks good - thank you for your contribution! I've kicked off the CI and there's a merge conflict to resolve, could you attach a screenshot of the UI so we can see what it looks like? I'll try get to testing it on device later today either so if I get there first I'll add a screenshot for others.

Thanks again!

Thanks for the review! I’ve resolved the merge conflict and attached a short demo below showing the character counter and validation state. Please let me know if anything else needed here!

@NinjaLikesCheez NinjaLikesCheez left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM - thanks!

@philprime philprime left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you @llirik0 for opening up this issue. I see the problem and how your implementation can help with sending valid feedback only.

As this is PR is also extending the standard user feedback UI with a character count label, I will need to raise this internally to gather feedback

updateMessageCharacterCount(label: messageCharacterCountLabel)
}

private func updateMessageCharacterCount(label: UILabel) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

h: Our user feedback UI is standardized across SDKs, so we must do an internal alignment with other SDK maintainers if adding this footer caption label is fine.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

sg, please let me know if anything needs to be changed. ty

@philprime

Copy link
Copy Markdown
Member

Created getsentry/sentry-docs#19424 as the matter of discussion on how to align cross-SDK behavior for the client-side feedback input validation. I'll let you know when we have a decision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-full-ci Allows gated GitHub Action workflows to run for a labelled pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feedback: Restrict message length to 4096 characters

3 participants