Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン
#2,944 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
72/100
issue の種類
リファクタリング
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rails, ruby
領域
backend

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.
主要言語
Ruby
スター
104
フォーク
205
平均マージ
1日 4時間
マージ済み PR(30日)
77

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

codebar/planner のほかの issue

codebar/planner の issue をすべて見る

似ている issue

Ruby の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。