Skip to content

chore: insights events (IN-1025) - #1818

Merged
joanagmaia merged 28 commits into
mainfrom
chore/insights-events
Sep 25, 2026
Merged

joanagmaia merged 28 commits into
mainfrom
chore/insights-events

Conversation

@joanagmaia

@joanagmaia joanagmaia commented Apr 6, 2026 •

Copy link
Copy Markdown
Collaborator

Status

Segment dispatch is disabled pending alignment with the analytics team. The $track call in frontend/composables/useTrackEvent.ts is commented out; events continue to persist to the internal events table via /api/events. Re-enable Segment by uncommenting the $track block and the two commented imports in the composable.


This pull request introduces a comprehensive event tracking system to the Insights app, focusing on Community Collections features. It adds an event catalog, a database schema for event storage, and integrates event tracking calls throughout the main collection-related Vue components. The tracking is implemented using the new useTrackEvent composable and catalog-driven event definitions, ensuring consistent analytics for user actions such as creating, updating, deleting, and sharing collections.

Event Tracking Infrastructure

  • Added .claude/skills/event-tracking/SKILL.md, documenting the workflow, file structure, and usage patterns for event tracking in the Insights app. This includes detailed instructions for adding and instrumenting events using the useTrackEvent composable and catalog-driven enums.
  • Introduced .claude/skills/event-tracking/references/events-catalog.md, which catalogs all approved events, their keys, types, and allowed properties for Community Collections. This serves as the source of truth for event instrumentation.
  • Added a new SQL migration V1775900000__createEventsTable.sql to create a normalized events table for tracking user interactions, including indexes for efficient querying.

Instrumentation of Collection Features

  • Integrated trackEvent calls into all major Community Collections flows:
    • Added tracking for creating, duplicating, updating, deleting, and sharing collections, as well as adding projects to collections, using the correct event keys and properties as defined in the catalog. [1] [2] [3] [4] [5] [6]
    • Tracked abandonment events for collection creation, duplication, and editing when modals are closed with unsaved changes. [1] [2]
  • Ensured all tracking calls are placed after successful operations and only use catalog-approved properties, following best practices outlined in the documentation. [1] [2]

Component and Codebase Updates

  • Updated relevant Vue components (add-to-collection-modal.vue, create-collection-modal.vue, edit-collection-modal.vue, details/header.vue) to import and use the new event tracking infrastructure. [1] [2] [3] [4] [5] [6] [7]
  • Minor code cleanup (e.g., fixed duplicated class in list/header.vue).

This foundational work enables robust analytics and paves the way for consistent, catalog-driven event tracking across the Insights frontend.

Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
Copilot AI balanced review requested due to automatic review settings April 6, 2026 17:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a catalog-driven analytics/event tracking system for the Insights “Community Collections” feature set, including a new events API endpoint + DB persistence, plus instrumentation across the main collection flows in the Nuxt/Vue frontend.

Changes:

  • Added server-side infrastructure to accept and persist tracked events (/api/events, repository, DB migration).
  • Introduced a frontend composable (useTrackEvent) and an event catalog/enum definitions to standardize event metadata.
  • Instrumented collection pages and components (view/share/create/update/delete/like/add-to-collection + abandonment events).

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
frontend/server/repo/events.repo.ts New repository to insert tracked events into Postgres
frontend/server/middleware/database.ts Allows DB pool injection for the new /api/events route
frontend/server/api/events/index.post.ts New POST endpoint to receive and store events
frontend/composables/useTrackEvent.ts New client-side composable to fire catalog-defined events
frontend/app/pages/collection/my-collections/index.vue Tracks “view my collections” page event
frontend/app/pages/collection/index.vue Tracks “view discover collections” page event
frontend/app/pages/collection/details/[slug].vue Tracks “view collection” event on details page
frontend/app/pages/collection/curated/index.vue Tracks “view curated collections” page event
frontend/app/pages/collection/community/index.vue Tracks “view community collections” page event
frontend/app/components/shared/types/events/index.ts Aggregates event keys/definitions and shared enums/types
frontend/app/components/shared/types/events/collections.ts Defines Collections event keys + definitions
frontend/app/components/shared/components/like-button.vue Tracks like/dislike events
frontend/app/components/shared/components/collection-list-item.vue Tracks share + delete events from list item
frontend/app/components/shared/components/collection-card.vue Tracks share + delete events from card
frontend/app/components/modules/collection/components/list/header.vue Minor class cleanup
frontend/app/components/modules/collection/components/edit-modal/edit-collection-modal.vue Tracks update + abandonment events in edit modal
frontend/app/components/modules/collection/components/details/header.vue Tracks share + delete from details header
frontend/app/components/modules/collection/components/create-modal/create-collection-modal.vue Tracks create/duplicate + abandonment events in create/duplicate modal
frontend/app/components/modules/collection/components/add-to-collection-modal/add-to-collection-modal.vue Tracks add-project-to-collection event
database/migrations/V1775900000__createEventsTable.sql Adds public.events table + indexes
.claude/skills/event-tracking/SKILL.md Documents conventions/workflow for event tracking in this repo
.claude/skills/event-tracking/references/events-catalog.md Adds the event catalog used as instrumentation source-of-truth

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread frontend/server/repo/events.repo.ts Outdated
Comment thread frontend/app/components/shared/types/events/collections.ts Outdated
Comment thread frontend/app/pages/collection/details/[slug].vue Outdated
Comment thread frontend/server/api/events/index.post.ts Outdated
Comment thread frontend/server/api/events/index.post.ts Outdated
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
@joanagmaia joanagmaia changed the title chore: insights events chore: insights events (IN-1025) Apr 7, 2026
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
@joanagmaia
joanagmaia requested review from epipav and gaspergrom April 7, 2026 10:32
joanagmaia and others added 2 commits April 10, 2026 11:19
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
Signed-off-by: Gašper Grom <gasper.grom@gmail.com>

# Conflicts:
#	frontend/app/components/modules/collection/components/add-to-collection-modal/add-to-collection-modal.vue
#	frontend/app/components/modules/collection/components/create-modal/create-collection-modal.vue
#	frontend/app/components/modules/collection/components/details/header.vue
#	frontend/app/components/modules/collection/components/edit-modal/edit-collection-modal.vue
#	frontend/app/components/modules/collection/components/list/header.vue
#	frontend/app/components/shared/components/collection-card.vue
#	frontend/app/components/shared/components/collection-list-item.vue
#	frontend/app/components/shared/components/like-button.vue
#	frontend/app/pages/collection/details/[slug].vue
#	frontend/app/pages/collection/my-collections/index.vue
Copilot AI review requested due to automatic review settings September 22, 2026 11:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread frontend/server/api/events/index.post.ts Outdated
Comment thread frontend/server/api/events/index.post.ts Outdated
Comment thread frontend/app/components/modules/collection/components/details/header.vue Outdated
Comment thread frontend/app/plugins/analytics.ts Outdated
Comment thread .claude/skills/event-tracking/SKILL.md Outdated
Comment thread .claude/skills/event-tracking/SKILL.md Outdated
Comment thread .claude/skills/event-tracking/SKILL.md Outdated
Comment thread frontend/composables/useTrackEvent.ts Outdated
Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
Copilot AI review requested due to automatic review settings September 22, 2026 11:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

The event endpoint permits identity spoofing, and several tracking paths currently emit missing, dropped, or incorrect analytics data.

Review effort: Balanced
Findings: 2 High severity · 8 Medium severity · 4 Low severity

Open (14)
Previously missed (3)

In code that hasn't changed since last review

Medium severity Buffer analytics events until the plugin is ready

frontend/​composables/​useTrackEvent.ts:36

$track is provided only after the analytics plugin waits for window.load, downloads the CDN script, and initializes it. The new onMounted page events run earlier, so this optional call silently drops their Segment copy. Queue events until analytics is ready or expose a synchronous buffering function.

Medium severity Validate request field types before calling trim

