Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/azure/src/components/__tests__/EvidenceSheet.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const buildFinding = (id: string, status: Finding['status'], text = 'A finding')
deletedAt: null,
investigationId: 'general-unassigned',
context: {} as Finding['context'],
evidenceType: 'data',
status,
comments: [],
statusChangedAt: 1714000000000,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ function makeFinding(overrides: Partial<Finding> = {}): Finding {
activeFilters: { Shift: ['Night'] },
cumulativeScope: null,
},
evidenceType: 'data',
status: 'observed',
comments: [],
statusChangedAt: 1714000000000,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function makeFinding(overrides: Partial<Finding> = {}): Finding {
deletedAt: null,
investigationId: 'general-unassigned',
context: { activeFilters: {}, cumulativeScope: null },
evidenceType: 'data',
status: 'observed',
comments: [],
statusChangedAt: LAST_VIEWED - 1000,
Expand Down
1 change: 1 addition & 0 deletions apps/azure/src/services/__tests__/merge.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function makeFinding(overrides: Partial<Finding> = {}): Finding {
deletedAt: null,
investigationId: 'general-unassigned',
context: { activeFilters: {}, cumulativeScope: null },
evidenceType: 'data',
status: 'observed',
comments: [],
statusChangedAt: 1000,
Expand Down
2 changes: 2 additions & 0 deletions apps/azure/src/services/__tests__/shareContent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function makeFinding(overrides: Partial<Finding> = {}): Finding {
cumulativeScope: 42,
stats: { mean: 250.1, samples: 30, cpk: 0.8 },
},
evidenceType: 'data',
...overrides,
};
}
Expand Down Expand Up @@ -67,6 +68,7 @@ describe('shareContent', () => {
it('omits Cpk when stats have no cpk', () => {
const finding = makeFinding({
context: { activeFilters: {}, cumulativeScope: null, stats: { mean: 10, samples: 5 } },
evidenceType: 'data',
});
const payload = buildFindingSharePayload(finding, 'P', BASE_URL);
expect(payload.previewText).not.toContain('Cpk');
Expand Down
10 changes: 10 additions & 0 deletions apps/azure/src/services/merge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,14 @@ function mergeSingleFinding(
// Context: follow status winner (context is captured at status change time)
const context = local.statusChangedAt >= remote.statusChangedAt ? local.context : remote.context;

// EvidenceType: follow status winner (re-classification typically happens with status changes)
const evidenceType =
local.statusChangedAt >= remote.statusChangedAt ? local.evidenceType : remote.evidenceType;

// Refutes: follow status winner — refutation flag is a classification decision made at
// the same time as status; deferring to the more-recent status change preserves intent.
const refutes = local.statusChangedAt >= remote.statusChangedAt ? local.refutes : remote.refutes;

// Comments: union by ID
const mergedComments = mergeComments(base.comments, local.comments, remote.comments);

Expand All @@ -211,6 +219,8 @@ function mergeSingleFinding(
deletedAt: base.deletedAt ?? null,
investigationId: base.investigationId,
context,
evidenceType,
refutes,
status,
tag,
comments: mergedComments,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ function makeFindingWithFixedLens(id: string): Finding {
activeFilters: { Machine: ['Line-1'] },
cumulativeScope: 42,
},
evidenceType: 'data',
source: {
chart: 'boxplot',
category: 'Machine',
Expand Down Expand Up @@ -197,6 +198,7 @@ describe('App.tsx findingRestore — timeLens + filter replay', () => {
activeFilters: { Region: ['North'] },
cumulativeScope: null,
},
evidenceType: 'data',
// source intentionally omitted — some findings have no chart source
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const makeFinding = (overrides: Partial<Finding> = {}): Finding => ({
deletedAt: null,
investigationId: 'general-unassigned',
context: { activeFilters: {}, cumulativeScope: null },
evidenceType: 'data',
status: 'observed',
comments: [],
statusChangedAt: 1714000000000,
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/__tests__/export.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ describe('findings export', () => {
cumulativeScope: 45.2,
stats: { mean: 10.5, cpk: 0.85, samples: 100 },
},
evidenceType: 'data',
status: 'analyzed',
tag: 'key-driver',
comments: [],
Expand Down
10 changes: 10 additions & 0 deletions packages/core/src/__tests__/findings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ describe('findDuplicateFinding', () => {
deletedAt: null,
investigationId: 'general-unassigned',
context: { activeFilters, cumulativeScope: null },
evidenceType: 'data',
status: 'observed',
comments: [],
statusChangedAt: 1714000000000,
Expand Down Expand Up @@ -161,6 +162,7 @@ describe('getFindingStatus', () => {
deletedAt: null,
investigationId: 'general-unassigned',
context: { activeFilters: {}, cumulativeScope: null },
evidenceType: 'data',
status: 'analyzed',
comments: [],
statusChangedAt: 1000,
Expand All @@ -177,6 +179,7 @@ describe('groupFindingsByStatus', () => {
deletedAt: null,
investigationId: 'general-unassigned',
context: { activeFilters: {}, cumulativeScope: null },
evidenceType: 'data',
status,
comments: [],
statusChangedAt: 1714000000000,
Expand Down Expand Up @@ -253,6 +256,7 @@ describe('migrateFindingStatus', () => {
deletedAt: null,
investigationId: 'general-unassigned',
context: { activeFilters: {}, cumulativeScope: null },
evidenceType: 'data',
status: status as FindingStatus,
tag: tag as Finding['tag'],
comments: [],
Expand Down Expand Up @@ -310,6 +314,7 @@ describe('migrateFindings', () => {
investigationId: 'general-unassigned',
status: 'observed' as FindingStatus,
context: { activeFilters: {}, cumulativeScope: null },
evidenceType: 'data',
comments: [],
statusChangedAt: 1000,
},
Expand All @@ -321,6 +326,7 @@ describe('migrateFindings', () => {
investigationId: 'general-unassigned',
status: 'confirmed' as FindingStatus,
context: { activeFilters: {}, cumulativeScope: null },
evidenceType: 'data',
comments: [],
statusChangedAt: 2000,
},
Expand All @@ -332,6 +338,7 @@ describe('migrateFindings', () => {
investigationId: 'general-unassigned',
status: 'dismissed' as FindingStatus,
context: { activeFilters: {}, cumulativeScope: null },
evidenceType: 'data',
comments: [],
statusChangedAt: 3000,
},
Expand Down Expand Up @@ -380,6 +387,7 @@ describe('findDuplicateBySource', () => {
deletedAt: null,
investigationId: 'general-unassigned',
context: { activeFilters: {}, cumulativeScope: null },
evidenceType: 'data',
status: 'observed',
comments: [],
statusChangedAt: 1714000000000,
Expand Down Expand Up @@ -680,6 +688,7 @@ describe('migrateFindings action assignee migration', () => {
deletedAt: null,
investigationId: 'general-unassigned',
context: { activeFilters: {}, cumulativeScope: null },
evidenceType: 'data',
status: 'improving',
comments: [],
statusChangedAt: 1000,
Expand Down Expand Up @@ -707,6 +716,7 @@ describe('migrateFindings action assignee migration', () => {
deletedAt: null,
investigationId: 'general-unassigned',
context: { activeFilters: {}, cumulativeScope: null },
evidenceType: 'data',
status: 'improving',
comments: [],
statusChangedAt: 1000,
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/__tests__/processEvidence.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const baseFinding = (overrides: Partial<Finding> = {}): Finding => ({
deletedAt: null,
investigationId: 'inv-test-001',
context: {} as Finding['context'],
evidenceType: 'data',
status: 'analyzed',
comments: [],
statusChangedAt: 1714000000000,
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/__tests__/projection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ describe('isFindingScoped', () => {
deletedAt: null,
investigationId: 'inv-test-001',
context: { activeFilters: {}, cumulativeScope: null },
evidenceType: 'data',
status: 'observed',
comments: [],
statusChangedAt: 1714000000000,
Expand Down Expand Up @@ -290,6 +291,7 @@ describe('getScopedFindings', () => {
deletedAt: null,
investigationId: 'inv-test-001',
context: { activeFilters: {}, cumulativeScope: null },
evidenceType: 'data',
status: 'analyzed',
comments: [],
statusChangedAt: 1714000000000,
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/__tests__/signalCards.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const finding = (): Finding => ({
deletedAt: null,
investigationId: 'inv-test-001',
context: { activeFilters: {}, cumulativeScope: null },
evidenceType: 'data',
status: 'analyzed',
comments: [],
statusChangedAt: 1760000000000,
Expand Down
9 changes: 9 additions & 0 deletions packages/core/src/ai/__tests__/buildAIContext.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ describe('buildAIContext', () => {
deletedAt: null,
investigationId: 'inv-test-001',
context: { activeFilters: {}, cumulativeScope: null },
evidenceType: 'data',
status: 'analyzed',
tag: 'key-driver',
comments: [],
Expand All @@ -102,6 +103,7 @@ describe('buildAIContext', () => {
deletedAt: null,
investigationId: 'inv-test-001',
context: { activeFilters: {}, cumulativeScope: null },
evidenceType: 'data',
status: 'observed',
comments: [],
statusChangedAt: 2000,
Expand All @@ -122,6 +124,7 @@ describe('buildAIContext', () => {
deletedAt: null,
investigationId: 'inv-test-001',
context: { activeFilters: {}, cumulativeScope: null },
evidenceType: 'data',
status: 'investigating',
comments: [],
statusChangedAt: 1000,
Expand All @@ -134,6 +137,7 @@ describe('buildAIContext', () => {
deletedAt: null,
investigationId: 'inv-test-001',
context: { activeFilters: {}, cumulativeScope: null },
evidenceType: 'data',
status: 'analyzed',
comments: [],
statusChangedAt: 2000,
Expand All @@ -146,6 +150,7 @@ describe('buildAIContext', () => {
deletedAt: null,
investigationId: 'inv-test-001',
context: { activeFilters: {}, cumulativeScope: null },
evidenceType: 'data',
status: 'observed',
comments: [],
statusChangedAt: 3000,
Expand Down Expand Up @@ -173,6 +178,7 @@ describe('buildAIContext', () => {
deletedAt: null,
investigationId: 'inv-test-001',
context: { activeFilters: {}, cumulativeScope: null },
evidenceType: 'data',
status: 'observed',
comments: [],
statusChangedAt: 1000,
Expand Down Expand Up @@ -200,6 +206,7 @@ describe('buildAIContext', () => {
deletedAt: null,
investigationId: 'inv-test-001',
context: { activeFilters: {}, cumulativeScope: null },
evidenceType: 'data',
status: 'observed',
comments: [],
statusChangedAt: 1000,
Expand Down Expand Up @@ -576,6 +583,7 @@ describe('detectInvestigationPhase', () => {
deletedAt: null,
investigationId: 'general-unassigned',
context: { activeFilters: {}, cumulativeScope: null },
evidenceType: 'data' as const,
status: 'improving' as const,
comments: [],
statusChangedAt: 1714000000000,
Expand Down Expand Up @@ -702,6 +710,7 @@ function makeFinding(overrides: Partial<Finding> & { id: string; createdAt: numb
deletedAt: null,
investigationId: 'inv-test-001',
context: { activeFilters: {}, cumulativeScope: null },
evidenceType: 'data',
comments: [],
statusChangedAt: overrides.createdAt,
...overrides,
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/ai/__tests__/promptTemplates.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1349,6 +1349,7 @@ describe('buildReportPrompt', () => {
cumulativeScope: 45.2,
stats: { mean: 10.5, cpk: 0.85, samples: 100 },
},
evidenceType: 'data',
status: 'analyzed',
tag: 'key-driver',
comments: [],
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/ai/__tests__/searchProject.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ function makeFinding(overrides: Partial<Finding> & { id: string; text: string })
activeFilters: {},
cumulativeScope: null,
},
evidenceType: 'data',
status: 'observed',
comments: [],
statusChangedAt: 1714000000000,
Expand Down Expand Up @@ -498,6 +499,7 @@ describe('searchProjectArtifacts — filterContext', () => {
id: 'fec',
text: 'Empty context finding',
context: { activeFilters: {}, cumulativeScope: null },
evidenceType: 'data',
});
const results = searchProjectArtifacts({
query: 'empty context',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ function finding(id: string, validationStatus?: Finding['validationStatus']): Fi
deletedAt: null,
investigationId: 'general-unassigned',
context: { activeFilters: {}, cumulativeScope: null },
evidenceType: 'data',
status: 'observed',
comments: [],
statusChangedAt: FIXED_NOW,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function finding(
deletedAt: null,
investigationId: 'inv-test-001',
context: { activeFilters: {}, cumulativeScope: null },
evidenceType: 'data',
status: 'observed',
comments: [],
statusChangedAt: 1714000000000,
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/findings/__tests__/drift.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const makeFinding = (atCreation: WindowContext['statsAtCreation']): Finding => (
deletedAt: null,
investigationId: 'inv-test-001',
context: stubContext,
evidenceType: 'data',
status: 'observed',
comments: [],
statusChangedAt: 1714000000000,
Expand Down Expand Up @@ -68,6 +69,7 @@ describe('computeFindingWindowDrift', () => {
deletedAt: null,
investigationId: 'inv-test-001',
context: stubContext,
evidenceType: 'data',
status: 'observed',
comments: [],
statusChangedAt: 1714000000000,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function makeFindingWith(source: FindingSource): Finding {
deletedAt: null,
investigationId: 'inv-test-001',
context: { activeFilters: {}, cumulativeScope: null },
evidenceType: 'data',
status: 'observed',
comments: [],
statusChangedAt: 1714000000000,
Expand Down Expand Up @@ -122,6 +123,7 @@ describe('migrateFindings — timeLens back-fill', () => {
text: 'old finding',
createdAt: 1000,
context: { activeFilters: {}, cumulativeScope: null },
evidenceType: 'data',
status: 'observed',
comments: [],
statusChangedAt: 1000,
Expand All @@ -138,6 +140,7 @@ describe('migrateFindings — timeLens back-fill', () => {
text: 'ichart finding',
createdAt: 2000,
context: { activeFilters: {}, cumulativeScope: null },
evidenceType: 'data',
status: 'observed',
comments: [],
statusChangedAt: 2000,
Expand All @@ -154,6 +157,7 @@ describe('migrateFindings — timeLens back-fill', () => {
text: 'coscout finding',
createdAt: 3000,
context: { activeFilters: {}, cumulativeScope: null },
evidenceType: 'data',
status: 'observed',
comments: [],
statusChangedAt: 3000,
Expand Down Expand Up @@ -184,6 +188,7 @@ describe('migrateFindings — timeLens back-fill', () => {
deletedAt: null,
investigationId: 'inv-test-001',
context: { activeFilters: {}, cumulativeScope: null },
evidenceType: 'data',
status: 'observed',
comments: [],
statusChangedAt: 1714000000000,
Expand Down
Loading