fix(timeline): exclude undated events from the cluster lookup

buildEventLookup also collected `timeline.undated`, so an undated curated
event — which renders as a plain EventPill in the undated bucket, out of
clustering scope — still seeded clusters: its dated linked letters
scattered into year bands and each collapsed into a ✉ cross-year card
with no edit link and no spatial tie to the pill, showing the event title
twice with no relationship.

Only year-band events are collected now. Fixes review finding #7.

Refs #850
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-06-15 22:08:39 +02:00
committed by marcel
parent 4b965e655e
commit 5870d244fc
2 changed files with 10 additions and 4 deletions

View File

@@ -13,7 +13,7 @@ const makeEvent = (overrides: Partial<TimelineEntryDTO> = {}): TimelineEntryDTO
makeEntry({ kind: 'EVENT', type: 'PERSONAL', documentId: undefined, ...overrides });
describe('eventClustering — buildEventLookup', () => {
it('maps each curated event (kind EVENT + eventId) to its title across years + undated', () => {
it('maps a curated year-band event to its title, excluding undated-bucket events (#7)', () => {
const timeline: TimelineDTO = {
years: [
{
@@ -25,8 +25,11 @@ describe('eventClustering — buildEventLookup', () => {
};
const lookup = buildEventLookup(timeline);
expect(lookup.get(EV_A)).toBe('Ein gewaltiger Stadtbrand');
expect(lookup.get(EV_B)).toBe('Briefe von der Front');
expect(lookup.size).toBe(2);
// An undated event renders as a plain pill in the undated bucket — out of clustering
// scope. Including it here would scatter its dated letters into orphaned ✉ cross-year
// cards detached from the pill (#7), so it must NOT enter the lookup.
expect(lookup.has(EV_B)).toBe(false);
expect(lookup.size).toBe(1);
});
it('ignores derived events (no eventId) and letters', () => {