Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Replace the Auditor write path with MemberActivityRecorder — one funnel for activity rows

Đang mở
#2,944 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
72/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rails, ruby
Lĩnh vực
backend

Hướng nghiên cứu

Start by reading MemberActivityRecorder and app/services/auditor.rb, then trace the two Auditor::Audit call sites in ContactPreferencesController and Admin::SponsorsController. Check Sponsor's activities helper and the listed direct activity reads before changing the write path. Done means one PublicActivity::Activity creation location, preserved sponsor-consent activity keys, reported recorder failures, and removal of app/services/auditor.rb.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

refactoring tech debt

Problem

MemberActivityRecorder describes itself as the "single funnel for member-activity rows" and is used by ~18 controllers and services. But writes to PublicActivity::Activity still happen through two different wrappers:

  1. MemberActivityRecorder.record(actor:, key:, trackable:, recipient:) — validates keys against a KEYS vocabulary, never raises (logs failures via Rails.logger.warn).
  2. Auditor::Audit (app/services/auditor.rb) — ad-hoc wrapper, passes parameters: (a changes hash or {note: ...}), used only by:
    • ContactPreferencesController#audit_contact_subscription
    • Admin::SponsorsController#audit_contact_subscription
    • Sponsor includes Auditor::Model for a read-only #activities helper

Both write the same table with the same columns. Two funnels means inconsistent key vocabularies, no key validation on the Auditor path, and duplicate machinery.

(Direct reads of PublicActivity::Activity — Admin::MembersController, Admin::Members::ActivityStrip, SubscriptionTombstoneBackfill — are fine as-is; only writes need one funnel.)

Proposed change

  • Extend MemberActivityRecorder to accept the one thing Auditor has that it lacks: parameters (the note/changes payload).
  • Re-point the two Auditor::Audit.new(...) call sites at MemberActivityRecorder.record, registering their sponsor.contact_subscribe / sponsor.contact_unsubscribe keys in KEYS.
  • Failure policy: keep the recorder's swallow-and-continue behaviour, but report failures with Rails.error.report instead of Rails.logger.warn so they reach Rollbar (same pattern as ApplicationJob). Raising by default was considered and rejected: recording is a side effect and must not turn a completed user action into a 500.
  • Move Sponsor#activities (the only useful part of Auditor::Model) to where it's used, and delete app/services/auditor.rb.

Acceptance

  • PublicActivity::Activity.create is called in exactly one place: MemberActivityRecorder.
  • Sponsor contact-consent changes still appear in the sponsor's activity trail with the same keys.
  • Recorder failures surface in Rollbar.
  • app/services/auditor.rb deleted.
Ngôn ngữ chính
Ruby
Star
104
Fork
205
Merge trung bình
1 ngày 4 giờ
Pull request đã merge (30 ngày)
77

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của codebar/planner

Tất cả issue của codebar/planner

Issue tương tự

Thêm issue về Ruby

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.