frontend/​server/​api/​events/​index.post.ts:52

The TypeScript annotation does not validate request JSON. A numeric key, type, or name makes .trim() throw before the try, producing a 500 instead of the documented 400. Add runtime type guards before trimming.

Low severity Add ADD_REPO_TO_COLLECTION to the event catalog

.claude/​skills/​event-tracking/​references/​events-catalog.md:25

The code defines ADD_REPO_TO_COLLECTION, but the catalog omits it even though this document is declared the source of truth. Add the event and its allowed repository property shape, then use it for the repository branch of the add-to-collection modal.

- Derive userId from server session instead of client-supplied body
- Suppress DB error details from 500 HTTP response
- Track VIEW_COLLECTION with real collection id via watch({once:true})
  instead of onMounted with slug
- Emit ADD_REPO_TO_COLLECTION (not ADD_PROJECT_TO_COLLECTION) for
  repository additions in add-to-collection modal
- Remove sourceCollectionId from ABANDONED_COLLECTION_DUPLICATION
  (catalog allows no properties for this event)
- Track ABANDONED_COLLECTION_EDITION in closeModal() before form reset
  so Cancel/close buttons capture the event
- Add projects/repositories to changedFields on UPDATE_COLLECTION
- Emit SHARE_COLLECTION after share action fires, not before modal opens
- Fix analytics reset: only call reset() on auth->unauth transition,
  not on every unauthenticated page load
- Type $track without eslint-disable any suppression
- Fix SKILL.md: remove description field, fix import path and
  EventFeature location for new-feature workflow
- Add ADD_REPO_TO_COLLECTION to events catalog

Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
Copilot AI review requested due to automatic review settings September 22, 2026 15:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Resolve the unapproved Segment PII identification, runtime validation gaps, watcher failures, abandonment tracking, and documentation inconsistencies.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 High severity · 2 Low severity

Open (3)
Resolved since last review (1)
Previously missed (2)

In code that hasn't changed since last review

Medium severity Validate source fields before calling trim

frontend/​server/​api/​events/​index.post.ts:72

readBody<T> does not enforce these types at runtime. A public request with numeric source or entrySource reaches .trim() and returns a 500; validate both optional fields and return 400 before normalizing them.

Low severity Align catalog event name with persisted definition

.claude/​skills/​event-tracking/​references/​events-catalog.md:24

The catalog still names this event “Duplicate collections,” while COLLECTIONS_EVENT_DEFINITIONS now uses the singular “Duplicate collection.” Since the catalog is documented as the source of truth, align it with the value actually persisted.

Comment thread frontend/app/plugins/analytics.ts
Comment thread .claude/skills/event-tracking/SKILL.md Outdated
Comment thread frontend/server/api/events/index.post.ts Outdated
…n IN-1025

Use newCollectionId (not collectionId) in SKILL.md examples for
CREATE_COLLECTION — collectionId is stripped server-side by the
allowlist filter. Update the events API JSDoc to reflect that
properties are catalog-filtered, not arbitrary.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
Copilot AI review requested due to automatic review settings September 23, 2026 15:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Resolve the detail-view watcher failure and event API validation gaps before approval.

Review effort: Balanced
Findings: None

Resolved since last review (3)
Previously missed (5)

In code that hasn't changed since last review

Medium severity Reject null properties during runtime validation

frontend/​server/​api/​events/​index.post.ts:57

typeof null is 'object', so this check accepts properties: null despite the documented object contract. Explicitly reject null to keep runtime validation aligned with the endpoint type.

Medium severity Validate optional source fields are strings before trimming

frontend/​server/​api/​events/​index.post.ts:72

The generic passed to readBody does not validate JSON at runtime. A valid-key request with numeric/object source or entrySource reaches .trim() and returns a 500; reject non-string optional values with a 400 first.

Low severity Update module layout to reference base.ts

.claude/​skills/​event-tracking/​SKILL.md:28

This tree says the enums and interface live in index.ts, but they were moved to base.ts. Update the structure so future event work starts from the actual module layout.

