Record feature deletions in global history by michal-granec · Pull Request #200 · fetlife/rollout · GitHub
Skip to content

Record feature deletions in global history - #200

Merged
michal-granec merged 2 commits into
masterfrom
feature/global-delete-history-event
Oct 1, 2026
Merged

michal-granec merged 2 commits into
masterfrom
feature/global-delete-history-event

Conversation

@michal-granec

@michal-granec michal-granec commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Record deletions as global history events for existing features when global logging is enabled, carrying the current logging context (e.g. actor).
  • Adapters implement delete_feature_with_history(name, event:, history_length:); event is nil when global logging is off or suppressed.
    • ActiveRecord: feature removal, per-feature history removal, and the global event are written in one transaction (savepoint).
    • Redis: plain commands, no Lua. DEL's return value decides whether the feature existed, so concurrent deletes record one event. Like the adapter's other writes, the steps are not atomic as a group; this keeps it Redis Cluster–safe.
  • Adapters without delete_feature_with_history keep the previous deletion behavior (no event), since rollout 3.1 is released and adapter gems version independently. The fallback can be dropped in 4.0.
  • Cover deletion logging, retention, registry removal, rollback, and cache invalidation; document lifecycle behavior.

Testing

  • Core: 62 examples; all pass except feature_state_spec BigDecimal on Ruby 3.4 (pre-existing, bigdecimal not a default gem).
  • Redis adapter: 150 examples, 0 failures.
  • ActiveRecord adapter: 112 examples, 0 failures.

🤖 Generated with Claude Code

- Flatten Rollout#delete; built-in adapters receive event: nil when
  global logging is off, keeping the legacy fallback for older adapters.
- Redis: replace the Lua script with plain commands, using DEL's return
  value as the existence check. Matches the adapter's existing
  consistency model and avoids CROSSSLOT on Redis Cluster.
- Active Record: detect existence via delete_all instead of lock + load.
- Split the combined core spec, drop the stubbed transaction spec, and
  assert registry removal in the history contract.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@michal-granec
michal-granec merged commit a3faf77 into master Oct 1, 2026
24 checks passed
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