Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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

未关闭
#2,944 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
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 小时
30 天内合并 PR
77

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

codebar/planner 的其他 Issue

查看 codebar/planner 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。