Skip to content

fix(output): the network table colors a safe low-risk reference red #2646

Closed

Description

@dan-petty

Problem Description

format_network_references_table (src/devops_cli/output/formatters/tables.py) colors a network reference red when its status holds the text RISK. The status "✓ Safe / Low Risk" holds that text, so a safe reference shows in red, the color of a flagged one. The review report (review/report.py) does not do this: it colors only the status with the warning sign red.

Reproduction Steps

  1. Run uv run python -c "from devops_cli.models.vulnerability import NetworkReference; from devops_cli.output.formatters.tables import format_network_references_table as f; print(f([NetworkReference(target='https://safe-corp.com', security_status='✓ Safe / Low Risk')]).rows[0][3])".

Expected vs Actual Behavior

Expected: [green]✓ Safe / Low Risk[/green].

Actual: [red]✓ Safe / Low Risk[/red].

Environment Diagnostics

devops-cli 0.16.0, Linux, Python 3.14. The probe made no network request.

Logs, Traces, or Terminal Output

[red]✓ Safe / Low Risk[/red]

Pre-Submission Checklist

  • I have verified that no sensitive credentials, private keys, or internal tokens are contained in this issue report.
  • I have checked existing issues and pull requests to ensure this is not a duplicate.

Source: found while working on #2504.

Proposed design

Problem statement

The network references table colors a safe low-risk reference red. The status text "✓ Safe / Low Risk" holds the substring "RISK", so the condition on line 214 of tables.py matches it and assigns the red color. The review report in reference_extractor.py already handles this case by excluding "LOW" from the RISK check. The table formatter is missing that exclusion.

Acceptance criteria

Requirement: Safe low-risk status is green

A network reference whose security_status holds the text "Low Risk" SHALL be colored green.

Scenario: Safe low-risk reference renders green

  • WHEN A NetworkReference has security_status of "✓ Safe / Low Risk"
  • THEN The status cell in the table row is wrapped in [green]...[/green] markup

Requirement: Flagged status is red

A network reference whose security_status holds "⚠️" or "MALICIOUS" or "RISK" without "LOW" SHALL be colored red.

Scenario: High-risk reference renders red

  • WHEN A NetworkReference has security_status of "⚠️ High Risk Detected"
  • THEN The status cell in the table row is wrapped in [red]...[/red] markup

Requirement: Unchecked status is yellow

A network reference whose security_status holds "UNCHECKED" and does not hold a red trigger SHALL be colored yellow.

Scenario: Unchecked reference renders yellow

  • WHEN A NetworkReference has security_status of "Unchecked"
  • THEN The status cell in the table row is wrapped in [yellow]...[/yellow] markup

Existing Tool Considered

No external tool or library covers this need. The fix is a one-line change to a string condition in the project's own code. The written cost is the tokens to edit one condition, add one test case, and verify the output, plus the elapsed time of one pull request cycle.

