Skip to content

Stop search crashing on repeated session codes within an event - #63

Merged
zx000097 merged 1 commit into
mainfrom
zanebong-microsoft-m365-snapshot-skill-script
Oct 30, 2026
Merged

zx000097 merged 1 commit into
mainfrom
zanebong-microsoft-m365-snapshot-skill-script

Conversation

@zx000097

Copy link
Copy Markdown
Contributor

What does this PR do?

The live Ignite 2026 catalog lists some sessions once per time slot. Today that's 77 codes, mostly labs and lightning talks; for example, LAB700 appears 4 times, each with its own sessionInstanceId and start time. The search index uses event::sessionCode as its ID, so MiniSearch throws duplicate ID ignite-2026::BRK101. With 0.3.2, every msevents sessions / session call fails once the Ignite 2026 catalog is cached.

The fix guards against the crash without changing other behavior:

  • buildIndex indexes only the first row for each event::sessionCode. Search results are unchanged, and each session appears once.
  • findSession still searches all rows, so session LAB700 --event ignite-2026 lists all 4 time slots.
  • The M365 build no longer rejects repeated codes. That check only existed because of this crash, and it blocked packaging Ignite 2026.

If the catalog stops repeating codes, the guard has no effect. It doesn't bump the CLI version; that's left for the next release PR.

Known gap: when a code repeats within one event, the text output of session <code> still says "across events" and suggests --event. JSON output isn't affected.

Note

This project is maintained by a small team for Microsoft Build. We may not be able to review or accept all contributions — but we appreciate the effort!

Before submitting a PR, consider opening an issue or discussion first. This helps us align on direction before you invest time in code.

Checklist

  • I have not included any secrets or credentials
  • I have tested my changes (if applicable)
  • My changes don't break existing functionality

Validation, run from cli\:

  • npm run build: passed
  • npm test: passed (73 tests)
  • npx vitest run test/search.test.ts without the guard: the new test fails with MiniSearch: duplicate ID ignite-2026::LAB700, so the test reproduces the crash
  • npm run smoke:m365: passed
  • Live Ignite 2026 catalog with the built CLI: sessions --query agents --event ignite-2026 returns results, and session LAB700 --event ignite-2026 lists 4 slots
  • npm run build:m365 -- --event ignite-2026 --plugin-version 1.0.7: passed; before this change it failed on repeated codes

The Ignite 2026 catalog lists some sessions once per time slot (77 codes
today, mostly labs and lightning talks), so MiniSearch throws "duplicate
ID" and every msevents search fails. Index only the first row per
event::sessionCode; findSession still returns every slot. Drop the M365
build's unique-code check, which existed only because of this crash.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: dc8d0c3c-e6a7-4a74-bee9-cf99887b72b5
Copilot AI balanced review requested due to automatic review settings October 30, 2026 03: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.

🟡 Changes recommended

Code-shaped queries still return duplicate sessions that consume limit slots; deduplicate matches by event and code before limiting, preserve all rows for findSession, and add regression coverage.

1 open issue
What changed in this PR

This PR prevents repeated session codes in event catalogs from crashing the CLI search index and blocking M365 plugin packaging, while preserving individual time slots for session lookup.

Changes:

  • Indexs only the first row for each event/session-code pair.
  • Adds regression tests for keyword-search deduplication and multi-slot session lookup.
  • Allows repeated session codes during M365 catalog validation.
File Description
cli/​test/​search.test.ts Tests repeated-code search and preservation of session time slots.
cli/​src/​search/​index.ts Deduplicates MiniSearch input by event and session code.
cli/​scripts/​build-m365-plugin.mjs Removes the repeated-code rejection from catalog validation.

Review effort: Balanced

Comment thread cli/src/search/index.ts
Comment on lines +41 to +44
index.addAll(sessions.filter((s) => {
const id = `${s.event}::${s.sessionCode}`;
if (seen.has(id)) return false;
seen.add(id);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Leaving this as-is on purpose. This PR is only a guard that stops the crash. Repeated codes within one event are a temporary glitch in the Ignite 2026 catalog, and no other event has them, so I'm keeping behavior changes to a minimum. A code query that lists every time slot matches what session <code> shows, and repeats rarely fill the default limit. Catalogs without repeats behave exactly as they do on main.

@zx000097 zx000097 self-assigned this Oct 30, 2026
@zx000097
zx000097 merged commit 7422e00 into main Oct 30, 2026
5 checks passed
zx000097 added a commit that referenced this pull request Oct 30, 2026
Build 2025 and Ignite 2025 catalog endpoints now return 404. Drop them from KNOWN_EVENTS and move tests, smoke scripts and the CLI README to the 2026 events. The version bump also ships the duplicate session code crash guard (#63).

Co-authored-by: Zane Bong <zanebong@microsoft.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: dc8d0c3c-e6a7-4a74-bee9-cf99887b72b5
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.

3 participants