adding more tests for devices queries #2427
No reviewers
Labels
No labels
1week
2weeks
Failed compliance check
IP cameras
NATS
Possible security concern
Review effort 1/5
Review effort 2/5
Review effort 3/5
Review effort 4/5
Review effort 5/5
UI
aardvark
accessibility
amd64
api
arm64
auth
back-end
bgp
blog
bug
build
checkers
ci-cd
cleanup
cnpg
codex
core
dependencies
device-management
documentation
duplicate
dusk
ebpf
enhancement
eta 1d
eta 1hr
eta 3d
eta 3hr
feature
fieldsurvey
github_actions
go
good first issue
help wanted
invalid
javascript
k8s
log-collector
mapper
mtr
needs-triage
netflow
network-sweep
observability
oracle
otel
plug-in
proton
python
question
reddit
redhat
research
rperf
rperf-checker
rust
sdk
security
serviceradar-agent
serviceradar-agent-gateway
serviceradar-web
serviceradar-web-ng
siem
snmp
sysmon
topology
ubiquiti
wasm
wontfix
zen-engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
carverauto/serviceradar!2427
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "refs/pull/2427/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from GitHub pull request.
Original GitHub pull request: #1959
Original author: @mfreeman451
Original URL: https://github.com/carverauto/serviceradar/pull/1959
Original created: 2025-11-19T17:14:12Z
Original updated: 2025-11-19T17:26:54Z
Original head: carverauto/serviceradar:srql/queries_test
Original base: main
Original merged: 2025-11-19T17:26:27Z by @mfreeman451
User description
IMPORTANT: Please sign the Developer Certificate of Origin
Thank you for your contribution to ServiceRadar. Please note, when contributing, the developer must include
a DCO sign-off statement indicating the DCO acceptance in one commit message. Here
is an example DCO Signed-off-by line in a commit message:
Describe your changes
Issue ticket number and link
Code checklist before requesting a review
PR Type
Tests
Description
Add seven new device query test cases covering time filters
Test sorting by last_seen in ascending and descending order
Test limit functionality and is_available filter conditions
Add device-delta fixture with 8-day old timestamp for testing
Reformat SQL seed file with consistent indentation and spacing
Diagram Walkthrough
File Walkthrough
comprehensive_queries.rs
Add device query test cases with validatorsrust/srql/tests/comprehensive_queries.rs
time:last_7dandtime:last_1hsort:last_seen:descandsort:last_seen:ascseed.sql
Add device-delta fixture and reformat SQLrust/srql/tests/fixtures/seed.sql
device-deltafixture with 8-day old last_seen timestampdevice-alphalast_seen from 1 hour to 30 minutesImported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/1959#issuecomment-3553826780
Original created: 2025-11-19T17:14:48Z
PR Compliance Guide 🔍
(Compliance updated until commit
github.com/carverauto/serviceradar@64e366a4f7)Below is a summary of compliance checks for this PR:
No security concerns identified
No security vulnerabilities detected by AI analysis. Human verification advised for critical code.🎫 No ticket provided
Codebase context is not defined
Follow the guide to enable codebase context checks.
Generic: Meaningful Naming and Self-Documenting Code
Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting
Status: Passed
Generic: Comprehensive Audit Trails
Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.
Status:
Not applicable tests: The PR adds test cases and seed data without introducing or omitting any production audit
logging; applicability to audit trails cannot be determined from test-only changes.
Referred Code
Generic: Robust Error Handling and Edge Case Management
Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation
Status:
No error paths: The added code is test assertions and SQL fixtures without runtime error handling changes,
so robustness of error handling in application code cannot be assessed from this diff.
Referred Code
Generic: Secure Error Handling
Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.
Status:
Test-only changes: No user-facing error handling is introduced or modified in these test additions; security
of error messages cannot be evaluated here.
Referred Code
Generic: Secure Logging Practices
Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.
Status:
Fixture content: The SQL seed inserts synthetic device and trace data including IPs and identifiers for
testing; since no runtime logging behavior is added or modified, secure logging compliance
cannot be determined from this diff.
Referred Code
Generic: Security-First Input Validation and Data Handling
Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities
Status:
Query strings: The PR adds test query strings and seed data only; it does not modify input validation or
query parameterization in production code, so security of input handling cannot be
assessed from this diff.
Referred Code
Compliance status legend
🟢 - Fully Compliant🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label
Previous compliance checks
Compliance check up to commit 64e366a
No security concerns identified
No security vulnerabilities detected by AI analysis. Human verification advised for critical code.🎫 No ticket provided
Codebase context is not defined
Follow the guide to enable codebase context checks.
Generic: Meaningful Naming and Self-Documenting Code
Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting
Status: Passed
Generic: Secure Error Handling
Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.
Status: Passed
Generic: Comprehensive Audit Trails
Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.
Status:
Test Coverage: The PR adds only tests and fixtures and does not introduce application logic that would
affect audit trails; verifying comprehensive audit logging is outside the scope of the
shown changes.
Referred Code
Generic: Robust Error Handling and Edge Case Management
Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation
Status:
Test Assertions: New test code asserts expected results but does not include explicit error handling paths;
robustness of runtime error handling cannot be assessed from these additions alone.
Referred Code
Generic: Secure Logging Practices
Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.
Status:
Log Data Content: Seed data inserts log rows with generic messages but assessing actual logging practices
and potential sensitive data exposure in runtime logs is not possible from these fixture
changes alone.
Referred Code
Generic: Security-First Input Validation and Data Handling
Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities
Status:
Input Validation: Added tests construct SRQL query strings but do not demonstrate input validation or
sanitization in the application layer; security of input handling cannot be determined
from the test additions.
Referred Code
Imported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/1959#issuecomment-3553831969
Original created: 2025-11-19T17:16:12Z
PR Code Suggestions ✨
Explore these optional code suggestions:
Use
expect()instead ofunwrap()Replace
unwrap()withexpect()when accessing theresultsarray in tests toprovide a more descriptive error message upon failure.
rust/srql/tests/comprehensive_queries.rs [71]
Suggestion importance[1-10]: 4
__
Why: The suggestion correctly recommends replacing
unwrap()withexpect()to provide more informative error messages in tests, which improves debuggability.