Repository navigation
Anonymous crash reports and one export count with Sentry - #34
Merged
Merged
Conversation
sentry-cocoa 9.32.0, pinned, under the portfolio's anonymous recipe: one shared user, no device IDs, the installation ID pinned so sessions carry none, no breadcrumbs, paths scrubbed, and one count, project.exported with a device attribute. MetricKit on, tracing off. The environment is debug, testflight or production, from StoreKit in release builds. Network access (com.apple.security.network.client) is for Sentry only. The DSN lives in a gitignored xcconfig that ci_pre_xcodebuild.sh writes, and an archive without a usable one fails. ci_post_xcodebuild.sh uploads dSYMs with a pinned, checksum-checked sentry-cli. PrivacyInfo.xcprivacy declares crash, performance and product-interaction data, not linked. Refs #33 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The CI script checks the environment variable; this checks the value the build actually resolved after the xcconfig, so a hand-written xcconfig or a local archive can't ship a truncated "https:" either. Tested with xcodebuild install: no DSN and a plain https:// both fail, the escaped form passes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The portfolio standard now declares Other Diagnostic Data next to Crash Data and Performance Data, as sentry-cocoa's own manifest does: not linked, not tracking, App Functionality. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Anonymous crash reports, app hangs, crash-free sessions, MetricKit diagnostics and one feature count go to Sentry, under the portfolio's anonymous recipe. Refs #33. That issue closes once a release build has been checked in Sentry.
This needs your explicit OK before merge. It touches:
ci_scripts/),For 1.2.0. The site and policy copy is in a separate PR, #33's site half, which merges on the day this ships.
What changed
App/project.yml, and verified against the tag's commit. It is the newest release that is more than two weeks old, and the one WODrounds' envelope check used. It is pinned because the anonymous sessions depend on how this version stores its installation ID.App/Patternaut/Telemetry.swift:anonymous, set right afterSentrySDK.startand again on every event inbeforeSend.beforeSenddrops:contexts.app.device_app_hash,contexts.device.idandserver_name./Users/~/…). Paths in exception and event messages become<path>.INSTALLATIONfile is pinned toanonymousbefore the SDK starts, the same technique as WODrounds #227.sendDefaultPii, performance tracing and file I/O tracing. The Mac SDK has no screenshots or view hierarchy.project.exported:device(tracker_plus/tracker_mini);beforeSendMetrickeeps an allowlist and drops the rest,user.idincluded.PatternautCore/.../TelemetryRules.swift: the allowlist, the fixed device values and both path rules.debugfor builds from Xcode.AppTransactiondecides:productionfor the App Store,testflightfor TestFlight. On the Mac a receipt can't tell the two apart.release, and sessions from release builds sayreleasetoo. That is noted inApp/SENTRY.md.com.apple.security.network.clientadded to the entitlements, used by Sentry only.App/Sentry.xcconfig(gitignored), included optionally from the newApp/Config.xcconfig, and reaches the app through Info.plistSentryDSN.ci_scripts/ci_pre_xcodebuild.shwrites it fromSENTRY_DSN, escaped ashttps:/$()/…. In an xcconfig,//starts a comment, so a plainhttps://…leaves onlyhttps:. I checked this withxcodebuild -showBuildSettings.https:DSN.ACTION=install) whose resolvedSENTRY_DSNisn'thttp(s)://…@…/…, which covers hand-written xcconfigs and local archives too. Tested withxcodebuild install:https://fails (it resolves tohttps:);https://….ci_scripts/ci_post_xcodebuild.shuploads the archive's dSYMs with sentry-cli 3.8.2. The download is checked against the SHA-256 GitHub publishes, which I verified. It needsSENTRY_AUTH_TOKEN; without it, it warns and the build goes on.App/Patternaut/PrivacyInfo.xcprivacy:App/SENTRY.md(what's sent, the DSN, dSYMs, and the envelope check).Envelope test (Debug build, local stand-in for Sentry)
I ran a Debug build against a local HTTP server that saved every envelope, with the probe on (
PATTERNAUT_SENTRY_PROBE=1). The probe sends one event and two counts, and one count carries an extraprojectattribute. I ran it in the existing sandbox, and in a fresh one through a copy with another bundle ID, to see a first run.16 envelopes came back: 7 events, 6 sessions and 3 metric batches. Results:
didwasanonymous, including the closingabnormalupdate after a restart.userwas{"id": "anonymous"}.device_app_hash,server_nameanduser.idappeared nowhere.projectattribute was dropped./Users/appeared.Two things I could not do:
com.iamjarl.its404yo, are excluded from the count above.Also seen: a launch hang of about 2 seconds in Debug builds, in SwiftUI's first layout. That is the app itself, not Sentry, and exactly what these reports should surface.
The Debug and Release builds compile.
swift testpasses: 166 tests, with the newTelemetryRulesTests.Your steps
SENTRY_DSN, from Sentry → Settings → Projects → patternaut → Client Keys;SENTRY_AUTH_TOKEN, an organisation token that can upload debug files.anonymous, there is nodevice_app_hashand no path, and the environment istestflightorproduction.Checklist
cd PatternautCore && swift test)🤖 Generated with Claude Code