Skip to content

chore(query): add support for timestamp in config changes#1878

Merged
yashmehrotra merged 3 commits intomainfrom
from-inserted
Apr 10, 2026
Merged

chore(query): add support for timestamp in config changes#1878
yashmehrotra merged 3 commits intomainfrom
from-inserted

Conversation

@yashmehrotra
Copy link
Copy Markdown
Member

@yashmehrotra yashmehrotra commented Apr 10, 2026

Summary by CodeRabbit

  • Improvements
    • Date filters now accept both RFC3339 and datemath formats with enhanced validation.
    • Error messages for invalid date inputs now clearly specify the expected formats.
    • Cursor-based pagination with created_at filtering now uses exclusive cursor semantics, ensuring the cursor point itself is excluded from results.

@yashmehrotra yashmehrotra requested a review from moshloop April 10, 2026 14:11
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 10, 2026

Benchstat (RLS)

Base: f85856646a57c46aa280bb51ac1f055e23c526f9
Head: 8fd4c39ac3c2e5f4b66b116354476f08404030ab

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

Benchmark Base Head Change p-value
RLS/Sample-15000/config_names/With_RLS-4 125.5m 127.1m +1.26% 0.002
RLS/Sample-15000/analysis_types/Without_RLS-4 3.880m 3.924m +1.15% 0.009
✅ 7 improvement(s)
Benchmark Base Head Change p-value
RLS/Sample-15000/change_types/Without_RLS-4 5.850m 5.333m -8.84% 0.002
RLS/Sample-15000/analysis_types/With_RLS-4 3.996m 3.896m -2.49% 0.041
RLS/Sample-15000/catalog_changes/Without_RLS-4 5.435m 5.313m -2.24% 0.002
RLS/Sample-15000/change_types/With_RLS-4 5.472m 5.366m -1.93% 0.041
RLS/Sample-15000/config_types/Without_RLS-4 4.013m 3.951m -1.54% 0.015
RLS/Sample-15000/config_classes/With_RLS-4 125.2m 123.7m -1.19% 0.002
RLS/Sample-15000/config_classes/Without_RLS-4 3.302m 3.285m -0.51% 0.004
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.435m ± 1%   5.313m ± 1%  -2.24% (p=0.002 n=6)
RLS/Sample-15000/catalog_changes/With_RLS-4         129.7m ± 1%   129.9m ± 1%       ~ (p=0.310 n=6)
RLS/Sample-15000/config_changes/Without_RLS-4       5.228m ± 1%   5.221m ± 1%       ~ (p=0.818 n=6)
RLS/Sample-15000/config_changes/With_RLS-4          129.4m ± 1%   130.1m ± 1%       ~ (p=0.065 n=6)
RLS/Sample-15000/config_detail/Without_RLS-4        3.947m ± 1%   3.978m ± 2%       ~ (p=0.240 n=6)
RLS/Sample-15000/config_detail/With_RLS-4           124.5m ± 4%   126.7m ± 0%       ~ (p=0.065 n=6)
RLS/Sample-15000/config_names/Without_RLS-4         12.78m ± 4%   13.07m ± 1%       ~ (p=0.065 n=6)
RLS/Sample-15000/config_names/With_RLS-4            125.5m ± 0%   127.1m ± 0%  +1.26% (p=0.002 n=6)
RLS/Sample-15000/config_summary/Without_RLS-4       62.17m ± 1%   62.02m ± 2%       ~ (p=0.485 n=6)
RLS/Sample-15000/config_summary/With_RLS-4          744.6m ± 1%   745.3m ± 1%       ~ (p=0.589 n=6)
RLS/Sample-15000/configs/Without_RLS-4              7.162m ± 1%   7.156m ± 2%       ~ (p=0.818 n=6)
RLS/Sample-15000/configs/With_RLS-4                 123.0m ± 3%   125.5m ± 1%       ~ (p=0.065 n=6)
RLS/Sample-15000/analysis_types/Without_RLS-4       3.880m ± 1%   3.924m ± 0%  +1.15% (p=0.009 n=6)
RLS/Sample-15000/analysis_types/With_RLS-4          3.996m ± 5%   3.896m ± 5%  -2.49% (p=0.041 n=6)
RLS/Sample-15000/analyzer_types/Without_RLS-4       3.720m ± 0%   3.726m ± 0%       ~ (p=1.000 n=6)
RLS/Sample-15000/analyzer_types/With_RLS-4          3.772m ± 5%   3.887m ± 4%       ~ (p=0.240 n=6)
RLS/Sample-15000/change_types/Without_RLS-4         5.850m ± 5%   5.333m ± 2%  -8.84% (p=0.002 n=6)
RLS/Sample-15000/change_types/With_RLS-4            5.472m ± 3%   5.366m ± 2%  -1.93% (p=0.041 n=6)
RLS/Sample-15000/config_classes/Without_RLS-4       3.302m ± 1%   3.285m ± 0%  -0.51% (p=0.004 n=6)
RLS/Sample-15000/config_classes/With_RLS-4          125.2m ± 1%   123.7m ± 0%  -1.19% (p=0.002 n=6)
RLS/Sample-15000/config_types/Without_RLS-4         4.013m ± 4%   3.951m ± 1%  -1.54% (p=0.015 n=6)
RLS/Sample-15000/config_types/With_RLS-4            124.5m ± 1%   125.0m ± 0%       ~ (p=0.093 n=6)
geomean                                             19.42m        19.37m       -0.28%

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 10, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d141a340-7e57-4078-ba68-b4dfc8578194

