Ahoy lifecycle tracking silently drops changes made with no Current actor
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
- 52/100
Hướng nghiên cứu
Bắt đầu trong ApplicationController, Events::CalloutsController và Analytics::LifecycleBuffer để theo dõi cách Current.source được thiết lập và thời điểm các sự kiện vòng đời được flush. Tái hiện flow scholarship agreement khi đã đăng xuất và một lần ghi model bên ngoài một request, sau đó thêm các specs tập trung cho thấy action công khai được gán nguồn và hành vi ngoài request được xử lý một cách rõ ràng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
🤖 From Claude:
AhoyTrackable (included in ApplicationRecord) tracks create/update/destroy for every model, but track_lifecycle_event opens with:
return unless Current.user || Current.source
Current.user is only set for a signed-in request (ApplicationController#set_current_user), and Current.source is set in exactly two places (public_forms_controller, events/public_registrations_controller). Everything else that writes without a signed-in user leaves no trace at all — no event, no error, no log line.
Verified
Calling scholarship.accept_agreement!(by: "recipient") with no actor set:
| Actor | Buffered events |
|---|---|
| none | [] |
Current.user set |
update.scholarship, create.scholarship_agreement_response |
Current.source set |
update.scholarship, create.scholarship_agreement_response |
Where this bites today
- Scholarship accept/decline on the public callout.
Events::CalloutsControllerdoesskip_before_action :authenticate_user!and never setsCurrent.source, so a logged-out recipient accepting or declining their agreement produces no Ahoy event. The bespokescholarship_agreement_responseslog is currently the only record of it. - Anything outside a request — jobs, rake tasks, console, webhooks (Stripe). These are dropped twice over: the actor guard, and
Analytics::LifecycleBufferonly flushing inApplicationController'safter_action, so a buffered event outside a request is never written.
Recommendation
Close the request-shaped hole narrowly rather than removing the guard.
- Default a source for every actorless request — one line in
ApplicationController: setCurrent.sourcewhen there's no signed-in user, so any public flow (present or future) is covered without each controller having to remember. Named per controller where it matters, generic otherwise. - Opt non-request contexts in explicitly — jobs, webhooks, and rake tasks set their own
Current.source("stripe_webhook","job:x"), andLifecycleBufferneeds a flush path that doesn't depend on a controller. - Don't just delete the guard. Seeds, imports, and the test suite would start emitting events in volume, which is presumably why it's there.
Acceptance
- A logged-out recipient accepting a scholarship agreement produces an Ahoy event attributed to a named source.
- A model write inside a job produces an event (or is a documented, deliberate exclusion).
- Specs cover both, so the guard can't silently re-open the hole.
- Ngôn ngữ chính
- Ruby
- Star
- 15
- Fork
- 28
- Merge trung bình
- 1 ngày 12 phút
- Pull request đã merge (30 ngày)
- 262
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của rubyforgood/awbw
-
blocked
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
rubyforgood/awbw#2824 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
rubyforgood/awbw#2822 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
rubyforgood/awbw#2160 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Update callout faq defualt text when the new person subscription launchesCó thể đã có người làm @maebeale đã nhận 80 ngày trước. Đang mởblocked
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
rubyforgood/awbw#2095 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
rubyforgood/awbw#2088 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của rubyforgood/awbw
Issue tương tự
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
alphagov/tech-docs-gem#580 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Onboarding form: instructor radio never pre-selected "Yes" (permission vs permissions typo)Có thể đã có người làm @ThakuraAnki đã nhận hôm nay. Đang mởbug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
WikiEducationFoundation/WikiEduDashboard#7235 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
zerocracy/judges-action#3021 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Missing de translation: components/common/CommunitySolution.tsx:communitySolution.passesLatestTestsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 63/100
hitobito/hitobito_bdp#58 ·