Skip to content

feat: parse and check sessionize exports - #5447

Open
mbani01 wants to merge 5 commits into
mainfrom
feat/issue-1156-sessionize-event-export
Open

mbani01 wants to merge 5 commits into
mainfrom
feat/issue-1156-sessionize-event-export

Conversation

@mbani01

@mbani01 mbani01 commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

What this adds

A parser and checker for the Sessionize organizer exports. It takes a spreadsheet that is already read into memory and returns the rows the connector needs, or it fails with a contract error. Nothing calls it yet: the sync that uses it comes in the next PR, so merging this loads nothing.

Behaviour

  • Two exports. "All sessions" (worksheet Sessions and speakers) and "Accepted" (worksheet Accepted sessions and speakers). Each has its own list of required columns. A wrong worksheet name or a missing required column is a contract error.
  • Co-speakers. The export has one row per speaker. Rows with the same Session Id are one session, and a co-speaker row takes the status and submission date of the session's first row.
  • Session Id spelling. A text cell made of digits is read like a number cell, so 0501 and 501 are the same session.
  • Checks. Session Id must be a number, Speaker Id a GUID, the status one of the six known values, and date cells real dates. A duplicate (session, speaker) pair is an error. Any failure rejects the whole file, so nothing is loaded from a file that changed shape.
  • Skipped rows. Rows with the standard test title and rows with no speaker are dropped and counted.
  • Empty export. An event with no sessions returns a worksheet with no header row. It now parses as zero rows and is not an error.
  • Times. Export times are kept as written, with no time zone conversion.
  • Privacy. Only contract columns are read. Columns such as gender identity or country of residence are never read. No cell content appears in an error message.
  • Drift warnings. A comparison with the last good run reports a missing optional column, a drop in the email or LinkedIn fill rate, a drop in the row count, and a duplicated optional column.

The rules follow the format measured on the production exports of 153 events (68,846 rows).

Tests

191 tests pass for the Sessionize connector folder and the export probe. Fixtures use made-up data only.

Known small point

A duplicated optional column gives two warnings, one of them a false "missing column". It is fixed in the next PR.

Refs linuxfoundation/lfx-cdp-insights-ops#1156

@mbani01
mbani01 requested review from a team and lfx-one as code owners November 26, 2026 09:39
Copilot AI balanced review requested due to automatic review settings November 26, 2026 09:39
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
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.

@cursor

cursor Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
Adds isolated parsing/validation code with broad test coverage and no production integration in this PR; the only behavioral change is softer handling of headerless empty worksheets.

Overview
Introduces parseSessionizeExport (exportRows.ts) to turn an in-memory Sessionize spreadsheet into normalized session/speaker rows for all vs accepted exports, with strict column contracts, co-speaker session merging, test-submission and no-speaker skips, and compareWithLastGoodRun drift warnings (columns, fill rates, row count). Nothing in the worker/sync calls it yet—tests only.

readExportSheet no longer fails when row 1 has no headers: those workbooks return empty headers/rows, and the parser treats that as a zero-row export instead of a contract error. Probe/sheet tests were updated for empty exports and for rejecting data under a blank header row (not merely a missing header).

Reviewed by Cursor Bugbot for commit c63a853. Bugbot is set up for automated code reviews on this repo. Configure here.

@lfx-one

lfx-one commented Nov 26, 2026 •

Copy link
Copy Markdown

@mbani01 I'm starting review 1 of this pull request now (started 2026-11-26 09:39 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 clear PR description and the thorough tests.

Summary

This PR adds an in-memory parser and checker for the two Sessionize organizer exports, plus drift warnings against the last good run. It also makes readExportSheet accept a worksheet with no header row as an empty export. The code is clean and well tested. The main concern is that co-speaker rows can override the session's first-row status and date.

Decision

⏸️ Not approved, new commits pushed during review

🟡 2 minor · ⚪ 1 nit · ❔ 1 question

Commits pushed after 3df3b6f were not reviewed (the head is now 2527283). The next push, a comment that begins with a mention of me followed by re-review, or converting the PR to a draft and marking it ready again starts a follow-up review that covers them.

Details

Overall impression: This is a focused parser with a strict contract. It rejects the whole file on any shape change, and error messages carry no cell content. Only contract columns are read, and sensitive headers are reported by name only. That matches the privacy goals in the description. The empty-export change in exportFile.ts is small and has tests: values under an empty header row are still rejected. The two minor findings are both gaps between the PR text and the code: co-speaker rows inherit the first row's session values, and duplicates are detected by Speaker Id, case-insensitively. Greptile and Copilot flagged the same two points, and Copilot also raised the adjacency question. This review covers 3df3b6f only. The head moved to 2527283 during the review, and those commits were not reviewed.

🟡 Minor: 2 issues: Co-speaker rows can override the session's first-row values, The duplicate (session, speaker) check is case-sensitive on the GUID
⚪ Nit: 1 issue: The 'race' header word matches unrelated headers
❔ Question: 1 item: Are a session's speaker rows always adjacent in the export?

Other reviewers and CI checks: Greptile (co-speaker overwrite) and Copilot (co-speaker overwrite, non-adjacent rows, GUID casing) raised the same points. They are incorporated above and not duplicated. The required DCO check passed on 3df3b6f. I did not re-read the checks for 2527283.

Unread files: none.

Rule files: read AGENTS.md, .claude/rules/commit-workflow.md, .claude/rules/skill-guidance.md, .claude/rules/adr-format.md; skipped CONTRIBUTING.md (read, but it adds nothing for this change)

Questions, problems, or feedback: https://github.com/linuxfoundation/lfx-review-agent/issues

@greptile-apps

greptile-apps Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Confidence Score: 4/5 · Update PR #5452’s warning test before merging the stack.RetriggerView in GreptileConfidence Score: 4/5

[Low impact] The changes stay within Sessionize export parsing and its probe tests.

Update PR #5452’s warning test before merging the stack.

FindingsFix All in Claude CodeFindings

  1. P1 Dependent warning test fails ▶
Fix with agent prompt
### Issue 1
services/libs/connectors/src/connectors/sessionize/exportRows.ts:449-452
Removing `sensitive_column` breaks the warning test in PR #5452. At `1656f179f4cb955b4dac25b6d19962c764933589`, `syncs/eventExport.test.ts:496–503` still expects that warning when the export includes `Gender identity`. This code stops producing it, so the test will fail when #5452 takes this update. Keep the intentional removal, but update the dependent test before merging the stack.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Adds Sessionize export parsing, contract checks, co-speaker grouping, empty-export support, and warnings about changes between runs.

  • Sessionize exports turn into checked speaker rows and drift warnings.

Reviews (5) · Last reviewed commit: "refactor: drop the sensitive column warn..." · Reviewed by Greptile

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.

🟡 Changes recommended

Session export parsing still allows conflicting session metadata, fails inheritance across nonadjacent rows, and misses duplicate speakers when GUID casing differs.

3 open issues
What changed in this PR

Adds an in-memory parser and validator for Sessionize organizer exports, preparing data for a future connector sync. This PR does not wire the parser into ingestion.

Changes:

  • Supports both export variants with contract validation, co-speaker inheritance, skipped-row counts, and drift warnings.
  • Accepts genuinely empty worksheets without headers.
  • Adds parser, validation, warning, and empty-export tests using synthetic data.
File Description
services/​libs/​connectors/​src/​connectors/​sessionize/​exportRows.ts Adds export parsing, validation, profiling, and drift warnings.
services/​libs/​connectors/​src/​connectors/​sessionize/​exportRows.test.ts Tests parsing contracts, inheritance, filtering, timestamps, and warnings.
services/​libs/​connectors/​src/​connectors/​sessionize/​exportFile.ts Allows empty worksheets without a header row.
services/​libs/​connectors/​src/​connectors/​sessionize/​exportFile.test.ts Tests empty worksheets and rejects data beneath missing headers.
services/​apps/​connectors_worker/​src/​sessionizeExportProbe.test.ts Verifies probe reporting for headerless empty exports.

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 26, 2026 09:49

@lfx-one lfx-one left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

New commits were pushed while this review ran; this review covers 3df3b6f only. It found 2 minor issues, 1 nit and 1 question, and no blocking issues. I'm not approving, because the branch now holds code I did not review.

Findings outside the diff

[nit] The 'race' header word matches unrelated headers (services/libs/connectors/src/connectors/sessionize/exportRows.ts:120)

Issue: sensitiveColumns uses a plain substring match, so 'race' also flags headers such as "Trace", "Grace period" or "Embrace".
Proof: SENSITIVE_HEADER_WORDS includes 'race', and sensitiveColumns calls normalized.includes(word) on every header.
Why it matters: Each false hit is a sensitive_column warning on every run, which is noise and teaches people to ignore the warning.
Fix: Match whole words, for example a \brace\b regex, or use 'racial' instead.

[minor] Co-speaker rows can override the session's first-row values (services/libs/connectors/src/connectors/sessionize/exportRows.ts:301)

Issue: The PR says a co-speaker row takes the status and submission date of the session's first row. In the code, a row's own populated value wins, and the result is carried forward to the speakers after it.
Proof: readStatus(read, rowNumber, inherited?.status) returns the row's own status when the cell is non-empty. read.timestamp('dateSubmitted') ?? inherited?.dateSubmitted and the room, scheduledAt and duration lines do the same. In the loop, session = readSessionFields(...) replaces the carried session. Session 501 with row 1 Accepted, row 2 Declined and row 3 blank gives row 2 and row 3 the status Declined. The tests only cover co-speaker rows with blank session cells. Greptile and Copilot raised the same problem.
Why it matters: Speakers of one session can end up with different statuses or dates, so a connector could load one session as both Accepted and Declined. That contradicts the stated first-row rule.
Fix: For a continuing row, keep the first row's session fields. Or fail with a contract error when a populated value differs, which matches the "any failure rejects the file" approach. Add a test where a later row has a populated, different Status and Date Submitted.

const inherited = continues && session?.sessionId === sessionId ? session : undefined
session = inherited ?? readSessionFields(read, rowNumber, previous, variant, undefined)

[question] Are a session's speaker rows always adjacent in the export? (services/libs/connectors/src/connectors/sessionize/exportRows.ts:374)

Issue: Grouping uses only the previous row (previous?.sessionId === sessionId), so rows for sessions 501, 502, 501 are not grouped. The PR says rows with the same Session Id are one session.
Proof: A later 501 row with a blank Title or Status reaches readTitle or readStatus and throws "starts a session without a Title". That error is misleading, because the session is a repeat. If every cell is filled, the row is parsed as an independent session.
Why it matters: The file is rejected, so no bad data loads. But the message points at the wrong cause, and the behavior differs from the PR description. Copilot raised the same point.
Fix: If the 153 measured exports always keep a session's rows together, say so in the PR and pin it with a test. Otherwise keep a Map<sessionId, SessionFields> and inherit from it.

[minor] The duplicate (session, speaker) check is case-sensitive on the GUID (services/libs/connectors/src/connectors/sessionize/exportRows.ts:388)

Issue: GUID is case-insensitive, but the duplicate key uses the raw Speaker Id string. The same speaker written in a different case on the same session is not reported as a duplicate.
Proof: readSpeakerId returns the cell unchanged after GUID.test(speakerId), and the pair key is built from it. Rows 501 / 0A1B2C3D-...-0001 and 501 / 0a1b2c3d-...-0001 both pass and produce two keys in seenPairs. Copilot raised the same problem.
Why it matters: The PR says a duplicate pair is an error. This gap lets two rows through for one speaker and session. If the speaker id is used as an identity key later, the two rows also split by case.
Fix: Normalize the id once, then add a test for mixed-case duplicates.

return speakerId.toLowerCase()

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.

🔵 Needs a closer look

Session ID normalization treats 501 and '0501' as different keys, allowing duplicate speaker-session rows and preventing blank co-speaker rows from inheriting the session.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Canonicalize numeric session IDs before grouping and deduplication

services/​libs/​connectors/​src/​connectors/​sessionize/​exportRows.ts:273

Numeric Session Ids are normalized with String(value), but numeric strings are returned verbatim. Consequently, 501 and '0501' produce different session-map and duplicate-pair keys: two fully populated rows with the same speaker bypass duplicate detection, while a blank co-speaker row fails to inherit the session. Normalize digit strings to the same canonical numeric representation before grouping and deduplication, applying the same safe-integer validation as for numeric cells.

3 resolved since last review

Review effort: Balanced

@lfx-one

lfx-one commented Nov 26, 2026 •

Copy link
Copy Markdown

@mbani01 I'm starting review 2 of this pull request now (started 2026-11-26 10:17 UTC using review agent v0.1.34). The hourly check started this review. 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 quick and thorough fixes to the earlier feedback.

Summary

These new commits make the first row of a session the single source of its fields. They also add a session map that works for non-adjacent rows, and lowercase the Speaker Id before the duplicate check. The code is clean and well tested. The one new concern is that Session Ids written as text with leading zeros are not canonicalized.

Decision

✅ Approved with minor comments

🟡 1 minor · ⚪ 1 prior item still open

The required DCO check passed on 2527283.

Details

Overall impression: The follow-up replaces the carry-forward inheritance with a per-session map. Later rows can only repeat or leave empty the first row's values, and a different filled value rejects the file with a contract error. Error messages still carry no cell content. The new tests cover a different status, a different date, non-adjacent rows and mixed-case speaker ids. The remaining gap is the same family of problem: the Session Id key.

👏 Nice work: Using SESSION_COLUMNS with satisfies readonly ColumnKey[] keeps the later-row check in step with the column contract. Failing the file on a conflicting value, instead of choosing a winner silently, fits the "any failure rejects the file" rule.

  • ✅ Resolved (r1-f2, co-speaker values): the first row is authoritative in 3df3b6f..2527283, and a later row with a different value is a contract error, with tests.
  • ✅ Resolved (r1-f3, adjacency question): session fields are kept in a Map keyed by Session Id, so rows 501, 502, 501 work.
  • ✅ Resolved (r1-f4, GUID casing): readSpeakerId returns the lowercased id, and the duplicate key uses it.
  • ❌ Still open (r1-f1, nit): 'race' in SENSITIVE_HEADER_WORDS is a plain substring match, so headers such as "Trace" or "Grace period" are flagged as sensitive. Match whole words, or use 'racial'.

🟡 Minor: 1 issue: Numeric-string Session Ids are not canonicalized
⚪ Nit: 1 issue: The 'race' header word matches unrelated headers (prior)

Other reviewers and CI checks: Copilot's remaining point (Session Id canonicalization) is incorporated above. Greptile found no new blocking issues. DCO (required) passed.

Unread files: none.

Rule files: read AGENTS.md; skipped CONTRIBUTING.md (not read, it adds nothing for this change)

Questions, problems, or feedback: https://github.com/linuxfoundation/lfx-review-agent/issues

lfx-one
lfx-one previously approved these changes Nov 26, 2026

@lfx-one lfx-one left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Follow-up review of the commits since 3df3b6f. The co-speaker, adjacency and GUID-casing findings from review 1 are fixed. I found one new minor issue (numeric Session Id strings are not canonicalized) and the earlier 'race' nit is still open. No blocking issues.

@lfx-one

lfx-one commented Nov 26, 2026 •

Copy link
Copy Markdown

@mbani01 I'm starting review 3 of this pull request now (started 2026-11-26 15:53 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 fast fix for the Session Id finding.

Summary

This commit makes a text Session Id made of digits go through the same number check as a numeric cell, so 0501 and 501 are one session. The change is small and has tests for both the co-speaker case and the repeated-pair case. I found no new issues.

Decision

✅ Approved

⚪ 1 prior item still open

The required DCO check passed on 67624ae.

Details

Overall impression: The follow-up replaces the two separate branches in readSessionId (number, and digit string returned as written) with a single path: a digit string is checked against /^\d+$/, converted with Number, checked with Number.isSafeInteger, and returned with String. Session grouping, the test-session skip and the duplicate (session, speaker) key all use that value, so the three agree. Error messages still carry no cell content. The PR description now lists the Session Id rule. A very long digit string fails the safe-integer check and is rejected with a contract error, which fits the "any failure rejects the file" rule.

👏 Nice work: Reusing the number path for text cells, instead of adding a second normalizer, leaves one place to get the Session Id rule right. The tests change the existing co-speaker row to '0501' and add a repeated-pair case across the two spellings.

  • ✅ Resolved (r2-f1, Session Id canonicalization): readSessionId converts digit strings with Number, checks safe integers and returns String(id), in 2527283..67624ae.
  • ✅ Resolved (r1-f2, r1-f3, r1-f4): fixed in review 2 and still fixed.
  • ❌ Still open (r1-f1, nit): 'race' in SENSITIVE_HEADER_WORDS is a plain substring match, so headers such as "Trace" or "Grace period" are flagged as sensitive. Match whole words, or use 'racial'. This does not block approval.

⚪ Nit: 1 issue: The 'race' header word matches unrelated headers (prior)

Other reviewers and CI checks: Copilot's Session Id point is fixed by this commit. Greptile and Cursor Bugbot raised no open issues on the new head. DCO (required) passed on 67624ae.

Unread files: none.

Rule files: read AGENTS.md; skipped CONTRIBUTING.md (not read, it adds nothing for this change)

Questions, problems, or feedback: https://github.com/linuxfoundation/lfx-review-agent/issues

@mbani01
mbani01 added this pull request to stack #5454 November 26, 2026 15:56

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.

🟢 Approval recommended

No active review issues remain for the Sessionize export parsing and validation changes.

No open issues 🎉

Review effort: Balanced

lfx-one
lfx-one previously approved these changes Nov 26, 2026

@lfx-one lfx-one left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Follow-up review of the commit since 2527283. A text Session Id made of digits now goes through the same number check as a numeric cell, so 0501 and 501 are one session, and the new tests cover it. I found no new issues. The earlier 'race' header nit is still open and does not block approval.

Refs linuxfoundation/lfx-cdp-insights-ops#1156

Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
Refs linuxfoundation/lfx-cdp-insights-ops#1156

Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
A Session Id typed as text is read as a number, so '0501' and 501 are one session.

Refs linuxfoundation/lfx-cdp-insights-ops#1156

Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
Copilot AI balanced review requested due to automatic review settings November 26, 2026 16:14
@mbani01
mbani01 force-pushed the feat/issue-1156-sessionize-event-export branch from 67624ae to e3c79fb Compare November 26, 2026 16:14

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.

🟡 Changes recommended

The sensitive-column detector misses headers such as Racial background because it checks for race but not racial, leaving race-related questions without a warning.

1 open issue

Review effort: Balanced

Sensitive answers are never read: the parser reads only its named columns.
The word list only produced a log warning, so it is removed.

Refs linuxfoundation/lfx-cdp-insights-ops#1156

Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
Copilot AI balanced review requested due to automatic review settings November 26, 2026 16:26
@lfx-one

lfx-one commented Nov 26, 2026 •

Copy link
Copy Markdown

@mbani01 I'm starting review 4 of this pull request now (started 2026-11-26 16:26 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 quick change that settles the sensitive-column comments.

Summary

This commit removes the sensitive-column word list, its warning kind and the matching tests and docs. The parser never reads those columns, so the warning only produced noise. The change is small and clean, and I found no new issues.

Decision

✅ Approved

The required DCO check passed on c63a853.

Details

Overall impression: The commit deletes SENSITIVE_HEADER_WORDS, sensitiveColumns(), the sensitiveColumns field of ParsedExport and the sensitive_column warning kind, and updates the tests and the PR description to match. compareWithLastGoodRun now builds its warnings from the duplicated optional columns alone, and the types still line up. Privacy is unchanged: only named contract columns are read, error messages carry no cell content, and a test still asserts that a sensitive answer never appears in the parsed rows. The earlier 'race' substring false positive and Copilot's Racial background false negative both disappear with the word list.

👏 Nice work: Dropping the detector, rather than patching the word list a third time, removes a source of noise. The privacy guarantee rests on the parser never reading those columns, and a test covers that.

  • ✅ Resolved (r1-f1, 'race' header nit): the word list is gone from the code.
  • ✅ Resolved (r1-f2, r1-f3, r1-f4, r2-f1): fixed in earlier rounds and still fixed.

Other reviewers and CI checks: Copilot's Racial background comment no longer applies, because the detector is removed. Greptile and Cursor Bugbot raised no open issues. DCO (required) passed on c63a853.

Unread files: none.

Rule files: read AGENTS.md; skipped CONTRIBUTING.md (not read, it adds nothing for this change)

Questions, problems, or feedback: https://github.com/linuxfoundation/lfx-review-agent/issues

@lfx-one lfx-one left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Follow-up review of the commit since e3c79fb. The commit removes the sensitive-column word list and its warning, so the 'race' nit from review 1 no longer applies, and Copilot's Racial background comment is gone for the same reason. The parser still reads only its named columns, and a test still checks that a sensitive answer never reaches the parsed rows. I found no new issues.

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.

🟢 Approval recommended

No active review issues are identified for the standalone Sessionize export parser and contract checker.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

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.

4 participants