Key questions

  • What condition should trigger the red color for a network reference status?: Use the same pattern as reference_extractor.py line 609: red when the status holds "⚠️", or holds "RISK" and does not hold "LOW", or holds "MALICIOUS". This excludes "Low Risk" from the red trigger while keeping "High Risk" and "⚠️" statuses red. (best practice) [sources: src/devops_cli/security/reference_extractor.py:609, src/devops_cli/output/formatters/tables.py:214]
    • Chosen: Exclude "LOW" from the RISK check. Matches the existing pattern in reference_extractor.py:609. Keeps "High Risk" red and makes "Low Risk" green.
    • Rejected: Check only for "⚠️" as the red trigger. The issue mentions the review report colors only the warning sign red. But this would leave "MALICIOUS" and "High Risk" without the warning sign uncolored red, losing information.
    • Rejected: Use a structured severity field instead of string matching. A larger refactor. The NetworkReference model does not expose a severity enum. The string-based approach is the existing convention in this codebase.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/bug
    status/new
    value/medium
    effort/low
    on Oct 29, 2026
  2. dan-petty commented on Oct 29, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/bug. The table formatter incorrectly colors a safe status red because it matches the substring RISK.
    • Priority: P2-Medium. It misleads users about security status but does not corrupt data or expose a vulnerability.
    • Value: Medium. A user reading the table may believe a safe reference is flagged, causing confusion and wasted triage.
    • Effort: Low. The fix is a one-line condition change in format_network_references_table to match the warning sign instead of the word RISK.
    • Related: fix(models): make clean-default model fields required #2636, which asks for a different change. Both deal with NetworkReference.security_status and the 'safe' concept, but #2636 fixes model defaults while this fixes the table color logic.
  3. added
    priority/p2-medium
    on Oct 29, 2026
  4. added
    status/ready
    and removed
    status/new
    on Oct 30, 2026
  5. devops-cli-service commented on Oct 30, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 0b7e190 (see proposed design in issue body).

  6. devops-cli-service commented on Nov 2, 2026

    @devops-cli-service
    Contributor

    Staged: branch fix/2646-the-network-table-colors-a-safe, draft pull request #3150. The pull request plans the item and closes no issue.

    The task groups, with the tokens of the inputs of each step, for a budget of 40000 tokens:

    1. Fix low-risk color in network table: 15436 tokens
  7. removed
    status/ready
    on Nov 2, 2026
  8. 10 remaining items

  9. added
    status/planned
    on Nov 3, 2026
  10. devops-cli-service commented on Nov 3, 2026

    @devops-cli-service
    Contributor

    Cleared the stop at group 1 by the rule digest: the runner image changed since the stop, from sha256:ef0d0ace3359daaf57e2bb1904dd131a16eca5fd52c54ffdcfeb5cf25f2c41f8 to sha256:71484cc064d6ab241bf53e6464dad843cc76f71025f0e46dc59adee51ae9b14f. The item is Planned again, and the Service takes it in the next round. The Service clears a stop one time for each runner image. A new stop on this image waits for a comment implement: retry.

  11. added
    owner/service
    status/in-progress
    status/in-review
    and removed
    status/planned
    status/in-progress
    on Nov 4, 2026
  12. devops-cli-service commented on Nov 4, 2026

    @devops-cli-service
    Contributor

    Pull request #3442 is ready for review. The checks passed.

    Spend: 54 model requests, 2878517 input tokens, 9265 output tokens.

  13. devops-cli-service commented on Nov 4, 2026

    @devops-cli-service
    Contributor

    The runner Job devops-cli-runner-20261104-082834-0aee ended: succeeded.
    Image digest: sha256:68ba10ea2a5e3536c67a726812a8aaac645a24539797eb2a7cf907c8762cdf68

    The last lines of its log:

    Tool call: shell, started: ls -la .data/agent/
    Tool call: shell, program ls, ok.
    Tool call: shell, started: git status --porcelain
    Tool call: shell, program git, ok.
    Tool call: shell, started: other
    Tool call: shell, program other, refused.
    Tool call: shell, started: git diff --name-only
    Tool call: shell, program git, ok.
    Tool call: shell, started: git diff src/devops_cli/output/formatters/tables.py
    Tool call: shell, program git, ok.
    Tool call: shell, started: git diff HEAD~1 src/devops_cli/output/formatters/tables.py
    Tool call: shell, program git, ok.
    Tool call: shell, started: ls -la tests/output/test_network_table_color.py
    Tool call: shell, program ls, ok.
    Tool call: shell, started: uv run devops ci test tests/output/test_network_table_color.py ...
    Tool call: shell, program uv, ok.
    Tool call: shell, started: uv run devops ci test tests/output/test_network_table_color.py
    Tool call: shell, program uv, ok.
    Tool call: shell, started: find . -name tmp_test.py -delete 2>/dev/null ...
    Tool call: shell, program find, refused.
    Tool call: shell, started: ls -la | grep tmp_test
    Tool call: shell, program ls, refused.
    Tool call: shell, started: git diff --stat
    Tool call: shell, program git, ok.
    Tool call: shell, started: git diff --name-only HEAD
    Tool call: shell, program git, ok.
    Tool call: shell, started: other
    Tool call: shell, program other, refused.
    Tool call: shell, started: other
    Tool call: shell, program other, refused.
    Tool call: shell, started: git diff --name-only
    Tool call: shell, program git, ok.
    Tool call: shell, started: git diff --quiet || echo <masked>
    Tool call: shell, program git, refused.
    Tool call: shell, started: git diff --name-only HEAD
    Tool call: shell, program git, ok.
    Removed stray files that the group does not name: tmp_test.py.
    Formatted: src/devops_cli/output/formatters/tables.py, tests/output/test_network_table_color.py
    ✓ Took 1 item(s) to a ready pull request, stopped 0.
    Elapsed: 20m 34s
    
  14. removed
    owner/service
    on Nov 4, 2026
  15. removed
    status/in-review
    on Nov 4, 2026
  16. devops-cli-service commented on Nov 4, 2026

    @devops-cli-service
    Contributor
  17. devops-cli-service commented on Nov 4, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-04 14:17 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lowpriority/p2-mediumsource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions