fix: KeyError not passing @agents #2856

Merged
mfreeman451 merged 3 commits from refs/pull/2856/head into staging 2026-02-05 05:42:27 +00:00
mfreeman451 commented 2026-02-05 04:33:53 +00:00 (Migrated from github.com)
Owner

Imported from GitHub pull request.

Original GitHub pull request: #2707
Original author: @mfreeman451
Original URL: https://github.com/carverauto/serviceradar/pull/2707
Original created: 2026-02-05T04:33:53Z
Original updated: 2026-02-05T05:42:29Z
Original head: carverauto/serviceradar:2704-bugweb-ng-mapper
Original base: staging
Original merged: 2026-02-05T05:42: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:

Signed-off-by: J. Doe <j.doe@domain.com>

Describe your changes

Code checklist before requesting a review

  • I have signed the DCO?
  • The build completes without errors?
  • All tests are passing when running make test?

PR Type

Bug fix


Description

  • Add missing agents parameter to discovery panel component

  • Pass @agents assign from parent to child component

  • Define agents attribute in discovery_panel function component


Diagram Walkthrough

flowchart LR
  Parent["Parent Component<br/>with @agents"] -- "pass agents={@agents}" --> Child["discovery_panel<br/>Component"]
  Child -- "receive agents attr" --> Render["Render with<br/>agents data"]

File Walkthrough

Relevant files
Bug fix
index.ex
Pass agents parameter to discovery panel                                 

web-ng/lib/serviceradar_web_ng_web/live/settings/networks_live/index.ex

  • Added agents={@agents} parameter when calling discovery_panel
    component
  • Added attr :agents, :list, default: [] attribute definition to
    discovery_panel function component
  • Ensures agents data is properly passed from parent to child component
+2/-0     

Imported from GitHub pull request. Original GitHub pull request: #2707 Original author: @mfreeman451 Original URL: https://github.com/carverauto/serviceradar/pull/2707 Original created: 2026-02-05T04:33:53Z Original updated: 2026-02-05T05:42:29Z Original head: carverauto/serviceradar:2704-bugweb-ng-mapper Original base: staging Original merged: 2026-02-05T05:42: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]( https://developercertificate.org/) indicating the DCO acceptance in one commit message. Here is an example DCO Signed-off-by line in a commit message: ``` Signed-off-by: J. Doe <j.doe@domain.com> ``` ## Describe your changes ## Issue ticket number and link ## Code checklist before requesting a review - [ ] I have signed the DCO? - [ ] The build completes without errors? - [ ] All tests are passing when running make test? ___ ### **PR Type** Bug fix ___ ### **Description** - Add missing `agents` parameter to discovery panel component - Pass `@agents` assign from parent to child component - Define `agents` attribute in discovery_panel function component ___ ### Diagram Walkthrough ```mermaid flowchart LR Parent["Parent Component<br/>with @agents"] -- "pass agents={@agents}" --> Child["discovery_panel<br/>Component"] Child -- "receive agents attr" --> Render["Render with<br/>agents data"] ``` <details><summary><h3>File Walkthrough</h3></summary> <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Bug fix</strong></td><td><table> <tr> <td> <details> <summary><strong>index.ex</strong><dd><code>Pass agents parameter to discovery panel</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> web-ng/lib/serviceradar_web_ng_web/live/settings/networks_live/index.ex <ul><li>Added <code>agents={@agents}</code> parameter when calling <code>discovery_panel</code> <br>component<br> <li> Added <code>attr :agents, :list, default: []</code> attribute definition to <br>discovery_panel function component<br> <li> Ensures agents data is properly passed from parent to child component</ul> </details> </td> <td><a href="https://github.com/carverauto/serviceradar/pull/2707/files#diff-b2127e71582033bc6dfd2d7397f56bf43c1f7c613defffc504b3d8ee1e7406c4">+2/-0</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tbody></table> </details> ___
qodo-code-review[bot] commented 2026-02-05 04:34:11 +00:00 (Migrated from github.com)
Author
Owner

Imported GitHub PR comment.

Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/2707#issuecomment-3851030617
Original created: 2026-02-05T04:34:11Z

ⓘ You are approaching your monthly quota for Qodo. Upgrade your plan

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🟢
🎫 #2704
🟢 Prevent the LiveView KeyError crash caused by missing :agents assign in the discovery
panel rendering path.
Ensure the discovery panel component receives/passes an agents value (or has a safe
default) so rendering does not require @agents to always be present.
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

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

Learn more about managing compliance generic rules or creating your own custom rules

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

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

  • Update
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/2707#issuecomment-3851030617 Original created: 2026-02-05T04:34:11Z --- <pre>ⓘ You are approaching your monthly quota for Qodo. <a href="https://www.qodo.ai/pricing">Upgrade your plan</a></pre> ## PR Compliance Guide 🔍 <!-- https://github.com/carverauto/serviceradar/commit/1b4d48813982e569876307f34544d534a605a3c9 --> Below is a summary of compliance checks for this PR:<br> <table><tbody><tr><td colspan='2'><strong>Security Compliance</strong></td></tr> <tr><td>🟢</td><td><details><summary><strong>No security concerns identified</strong></summary> No security vulnerabilities detected by AI analysis. Human verification advised for critical code. </details></td></tr> <tr><td colspan='2'><strong>Ticket Compliance</strong></td></tr> <tr><td>🟢</td> <td> <details> <summary>🎫 <a href=https://github.com/carverauto/serviceradar/issues/2704>#2704</a></summary> <table width='100%'><tbody> <tr><td rowspan=2>🟢</td> <td>Prevent the LiveView <code>KeyError</code> crash caused by missing <code>:agents</code> assign in the discovery <br>panel rendering path.</td></tr> <tr><td>Ensure the discovery panel component receives/passes an <code>agents</code> value (or has a safe <br>default) so rendering does not require <code>@agents</code> to always be present.</td></tr> </tbody></table> </details> </td></tr> <tr><td colspan='2'><strong>Codebase Duplication Compliance</strong></td></tr> <tr><td>⚪</td><td><details><summary><strong>Codebase context is not defined </strong></summary> Follow the <a href='https://qodo-merge-docs.qodo.ai/core-abilities/rag_context_enrichment/'>guide</a> to enable codebase context checks. </details></td></tr> <tr><td colspan='2'><strong>Custom Compliance</strong></td></tr> <tr><td rowspan=6>🟢</td><td> <details><summary><strong>Generic: Comprehensive Audit Trails</strong></summary><br> **Objective:** To create a detailed and reliable record of critical system actions for security analysis <br>and compliance.<br> **Status:** Passed<br> > Learn more about managing compliance <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#configuration-options'>generic rules</a> or creating your own <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#custom-compliance'>custom rules</a> </details></td></tr> <tr><td> <details><summary><strong>Generic: Meaningful Naming and Self-Documenting Code</strong></summary><br> **Objective:** Ensure all identifiers clearly express their purpose and intent, making code <br>self-documenting<br> **Status:** Passed<br> > Learn more about managing compliance <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#configuration-options'>generic rules</a> or creating your own <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#custom-compliance'>custom rules</a> </details></td></tr> <tr><td> <details><summary><strong>Generic: Robust Error Handling and Edge Case Management</strong></summary><br> **Objective:** Ensure comprehensive error handling that provides meaningful context and graceful <br>degradation<br> **Status:** Passed<br> > Learn more about managing compliance <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#configuration-options'>generic rules</a> or creating your own <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#custom-compliance'>custom rules</a> </details></td></tr> <tr><td> <details><summary><strong>Generic: Secure Error Handling</strong></summary><br> **Objective:** To prevent the leakage of sensitive system information through error messages while <br>providing sufficient detail for internal debugging.<br> **Status:** Passed<br> > Learn more about managing compliance <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#configuration-options'>generic rules</a> or creating your own <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#custom-compliance'>custom rules</a> </details></td></tr> <tr><td> <details><summary><strong>Generic: Secure Logging Practices</strong></summary><br> **Objective:** To ensure logs are useful for debugging and auditing without exposing sensitive <br>information like PII, PHI, or cardholder data.<br> **Status:** Passed<br> > Learn more about managing compliance <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#configuration-options'>generic rules</a> or creating your own <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#custom-compliance'>custom rules</a> </details></td></tr> <tr><td> <details><summary><strong>Generic: Security-First Input Validation and Data Handling</strong></summary><br> **Objective:** Ensure all data inputs are validated, sanitized, and handled securely to prevent <br>vulnerabilities<br> **Status:** Passed<br> > Learn more about managing compliance <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#configuration-options'>generic rules</a> or creating your own <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/#custom-compliance'>custom rules</a> </details></td></tr> <tr><td align="center" colspan="2"> - [ ] Update <!-- /compliance --update_compliance=true --> </td></tr></tbody></table> <details><summary>Compliance status legend</summary> 🟢 - Fully Compliant<br> 🟡 - Partial Compliant<br> 🔴 - Not Compliant<br> ⚪ - Requires Further Human Verification<br> 🏷️ - Compliance label<br> </details>
qodo-code-review[bot] commented 2026-02-05 04:35:10 +00:00 (Migrated from github.com)
Author
Owner

Imported GitHub PR comment.

Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/2707#issuecomment-3851033359
Original created: 2026-02-05T04:35:10Z

ⓘ You are approaching your monthly quota for Qodo. Upgrade your plan

PR Code Suggestions

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Prevent a crash if agents is nil

To prevent a potential runtime error if @agents is nil, provide a fallback to an
empty list when passing it to the discovery_panel component.

web-ng/lib/serviceradar_web_ng_web/live/settings/networks_live/index.ex [952]

-agents={@agents}
+agents={@agents || []}
  • Apply / Chat
Suggestion importance[1-10]: 7

__

Why: The suggestion correctly identifies that if @agents is nil, passing it to the component will cause a runtime ArgumentError due to the :list type constraint, and the proposed fix prevents this crash.

Medium
General
Require agents attribute

Change the agents attribute from having a default value to being a required
attribute to enforce its presence at compile time.

web-ng/lib/serviceradar_web_ng_web/live/settings/networks_live/index.ex [1069]

-attr :agents, :list, default: []
+attr :agents, :list, required: true
  • Apply / Chat
Suggestion importance[1-10]: 3

__

Why: This suggests a valid alternative design choice by making the agents attribute required, but it contradicts the PR's intent of providing a default and does not solve the potential runtime error if nil is passed.

Low
  • Update
Imported GitHub PR comment. Original author: @qodo-code-review[bot] Original URL: https://github.com/carverauto/serviceradar/pull/2707#issuecomment-3851033359 Original created: 2026-02-05T04:35:10Z --- <pre>ⓘ You are approaching your monthly quota for Qodo. <a href="https://www.qodo.ai/pricing">Upgrade your plan</a></pre> ## PR Code Suggestions ✨ <!-- 1b4d488 --> Explore these optional code suggestions: <table><thead><tr><td><strong>Category</strong></td><td align=left><strong>Suggestion&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </strong></td><td align=center><strong>Impact</strong></td></tr><tbody><tr><td rowspan=1>Possible issue</td> <td> <details><summary>Prevent a crash if agents is nil</summary> ___ **To prevent a potential runtime error if <code>@agents</code> is <code>nil</code>, provide a fallback to an <br>empty list when passing it to the <code>discovery_panel</code> component.** [web-ng/lib/serviceradar_web_ng_web/live/settings/networks_live/index.ex [952]](https://github.com/carverauto/serviceradar/pull/2707/files#diff-b2127e71582033bc6dfd2d7397f56bf43c1f7c613defffc504b3d8ee1e7406c4R952-R952) ```diff -agents={@agents} +agents={@agents || []} ``` - [ ] **Apply / Chat** <!-- /improve --apply_suggestion=0 --> <details><summary>Suggestion importance[1-10]: 7</summary> __ Why: The suggestion correctly identifies that if `@agents` is `nil`, passing it to the component will cause a runtime `ArgumentError` due to the `:list` type constraint, and the proposed fix prevents this crash. </details></details></td><td align=center>Medium </td></tr><tr><td rowspan=1>General</td> <td> <details><summary>Require agents attribute</summary> ___ **Change the <code>agents</code> attribute from having a default value to being a required <br>attribute to enforce its presence at compile time.** [web-ng/lib/serviceradar_web_ng_web/live/settings/networks_live/index.ex [1069]](https://github.com/carverauto/serviceradar/pull/2707/files#diff-b2127e71582033bc6dfd2d7397f56bf43c1f7c613defffc504b3d8ee1e7406c4R1069-R1069) ```diff -attr :agents, :list, default: [] +attr :agents, :list, required: true ``` - [ ] **Apply / Chat** <!-- /improve --apply_suggestion=1 --> <details><summary>Suggestion importance[1-10]: 3</summary> __ Why: This suggests a valid alternative design choice by making the `agents` attribute required, but it contradicts the PR's intent of providing a default and does not solve the potential runtime error if `nil` is passed. </details></details></td><td align=center>Low </td></tr> <tr><td align="center" colspan="2"> - [ ] Update <!-- /improve_multi --more_suggestions=true --> </td><td></td></tr></tbody></table>
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
carverauto/serviceradar!2856
No description provided.