feat(sentry): stamp the release with the build hash and tag balena deploys - #3025
Merged
Conversation
…ploys - The CalVer alone proved ambiguous: a balena OTA deploy from master ships new code while pyproject still carries the last tagged version, so pre- and post-deploy events were indistinguishable in the 2026.6.2 audit - Postfix the release with GIT_SHORT_HASH (already baked into every image by tools/image_builder) as semver build metadata: 2026.6.2+abc1234 - Tag events balena=true/false via the same is_balena_app() helper the reboot/shutdown tasks use, so triage knows which operational playbook applies - Add tests for the release stamping and the tag wiring Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
There was a problem hiding this comment.
Pull request overview
Improves Sentry event attribution for Anthias deployments by stamping each event with a build-unique release identifier and tagging whether the instance is running under balena, closing the ambiguity where multiple post-deploy builds reported the same CalVer-only release.
Changes:
- Add
get_sentry_release()to compose a Sentry release asCalVer+GIT_SHORT_HASH(orNoneif unknown), and wire it intosentry_sdk.init(...). - Add a
balena: true|falseSentry tag derived fromis_balena_app(). - Add unit tests covering
get_sentry_release()behavior and a guard around how the balena tag is derived.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
tests/test_sentry.py |
Adds regression tests for release stamping and a guard for the balena deployment tag. |
src/anthias_server/django_project/settings.py |
Implements build-hash Sentry release stamping and sets a balena Sentry tag via the shared helper. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Importing anthias_common.utils into Django settings dragged sh/requests/redis into every settings load and crashed django-stubs' mypy plugin in CI's slim environment - Inline the BALENA env check as is_balena_deploy() and pin it against the canonical is_balena_app() helper in a test so the two can't drift (also replaces the brittle source-text assertion — Copilot) Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
This was referenced Jun 7, 2026
vpetersson
added a commit
that referenced
this pull request
Jun 9, 2026
- CalVer (YYYY.0M.MICRO); still June 2026, micro 2 -> 3 - Gives Sentry a real release boundary: every build since 2026.6.2 reported the same base version (only the +git-hash differed), so resolved-in-next-release never stuck and fixed issues kept reopening on the next event. A version bump lets the deployed fixes actually clear from the board. - Ships the crash/noise fixes merged since 2026.6.2: SQLite WAL + busy timeout (#3015), celery migration-gate (#3016) and asset-probe soft limits (#3017), transient-redis/CancelledError Sentry filtering + redis healthcheck (#3018/#3028), GitHub update-check log level (#3019), webview respawn on D-Bus death at setup and mid-play (#3020/#3031), resilient static-file scan (#3026), Wayland-socket wait (#3030), and Sentry release/board triage tags (#3021/#3025) Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
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.



Issues Fixed
Closes the audit gap found after the balena deploy: every post-deploy event still reported
release: 2026.6.2(pyproject carries the last tagged version), so old- and new-code events could only be told apart by which tags they carried.Description
+build hash —GIT_SHORT_HASHis already baked into every image bytools/image_builder(it's the same hash the docker tag uses), so the Sentry release becomes e.g.2026.6.2+be63202, pinning each event to the exact build.+is semver build-metadata syntax; Sentry handles it natively. Host/dev runs without the env fall back to the bare CalVer.balena: true|falsetag — via the sameis_balena_app()helper the reboot/shutdown tasks use. Balena and plain compose installs differ operationally (supervisor-managed restarts, nodepends_onconditions), so triage knows which playbook applies.Checklist
🤖 Generated with Claude Code