Low severity Correct EventKey extension and definition aggregation guidance

.claude/​skills/​event-tracking/​SKILL.md:33

index.ts does not re-export the feature enum or definitions; it imports them and aggregates the definitions. Update this instruction to describe extending EventKey and spreading the definitions, otherwise a future feature may follow a nonexistent export pattern.

Low severity Include required allowedProperties in the example

.claude/​skills/​event-tracking/​SKILL.md:207

EventDefinition requires allowedProperties, so following this new-feature example produces a TypeScript error. Include the required field in the sample.

…ly IN-1025

Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
Copilot AI review requested due to automatic review settings September 24, 2026 16:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

The public endpoint has runtime validation gaps, and several skill examples conflict with the implemented event contract.

Review effort: Balanced
Findings: None

Previously missed (12)

In code that hasn't changed since last review

Medium severity Validate URL fields at runtime before trimming

frontend/​server/​api/​events/​index.post.ts:72

Because this public route only has compile-time body types, numeric or object source values reach .trim() and return a 500. Runtime-check both URL fields and return 400 before trimming them.

Medium severity Add runtime schemas for event property values

frontend/​server/​api/​events/​index.post.ts:77

Allowlisting property names does not validate their values. Public callers can persist objects as collectionId, arbitrary strings as shareMethod, or malformed arrays, corrupting analytics. Add per-event runtime schemas for property value types.

Low severity Include required imports and type in re-enable instructions

.claude/​skills/​event-tracking/​SKILL.md:15

This re-enable instruction is incomplete: the composable also requires its commented useNuxtApp import and TrackFn type. Following the skill as written produces unresolved names.

Low severity Correct the shared types file tree

.claude/​skills/​event-tracking/​SKILL.md:28

This tree incorrectly says index.ts defines the shared enums/interface and omits base.ts. That conflicts with the implementation and will direct future changes to the wrong file.

Low severity Clarify imports and aggregation in the workflow

.claude/​skills/​event-tracking/​SKILL.md:33

This says to re-export both symbols, but index.ts only imports them for the union/aggregate and callers import feature enums directly. Say “import and aggregate” so the workflow matches the shown code.

Low severity Use approved fields in an immediate guarded watcher example

.claude/​skills/​event-tracking/​SKILL.md:138

This example sends viewerType, which is absent from VIEW_COLLECTION.allowedProperties and is silently stripped, and its non-immediate watcher misses SSR-hydrated data. Show a guarded immediate watcher using catalog-approved fields.

Low severity Include allowedProperties in every event definition example

.claude/​skills/​event-tracking/​SKILL.md:207

EventDefinition requires allowedProperties, so following this new-feature example fails TypeScript compilation. Include the required allowlist in every definition sample.

Low severity Align duplicate collection event names

.claude/​skills/​event-tracking/​references/​events-catalog.md:24

The catalog still calls this event “Duplicate collections,” while COLLECTIONS_EVENT_DEFINITIONS now emits “Duplicate collection.” Keep the source of truth aligned so dashboards and future instrumentation use the actual name.

Low severity Clarify callback-order constraint without an em dash

frontend/​app/​pages/​collection/​my-collections/​index.vue:44

The repository convention forbids em dashes in code comments (CLAUDE.md:182). This can state the callback-order constraint more directly.

Low severity Document all required changes to re-enable the block

frontend/​composables/​useTrackEvent.ts:22

Uncommenting only this block leaves useNuxtApp and TrackFn commented, so the documented re-enable step will not compile. Mention all three required changes.

Low severity Clarify server-side constraint without an em dash

frontend/​composables/​useTrackEvent.ts:38

The repository convention forbids em dashes in code comments (CLAUDE.md:182), and this comment should explain the server-side constraint rather than narrate the request.

Low severity Remove em dash from route-contract comment

frontend/​server/​api/​events/​index.post.ts:33

The repository convention forbids em dashes in code comments (CLAUDE.md:182). Rephrase this route-contract explanation without one.

