Repository navigation
Description
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,.hppand.hxxare C++;.tplinside a Helm chart (besideChart.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.
- One
detect_language, used by every caller of both. - A table test covers C++,
.h,.tpl, Dockerfiles and YAML with an emptymimetypesdatabase.
fix(security): secret masking tells code from literals by the file's syntax, not by receiver names #889 and fix(ai): rag chunks stay under the embedder's real token limit, not a four-characters-per-token estimate #1300 build on it.
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: Rundevops review samples validateand 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: Rundevops review samples validateand 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_languageinai/analyze/scanner.pyat 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
mimetypesbranch indetect_language(lines 150-155) turns all six C++ extensions intoc. [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:93which sayscppandbash. [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.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty commentedon Sep 30, 2026
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.
dan-petty commentedon Oct 8, 2026
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.
dan-petty commentedon Oct 17, 2026
Status set to Ready at 3dd7fa6 (see proposed design in issue body).