Skip to content

File analysis labels C++ as C and Helm templates as plain text #540

Closed

Description

@dan-petty

Found by the first run of devops review samples validate (#505).

analyze.scanner.detect_language labels fmt's .cc sources as c, and reads the Helm chart's _helpers.tpl as plaintext. The file analysis feeds review context and file classification, so C++ is reviewed as C and a Helm template as text.

Deliverables

  • .cc, .cpp, .cxx, .hh, .hpp and .hxx are C++; .tpl inside a Helm chart (beside Chart.yaml) is a Helm template.
  • The sample validation reports no mislabelled files for the C/C++ and Kubernetes/Helm categories.

Update 2026-10-08: refinement

The function is ai/analyze/scanner.py:127; its mimetypes branch (:150-155) turns all six C++ extensions into c on hosts that list C++. A second classifier, ai/ast/engine.py:93, says cpp and bash. #1137 makes this the one classifier. (proposed) pygments, already locked, plus our Helm .tpl and Dockerfile.<suffix> rules.

Proposed design

Problem statement

The file analysis tool misclassifies C++ source files (with extensions .cc, .cpp, .cxx, .hh, .hpp, .hxx) as C and Helm template files (.tpl) within Helm charts as plain text, leading to incorrect review contexts and file classifications.

Acceptance criteria

  • Criterion 1: C++ source files with extensions .cc, .cpp, .cxx, .hh, .hpp, and .hxx are correctly identified as C++ language.
    Verification: Run devops review samples validate and confirm no mislabeled C++ files are reported in the output.
  • Criterion 2: Helm template files (.tpl) inside a Helm chart (beside Chart.yaml) are correctly identified as Helm templates.
    Verification: Run devops review samples validate and confirm no mislabeled Helm template files are reported in the output.

Key questions

  • What is the function responsible for detecting file language?: The function detect_language in ai/analyze/scanner.py at line 127. [sources: src/devops_cli/ai/analyze/scanner.py:127]
  • How does the mimetypes library affect language detection for C++ files?: On hosts that list C++, the mimetypes branch in detect_language (lines 150-155) turns all six C++ extensions into c. [sources: src/devops_cli/ai/analyze/scanner.py:150]
  • Is there a second classifier for language detection?: Yes, there is a second classifier ai/ast/engine.py:93 which says cpp and bash. [sources: src/devops_cli/ai/ast/engine.py:93]
  • Should the detect_language function be unified into one classifier?: Yes, issue feat(review): evidence-first code review — tools find, version-pinned facts ground, models explain and plan, fixes are re-checked #1137 proposes making this the one classifier. (proposed) [sources: src/devops_cli/ai/analyze/scanner.py:127]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added this to the v0.2.24 milestone on Sep 24, 2026
  2. added
    type/bug
    scope/ai
    priority/p2-medium
    on Sep 24, 2026
  3. modified the milestones: v0.2.24, v0.2.25 on Sep 30, 2026
  4. dan-petty commented on Sep 30, 2026

    @dan-petty
    OwnerAuthor

    Moved from v0.2.25 to the backlog. v0.2.25 is capped at 12 items (#740), and only the next two planned releases keep a milestone (#739), so P2 items wait in the backlog until reprioritization pulls them in.

  5. added
    scope/review
    on Oct 2, 2026
  6. dan-petty commented on Oct 8, 2026

    @dan-petty
    OwnerAuthor

    Linked: #539. Both come from #505's sample validation; this item's classifier feeds #539's YAML, Dockerfile and Helm symbol extraction. Found by the 2026-10-08 backlog review.

  7. modified the milestones: v0.2.39, v0.2.38 on Oct 17, 2026
  8. dan-petty commented on Oct 17, 2026

    @dan-petty
    OwnerAuthor

    Status set to Ready at 3dd7fa6 (see proposed design in issue body).

  9. modified the milestones: v0.2.38, on Oct 20, 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/p2-mediumscope/aiscope/reviewtype/bug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions