Skip to content

Sumeru / #581 - Fix IterableInAppMessage.createdAt type mismatch causing crashes#851

Open
sumeruchat wants to merge 1 commit intomasterfrom
sumeru/581-fix-createdAt-type-mismatch
Open

Sumeru / #581 - Fix IterableInAppMessage.createdAt type mismatch causing crashes#851
sumeruchat wants to merge 1 commit intomasterfrom
sumeru/581-fix-createdAt-type-mismatch

Conversation

@sumeruchat
Copy link
Copy Markdown

Summary

  • Fixes type mismatch for IterableInAppMessage.createdAt and expiresAt that causes runtime crashes
  • The native bridge sends epoch milliseconds (number), but setUTCMilliseconds() returns a number, not a Date — so consumers calling Date methods on createdAt would crash
  • Replaced with new Date(milliseconds) to properly convert timestamps to Date objects
  • Removed the @ts-ignore workaround that was masking the type error
  • Added default value for priorityLevel to fix exposed type issue

Test plan

  • Added unit test verifying createdAt and expiresAt return valid Date objects from fromDict
  • Added unit test verifying undefined timestamps remain undefined
  • Verify no crashes when accessing createdAt on in-app messages in a running app
  • Check backward compatibility with existing in-app message flows

🤖 Generated with Claude Code

The native bridge sends epoch milliseconds (number) for createdAt and
expiresAt, but the previous code used setUTCMilliseconds which returns
a number instead of a Date object. This caused runtime crashes when
consumers tried to use createdAt as a Date. Replace with new Date()
constructor to properly convert timestamps. Also removes the @ts-ignore
workaround and provides a default for priorityLevel.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sumeruchat sumeruchat self-assigned this Apr 7, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

Lines Statements Branches Functions
Coverage: 62%
62.72% (392/625) 40.54% (105/259) 61.5% (139/226)

@qltysh
Copy link
Copy Markdown

qltysh bot commented Apr 7, 2026

Qlty

Coverage Impact

⬇️ Merging this pull request will decrease total coverage on master by 0.36%.

Modified Files with Diff Coverage (1)

RatingFile% DiffUncovered Line #s
Coverage rating: B Coverage rating: B
src/inApp/classes/IterableInAppMessage.ts100.0%
Total100.0%
🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

@sumeruchat sumeruchat added the Experimental Experimental fix generated by AI label Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Experimental Experimental fix generated by AI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants