Skip to content
Open
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
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# OSIM Changelog
## Unreleased
## [Unreleased]
### Fixed
* Group by module on multi flaw affects not showing correct values (`OSIDB-4684`)

## [2026.1.2]
### Fixed
* Send partially modified Aegis-suggestions (`OSIDB-4764`)

Expand Down
57 changes: 57 additions & 0 deletions src/composables/__tests__/useMultiFlawTrackers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -591,4 +591,61 @@ describe('useMultiFlawTrackers', () => {
expect(affectUuids).toEqual([]);
});
});

describe('grouped affects filtering (multi-flaw tracker filing)', () => {
it('should correctly identify which affects have shared streams for filtering', () => {
const { actions, state } = useMultiFlawTrackers();
state.relatedAffects.set('CVE-2024-0002', mockAffectsForCVE2);

// Shared stream returns multiple UUIDs
const sharedStreamUuids = actions.getAffectUuidsForStream('stream-1:component-1');
expect(sharedStreamUuids.length).toBeGreaterThan(1);

// Non-shared stream returns empty array
const nonSharedStreamUuids = actions.getAffectUuidsForStream('stream-2:component-2');
expect(nonSharedStreamUuids).toEqual([]);
});

it('should filter affects correctly when multiple affects share same ps_module but different streams', () => {
const flawWithMultipleStreamsPerModule: ZodFlawType = {
...defaultMockFlaw,
affects: [
{
uuid: 'affect-shared',
ps_component: 'component-1',
ps_module: 'module-1',
ps_update_stream: 'stream-1',
tracker: null,
} as ZodAffectType,
{
uuid: 'affect-not-shared',
ps_component: 'component-99',
ps_module: 'module-1',
ps_update_stream: 'stream-99',
tracker: null,
} as ZodAffectType,
],
} as ZodFlawType;

mockFlawRef.value = flawWithMultipleStreamsPerModule;

const { actions, state } = useMultiFlawTrackers();
state.relatedAffects.set('CVE-2024-0002', mockAffectsForCVE2);

const sharedUuids = actions.getAffectUuidsForStream('stream-1:component-1');
expect(sharedUuids.length).toBeGreaterThan(1);
expect(sharedUuids).toContain('affect-shared');

const nonSharedUuids = actions.getAffectUuidsForStream('stream-99:component-99');
expect(nonSharedUuids).toEqual([]);
});

it('should return empty for streams only in related flaws', () => {
const { actions, state } = useMultiFlawTrackers();
state.relatedAffects.set('CVE-2024-0002', mockAffectsForCVE2);

const relatedOnlyUuids = actions.getAffectUuidsForStream('stream-3:component-3');
expect(relatedOnlyUuids).toEqual([]);
});
});
});
36 changes: 28 additions & 8 deletions src/composables/useAffectsTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,34 @@ export function useAffectsTable() {

// Automatically filter affects to show only those with related CVEs when they exist
const displayAffects = computed(() => {
const baseData = settings.value.affectsGrouping ? groupedAffects.value : currentAffects.value;

return relatedAffects.size === 0
? baseData
: baseData.filter(affect => getAffectUuidsForStream(
`${affect.ps_update_stream}:${affect.ps_component}`,
).length > 1,
);
if (relatedAffects.size === 0) {
return settings.value.affectsGrouping ? groupedAffects.value : currentAffects.value;
}

const hasSharedStream = (affect: ZodAffectType) =>
getAffectUuidsForStream(`${affect.ps_update_stream}:${affect.ps_component}`).length > 1;

const filteredAffects = currentAffects.value.filter(hasSharedStream);

if (!settings.value.affectsGrouping) {
return filteredAffects;
}

// Group filtered affects by ps_module
const groupsByModule = new Map<string, ZodAffectType[]>();
for (const affect of filteredAffects) {
if (newAffects.has(affectUUID(affect) ?? '')) continue;

const module = affect.ps_module ?? '';
const group = groupsByModule.get(module) ?? [];
if (group.length === 0) groupsByModule.set(module, group);
group.push(affect);
}

return Array.from(groupsByModule.values()).map(group => ({
...group[0],
rows: group.length > 1 ? group.slice(1) : [],
}));
});

const table = useVueTable({
Expand Down