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

Ahoy lifecycle tracking silently drops changes made with no Current actor

Đang mở
#2,351 1 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
52/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
ruby
Lĩnh vực
backend

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ả

bug

🤖 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::CalloutsController does skip_before_action :authenticate_user! and never sets Current.source, so a logged-out recipient accepting or declining their agreement produces no Ahoy event. The bespoke scholarship_agreement_responses log 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::LifecycleBuffer only flushing in ApplicationController's after_action, so a buffered event outside a request is never written.

Recommendation

Close the request-shaped hole narrowly rather than removing the guard.

  1. Default a source for every actorless request — one line in ApplicationController: set Current.source when 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.
  2. Opt non-request contexts in explicitly — jobs, webhooks, and rake tasks set their own Current.source ("stripe_webhook", "job:x"), and LifecycleBuffer needs a flush path that doesn't depend on a controller.
  3. 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

Mở trong Codespaces

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.

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 rubyforgood/awbw

Tất cả issue của rubyforgood/awbw

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.