This issue also appears on line 39 of the same file.

…ard IN-1025

Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
Copilot AI review requested due to automatic review settings September 24, 2026 17:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

The public endpoint mishandles malformed URL fields, and several tracking instructions conflict with the implemented catalog.

Review effort: Balanced
Findings: None

Previously missed (4)

In code that hasn't changed since last review

Medium severity Validate source and entrySource runtime types before trimming

frontend/​server/​api/​events/​index.post.ts:84

source and entrySource are only statically typed. A public caller can send a number or object, causing .trim() to throw and return 500 instead of the documented 400. Validate both runtime types before trimming.

Low severity Include useNuxtApp and TrackFn declarations when re-enabling the block

.claude/​skills/​event-tracking/​SKILL.md:15

Re-enabling only this block leaves useNuxtApp and TrackFn commented, so the composable will not compile. Include the two supporting declarations in the instruction, matching the PR status guidance.

This issue also appears in the following locations of the same file:

  • line 24
  • line 121
  • line 129
  • line 204
Low severity Align the catalog name with the singular event definition

.claude/​skills/​event-tracking/​references/​events-catalog.md:24

The catalog name remains plural while COLLECTIONS_EVENT_DEFINITIONS now uses the singular Duplicate collection. Keep the source-of-truth entry aligned with the emitted metadata.

Low severity Rewrite the comment to explain the trust boundary

frontend/​composables/​useTrackEvent.ts:38

Per CLAUDE.md:178-182, this comment narrates the next request and uses a prohibited em dash. Explain the trust boundary instead of restating the call.

Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
… mismatch IN-1025

Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
Copilot AI review requested due to automatic review settings September 25, 2026 10:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Malformed request fields can produce 500 responses, repository additions can be overcounted, and tracking documentation is inconsistent.

Review effort: Balanced
Findings: None

Previously missed (11)

In code that hasn't changed since last review

Medium severity Report only URLs newly added to the collection

frontend/​app/​components/​modules/​collection/​components/​add-to-collection-modal/​add-to-collection-modal.vue:314

When the selection partially overlaps the collection, the update deduplicates URLs but this event reports every selected URL, including repositories already present. Send only URLs actually added so analytics does not overcount additions.

Medium severity Validate source fields before calling trim

frontend/​server/​api/​events/​index.post.ts:84

source and entrySource are only statically typed. A public caller can send a number or object, causing .trim() to throw and return a 500 instead of the documented 400. Validate both fields before trimming.

Low severity Include omitted declarations in rollout instructions

.claude/​skills/​event-tracking/​SKILL.md:15

This rollout instruction also omits the commented useNuxtApp import and TrackFn declaration. Following it literally makes the re-enabled block fail type checking.

Low severity Align documented file tree with implementation

.claude/​skills/​event-tracking/​SKILL.md:28

The documented tree assigns the enums and interface to index.ts, but they now live in base.ts. This contradicts the implementation and can send future contributors to the wrong file.

Low severity Include required allowedProperties in the example

.claude/​skills/​event-tracking/​SKILL.md:207

EventDefinition requires allowedProperties, so the documented new-feature example does not type-check when copied. Include the required field to keep the workflow executable.

Low severity Align catalog and definition event names

.claude/​skills/​event-tracking/​references/​events-catalog.md:24

The catalog says Duplicate collections, while the executable definition records Duplicate collection. Since this file is the stated source of truth, align the name to prevent conflicting analytics documentation.

Low severity Remove em dash from placement rationale

frontend/​app/​pages/​collection/​my-collections/​index.vue:44

Repository comments explicitly prohibit em dashes. Rephrase this placement rationale without one.

Low severity Include all declarations in the re-enable instruction

frontend/​composables/​useTrackEvent.ts:22

The re-enable instruction is incomplete: uncommenting only the $track block leaves useNuxtApp and TrackFn commented, so the composable will not compile. Include both declarations in the instruction.

Low severity Remove em dash from server responsibility comment

frontend/​composables/​useTrackEvent.ts:38

