Skip to content

fix(review): discriminate kubernetes manifests for kube-linter and pluto static scans #1242

Closed

Description

@dan-petty

Problem

During branch reviews (devops ai review branch), static analyzers report execution failures for Kube-linter and Pluto:
! Failed during execution: Kube-linter, Pluto (the report's Static Analyzers table says why)

Root causes:

  1. Candidate yaml_paths in _run_static_scanners includes deleted YAML files from branch diffs (e.g. .github/dependabot.yml, .github/workflows/update-prs.yml). Neither the caller nor _scan_kubernetes_manifests checks if p.is_file(), causing Kube-linter (lstat: no such file or directory) and Pluto (invalid file specified) to exit 1.
  2. Generic non-Kubernetes YAML files (such as .github/labels.yml or GitHub Actions workflows) are treated as Kubernetes manifests. Pluto strictly expects Kubernetes API resources and fails to unmarshal sequence-based YAML into a resource map, exiting 1.

Solution

  1. Pre-filter candidate paths to require p.is_file().
  2. Discriminate real Kubernetes manifests (is_kubernetes_manifest(path)) before invoking Kube-linter and Pluto, verifying documents declare apiVersion.
  3. Add test coverage verifying that deleted and non-Kubernetes YAML files are bypassed cleanly by manifest scanners without reporting analyzer failures.

Activity

  1. added this to the v0.2.27 milestone on Oct 6, 2026
  2. added
    type/bug
    scope/ai
    priority/p1-high
    on Oct 6, 2026
  3. dan-petty-bot commented on Oct 6, 2026

    @dan-petty-bot
    Collaborator

    Intake placed this item kept in v0.2.27: it was already in v0.2.27.

    • Priority: P2-Medium. The review pipeline still completes but reports spurious analyzer failures, confusing reviewers without blocking the workflow.
    • Value: Medium. Eliminates misleading failure reports for every branch that touches non-K8s YAML or deletes files, improving trust in the review tooling.
    • Effort: Low. The fix is a small 'is_file()' guard plus an 'is_kubernetes_manifest' discriminator and a few unit tests.
  4. removed this from the v0.2.27 milestone on Oct 6, 2026
  5. dan-petty-bot commented on Oct 6, 2026

    @dan-petty-bot
    Collaborator

    Moved to the backlog: after v0.2.27 started, only a critical fix can join it. A person can place it in a planned release, and that placement stands. (devops roadmap reprioritize)

  6. added this to the v0.2.27 milestone on Oct 6, 2026
  7. dan-petty-bot commented on Oct 6, 2026

    @dan-petty-bot
    Collaborator

    What changed

    #1243, merged into release/v0.2.27 as 8de12a5.

    Summary

    Fixes #1242 by preventing false static analyzer execution failures in review pipelines (devops ai review branch) for Kube-linter and Pluto when reviewing branches with deleted files or non-Kubernetes YAML files.

    • Introduces is_kubernetes_manifest(path) in devops_cli.security.kubeconform and re-exports it in devops_cli.security, validating file existence, supported extensions, bounded file size, and the presence of apiVersion in parsed documents.
    • Pre-filters candidate Kubernetes manifest paths in _run_static_scanners and _scan_kubernetes_manifests via _is_scannable_manifest, skipping non-manifest YAML files (e.g. .github/labels.yml, GitHub Actions workflows) and deleted files in branch diffs while preserving compatibility with mocked scanner test harnesses.
    • Resolves target paths to absolute paths in KubelinterScanner.build_command when present.
    • Upgrades multidict from 6.8.0 to 6.9.1 in uv.lock resolving vulnerability GHSA-54p9-h82j-f925.
    • Adds comprehensive unit tests in tests/test_review_static_analyzers.py.

    9 file(s) changed.

    How it was verified

    Check runs at 9f7bf15:

    • Prune PR DevContainer Images: pass
    • CodeQL: pass
    • Static Analysis: pass
    • Analyze (actions): pass
    • Analyze (python): pass
    • Tests & Coverage: pass
    • DevContainer Image: skipping
    • Service Image: skipping
    • Dependency Freshness: skipping

    Acceptance Criteria of docs/agent/tasks/task-1242-discriminate-k8s-manifests-for-scanners.md:

    • Kubernetes manifest discrimination. is_kubernetes_manifest(path) returns True for valid Kubernetes manifests (YAML or JSON) declaring apiVersion, and False for non-Kubernetes YAML files (e.g. .github/labels.yml, .github/workflows/ci.yml), non-existent files, and oversized files.
    • Clean manifest scanning execution. _scan_kubernetes_manifests filters candidate paths to valid manifests, ensuring missing files and non-manifest YAML files are bypassed cleanly without setting analyzer status to failed.
    • Mock test harness compatibility. _is_scannable_manifest supports mocked scanner test executions that supply non-existent dummy file paths.
    • Security vulnerability remediation. uv.lock upgraded for multidict to 6.9.1, passing uv audit.
    • Changelog fragment. changelog.d/1242.md created; CHANGELOG.md and docs/ROADMAP.md untouched.
    • Pending a person: uv run devops ci passes on this branch.
  8. added a commit that references this issue on Oct 6, 2026
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

    priority/p1-highscope/aitype/bug

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions