Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Index resource source-adapter filters
rcourtmanfc3cf0624b1b
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.mdindex 69ed66689b..662efafdca 100644--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md@@ -97,9 +97,9 @@ capability, relationship, and timeline reads through`internal/api/resources.go`, but those query surfaces remain owned by the APIand unified-resource contracts rather than by lifecycle continuity.Those same dedicated reads also accept governed timeline filters for change-kind and source type, and the underlying store owns the filtered counts so-agent lifecycle routing still stays on canonical fleet-continuity ownership-instead of re-deriving resource history locally.+kind, source type, and source adapter, and the underlying store owns the+filtered counts so agent lifecycle routing still stays on canonical+fleet-continuity ownership instead of re-deriving resource history locally.The dedicated profile client now also routes list, schema, and validationparsing through shared response helpers in `frontend-modern/src/api/agentProfiles.ts`,so profile transport stays aligned with the governed API contract instead ofdiff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex e897659754..252502f1f3 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -123,10 +123,10 @@ The same resource contract now also exposes dedicated facet endpoints for`/api/resources/{id}/capabilities`, `/api/resources/{id}/relationships`, and`/api/resources/{id}/timeline`, so operators can read the graph and changehistory without depending on a monolithic resource payload.-Those history reads now also accept governed `kind` and `sourceType` query-filters, and the backend store owns the corresponding filtered counts, so the-timeline contract can narrow by change class without inventing a frontend-only-slice of the graph.+Those history reads now also accept governed `kind`, `sourceType`, and+`sourceAdapter` query filters, and the backend store owns the corresponding+filtered counts, so the timeline contract can narrow by change class and+adapter provenance without inventing a frontend-only slice of the graph.The same API contract now also exposes the unified-resource control-planehistory through dedicated enterprise audit reads. The action, lifecycle, andexport history endpoints live in `internal/api/activity_audit_handlers.go` anddiff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex 28b0c4657d..f95b135dd4 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -121,9 +121,9 @@ The same shared API runtime now also exposes dedicatedto treat those as adjacent governed API ownership rather than storage/recoverytimeline ownership.Those resource timeline reads now also accept governed kind and source-type-filters, with filtered history counts owned by the unified-resource store so-storage and recovery views can consume the same canonical history contract-without re-deriving their own timeline slices.+filters plus source-adapter filters, with filtered history counts owned by the+unified-resource store so storage and recovery views can consume the same+canonical history contract without re-deriving their own timeline slices.The shared unified-resource consumer hook now also preserves `capabilities`,`relationships`, `recentChanges`, `facetCounts`, `policy`, and `aiSafeSummary`fields when storage and recovery surfaces read unified resources, so thosediff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.mdindex b25246b723..daa0131c3f 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -202,8 +202,9 @@ optional metadata blocks, and timeline cards surface change metadata when itis present, so the graph history view preserves the richer provenance alreadycarried by the unified-resource model instead of flattening those fields away.The same timeline and facet-bundle reads now also accept governed `kind` and-`sourceType` filters, so drill-down history can narrow by canonical change-class while the store still owns the filtered total counts.+`sourceType` filters, plus a governed `sourceAdapter` filter for adapter-level+provenance drill-down, so history can narrow by canonical change class and+integration source while the store still owns the filtered total counts.The Connected infrastructure settings surface now also depends on a backendowned `connectedInfrastructure` projection derived from unified resources plusreporting-ignore state. That projection is now also the only v6 clientdiff --git a/frontend-modern/src/api/__tests__/resources.test.ts b/frontend-modern/src/api/__tests__/resources.test.tsindex 01b83e31dd..8d2fc7a478 100644--- a/frontend-modern/src/api/__tests__/resources.test.ts+++ b/frontend-modern/src/api/__tests__/resources.test.ts@@ -48,10 +48,11 @@ describe('ResourceAPI', () => {limit: 25,kind: 'restart',sourceType: 'platform_event',+ sourceAdapter: 'proxmox_adapter',});expect(apiFetchJSON).toHaveBeenCalledWith(- '/api/resources/vm%3A42/facets?since=2026-03-18T12%3A00%3A00.000Z&limit=25&kind=restart&sourceType=platform_event',+ '/api/resources/vm%3A42/facets?since=2026-03-18T12%3A00%3A00.000Z&limit=25&kind=restart&sourceType=platform_event&sourceAdapter=proxmox_adapter',{cache: 'no-store',},@@ -86,10 +87,11 @@ describe('ResourceAPI', () => {limit: -1,kind: 'metric_anomaly',sourceType: 'pulse_diff',+ sourceAdapter: 'docker_adapter',});expect(apiFetchJSON).toHaveBeenCalledWith(- '/api/resources/vm%3A42/timeline?kind=metric_anomaly&sourceType=pulse_diff',+ '/api/resources/vm%3A42/timeline?kind=metric_anomaly&sourceType=pulse_diff&sourceAdapter=docker_adapter',{cache: 'no-store',},@@ -108,10 +110,11 @@ describe('ResourceAPI', () => {limit: 10,kind: 'state_transition',sourceType: 'platform_event',+ sourceAdapter: 'proxmox_adapter',});expect(apiFetchJSON).toHaveBeenCalledWith(- '/api/resources/vm%3A42/timeline?since=2026-03-18T12%3A00%3A00.000Z&limit=10&kind=state_transition&sourceType=platform_event',+ '/api/resources/vm%3A42/timeline?since=2026-03-18T12%3A00%3A00.000Z&limit=10&kind=state_transition&sourceType=platform_event&sourceAdapter=proxmox_adapter',{cache: 'no-store',},diff --git a/frontend-modern/src/api/resources.ts b/frontend-modern/src/api/resources.tsindex 1f5c3df79c..2c848e2cb3 100644--- a/frontend-modern/src/api/resources.ts+++ b/frontend-modern/src/api/resources.ts@@ -3,6 +3,7 @@ import type {ResourceCapability,ResourceChange,ResourceChangeKind,+ ResourceChangeSourceAdapter,ResourceChangeSourceType,ResourceFacetCounts,ResourceRelationship,@@ -25,6 +26,7 @@ export interface ResourceTimelineQueryOptions {limit?: number;kind?: ResourceChangeKind;sourceType?: ResourceChangeSourceType;+ sourceAdapter?: ResourceChangeSourceAdapter;}export interface ResourceTimelineResponse {@@ -62,6 +64,9 @@ const buildTimelineQuery = (options?: ResourceTimelineQueryOptions): string => {if (options?.sourceType) {params.set('sourceType', options.sourceType);}+ if (options?.sourceAdapter) {+ params.set('sourceAdapter', options.sourceAdapter);+ }const query = params.toString();return query ? `?${query}` : '';};diff --git a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsxindex 310ad9abfb..5d54ca90e2 100644--- a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx+++ b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx@@ -3,6 +3,7 @@ import type { Component } from 'solid-js';import type {Resource,ResourceChangeKind,+ ResourceChangeSourceAdapter,ResourceChangeSourceType,} from '@/types/resource';import { getDisplayName } from '@/types/resource';@@ -98,6 +99,15 @@ const timelineSourceTypeOptions: Array<{ label: string; value: ResourceChangeSou{ label: 'Agent action', value: 'agent_action' },];+const timelineSourceAdapterOptions: Array<{ label: string; value: ResourceChangeSourceAdapter | '' }> =+ [+ { label: 'All adapters', value: '' },+ { label: 'Docker adapter', value: 'docker_adapter' },+ { label: 'Proxmox adapter', value: 'proxmox_adapter' },+ { label: 'TrueNAS adapter', value: 'truenas_adapter' },+ { label: 'Ops agent', value: 'agent:ops-helper' },+ ];+const DrawerContent: Component<ResourceDetailDrawerProps> = (props) => {type DrawerTab =| 'overview'@@ -239,6 +249,8 @@ const DrawerContent: Component<ResourceDetailDrawerProps> = (props) => {const [timelineKindFilter, setTimelineKindFilter] = createSignal<ResourceChangeKind | ''>('');const [timelineSourceTypeFilter, setTimelineSourceTypeFilter] =createSignal<ResourceChangeSourceType | ''>('');+ const [timelineSourceAdapterFilter, setTimelineSourceAdapterFilter] =+ createSignal<ResourceChangeSourceAdapter | ''>('');const resourceFacetRequest = createMemo(() => {const id = resourceFacetId();return id ? { id } : null;@@ -256,8 +268,9 @@ const DrawerContent: Component<ResourceDetailDrawerProps> = (props) => {if (!id) return null;const kind = timelineKindFilter();const sourceType = timelineSourceTypeFilter();- if (!kind && !sourceType) return null;- return { id, kind, sourceType };+ const sourceAdapter = timelineSourceAdapterFilter();+ if (!kind && !sourceType && !sourceAdapter) return null;+ return { id, kind, sourceType, sourceAdapter };});const [timelineFacets, { refetch: refetchTimelineFacets }] = createResource(timelineFacetRequest,@@ -267,6 +280,7 @@ const DrawerContent: Component<ResourceDetailDrawerProps> = (props) => {limit: 25,kind: request.kind || undefined,sourceType: request.sourceType || undefined,+ sourceAdapter: request.sourceAdapter || undefined,});},{ initialValue: null },@@ -368,7 +382,10 @@ const DrawerContent: Component<ResourceDetailDrawerProps> = (props) => {() => historyFacetBundle()?.counts ?? resourceFacetCounts(),);const hasTimelineFilters = createMemo(- () => Boolean(timelineKindFilter() || timelineSourceTypeFilter()),+ () =>+ Boolean(+ timelineKindFilter() || timelineSourceTypeFilter() || timelineSourceAdapterFilter(),+ ),);const resourceCapabilityCount = createMemo(() => resourceFacetCounts()?.capabilities ?? resourceCapabilities().length,@@ -1446,9 +1463,9 @@ const DrawerContent: Component<ResourceDetailDrawerProps> = (props) => {</label><label class="space-y-1 text-[10px]"><span class="text-muted">Source type</span>- <select- class="w-full rounded border border-border bg-base px-2 py-1 text-[11px] text-base-content"- value={timelineSourceTypeFilter()}+ <select+ class="w-full rounded border border-border bg-base px-2 py-1 text-[11px] text-base-content"+ value={timelineSourceTypeFilter()}onChange={(event) =>setTimelineSourceTypeFilter((event.currentTarget.value || '') as ResourceChangeSourceType | '',@@ -1458,6 +1475,22 @@ const DrawerContent: Component<ResourceDetailDrawerProps> = (props) => {<For each={timelineSourceTypeOptions}>{(option) => <option value={option.value}>{option.label}</option>}</For>+ </select>+ </label>+ <label class="space-y-1 text-[10px]">+ <span class="text-muted">Source adapter</span>+ <select+ class="w-full rounded border border-border bg-base px-2 py-1 text-[11px] text-base-content"+ value={timelineSourceAdapterFilter()}+ onChange={(event) =>+ setTimelineSourceAdapterFilter(+ (event.currentTarget.value || '') as ResourceChangeSourceAdapter | '',+ )+ }+ >+ <For each={timelineSourceAdapterOptions}>+ {(option) => <option value={option.value}>{option.label}</option>}+ </For></select></label></div>@@ -1470,6 +1503,7 @@ const DrawerContent: Component<ResourceDetailDrawerProps> = (props) => {onClick={() => {setTimelineKindFilter('');setTimelineSourceTypeFilter('');+ setTimelineSourceAdapterFilter('');}}>Clear filtersdiff --git a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsxindex 1cb7932176..966bc11cad 100644--- a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx@@ -358,4 +358,138 @@ describe('ResourceDetailDrawer history tab', () => {expect(await panel.findByText('Routine restart requested')).toBeInTheDocument();expect(panel.queryByText('CPU spike detected')).toBeNull();});++ it('filters timeline entries by source adapter', async () => {+ facetBundleMock.getFacetBundle+ .mockResolvedValueOnce({+ capabilities: [+ {+ name: 'restart',+ type: 'common',+ description: 'Restart the resource safely.',+ minimumApprovalLevel: 'admin',+ },+ ],+ relationships: [+ {+ sourceId: 'node:pve-1',+ targetId: 'vm:42',+ type: 'runs_on',+ confidence: 1,+ active: true,+ discoverer: 'proxmox_adapter',+ observedAt: '2026-03-18T12:00:00Z',+ lastSeenAt: '2026-03-18T12:05:00Z',+ metadata: {+ cluster: 'pve-prod',+ source: 'live',+ },+ },+ ],+ recentChanges: [+ {+ id: 'change-1',+ observedAt: '2026-03-18T12:06:00Z',+ occurredAt: '2026-03-18T12:04:00Z',+ resourceId: 'vm:42',+ kind: 'restart',+ sourceType: 'platform_event',+ sourceAdapter: 'proxmox_adapter',+ confidence: 'high',+ actor: 'agent:oncall-helper',+ relatedResources: ['node:pve-1'],+ reason: 'Routine restart requested',+ metadata: {+ ticket: 'INC-1234',+ },+ },+ {+ id: 'change-2',+ observedAt: '2026-03-18T12:02:00Z',+ resourceId: 'vm:42',+ kind: 'metric_anomaly',+ sourceType: 'pulse_diff',+ sourceAdapter: 'docker_adapter',+ confidence: 'medium',+ reason: 'CPU spike detected',+ },+ ],+ counts: {+ capabilities: 1,+ relationships: 1,+ recentChanges: 2,+ },+ })+ .mockResolvedValueOnce({+ capabilities: [+ {+ name: 'restart',+ type: 'common',+ description: 'Restart the resource safely.',+ minimumApprovalLevel: 'admin',+ },+ ],+ relationships: [+ {+ sourceId: 'node:pve-1',+ targetId: 'vm:42',+ type: 'runs_on',+ confidence: 1,+ active: true,+ discoverer: 'proxmox_adapter',+ observedAt: '2026-03-18T12:00:00Z',+ lastSeenAt: '2026-03-18T12:05:00Z',+ metadata: {+ cluster: 'pve-prod',+ source: 'live',+ },+ },+ ],+ recentChanges: [+ {+ id: 'change-2',+ observedAt: '2026-03-18T12:02:00Z',+ resourceId: 'vm:42',+ kind: 'metric_anomaly',+ sourceType: 'pulse_diff',+ sourceAdapter: 'docker_adapter',+ confidence: 'medium',+ reason: 'CPU spike detected',+ },+ ],+ counts: {+ capabilities: 1,+ relationships: 1,+ recentChanges: 1,+ },+ });++ const resource = baseResource({+ id: 'vm:42',+ type: 'vm',+ name: 'vm-42',+ displayName: 'VM 42',+ platformId: 'vm-42',+ platformType: 'proxmox-pve',+ platformData: { sources: ['proxmox'] },+ });++ render(() => <ResourceDetailDrawer resource={resource} />);++ fireEvent.click(screen.getByRole('button', { name: 'History' }));++ await screen.findByText('Resource History');+ const historyPanel = screen.getByTestId('resource-history-tab');+ const panel = within(historyPanel);+ expect(await panel.findByText('restart')).toBeInTheDocument();+ expect(panel.getByText('CPU spike detected')).toBeInTheDocument();++ fireEvent.change(panel.getByLabelText('Source adapter'), {+ target: { value: 'docker_adapter' },+ });++ expect(await panel.findByText('Filtered facet data loaded')).toBeInTheDocument();+ expect(await panel.findByText('CPU spike detected')).toBeInTheDocument();+ expect(panel.queryByText('Routine restart requested')).toBeNull();+ });});diff --git a/internal/api/resources.go b/internal/api/resources.goindex 403b2d91ea..e9602e4908 100644--- a/internal/api/resources.go+++ b/internal/api/resources.go@@ -301,6 +301,11 @@ func parseResourceChangeFilters(values url.Values) (unified.ResourceChangeFilter} else {filters.SourceTypes = sourceTypes}+ if sourceAdapters, err := parseResourceChangeSourceAdapters(values["sourceAdapter"]); err != nil {+ return unified.ResourceChangeFilters{}, err+ } else {+ filters.SourceAdapters = sourceAdapters+ }return filters, nil}@@ -356,6 +361,20 @@ func parseResourceChangeSourceTypes(values []string) ([]unified.ChangeSourceTypereturn parsed, nil}+func parseResourceChangeSourceAdapters(values []string) ([]unified.ChangeSourceAdapter, error) {+ parsed := make([]unified.ChangeSourceAdapter, 0, len(values))+ for _, value := range values {+ for _, token := range strings.Split(value, ",") {+ normalized := strings.TrimSpace(token)+ if normalized == "" {+ continue+ }+ parsed = append(parsed, unified.ChangeSourceAdapter(normalized))+ }+ }+ return parsed, nil+}+// HandleResourceRoutes dispatches nested resource routes.func (h *ResourceHandlers) HandleResourceRoutes(w http.ResponseWriter, r *http.Request) {if strings.HasSuffix(r.URL.Path, "/facets") {diff --git a/internal/api/resources_test.go b/internal/api/resources_test.goindex d133ba4704..50c8962d6d 100644--- a/internal/api/resources_test.go+++ b/internal/api/resources_test.go@@ -954,13 +954,17 @@ func TestResourceGetFacetsAndTimeline(t *testing.T) {t.Fatalf("RecordChange: %v", err)}for i, offset := range []time.Duration{2 * time.Minute, 4 * time.Minute} {+ sourceAdapter := unified.AdapterProxmox+ if i == 1 {+ sourceAdapter = unified.AdapterDocker+ }if err := store.RecordChange(unified.ResourceChange{ID: fmt.Sprintf("chg-42-extra-%d", i+1),ResourceID: "vm:42",ObservedAt: now.Add(-offset),Kind: unified.ChangeAnomaly,SourceType: unified.SourcePulseDiff,- SourceAdapter: unified.AdapterProxmox,+ SourceAdapter: sourceAdapter,Confidence: unified.ConfidenceMedium,Reason: "history backfill",}); err != nil {@@ -1095,6 +1099,29 @@ func TestResourceGetFacetsAndTimeline(t *testing.T) {}})+ t.Run("filtered timeline by source adapter", func(t *testing.T) {+ rec := httptest.NewRecorder()+ req := httptest.NewRequest(http.MethodGet, "/api/resources/vm:42/timeline?sourceAdapter=docker_adapter", nil)+ h.HandleResourceRoutes(rec, req)+ if rec.Code != http.StatusOK {+ t.Fatalf("status = %d, body=%s", rec.Code, rec.Body.String())+ }+ var payload struct {+ ResourceID string `json:"resourceId"`+ RecentChanges []unified.ResourceChange `json:"recentChanges"`+ Count int `json:"count"`+ }+ if err := json.NewDecoder(rec.Body).Decode(&payload); err != nil {+ t.Fatalf("decode filtered timeline adapter: %v", err)+ }+ if payload.ResourceID != "vm:42" || payload.Count != 1 || len(payload.RecentChanges) != 1 {+ t.Fatalf("unexpected filtered timeline adapter payload: %#v", payload)+ }+ if payload.RecentChanges[0].ID != "chg-42-extra-2" {+ t.Fatalf("unexpected adapter-filtered change: %#v", payload.RecentChanges[0])+ }+ })+t.Run("filtered facets", func(t *testing.T) {rec := httptest.NewRecorder()req := httptest.NewRequest(http.MethodGet, "/api/resources/vm:42/facets?kind=restart&sourceType=platform_event", nil)@@ -1122,6 +1149,34 @@ func TestResourceGetFacetsAndTimeline(t *testing.T) {t.Fatalf("unexpected filtered facets change: %#v", payload.RecentChanges[0])}})++ t.Run("filtered facets by source adapter", func(t *testing.T) {+ rec := httptest.NewRecorder()+ req := httptest.NewRequest(http.MethodGet, "/api/resources/vm:42/facets?sourceAdapter=docker_adapter", nil)+ h.HandleResourceRoutes(rec, req)+ if rec.Code != http.StatusOK {+ t.Fatalf("status = %d, body=%s", rec.Code, rec.Body.String())+ }+ var payload struct {+ ResourceID string `json:"resourceId"`+ RecentChanges []unified.ResourceChange `json:"recentChanges"`+ Relationships []unified.ResourceRelationship `json:"relationships"`+ Counts struct {+ Capabilities int `json:"capabilities"`+ Relationships int `json:"relationships"`+ RecentChanges int `json:"recentChanges"`+ } `json:"counts"`+ }+ if err := json.NewDecoder(rec.Body).Decode(&payload); err != nil {+ t.Fatalf("decode filtered facets adapter: %v", err)+ }+ if payload.ResourceID != "vm:42" || payload.Counts.RecentChanges != 1 || len(payload.RecentChanges) != 1 {+ t.Fatalf("unexpected filtered facets adapter payload: %#v", payload)+ }+ if payload.RecentChanges[0].ID != "chg-42-extra-2" {+ t.Fatalf("unexpected adapter-filtered facets change: %#v", payload.RecentChanges[0])+ }+ })}func containsSource(sources []unified.DataSource, target unified.DataSource) bool {diff --git a/internal/unifiedresources/changes.go b/internal/unifiedresources/changes.goindex db9f1607ae..88f91a124b 100644--- a/internal/unifiedresources/changes.go+++ b/internal/unifiedresources/changes.go@@ -49,8 +49,9 @@ const (// ResourceChangeFilters narrows the resource timeline to specific change kinds// and source origins while preserving the canonical change record shape.type ResourceChangeFilters struct {- Kinds []ChangeKind `json:"kinds,omitempty"`- SourceTypes []ChangeSourceType `json:"sourceTypes,omitempty"`+ Kinds []ChangeKind `json:"kinds,omitempty"`+ SourceTypes []ChangeSourceType `json:"sourceTypes,omitempty"`+ SourceAdapters []ChangeSourceAdapter `json:"sourceAdapters,omitempty"`}func (filters ResourceChangeFilters) matches(change ResourceChange) bool {@@ -78,6 +79,18 @@ func (filters ResourceChangeFilters) matches(change ResourceChange) bool {return false}}+ if len(filters.SourceAdapters) > 0 {+ match := false+ for _, sourceAdapter := range filters.SourceAdapters {+ if sourceAdapter == change.SourceAdapter {+ match = true+ break+ }+ }+ if !match {+ return false+ }+ }return true}diff --git a/internal/unifiedresources/code_standards_test.go b/internal/unifiedresources/code_standards_test.goindex 0ac2fde4a2..5f9c6a698f 100644--- a/internal/unifiedresources/code_standards_test.go+++ b/internal/unifiedresources/code_standards_test.go@@ -248,6 +248,7 @@ func TestResourceAPIExposesDedicatedFacetReads(t *testing.T) {"parseResourceChangeFilters(r.URL.Query())","GetRecentChangesFiltered(resourceID, since, limit, filters)","CountRecentChangesFiltered(resourceID, since, filters)",+ "sourceAdapter","strings.HasSuffix(r.URL.Path, \"/facets\")","strings.HasSuffix(r.URL.Path, \"/capabilities\")","strings.HasSuffix(r.URL.Path, \"/relationships\")",@@ -269,6 +270,7 @@ func TestResourceTimelineStoreIndexesSupportFilteredReads(t *testing.T) {requiredSnippets := []string{"idx_resource_changes_kind_time","idx_resource_changes_source_type_time",+ "idx_resource_changes_source_adapter_time","ensureResourceChangesIndexes",}for _, snippet := range requiredSnippets {diff --git a/internal/unifiedresources/store.go b/internal/unifiedresources/store.goindex 717aa7227f..a4556ac451 100644--- a/internal/unifiedresources/store.go+++ b/internal/unifiedresources/store.go@@ -389,6 +389,7 @@ func (s *SQLiteResourceStore) ensureResourceChangesIndexes() error {`CREATE INDEX IF NOT EXISTS idx_resource_changes_canonical_time ON resource_changes(canonical_id, observed_at DESC)`,`CREATE INDEX IF NOT EXISTS idx_resource_changes_kind_time ON resource_changes(kind, observed_at DESC)`,`CREATE INDEX IF NOT EXISTS idx_resource_changes_source_type_time ON resource_changes(source_type, observed_at DESC)`,+ `CREATE INDEX IF NOT EXISTS idx_resource_changes_source_adapter_time ON resource_changes(source_adapter, observed_at DESC)`,}for _, stmt := range indexes {if _, err := s.db.Exec(stmt); err != nil {@@ -651,6 +652,14 @@ func (s *SQLiteResourceStore) GetRecentChangesFiltered(canonicalID string, since}conditions = append(conditions, "source_type IN ("+strings.Join(placeholders, ", ")+")")}+ if len(filters.SourceAdapters) > 0 {+ placeholders := make([]string, 0, len(filters.SourceAdapters))+ for _, sourceAdapter := range filters.SourceAdapters {+ placeholders = append(placeholders, "?")+ args = append(args, string(sourceAdapter))+ }+ conditions = append(conditions, "source_adapter IN ("+strings.Join(placeholders, ", ")+")")+ }if len(conditions) > 0 {query += "\n\t\tWHERE " + strings.Join(conditions, " AND ")}@@ -726,6 +735,14 @@ func (s *SQLiteResourceStore) CountRecentChangesFiltered(canonicalID string, sin}conditions = append(conditions, "source_type IN ("+strings.Join(placeholders, ", ")+")")}+ if len(filters.SourceAdapters) > 0 {+ placeholders := make([]string, 0, len(filters.SourceAdapters))+ for _, sourceAdapter := range filters.SourceAdapters {+ placeholders = append(placeholders, "?")+ args = append(args, string(sourceAdapter))+ }+ conditions = append(conditions, "source_adapter IN ("+strings.Join(placeholders, ", ")+")")+ }query += ` WHERE ` + strings.Join(conditions, " AND ")s.mu.Lock()diff --git a/internal/unifiedresources/store_test.go b/internal/unifiedresources/store_test.goindex 937b543e8e..b16dd6402c 100644--- a/internal/unifiedresources/store_test.go+++ b/internal/unifiedresources/store_test.go@@ -217,6 +217,7 @@ func TestNewSQLiteResourceStore_MigratesLegacyResourceChangesTable(t *testing.T)"idx_resource_changes_canonical_time","idx_resource_changes_kind_time","idx_resource_changes_source_type_time",+ "idx_resource_changes_source_adapter_time",} {if _, ok := indexes[want]; !ok {t.Fatalf("expected migrated resource_changes index %q, got %#v", want, indexes)@@ -400,36 +401,40 @@ func TestCountRecentChanges_RespectsFilters(t *testing.T) {base := time.Date(2026, 3, 18, 12, 0, 0, 0, time.UTC)changes := []ResourceChange{{- ID: "chg-count-1",- ResourceID: "vm:1",- ObservedAt: base.Add(-30 * time.Minute),- Kind: ChangeStateTransition,- SourceType: SourcePlatformEvent,- Confidence: ConfidenceHigh,+ ID: "chg-count-1",+ ResourceID: "vm:1",+ ObservedAt: base.Add(-30 * time.Minute),+ Kind: ChangeStateTransition,+ SourceType: SourcePlatformEvent,+ SourceAdapter: AdapterProxmox,+ Confidence: ConfidenceHigh,},{- ID: "chg-count-2",- ResourceID: "vm:1",- ObservedAt: base.Add(-20 * time.Minute),- Kind: ChangeAnomaly,- SourceType: SourcePulseDiff,- Confidence: ConfidenceMedium,+ ID: "chg-count-2",+ ResourceID: "vm:1",+ ObservedAt: base.Add(-20 * time.Minute),+ Kind: ChangeAnomaly,+ SourceType: SourcePulseDiff,+ SourceAdapter: AdapterDocker,+ Confidence: ConfidenceMedium,},{- ID: "chg-count-3",- ResourceID: "vm:1",- ObservedAt: base.Add(-10 * time.Minute),- Kind: ChangeRelationship,- SourceType: SourcePulseDiff,- Confidence: ConfidenceLow,+ ID: "chg-count-3",+ ResourceID: "vm:1",+ ObservedAt: base.Add(-10 * time.Minute),+ Kind: ChangeRelationship,+ SourceType: SourcePulseDiff,+ SourceAdapter: AdapterProxmox,+ Confidence: ConfidenceLow,},{- ID: "chg-count-4",- ResourceID: "vm:2",- ObservedAt: base.Add(-5 * time.Minute),- Kind: ChangeCapability,- SourceType: SourcePulseDiff,- Confidence: ConfidenceLow,+ ID: "chg-count-4",+ ResourceID: "vm:2",+ ObservedAt: base.Add(-5 * time.Minute),+ Kind: ChangeCapability,+ SourceType: SourcePulseDiff,+ SourceAdapter: AdapterDocker,+ Confidence: ConfidenceLow,},}for _, change := range changes {@@ -473,6 +478,16 @@ func TestCountRecentChanges_RespectsFilters(t *testing.T) {if sourceFilteredCount != 3 {t.Fatalf("CountRecentChangesFiltered source types = %d, want 3", sourceFilteredCount)}++ adapterFilteredCount, err := store.CountRecentChangesFiltered("vm:1", base.Add(-35*time.Minute), ResourceChangeFilters{+ SourceAdapters: []ChangeSourceAdapter{AdapterProxmox},+ })+ if err != nil {+ t.Fatalf("CountRecentChangesFiltered source adapters: %v", err)+ }+ if adapterFilteredCount != 2 {+ t.Fatalf("CountRecentChangesFiltered source adapters = %d, want 2", adapterFilteredCount)+ }}func TestGetRecentChanges_RespectsFilters(t *testing.T) {@@ -480,28 +495,31 @@ func TestGetRecentChanges_RespectsFilters(t *testing.T) {base := time.Date(2026, 3, 18, 12, 0, 0, 0, time.UTC)changes := []ResourceChange{{- ID: "chg-1",- ResourceID: "vm:1",- ObservedAt: base.Add(-30 * time.Minute),- Kind: ChangeStateTransition,- SourceType: SourcePlatformEvent,- Confidence: ConfidenceHigh,+ ID: "chg-1",+ ResourceID: "vm:1",+ ObservedAt: base.Add(-30 * time.Minute),+ Kind: ChangeStateTransition,+ SourceType: SourcePlatformEvent,+ SourceAdapter: AdapterProxmox,+ Confidence: ConfidenceHigh,},{- ID: "chg-2",- ResourceID: "vm:1",- ObservedAt: base.Add(-20 * time.Minute),- Kind: ChangeAnomaly,- SourceType: SourcePulseDiff,- Confidence: ConfidenceMedium,+ ID: "chg-2",+ ResourceID: "vm:1",+ ObservedAt: base.Add(-20 * time.Minute),+ Kind: ChangeAnomaly,+ SourceType: SourcePulseDiff,+ SourceAdapter: AdapterDocker,+ Confidence: ConfidenceMedium,},{- ID: "chg-3",- ResourceID: "vm:1",- ObservedAt: base.Add(-10 * time.Minute),- Kind: ChangeRelationship,- SourceType: SourcePulseDiff,- Confidence: ConfidenceLow,+ ID: "chg-3",+ ResourceID: "vm:1",+ ObservedAt: base.Add(-10 * time.Minute),+ Kind: ChangeRelationship,+ SourceType: SourcePulseDiff,+ SourceAdapter: AdapterProxmox,+ Confidence: ConfidenceLow,},}for _, change := range changes {@@ -529,6 +547,16 @@ func TestGetRecentChanges_RespectsFilters(t *testing.T) {if len(sourceResults) != 2 || sourceResults[0].ID != "chg-3" || sourceResults[1].ID != "chg-2" {t.Fatalf("GetRecentChangesFiltered source types = %#v, want chg-3 then chg-2", sourceResults)}++ adapterResults, err := store.GetRecentChangesFiltered("vm:1", base.Add(-35*time.Minute), 10, ResourceChangeFilters{+ SourceAdapters: []ChangeSourceAdapter{AdapterProxmox},+ })+ if err != nil {+ t.Fatalf("GetRecentChangesFiltered source adapters: %v", err)+ }+ if len(adapterResults) != 2 || adapterResults[0].ID != "chg-3" || adapterResults[1].ID != "chg-1" {+ t.Fatalf("GetRecentChangesFiltered source adapters = %#v, want chg-3 then chg-1", adapterResults)+ }}func TestActionAuditRecord_RoundTrip(t *testing.T) {