Skip to content

fix(config): resolve duplicate session IDs without excluding every session - #143

Open
ehennestad wants to merge 2 commits into
devfrom
duplicate-session-keep-first-option
Open

ehennestad wants to merge 2 commits into
devfrom
duplicate-session-keep-first-option

Conversation

@ehennestad

Copy link
Copy Markdown
Collaborator

Mechanism

nansen.config.initializeSessionTable creates one Session object for each entry that nansen.dataio.session.listSessionFolders returns. When the session level of a data location is a file (SubfolderStructure(end).IsFolder is false), every matching file is one entry. Session.getSessionFolder maps a file to its parent folder, so several files in one folder with the same session ID give several sessions with the same session ID and the same session folder.

Problem

When session IDs were duplicated, nansen.manage.uiresolveDuplicateSessions offered "Exclude duplicates", which removed every session whose ID occurred more than once. For a flat folder with several files per session this removed all sessions, and initialization failed with NANSEN:InitializeSessionArray:DuplicateSessionIDs.

Changes

  • Add nansen.manage.excludeSameFolderDuplicates. It keeps the first of the sessions that have the same session ID and the same session folder in every data location. initializeSessionTable calls it after constructing the sessions, also when SkipInteractiveSteps is true. No dialog is shown for these sessions.
  • Add nansen.manage.excludeDuplicateSessions with a KeepFirst option. It returns the remaining sessions and a table of the excluded sessions.
  • uiresolveDuplicateSessions now offers "Keep first", "Exclude all" and "Resolve manually". The dialog is shown only when the same session ID comes from different folders. "Keep first" prints the excluded folders to the command window, because nansen.manage.detectNewSessions skips folders whose session ID is already in the session table. The default button is "Exclude all".
  • The dialog text tells the user to change the session ID extraction when the folders hold different sessions.
  • Add tests for both functions to DuplicateSessionResolutionTest.

🤖 Generated with Claude Code

…ssion

Session initialization removed every session whose session ID occurred
more than once. When the session level of a data location is a file,
every file in a folder gives one session, so each session ID occurred
several times and no sessions were left.

- Add nansen.manage.excludeSameFolderDuplicates and call it in
  initializeSessionTable. It keeps the first of the sessions that have
  the same session ID and the same session folder in every data
  location, without a dialog.
- Add nansen.manage.excludeDuplicateSessions with a KeepFirst option.
- Offer "Keep first", "Exclude all" and "Resolve manually" in
  uiresolveDuplicateSessions. "Keep first" prints the excluded folders,
  because detectNewSessions skips folders whose session ID is already
  in the session table.
- Tell the user in the dialog to change the session ID extraction when
  the folders hold different sessions.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Test Results

381 tests  +12   381 ✅ +12   36s ⏱️ +9s
 25 suites ± 0     0 💤 ± 0 
  1 files   ± 0     0 ❌ ± 0 

Results for commit 1c65ebd. ± Comparison against base commit d8ee8c3.

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