Skip to content

feat(sentry): source-map upload + release/commit association#58

Merged
SyniRon merged 1 commit into
mainfrom
feat/sentry-sourcemaps-releases
Jun 3, 2026
Merged

feat(sentry): source-map upload + release/commit association#58
SyniRon merged 1 commit into
mainfrom
feat/sentry-sourcemaps-releases

Conversation

@SyniRon

@SyniRon SyniRon commented Jun 3, 2026

Copy link
Copy Markdown
Owner

What

Makes Sentry errors actionable. Today errors are captured and tagged with the release, but stack traces are minified gibberish (/assets/index-*.js:1:NNN) and the Releases view is empty. This adds, on each release:

  1. Source-map upload — de-minified *.tsx:line traces
  2. Release creation + commit association — suspect-commit blaming and regression detection

via @sentry/vite-plugin, driven by SENTRY_AUTH_TOKEN / org syniron / project freightdesk.

The constraint that shapes the design

vite build runs inside the Docker image build, and that image is public on GHCR. So:

  • Token is a BuildKit secret, not an ARG/ENV — a token in any layer of a public image would leak. Mounted only for the build RUN, never persisted.
  • Source maps never ship — emitted hidden (no sourceMappingURL in the JS), uploaded, then deleted via filesToDeleteAfterUpload before the Caddy stage copies dist. Verified: find /srv -name '*.map' is empty.
  • No-ops without the token — PR/fork image-build (no secret) and local builds disable the plugin entirely and emit no maps, so the build still passes. Keeps the repo forker-generic (ADR 0001).
  • Commit association without .git — the Docker context has no .git, so the commit SHA is passed as a non-secret build-arg (github.sha) into release.setCommits.

Changes

  • web/package.json / lockfile / pnpm-workspace.yaml — add @sentry/vite-plugin; allow @sentry/cli's native-binary build script
  • web/vite.config.ts — token-gated plugin + build.sourcemap
  • Dockerfile — BuildKit secret mount + SENTRY_RELEASE_COMMIT arg
  • .github/workflows/release.yml — pass the secret + commit SHA to the build step
  • docs/adr/0014-* — records the secret-handling design, the FSL-1.1 build-time-only dependency footprint, and the forker-generic no-op property (per ADR 0001); docs/adr/0007 deferral note updated

Verified locally

  • pnpm build (no token) → 0 .map files, no sourceMappingURL in JS, all 208 vitest tests pass
  • docker build (no secret, mimics CI image-build) → succeeds; final image /srv has 0 .map files

⚠️ Required before this works (repo admin)

Create the SENTRY_AUTH_TOKEN repo secret (Settings → Secrets → Actions) — a Sentry token with project:releases + source-map write scopes. It's a repo secret (build-time), not a production Environment secret.

Verify after merge + tag

Cut a tag (e.g. v0.1.3): confirm the release appears in Sentry with its commit, trigger a client error and confirm the trace resolves to real *.tsx:line, and confirm no .map is served from the public site.

🤖 Generated with Claude Code

…ation

Make Sentry errors actionable: de-minify production stack traces and
populate the Releases view with suspect-commit blaming.

- Add @sentry/vite-plugin (web devDependency) — on each release it
  creates the Sentry release, associates the commit, and uploads source
  maps, all driven by SENTRY_AUTH_TOKEN / org syniron / project freightdesk.
- vite.config: build.sourcemap 'hidden' (no sourceMappingURL in shipped
  JS) and sourcemaps.filesToDeleteAfterUpload so no .map is ever served.
  Fully gated on SENTRY_AUTH_TOKEN: absent → plugin disabled, no maps
  emitted, build still passes (PR/fork/local).
- Dockerfile: SENTRY_AUTH_TOKEN as a BuildKit secret mount, never an
  ARG/ENV — the GHCR image is public, so a token in any layer would leak.
  SENTRY_RELEASE_COMMIT passed as a (non-secret) build-arg because the
  Docker context has no .git.
- release.yml: pass the secret + commit SHA to the build step.
- pnpm-workspace: allow @sentry/cli's build script (native binary, musl).
- ADR 0014 records the BuildKit-secret design, the FSL-1.1 build-time-only
  footprint, and the forker-generic no-op property (per ADR 0001); ADR
  0007's deferral note updated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@SyniRon SyniRon merged commit 1154ba6 into main Jun 3, 2026
2 checks passed
@SyniRon SyniRon deleted the feat/sentry-sourcemaps-releases branch June 3, 2026 03:42
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.

1 participant