Repository comments explicitly prohibit em dashes. This can state the server-side responsibility directly.

Low severity Remove em dash from anonymous event comment

frontend/​server/​api/​events/​index.post.ts:34

Repository comments explicitly prohibit em dashes. Rephrase this comment while preserving the reason that anonymous events are accepted.

Low severity Remove em dash from fallback explanation

frontend/​server/​api/​events/​index.post.ts:58

Repository comments explicitly prohibit em dashes. Rephrase this fallback explanation without one.

Copilot AI review requested due to automatic review settings September 25, 2026 10:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The public ingestion endpoint still permits unbounded request buffering, untyped property values, and malformed URL fields that produce 500 responses.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 High severity · 7 Low severity

Open (8)

Comment thread frontend/server/api/events/index.post.ts Outdated
Comment thread .claude/skills/event-tracking/SKILL.md
Comment thread .claude/skills/event-tracking/SKILL.md
Comment thread .claude/skills/event-tracking/references/events-catalog.md Outdated
Comment thread frontend/app/pages/collection/my-collections/index.vue Outdated
Comment thread frontend/composables/useTrackEvent.ts Outdated
Comment thread frontend/server/api/events/index.post.ts Outdated
Comment thread frontend/server/api/events/index.post.ts Outdated
- Enforce 20 KB body limit while reading request stream, returning 413
  before JSON parse so oversized payloads never buffer to memory
- Fix em dashes in comments (prohibited by CLAUDE.md)
- Update SKILL.md file tree: base.ts holds enums, index.ts is aggregator
- Add allowedProperties to new-feature EventDefinition example in SKILL.md
- Fix events-catalog.md: DUPLICATE_COLLECTION display name is singular

Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
Copilot AI review requested due to automatic review settings September 25, 2026 11:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Malformed inputs can cause server errors, repository events can over-report additions, and production Segment identification conflicts with the stated rollout status.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
Resolved since last review (8)
Previously missed (6)

In code that hasn't changed since last review

Medium severity Define telemetry retention or partitioning before rollout

database/​migrations/​V1775900000__createEventsTable.sql:2

This high-volume telemetry table stores every event indefinitely, and no retention or partitioning mechanism exists in the repository. The table and all five indexes therefore grow continuously; define a retention/archival or partition strategy before production rollout.

Medium severity Report only newly added repositories in analytics

frontend/​app/​components/​modules/​collection/​components/​add-to-collection-modal/​add-to-collection-modal.vue:314

When some selected repositories already belong to the collection, the update deduplicates them but this event still reports every selected URL as newly added. Filter out existingRepoUrls so the analytics property reflects only repositories added by this operation.

Medium severity Reject null properties in payload validation

frontend/​server/​api/​events/​index.post.ts:89

JSON null passes this typeof === 'object' check and is silently treated as absent later, although the endpoint contract says properties must be an object. Reject null so malformed payloads receive the documented 400 response.

Medium severity Validate source fields are strings before trimming

frontend/​server/​api/​events/​index.post.ts:104

source and entrySource come from an untrusted JSON body, so the TypeScript annotation does not validate them. A payload such as { "source": 42 } throws at .trim() and produces a 500 instead of a validation response; reject non-string values first.

Low severity Include all required uncommented prerequisites

.claude/​skills/​event-tracking/​SKILL.md:15

This rollout instruction omits the commented useNuxtApp import and TrackFn type alias. Following it literally makes the composable fail type-checking, so list all three pieces that must be uncommented.

Low severity Document all prerequisites for re-enabling the block

frontend/​composables/​useTrackEvent.ts:22

This instruction is incomplete: uncommenting only the block leaves useNuxtApp and TrackFn undefined because lines 3 and 7 remain commented. Include both prerequisites so the documented re-enable procedure compiles.

Comment thread frontend/server/api/events/index.post.ts
@joanagmaia
joanagmaia merged commit 5943f86 into main Sep 25, 2026
13 checks passed
@joanagmaia
joanagmaia deleted the chore/insights-events branch September 25, 2026 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants