Skip to content

WIP: feat(cache): consent-aware event caching#1542

Draft
jpnurmi wants to merge 3 commits intojpnurmi/feat/http-retryfrom
jpnurmi/feat/cache-consent
Draft

WIP: feat(cache): consent-aware event caching#1542
jpnurmi wants to merge 3 commits intojpnurmi/feat/http-retryfrom
jpnurmi/feat/cache-consent

Conversation

@jpnurmi
Copy link
Collaborator

@jpnurmi jpnurmi commented Feb 25, 2026

  • When require_user_consent and cache_keep are both enabled, cache envelopes to disk instead of discarding them when consent is not given
  • Write consent-revoked envelopes in retry format so they are automatically sent once consent is granted
  • Retry system checks user_consent before sending cached envelopes
  • No automatic retry when granting consent — call sentry_transport_retry() to trigger sending

Close: #1521

Instead of discarding envelopes when user consent is not given, write
them to <database>/cache/ when cache_keep is enabled. For old runs,
extend can_cache to also apply when consent is missing, so envelopes
are moved to cache instead of being discarded.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jpnurmi jpnurmi force-pushed the jpnurmi/feat/cache-consent branch from b73bccd to 680a83e Compare February 26, 2026 09:30
jpnurmi and others added 2 commits February 26, 2026 10:41
Consent-revoked envelopes were cached as `<uuid>.envelope` which
`sentry__retry_send()` skips (filename ≤45 chars). Write them in
retry format (`<ts>-<count>-<uuid>.envelope`) so they're picked up
when consent is later given.

- Add `retry_count` param to `write_envelope()`, `sentry__run_write_cache()`,
  and `sentry__run_move_cache()`: >= 0 produces retry format, -1 plain format
- Add lock-free consent check to `sentry__retry_send()` using stored
  `user_consent` pointer (same pattern as the batcher)
- Make `sentry__retry_write_envelope` static; remove from public header
- Skip `sentry__capture_envelope()` in `process_old_runs` when consent missing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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