Skip to content

JM: Reach the person history through records that hang off a person - #2354

Open
maebeale wants to merge 1 commit into
mainfrom
maebeale/person-history-reach
Open

JM: Reach the person history through records that hang off a person#2354
maebeale wants to merge 1 commit into
mainfrom
maebeale/person-history-reach

Conversation

@maebeale

@maebeale maebeale commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

🤖 suggested review level: 3 Read 📖 contained: ten resource types added to one query service, no schema change

Part of #2251.

Reach, not tracking

AhoyTrackable already covers every model, so a person's history isn't missing events — it's missing routes to them. Analytics::PersonActivityEvents maps person → ids per resource_type, and records that connect to a person only through a parent were absent from that map.

Nothing needs backfilling: the mapping is read-time, so it covers everything already recorded.

Ten types added

  • Registration childrenEventRegistrationChecklistCompletion, EventRegistrationOrganization, EventAttendanceTimeEntry
  • StaffingEventStaff
  • MoneyAllocation (through registration / CE registration / membership invoice), Refund (recipient, or reversing one of their payments), MembershipInvoice
  • FormsFormAnswer, plus the Asset uploads those answers own
  • ScholarshipsScholarshipAgreementResponse

Repeated subqueries (registration / submission / payment / scholarship ids) are memoized rather than rebuilt inline.

How to test

  1. ai/server, sign in as an admin.
  2. Act on something that reaches a person through a registration — add a payment/allocation, tick an onboarding checklist step, upload a form answer file.
  3. Open /people/:id/editAssociated recordsHistory, or /admin/activities/events?person_id=:id&time_period=all_time&audience[]=visitors&audience[]=users&audience[]=staff.
  4. Look at the Activity column for create.allocation, update.event_registration_checklist_completion, create.form_answer, create.asset. On main none of those can reach a person's history no matter how many exist.

Scope: all ten, decided

Keeping the full set, including the mechanical ones (create.allocation, update.event_registration_checklist_completion, update.event_attendance_time_entry). The history is meant to be complete; filtering for readability belongs in the UI, not in what reaches the page.

Note on the approach

This reaches the records at read time — the relation is an OR of ~33 subqueries, bounded per person. #2251 sketches a denormalized tag table instead; that's a different mechanism for a wider problem (event and organization timelines), and not a blocker here.

@maebeale

Copy link
Copy Markdown
Collaborator Author

🤖 From Claude: Scope decided — keeping all ten resource types rather than trimming to the money/forms subset. Completeness over scannability; filtering belongs in the UI. The read-time traversal question against #2251 is still open.

PersonActivityEvents maps person -> ids per Ahoy resource_type, and records that
connect to a person only through a parent were absent from that map. Their
events are recorded — AhoyTrackable covers every model — they just had no route
to a person: the registration's children, the money ledger, form answers and
their uploads, and scholarship agreement responses.

Ten types added. Nothing needs backfilling; the mapping is read-time, so it
covers everything already recorded.

Part of #2251.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@maebeale
maebeale force-pushed the maebeale/person-history-reach branch from 7784396 to 1a2ce63 Compare August 23, 2026 21:29
@maebeale
maebeale marked this pull request as ready for review August 24, 2026 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant