Skip to content

eng: add lint rule requiring explicit writing connections ECOMM-11653#53

Open
tahoemph wants to merge 1 commit into
masterfrom
eng/require-writing-connection-cop/ECOMM-11653
Open

eng: add lint rule requiring explicit writing connections ECOMM-11653#53
tahoemph wants to merge 1 commit into
masterfrom
eng/require-writing-connection-cop/ECOMM-11653

Conversation

@tahoemph

Copy link
Copy Markdown
Member

Summary

  • Adds Dutchie/RequireWritingConnection, a RuboCop cop that flags AR write calls (create, save, update, destroy, touch, etc.) not wrapped in connected_to(role: :writing).
  • Scoped via Include in config/default.yml to app/services/**/queries/**/*.rb plus app/models/plus_api_key.rb and app/models/plus_enterprise_api_key.rb — the places already known to contain code reachable from GET requests (which ActiveRecord::Middleware::DatabaseSelector routes to a read replica by default).
  • Bumps gem version to 2.2.0.
  • Follows from INC-1554 (Armageddon increased 500s from RDS failover).

Testing

bundle exec rspec

Adds Dutchie/RequireWritingConnection, scoped to app/services/**/queries/**
and the two PlusApiKey models, to flag write calls not wrapped in
connected_to(role: :writing). Bumps gem to 2.2.0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant