Skip to content

fix(logging): crash on release builds in rotation logger #4009

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 24, 2025
Merged

Conversation

harsh62
Copy link
Member

@harsh62 harsh62 commented Jun 20, 2025

Issue #

Fix cache sizing issue:

#4001

Description

General Checklist

  • Added new tests to cover change, if needed
  • Build succeeds with all target using Swift Package Manager
  • All unit tests pass
  • All integration tests pass
  • Security oriented best practices and standards are followed (e.g. using input sanitization, principle of least privilege, etc)
  • Documentation update for the change if required
  • PR title conforms to conventional commit style
  • New or updated tests include Given When Then inline code documentation and are named accordingly testThing_condition_expectation()
  • If breaking change, documentation/changelog update with migration instructions

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link

codecov bot commented Jun 20, 2025

Codecov Report

Attention: Patch coverage is 72.22222% with 5 lines in your changes missing coverage. Please review.

Project coverage is 67.68%. Comparing base (3013746) to head (0e7d11e).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...onsumer/CloudWatchLoggingStreamNameFormatter.swift 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4009      +/-   ##
==========================================
- Coverage   67.69%   67.68%   -0.02%     
==========================================
  Files        1128     1128              
  Lines       52468    52481      +13     
==========================================
+ Hits        35519    35521       +2     
- Misses      16949    16960      +11     
Flag Coverage Δ
API_plugin_unit_test 70.33% <ø> (ø)
AWSPluginsCore 69.21% <ø> (ø)
Amplify 47.83% <ø> (+0.01%) ⬆️
Analytics_plugin_unit_test 85.20% <ø> (ø)
Auth_plugin_unit_test 73.65% <ø> (-0.08%) ⬇️
DataStore_plugin_unit_test 83.35% <ø> (+0.05%) ⬆️
Geo_plugin_unit_test 74.86% <ø> (ø)
Logging_plugin_unit_test 63.53% <72.22%> (-0.02%) ⬇️
Predictions_plugin_unit_test 35.40% <ø> (ø)
PushNotifications_plugin_unit_test 88.43% <ø> (ø)
Storage_plugin_unit_test 76.87% <ø> (ø)
unit_tests 67.68% <72.22%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@harsh62 harsh62 marked this pull request as ready for review June 24, 2025 14:50
@harsh62 harsh62 requested a review from a team as a code owner June 24, 2025 14:50
// Use a reasonable file size limit that's a fraction of the total cache size
// Ensure it meets the minimum requirement of 1KB
let totalCacheSizeInBytes = localStoreMaxSizeInMB * 1048576
let fileSizeLimitInBytes = max(LogRotation.minimumFileSizeLimitInBytes, totalCacheSizeInBytes / 5)
Copy link
Member

Choose a reason for hiding this comment

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

why totalCacheSizeInBytes / 5 ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Update the code to better reflect what 5 was.. Its the file count.

@harsh62 harsh62 merged commit 34bc774 into main Jun 24, 2025
92 checks passed
@harsh62 harsh62 deleted the logging-crash branch June 24, 2025 17:49
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.

2 participants