You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: add the event mapping page to the admin panel - #5469
Admins only. The tab badge shows how many events still need a decision.
Status tabs with counts: Best match, Unresolved, Confirmed, Ignored. A platform filter sits above them (All platforms, Sessionize).
Each row shows the event and its dates, the platform, the match badge with its evidence (or the reason there is no suggestion), the project with its project group, and the actions.
Actions: Confirm, Ignore, change the project through a picker, "Use " when the rules found a close event they did not accept, Confirm selected for several rows, Undo on a confirmed row and Restore on an ignored one.
Undo is replaced by "Loading started" once the event has a sync unit.
A picked project that is not confirmed yet lives in the page only. It survives Undo, Restore and Ignore, with the "Picked manually" badge.
Failed loads show an error with a retry. They are never shown as an empty list.
After a decision the list is refetched, and the buttons stay disabled until it is fresh.
Project picker
The picker has its own small endpoint, GET /event-mapping/projects (permission eventMappingRead, Zod-validated search, limit, offset), backed by searchActiveSubprojectsForMapping in the data-access layer.
It returns active projects with the project group name taken from the project group itself, ordered by project group and then project name, so the grouped list stays in order as more pages load.
The search matches the project name or the project group name.
The existing "lite" project query was not reused: it pages by project name only, and 56 of the 12,885 active projects have no stored group name in the column it reads.
Differences from the design
The page follows the design for layout, copy and behaviour. Where the design and the shared components or theme tokens differ, the shared ones win:
Element
Design
This page
Cause
Match badges
Amber, blue, grey, orange
Best match and sub-event blue, unresolved yellow, manual pick gray
lf-pill types; the kit has no orange
Status tabs
Underlined
Highlighted
lf-tabs
Platform filter
Segmented control
Dropdown
Same control as the Integrations status page
Section heading
18 px
16 px
Theme heading scale (h6)
"Select project"
Full cell width
Natural width
lf-popover trigger
Project picker
Expands in the cell
Popover with the dropdown look
lf-popover, dropdown tokens
"Use "
Dashed border
Ghost button
lf-button
Colours, paddings
Design's own values
Theme tokens
Theme
Other agreed differences: no Credly option in the platform filter (no data yet), no event search box, and the extra unresolved reasons the API returns ("Not checked yet", "Project not in CDP").
44 frontend unit tests (labels, evidence texts, page state helpers), 58 backend handler tests and 28 data-access-layer database tests pass. Lint, type check and build pass.
The page was checked at 1440 px against the design in a local preview with mocked requests. It has not been tested against a real backend with an Auth0 login.
Known limits
The tab badge loads the full list to show one number. The list holds about 100 rows today.
One line in frontend/src/shared/queries/invalidate.ts is re-wrapped by the pre-commit prettier hook.
The table's minimum width uses one arbitrary value (min-w-[1040px]); the theme has no equivalent token.
"Confirm selected" sends every selected row in one request, and the endpoint accepts at most 200. There is no select-all, so this needs more than 200 manual ticks.
A search longer than 100 characters pasted into the picker is refused by the endpoint and shows as a load failure.
The picker search reads from the primary database; the replica would do, since a decision does not change projects.
The picker panel repeats the shared dropdown's classes rather than referencing its class name.
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You have signed the CLA already but the status is still pending? Let us recheck it.
Medium Risk
Introduces a new admin workflow that drives confirm/ignore/restore mapping decisions and a new paginated project search query; gated by admin role and eventMappingRead, but mistakes affect how Sessionize events link to projects.
Overview
Adds an Event mapping tab to the admin panel (admins only), including a badge with the count of events still needing a decision.
The new page lets reviewers filter by platform and status (Best match, Unresolved, Confirmed, Ignored), inspect match badges and evidence, pick or change CDP projects via a searchable infinite-scroll picker, and Confirm, Ignore, Restore/Undo, or bulk Confirm selected. Client-side state tracks manual picks and “Just now” decision notes until the list refetches.
Backend adds GET /event-mapping/projects (eventMappingRead, Zod-validated search/limit/offset) and searchActiveSubprojectsForMapping in the data-access layer (active subprojects with group name from the grandparent segment, ordered by group then project, ILIKE search with safe %/_ handling). The frontend wires TanStack Query keys, invalidation, API helpers, row/picker components, and shared label/evidence helpers, with broad unit and handler/DB test coverage.
Reviewed by Cursor Bugbot for commit 2b3d584. Bugbot is set up for automated code reviews on this repo. Configure here.
@mbani01 I'm starting review 1 of this pull request now (started 2026-11-27 17:17 UTC using review agent v0.1.34). This usually takes a few minutes. I'll update this comment with the summary when I'm done. If there's no summary here after about 45 minutes, the review stopped: push a new commit, or post a comment that begins with a mention of me followed by re-review, to start another. For help with the review agent, see https://github.com/linuxfoundation/lfx-review-agent/issues.
Hi Mouad BANI, thanks for the detailed PR description and the tests that come with it.
Summary
This adds an admin-only "Event mapping" tab where Sessionize events can be confirmed, ignored, restored or re-mapped through a project picker. It also adds the GET /event-mapping/projects endpoint and its data-access query. The code is consistent with the repository's conventions, with no findings.
Decision
✅ Approved
Details
Overall impression: The new endpoint checks eventMappingRead before reading anything, validates search, limit and offset with Zod, and the query binds its parameters and escapes % and _ in the search text. On the page, a failed load shows an error with a retry instead of an empty list, and the tab is rendered only for admins. The helper, label and handler tests, and the database tests for the new query, cover the main cases.
Other reviewers and CI checks: Greptile raised one P2 point: if a decision succeeds but the list refetch fails, the old buttons become enabled again and there is no retry control, because cached rows exist. It is a non-blocking edge case, and I did not repeat it as a finding. The required DCO check passed on 8d127b1.
Documentation reminder: changed /event-mapping/projects, Event mapping. Please check product pages and external docs; the author and maintainers own those updates.
The reason will be displayed to describe this comment to others. Learn more.
No blocking or minor findings. The new picker endpoint is permission-checked and Zod-validated, the new query escapes % and _ in the search text, and the page keeps failed loads out of the empty state. The required DCO check passed on this commit.
Documentation
This pull request changes behavior that may also be described outside this repository, such as product pages or an external docs site. I can't read those, so please check them; the author and maintainers own those updates. Changed here:
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Failed refreshes leave stale actions available, later-page fetch errors lack a retry, and project options and bulk-selection checkboxes have unresolved keyboard and screen-reader accessibility issues.
@mbani01 I'm starting review 2 of this pull request now (started 2026-11-27 17:28 UTC using review agent v0.1.34). This usually takes a few minutes. I'll update this comment with the summary when I'm done. If there's no summary here after about 45 minutes, the review stopped: push a new commit, or post a comment that begins with a mention of me followed by re-review, to start another. For help with the review agent, see https://github.com/linuxfoundation/lfx-review-agent/issues.
Hi Mouad BANI, thanks for addressing the earlier feedback so quickly.
Summary
This push makes a failed list refresh lock the row actions and show a retry. It also adds a retry for failed later pages in the project picker and gives the row checkboxes accessible names. The change is small and well tested, and I found no new issues.
Decision
✅ Approved
Details
Overall impression: The new listState helper separates a failed first load from a failed refresh. While a refresh has failed, actionsLocked disables every row action, the checkboxes and "Confirm selected", and the retry calls refetch(). The picker keeps the loaded projects and offers a retry for the next page. The listState unit test covers the four states. The earlier review's change to the new endpoint and query is unchanged.
👏 Nice work: Locking the actions on a failed refresh and keeping the rows visible keeps the reviewer's place and stops a repeated decision. The hidden "Select " label gives each checkbox a name even though LfCheckbox does not forward attributes to its input.
Revision tracking:
✅ Resolved: Greptile's "Failed refresh leaves stale actions" and Copilot's "Hide stale rows and show retry after mutation refresh fails", fixed in 2b3d584.
✅ Resolved: Copilot's "Show retry for failures loading later project pages", fixed in 2b3d584.
✅ Resolved: Copilot's "Add accessible names to bulk-selection checkboxes", fixed in 2b3d584.
ℹ️ Not changed by the author: Copilot's "Make project dropdown options keyboard accessible". The author replied that keyboard support belongs in the shared LfDropdownItem, which other dropdowns use the same way. It is an existing limitation of a shared component, so I did not raise it as a finding. Please track it separately.
Other reviewers and CI checks: Greptile's second pass reports no new issues. The required DCO check passed on 2b3d584.
Documentation reminder: changed Could not refresh the list., Could not load more projects.. Please check product pages and external docs; the author and maintainers own those updates.
The reason will be displayed to describe this comment to others. Learn more.
No blocking or minor findings in the new commit. A failed list refresh now locks the row actions, the checkboxes and "Confirm selected" and shows a retry, the project picker shows a retry when a later page fails, and the row checkboxes have accessible names. The required DCO check passed on 2b3d584.
Documentation
This pull request changes behavior that may also be described outside this repository, such as product pages or an external docs site. I can't read those, so please check them; the author and maintainers own those updates. Changed here:
Could not refresh the list. (new message with a retry on the event mapping page)
Could not load more projects. (new message with a retry in the project picker)
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The pagination query incorrectly reports total: 0 when the offset reaches or exceeds the matching project count, requiring a count fallback and a database test for this boundary.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Preserve total count when offset yields an empty page
When the offset reaches or exceeds the number of matching projects, the window-count query returns no rows and this reports total: 0. For example, three matches with offset=3 should return an empty page with total: 3. Obtain the count independently when a nonzero offset returns an empty page, and add a database test for this boundary.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds
Last PR for the review of held Sessionize events: the "Event mapping" tab in the admin panel.
#5463, #5465, #5467 and #5468 are merged; this branch is rebased on
main.Refs linuxfoundation/lfx-cdp-insights-ops#1158
The page
Admins only. The tab badge shows how many events still need a decision.
Project picker
The picker has its own small endpoint,
GET /event-mapping/projects(permissioneventMappingRead, Zod-validatedsearch,limit,offset), backed bysearchActiveSubprojectsForMappingin the data-access layer.Differences from the design
The page follows the design for layout, copy and behaviour. Where the design and the shared components or theme tokens differ, the shared ones win:
lf-pilltypes; the kit has no orangelf-tabsh6)lf-popovertriggerlf-popover, dropdown tokenslf-buttonOther agreed differences: no Credly option in the platform filter (no data yet), no event search box, and the extra unresolved reasons the API returns ("Not checked yet", "Project not in CDP").
Files that need a code owner
services/libs/data-access-layer/src/segments/index.ts(one added function).Tests
44 frontend unit tests (labels, evidence texts, page state helpers), 58 backend handler tests and 28 data-access-layer database tests pass. Lint, type check and build pass.
The page was checked at 1440 px against the design in a local preview with mocked requests. It has not been tested against a real backend with an Auth0 login.
Known limits
frontend/src/shared/queries/invalidate.tsis re-wrapped by the pre-commit prettier hook.min-w-[1040px]); the theme has no equivalent token.