fixing rule builder #2693
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!2693
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "refs/pull/2693/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: #2344
Original author: @mfreeman451
Original URL: https://github.com/carverauto/serviceradar/pull/2344
Original created: 2026-01-18T09:12:46Z
Original updated: 2026-01-18T09:14:18Z
Original head: carverauto/serviceradar:2343-bug-create-event-rule-from-log-is-broken
Original base: staging
Original merged: 2026-01-18T09:13:49Z by @mfreeman451
Label
bug fix
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
Bug fix, Tests
Description
Fix rule builder form data structure from atom keys to string keys
Add comprehensive test for log-to-event rule creation workflow
Document the fix and affected requirements in openspec
Diagram Walkthrough
File Walkthrough
promotion_rule_builder.ex
Normalize form data keys to stringsweb-ng/lib/serviceradar_web_ng_web/components/promotion_rule_builder.ex
build_form/1from atom syntax to string keys:nameto"name"formatdata
show_test.exs
Add test for log-to-event rule creationweb-ng/test/serviceradar_web_ng_web/live/log_live/show_test.exs
workflow
rule
unwrap_page/1helper function to extract results from Ashqueries
proposal.md
Document rule builder fix proposalopenspec/changes/fix-log-event-rule-builder/proposal.md
params
spec.md
Define unified rule builder requirementsopenspec/changes/fix-log-event-rule-builder/specs/observability-rule-management/spec.md
and from log entry
entry
tasks.md
Track implementation tasksopenspec/changes/fix-log-event-rule-builder/tasks.md
Imported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/2344#issuecomment-3765087871
Original created: 2026-01-18T09:13:21Z
PR Compliance Guide 🔍
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.🎫 #2343
to avoid Phoenix.HTML.FormData.Map warnings/errors.
:erlang.not(nil)/ ArgumentError crash in the report).a log entry.
Codebase context is not defined
Follow the guide to enable codebase context checks.
Generic: Comprehensive Audit Trails
Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.
Status: Passed
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 Logging Practices
Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.
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:
Leaky error message: The user-facing
:preview_errorincludesinspect(reason)which may expose internal details(e.g., stack/struct contents) to the UI instead of a generic message.
Referred Code
Generic: Robust Error Handling and Edge Case Management
Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation
Status:
Swallowed query errors: The new
unwrap_page/1helper returns an empty list for any unexpected Ash read resultwhich can hide underlying query failures instead of surfacing actionable context.
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:
Unvalidated map passthrough:
build_form/1passesparams["parsed_attributes"]directly into form data withoutvisible validation/sanitization, which may be unsafe depending on how these attributes are
later processed or persisted.
Referred Code
Compliance status legend
🟢 - Fully Compliant🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label
Imported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/2344#issuecomment-3765088067
Original created: 2026-01-18T09:13:38Z
CI Feedback 🧐
A test triggered by this PR failed. Here is an AI-generated analysis of the failure:
Action: build
Failed stage: Configure SRQL fixture database for tests [❌]
Failed test name: ""
Failure summary:
The action failed because a required secret/environment variable for TLS verification was missing:
-
The workflow explicitly checks for
SRQL_TEST_DATABASE_CA_CERTand aborted with:SRQL_TEST_DATABASE_CA_CERT secret must be configured to verify SRQL fixture TLS.(log line 636).-
SRQL_TEST_DATABASE_CA_CERTis shown as empty in the environment (log lines 321, 477, 540, 626),causing the step to exit with code 1 (log line 637).
Relevant error logs:
Imported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/2344#issuecomment-3765088591
Original created: 2026-01-18T09:14:18Z
PR Code Suggestions ✨
Explore these optional code suggestions:
Stringify parsed_attributes keys
In
build_form/1, ensure all keys within theparsed_attributesmap are convertedto strings. This prevents potential issues with form data binding if the
original map contains atom keys.
web-ng/lib/serviceradar_web_ng_web/components/promotion_rule_builder.ex [555]
Suggestion importance[1-10]: 7
__
Why: This suggestion correctly identifies a potential bug where nested atom keys in
parsed_attributeswould not be stringified, contrary to the PR's goal. Applying this change proactively prevents a likely runtime error and aligns the code with the PR's intent to normalize all keys to strings for form binding.Query for specific test resource
Refactor the test to query for the specific rule by its unique name instead of
fetching all rules and using
Enum.find. This makes the test more efficient andits assertions more precise.
web-ng/test/serviceradar_web_ng_web/live/log_live/show_test.exs [160-162]
Suggestion importance[1-10]: 5
__
Why: The suggestion correctly points out a more efficient and precise way to fetch the created resource in the test. Using a direct query with a filter is better than fetching all resources and filtering in memory, improving test performance and robustness.
Avoid silently swallowing test errors
Modify the
unwrap_page/1test helper to fail explicitly on error cases fromAsh.read/2instead of silently returning an empty list. Remove the catch-allclause to allow pattern matching errors on failure, improving test
debuggability.
web-ng/test/serviceradar_web_ng_web/live/log_live/show_test.exs [228-230]
Suggestion importance[1-10]: 6
__
Why: This is a valid suggestion that improves test robustness by preventing silent failures. Removing the catch-all clause in
unwrap_page/1will make test failures more explicit and easier to debug, which is a good practice for test helpers.