📥 Commits

Reviewing files that changed from the base of the PR and between f858566 and 8fd4c39.

📒 Files selected for processing (2)
  • query/catalog_search.go
  • tests/config_changes_test.go

Walkthrough

Modified date parsing in catalog search validation to accept RFC3339Nano or datemath formats, with fallback logic prioritizing RFC3339 parsing. Updated created_at filter bounds to use exclusive lower bound (clause.Gt) instead of inclusive (clause.Gte). Added comprehensive test coverage for cursor-based pagination with various date format inputs.

Changes

Cohort / File(s) Summary
Catalog Search Validation
query/catalog_search.go
Enhanced Validate() to parse from/to parameters as RFC3339Nano first, with fallback to datemath format; updated validation error messages to reflect accepted formats. Changed ApplyClauses() to use exclusive lower bound (clause.Gt) for created_at filtering when FromTime is set.
Cursor Pagination Tests
tests/config_changes_test.go
Added new test context covering cursor-based pagination with created_at filters, validating RFC3339 timestamps with fractional seconds, datemath expressions, exclusive cursor semantics, and error handling when From exceeds To.

Suggested reviewers

  • moshloop
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch from-inserted
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch from-inserted

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 10, 2026

Benchstat (Other)

Base: f85856646a57c46aa280bb51ac1f055e23c526f9
Head: 8fd4c39ac3c2e5f4b66b116354476f08404030ab

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

Benchmark Base Head Change p-value
ResourceSelectorConfigs/name-4 194.6µ 199.2µ +2.33% 0.026
✅ 3 improvement(s)
Benchmark Base Head Change p-value
ResourceSelectorQueryBuild/name-4 43.78µ 42.21µ -3.60% 0.002
ResourceSelectorQueryBuild/name_and_type-4 63.59µ 62.22µ -2.16% 0.041
ResourceSelectorQueryBuild/tags-4 16.91µ 16.64µ -1.59% 0.004
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       558.0µ ±  3%   561.2µ ±  5%       ~ (p=0.589 n=6)
InsertionForRowsWithAliases/config_items.external_id-4     1.077m ± 11%   1.059m ± 10%       ~ (p=0.699 n=6)
ResourceSelectorConfigs/name-4                             194.6µ ±  1%   199.2µ ±  2%  +2.33% (p=0.026 n=6)
ResourceSelectorConfigs/name_and_type-4                    215.1µ ±  2%   214.7µ ±  4%       ~ (p=0.699 n=6)
ResourceSelectorConfigs/tags-4                             28.60m ±  4%   28.26m ±  4%       ~ (p=0.485 n=6)
ResourceSelectorQueryBuild/name-4                          43.78µ ±  3%   42.21µ ±  1%  -3.60% (p=0.002 n=6)
ResourceSelectorQueryBuild/name_and_type-4                 63.59µ ±  2%   62.22µ ±  4%  -2.16% (p=0.041 n=6)
ResourceSelectorQueryBuild/tags-4                          16.91µ ±  2%   16.64µ ±  1%  -1.59% (p=0.004 n=6)
geomean                                                    276.2µ         273.6µ        -0.96%

@yashmehrotra yashmehrotra merged commit 62ca69e into main Apr 10, 2026
22 of 24 checks passed
@yashmehrotra yashmehrotra deleted the from-inserted branch April 10, 2026 14:31
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.

1 participant