Replace the Auditor write path with MemberActivityRecorder — one funnel for activity rows
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
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 内容生成。
描述
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:
MemberActivityRecorder.record(actor:, key:, trackable:, recipient:)— validates keys against aKEYSvocabulary, never raises (logs failures viaRails.logger.warn).Auditor::Audit(app/services/auditor.rb) — ad-hoc wrapper, passesparameters:(a changes hash or{note: ...}), used only by:ContactPreferencesController#audit_contact_subscriptionAdmin::SponsorsController#audit_contact_subscriptionSponsorincludesAuditor::Modelfor a read-only#activitieshelper
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
MemberActivityRecorderto accept the one thingAuditorhas that it lacks:parameters(the note/changes payload). - Re-point the two
Auditor::Audit.new(...)call sites atMemberActivityRecorder.record, registering theirsponsor.contact_subscribe/sponsor.contact_unsubscribekeys inKEYS. - Failure policy: keep the recorder's swallow-and-continue behaviour, but report failures with
Rails.error.reportinstead ofRails.logger.warnso they reach Rollbar (same pattern asApplicationJob). 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 ofAuditor::Model) to where it's used, and deleteapp/services/auditor.rb.
Acceptance
PublicActivity::Activity.createis 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.rbdeleted.
- 主要语言
- Ruby
- 星标
- 104
- 派生
- 205
- 平均合并
- 1 天 4 小时
- 30 天内合并 PR
- 77
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
codebar/planner 的其他 Issue
-
enhancement
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 56/100
维护者通常 1 天内回复
-
InvitationManager silently no-ops on non-invitable events/workshops while controllers flash success未关闭bug
难度 3/5 1-2 天 新手友好度 72/100
维护者通常 1 天内回复
-
refactoring tech debt
难度 3/5 1-2 天 新手友好度 68/100
维护者通常 1 天内回复
相似的 Issue
-
难度 1/5 1-3 小时 新手友好度 78/100
TheOdinProject/curriculum#31433 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 68/100
endoflife-date/endoflife.date#11194 ·
维护者通常 1 天内回复
-
难度 1/5 1-3 小时 新手友好度 84/100
-
难度 2/5 1-3 小时 新手友好度 84/100