Skip to content

test: Fix flaky HangTracker deallocated test#7639

Merged
noahsmartin merged 1 commit intomainfrom
fixHangTrackerTestFlake
Mar 9, 2026
Merged

test: Fix flaky HangTracker deallocated test#7639
noahsmartin merged 1 commit intomainfrom
fixHangTrackerTestFlake

Conversation

@noahsmartin
Copy link
Contributor

@noahsmartin noahsmartin commented Mar 7, 2026

This test would flake if the hang tracker's background thread hadn't finished running (a race condition). This fixes it and adds a comment to help explain why accessing mainThreadState is safe even when the deinit isn't documented to only be called on the main thread

Closes #7640

@github-actions
Copy link
Contributor

github-actions bot commented Mar 7, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (SPM) Add package traits for UI framework opt-out and macOS CLI sample by philprime in #7578
  • Use full flamegraph for metrickit app hangs by noahsmartin in #7185

Bug Fixes 🐛

  • Capture transactions during launch profiling window by philipphofmann in #7602

Internal Changes 🔧

Deps

  • Bump actions/setup-node from 6.2.0 to 6.3.0 by dependabot in #7627
  • Bump getsentry/craft/.github/workflows/changelog-preview.yml from 2.23.0 to 2.23.2 by dependabot in #7628
  • Bump getsentry/craft from 2.23.0 to 2.23.2 by dependabot in #7629
  • Bump ruby/setup-ruby from 1.288.0 to 1.290.0 by dependabot in #7631

Samples

  • Restructure watchOS-Swift sample by philprime in #7614
  • Restructure visionOS-Swift sample by philprime in #7616
  • Restructure visionOS-SwiftUI-SPM sample by philprime in #7615

Other

  • (test-samples) Restructure SwiftUITestSample and SwiftUICrashTest by philprime in #7612
  • Fix flaky HangTracker deallocated test by noahsmartin in #7639

🤖 This preview updates automatically when you update the PR.

@noahsmartin noahsmartin force-pushed the fixHangTrackerTestFlake branch from 0ff4681 to 19fa97c Compare March 7, 2026 23:34
@codecov
Copy link

codecov bot commented Mar 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.356%. Comparing base (313b966) to head (19fa97c).
⚠️ Report is 3 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##              main     #7639       +/-   ##
=============================================
+ Coverage   85.325%   85.356%   +0.031%     
=============================================
  Files          483       483               
  Lines        28785     28785               
  Branches     12506     12518       +12     
=============================================
+ Hits         24561     24570        +9     
+ Misses        4177      4169        -8     
+ Partials        47        46        -1     
Files with missing lines Coverage Δ
Sources/Swift/HangTracker.swift 96.774% <ø> (ø)

... and 5 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 313b966...19fa97c. Read the comment docs.

Copy link
Contributor

@itaybre itaybre left a comment

Choose a reason for hiding this comment

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

LGTM

@noahsmartin noahsmartin added the ready-to-merge Use this label to trigger all PR workflows label Mar 9, 2026
@sentry
Copy link

sentry bot commented Mar 9, 2026

Sentry Build Distribution

App Version Configuration
SDK-Size 9.6.0 (1) Release

@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2026

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1219.29 ms 1244.16 ms 24.87 ms
Size 24.14 KiB 1.12 MiB 1.10 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
98a16ef 1227.45 ms 1258.19 ms 30.74 ms
70fb69e 1230.45 ms 1257.00 ms 26.55 ms
9a34176 1227.24 ms 1266.22 ms 38.98 ms
59981b9 1207.25 ms 1240.71 ms 33.46 ms
8ef5e41 1214.14 ms 1248.52 ms 34.38 ms
26ae2f8 1221.61 ms 1250.76 ms 29.14 ms
83bf9af 1213.30 ms 1234.18 ms 20.89 ms
2d1826b 1216.96 ms 1254.05 ms 37.09 ms
b66e455 1211.30 ms 1241.39 ms 30.08 ms
70fb69e 1215.23 ms 1241.84 ms 26.61 ms

App size

Revision Plain With Sentry Diff
98a16ef 24.14 KiB 1.09 MiB 1.07 MiB
70fb69e 24.14 KiB 1.11 MiB 1.09 MiB
9a34176 24.14 KiB 1.10 MiB 1.07 MiB
59981b9 24.14 KiB 1.09 MiB 1.06 MiB
8ef5e41 24.14 KiB 1.10 MiB 1.08 MiB
26ae2f8 24.14 KiB 1.11 MiB 1.09 MiB
83bf9af 24.14 KiB 1.04 MiB 1.02 MiB
2d1826b 24.14 KiB 1.12 MiB 1.09 MiB
b66e455 24.14 KiB 1.11 MiB 1.09 MiB
70fb69e 24.14 KiB 1.11 MiB 1.09 MiB

@noahsmartin noahsmartin enabled auto-merge (squash) March 9, 2026 06:31
@noahsmartin noahsmartin merged commit aa0ceca into main Mar 9, 2026
339 of 358 checks passed
@noahsmartin noahsmartin deleted the fixHangTrackerTestFlake branch March 9, 2026 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Use this label to trigger all PR workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: Fix flaky HangTracker deallocated test

2 participants