Skip to content

Ignore unsupported column filters for resource types that don't support them#1847

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/fix-query-search-invalid-types
Draft

Ignore unsupported column filters for resource types that don't support them#1847
Copilot wants to merge 3 commits intomainfrom
copilot/fix-query-search-invalid-types

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 23, 2026

When searching across multiple resource types with a filter that only applies to some (e.g., #canary #config type=pod), the entire query failed because type is not a column on the canaries table.

Changes

  • Sentinel error (ErrColumnNotSupported) added to query/models.go so callers can distinguish "column doesn't exist on this table" from real errors
  • qm.Apply: wraps the unsupported column error with the sentinel instead of a plain fmt.Errorf
  • queryTableWithResourceSelectors / QueryTableColumnsWithResourceSelectors: skip (return empty results) for any selector that produces ErrColumnNotSupported rather than propagating the error
// Before: entire SearchResources call failed
query.SearchResourcesRequest{
    Canaries: []types.ResourceSelector{{Search: "type=Kubernetes::Node"}}, // ❌ error
    Configs:  []types.ResourceSelector{{Search: "type=Kubernetes::Node"}}, // never reached
}

// After: canaries silently return 0 results; configs return matches normally
Original prompt

This section details on the original issue you should resolve

<issue_title>Query search - ignore invalid types when at least 1 resource type applies</issue_title>
<issue_description>e.g. #canary #config type=pod
error applying query model: query for column:type in table:canaries not supported </issue_description>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI changed the title [WIP] Fix query search to ignore invalid resource types Ignore unsupported column filters for resource types that don't support them Mar 23, 2026
Copilot AI requested a review from moshloop March 23, 2026 07:04
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 23, 2026

Benchstat (Other)

Base: a02e5fc3d49e5a74ee448a6244dbb3dbd6c6b690
Head: 37e13bafe66df761c2aa3d4f637bc99ed976e2a6

📊 1 minor regression(s) (all within 5% threshold)

Benchmark Base Head Change p-value
InsertionForRowsWithAliases/external_users.aliases-4 553.2µ 560.7µ +1.36% 0.026
✅ 2 improvement(s)
Benchmark Base Head Change p-value
ResourceSelectorQueryBuild/name-4 44.04µ 42.94µ -2.49% 0.041
ResourceSelectorQueryBuild/name_and_type-4 63.41µ 62.76µ -1.03% 0.026
Full benchstat output
goos: linux
goarch: amd64
pkg: github.com/flanksource/duty/bench
cpu: AMD EPYC 7763 64-Core Processor                
                                                       │ bench-base.txt │           bench-head.txt           │
                                                       │     sec/op     │    sec/op     vs base              │
InsertionForRowsWithAliases/external_users.aliases-4       553.2µ ±  1%   560.7µ ±  4%  +1.36% (p=0.026 n=6)
InsertionForRowsWithAliases/config_items.external_id-4     1.064m ± 13%   1.065m ± 11%       ~ (p=0.818 n=6)
ResourceSelectorConfigs/name-4                             198.3µ ±  2%   196.7µ ±  2%       ~ (p=0.699 n=6)
ResourceSelectorConfigs/name_and_type-4                    218.4µ ±  4%   216.6µ ±  5%       ~ (p=0.485 n=6)
ResourceSelectorConfigs/tags-4                             29.12m ±  5%   29.24m ±  1%       ~ (p=0.937 n=6)
ResourceSelectorQueryBuild/name-4                          44.04µ ±  2%   42.94µ ±  3%  -2.49% (p=0.041 n=6)
ResourceSelectorQueryBuild/name_and_type-4                 63.41µ ±  1%   62.76µ ±  1%  -1.03% (p=0.026 n=6)
ResourceSelectorQueryBuild/tags-4                          17.28µ ±  1%   17.23µ ±  2%       ~ (p=0.818 n=6)
geomean                                                    278.1µ         276.9µ        -0.45%

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 23, 2026

Benchstat (RLS)

Base: a02e5fc3d49e5a74ee448a6244dbb3dbd6c6b690
Head: 37e13bafe66df761c2aa3d4f637bc99ed976e2a6

📊 4 minor regression(s) (all within 5% threshold)

Benchmark Base Head Change p-value
RLS/Sample-15000/config_classes/With_RLS-4 122.3m 124.6m +1.89% 0.002
RLS/Sample-15000/config_changes/With_RLS-4 129.1m 130.7m +1.24% 0.002
RLS/Sample-15000/config_summary/With_RLS-4 743.0m 749.4m +0.87% 0.041
RLS/Sample-15000/analysis_types/Without_RLS-4 3.873m 3.903m +0.78% 0.002
✅ 9 improvement(s)
Benchmark Base Head Change p-value
RLS/Sample-15000/change_types/With_RLS-4 5.372m 5.219m -2.84% 0.004
RLS/Sample-15000/catalog_changes/Without_RLS-4 5.437m 5.287m -2.77% 0.026
RLS/Sample-15000/config_types/With_RLS-4 127.4m 124.7m -2.17% 0.002
RLS/Sample-15000/config_summary/Without_RLS-4 61.61m 60.63m -1.59% 0.041
RLS/Sample-15000/catalog_changes/With_RLS-4 129.3m 127.4m -1.49% 0.002
RLS/Sample-15000/config_names/With_RLS-4 126.5m 124.7m -1.47% 0.009
RLS/Sample-15000/config_detail/With_RLS-4 125.1m 123.3m -1.45% 0.002
RLS/Sample-15000/configs/With_RLS-4 127.4m 125.9m -1.18% 0.002
RLS/Sample-15000/change_types/Without_RLS-4 5.312m 5.250m -1.17% 0.009
Full benchstat output
goos: linux
goarch: amd64
pkg: github.com/flanksource/duty/bench
cpu: AMD EPYC 7763 64-Core Processor                
                                               │ bench-base.txt │          bench-head.txt           │
                                               │     sec/op     │   sec/op     vs base              │
RLS/Sample-15000/catalog_changes/Without_RLS-4      5.437m ± 5%   5.287m ± 2%  -2.77% (p=0.026 n=6)
RLS/Sample-15000/catalog_changes/With_RLS-4         129.3m ± 0%   127.4m ± 1%  -1.49% (p=0.002 n=6)
RLS/Sample-15000/config_changes/Without_RLS-4       5.234m ± 2%   5.220m ± 1%       ~ (p=0.132 n=6)
RLS/Sample-15000/config_changes/With_RLS-4          129.1m ± 0%   130.7m ± 0%  +1.24% (p=0.002 n=6)
RLS/Sample-15000/config_detail/Without_RLS-4        3.894m ± 1%   3.890m ± 2%       ~ (p=0.485 n=6)
RLS/Sample-15000/config_detail/With_RLS-4           125.1m ± 0%   123.3m ± 1%  -1.45% (p=0.002 n=6)
RLS/Sample-15000/config_names/Without_RLS-4         12.83m ± 1%   12.78m ± 1%       ~ (p=0.589 n=6)
RLS/Sample-15000/config_names/With_RLS-4            126.5m ± 1%   124.7m ± 1%  -1.47% (p=0.009 n=6)
RLS/Sample-15000/config_summary/Without_RLS-4       61.61m ± 2%   60.63m ± 1%  -1.59% (p=0.041 n=6)
RLS/Sample-15000/config_summary/With_RLS-4          743.0m ± 1%   749.4m ± 1%  +0.87% (p=0.041 n=6)
RLS/Sample-15000/configs/Without_RLS-4              7.213m ± 2%   7.196m ± 3%       ~ (p=0.180 n=6)
RLS/Sample-15000/configs/With_RLS-4                 127.4m ± 1%   125.9m ± 0%  -1.18% (p=0.002 n=6)
RLS/Sample-15000/analysis_types/Without_RLS-4       3.873m ± 0%   3.903m ± 2%  +0.78% (p=0.002 n=6)
RLS/Sample-15000/analysis_types/With_RLS-4          3.914m ± 1%   3.875m ± 2%       ~ (p=0.065 n=6)
RLS/Sample-15000/analyzer_types/Without_RLS-4       3.764m ± 0%   3.719m ± 2%       ~ (p=0.065 n=6)
RLS/Sample-15000/analyzer_types/With_RLS-4          3.743m ± 2%   3.756m ± 4%       ~ (p=0.240 n=6)
RLS/Sample-15000/change_types/Without_RLS-4         5.312m ± 6%   5.250m ± 1%  -1.17% (p=0.009 n=6)
RLS/Sample-15000/change_types/With_RLS-4            5.372m ± 1%   5.219m ± 2%  -2.84% (p=0.004 n=6)
RLS/Sample-15000/config_classes/Without_RLS-4       3.272m ± 0%   3.264m ± 1%       ~ (p=0.394 n=6)
RLS/Sample-15000/config_classes/With_RLS-4          122.3m ± 1%   124.6m ± 0%  +1.89% (p=0.002 n=6)
RLS/Sample-15000/config_types/Without_RLS-4         3.913m ± 1%   3.914m ± 1%       ~ (p=0.937 n=6)
RLS/Sample-15000/config_types/With_RLS-4            127.4m ± 0%   124.7m ± 0%  -2.17% (p=0.002 n=6)
geomean                                             19.30m        19.17m       -0.66%

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.

Query search - ignore invalid types when at least 1 resource type applies

3 participants