Skip to content

fix(models): make clean-default model fields required #2636

Closed

Description

@dan-petty

Problem Description

Four models in src/devops_cli/models/ default to a clean result. A producer that forgets to set the field gives a result that reads as safe, with no error. This is the shape of the defect of #2504, where NetworkReputationRecord.outcome defaulted to ok. #2504 fixes that one model and leaves these four.

  • NetworkReference.security_status defaults to "✓ Safe" (models/vulnerability.py). The extractor (reference_extractor.py) also sets "✓ Safe" on each external reference before any lookup. The review pipeline replaces the text in _audit_file_network_references, so no reference reaches a report with the default today. A path that skips the audit would show an unchecked reference as safe.
  • PackageLookupResult.status defaults to ok (models/vulnerability.py). Each constructor in src/ names the status today, so no result is wrong today. A new client that forgets the status gives ok.
  • NetworkIntelResult defaults to reputation_summary="Safe" and risk_level="LOW", and PackageIntelResult defaults to security_status="Clean" (models/security.py). No code in src/ uses these two models. Only tests/test_resource_schemas.py builds them.

Reproduction Steps

  1. Run uv run python -c "from devops_cli.models.vulnerability import NetworkReference, PackageLookupResult; print(NetworkReference(target='203.0.113.7').security_status, PackageLookupResult().status)".
  2. Run uv run python -c "from devops_cli.models.security import NetworkIntelResult, PackageIntelResult; print(NetworkIntelResult(target='x').reputation_summary, PackageIntelResult(package_name='x').security_status)".

Expected vs Actual Behavior

Expected: a result that no lookup marked has no clean default. PackageLookupResult.status and NetworkReference.security_status are required, or default to an unchecked state. The two unused intel models are removed, or their fields are required.

Actual: the commands print ✓ Safe ok and Safe Clean.

Environment Diagnostics

devops-cli 0.15.1, from origin/main at dde2f55. Linux, Python 3.14. The probe made no network request.

Logs, Traces, or Terminal Output

✓ Safe ok
Safe Clean

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

Four models in src/devops_cli/models/ default to a clean security status. A producer that forgets to set the field gives a result that reads as safe. No error appears. This is the same defect shape as #2504. The fix makes two fields required and removes two unused models.

Acceptance criteria

Requirement: NetworkReference security_status is required

NetworkReference.security_status SHALL have no default value.

Scenario: Construct NetworkReference without security_status

  • WHEN A producer constructs NetworkReference without setting security_status
  • THEN Pydantic raises a validation error

Requirement: PackageLookupResult status is required

PackageLookupResult.status SHALL have no default value.

Scenario: Construct PackageLookupResult without status

  • WHEN A producer constructs PackageLookupResult without setting status
  • THEN Pydantic raises a validation error

Requirement: NetworkIntelResult is removed

NetworkIntelResult SHALL not exist in the models package.

Scenario: Import NetworkIntelResult

  • WHEN A consumer attempts to import NetworkIntelResult from devops_cli.models
  • THEN The import raises ImportError

Requirement: PackageIntelResult is removed

PackageIntelResult SHALL not exist in the models package.

Scenario: Import PackageIntelResult

  • WHEN A consumer attempts to import PackageIntelResult from devops_cli.models
  • THEN The import raises ImportError

Requirement: Package exports are updated

The models package all SHALL not list removed models.

Scenario: Inspect models.all

  • WHEN A consumer inspects devops_cli.models.all
  • THEN NetworkIntelResult and PackageIntelResult are not in the list

Requirement: Tests pass after removal

The test suite SHALL pass without referencing removed models.

Scenario: Run the test suite

  • WHEN The test suite runs after the change
  • THEN All tests pass and no test references NetworkIntelResult or PackageIntelResult

Existing Tool Considered

No check has run. No open, maintained tool or library covers the need to fix Pydantic model defaults in this project. The fix is a code change to the project's own models. The written cost is the tokens to change two field definitions, remove two unused classes, update the package exports, and update the test file.

Key questions

  • Should NetworkReference.security_status and PackageLookupResult.status be required or default to an unchecked state?: Make them required (no default). (best practice) [sources: src/devops_cli/models/vulnerability.py, openspec/changes/archive/2026-10-29-2504-shodan-failed-lookup-outcome/design.md]
    • Chosen: Required (no default). Forces the producer to set the status. A validation error appears if the field is missing. This is the safest option.
    • Rejected: Default to an unchecked state. A consumer must check for the sentinel value. If it does not, it may treat the unchecked state as a valid status.
  • Should NetworkIntelResult and PackageIntelResult be removed or have their fields made required?: Remove them. (best practice) [sources: src/devops_cli/models/security.py, tests/test_resource_schemas.py]
    • Chosen: Remove the models. No code in src/ uses them. Removing them eliminates dead code and its maintenance cost.
    • Rejected: Make their fields required. Keeps dead code. Adds a maintenance cost for models that no producer uses.
  • Does any code in src/ use NetworkIntelResult or PackageIntelResult?: No. Only tests/test_resource_schemas.py builds them. [sources: tests/test_resource_schemas.py, src/devops_cli/models/security.py]

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. Incorrect default values in model classes cause unchecked results to read as safe.
    • Priority: P2-Medium. No current code path triggers the wrong defaults, but a new client or skipped audit step would expose them.
    • Value: Medium. Prevents a class of latent defects where unchecked items appear safe to users.
    • Effort: Low. Changing or removing default values in four model classes is a small, contained change.
    • Related: fix(security): a failed shodan internetdb lookup has outcome failed, so a review never shows its address as safe #2504, which asks for a different change. Both fix model defaults that read as safe when unchecked; #2504 fixes one model's outcome field, the candidate fixes four other models' status fields.
  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 07fb4c2 (see proposed design in issue body).

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

    @devops-cli-service
    Contributor

    Staged: branch fix/2636-a-result-that-no-lookup-marked, draft pull request #3132. 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. Make security_status and status required: 5150 tokens
    2. Remove test references to deleted models: 3996 tokens
    3. Remove NetworkIntelResult and PackageIntelResult: 6822 tokens
  7. removed
    status/ready
    on Nov 2, 2026
  8. 42 remaining items

  9. added
    status/planned
    and removed
    status/blocked
    on Nov 4, 2026
  10. devops-cli-service commented on Nov 4, 2026

    @devops-cli-service
    Contributor

    Cleared the stop at group 1 by the rule digest: the runner image changed since the stop, from sha256:eb2c32f9c27c350eafb35b7f08c274621a0a05b95904b2185c667b9805b0d499 to sha256:ff7f81f8f5902c5ae4e48ed334bc83f842b51afb639ab71be65cb4240daadf01. 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. changed the title [-]fix(models): a result that no lookup marked must not default to a clean status[/-] [+]fix(models): make clean-default model fields required[/+] on Nov 6, 2026
  12. dan-petty commented on Nov 6, 2026

    @dan-petty
    OwnerAuthor

    The job shortened the title of this item. The summary had 65 characters, and the limit is 60. The type and the scope stay.

  13. added
    status/in-progress
    and removed
    status/planned
    on Nov 6, 2026
  14. added a commit that references this issue on Nov 6, 2026
  15. removed
    status/in-progress
    on Nov 6, 2026
  16. devops-cli-service commented on Nov 6, 2026

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

    @devops-cli-service
    Contributor

    Live since 2026-11-06 19:47 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