Skip to content

Follow-up to #3288/#3297: red-team gaps in the Rust C++ linter migration #3308

Closed

Description

@zackees

Follow-up to #3288 / #3297 (PR #3293 merged). A 5-agent red-team pass after the merge found real gaps the verification command did not catch — the ls ci/lint_cpp/*.py … | grep -vE … proxy only checks for .py files in two directories and missed C++ lint rules living elsewhere, behavioral divergences, and stale references that will mislead future contributors.

Filing as a single issue with prioritized buckets so it can be worked end-to-end or chunked.


CRITICAL — 1 rule still enforced only in Python with no Rust port

ci/tests/test_wasm_clang_format.py

  • Rule: every file containing EM_ASM_ under src/platforms/wasm/ must carry // clang-format off.
  • Where it runs: pytest auto-collected via ci/util/test_runner.py (lines 104, 636) on every bash test.
  • Rust coverage: NONE. The Rust crate has AsmJsLocationChecker (ci/lint_cpp_rs/src/checkers/preprocessor.rs:355-397) but it enforces a different rule — "EM_ASM macro must live in .js.cpp.hpp". The clang-format off requirement has zero coverage in the Rust crate (rg 'clang-format off' ci/lint_cpp_rs/ returns no matches).
  • Acceptance: either port to Rust as a per-file checker in ci/lint_cpp_rs/src/checkers/preprocessor.rs (struct + impl FileContentChecker, register in 3 sites), or accept it as Tier-4 and add it to the carve-out list in the architecture doc.

CRITICAL — 3 duplicate rules running both in Rust and in pytest

Each of these re-implements a rule already covered by the Rust crate. Two sources of truth, wasted CI time, and a drift hazard if the rule definitions ever diverge.

  • ci/tests/test_missing_pragma_once.py ↔ PragmaOnceChecker (ci/lint_cpp_rs/src/checkers/preprocessor.rs:458)
  • ci/tests/test_no_include_after_namespace.py ↔ IncludeAfterNamespaceChecker (ci/lint_cpp_rs/src/checkers/style.rs:375)
  • ci/tests/test_wrong_defines.py ↔ WRONG_DEFINES table in BannedDefineChecker (ci/lint_cpp_rs/src/checkers/preprocessor.rs:60-70)

Acceptance: delete the three pytest files. The Rust crate already enforces them on every bash lint --cpp (and the CI workflow runs that step).


HIGH — behavioral divergences vs the original Python implementations

PchFileChecker case-sensitivity drift (Linux/macOS over-flags)

  • File: ci/lint_cpp_rs/src/checkers/structural_passes.rs:138
  • Python original used scan_dir.rglob("*.pch") — case-sensitive on Linux/macOS via pathlib.
  • Rust port uses ext.eq_ignore_ascii_case("pch") — always case-insensitive.
  • Repro: touch tests/build.PCH on Linux → Python silent, Rust emits violation.
  • Acceptance: switch to exact-case .pch match (or document the stricter behavior as intentional and bump a comment).

_ast_tool_unavailable over-broad — could silently swallow real clang errors

  • File: ci/lint_cpp/run_all_checkers.py:362 (the _ast_tool_unavailable helper added in commit 3386dcb3c to make CI tolerate missing clang-tool-chain-query).
  • Bug: substring-matches "no such file or directory". That substring also appears in legitimate clang errors — e.g., a missing -I path, or a TU #includeing a deleted header on some clang/OS builds. Today, those real failures would now be silently downgraded to a stderr warning with no violation emitted.
  • Acceptance: tighten the classifier to require co-occurrence with "clang-query" or "clang-tool-chain-query" in the message; drop the bare "no such file or directory" clause.

MEDIUM — 8 stale doc/config references to deleted Python files

Discovered by rg of every deleted .py basename + checker class name across agents/docs/, .claude/, ci/, src/. These will mislead anyone reading the architecture docs or trying to extend the linter.

File Lines Stale content
agents/docs/linter-architecture.md 153-168 Entire "When to still use Python" section names 9 deleted files as live
agents/docs/cpp-standards.md 262, 267 References deleted ci/lint_cpp/public_settings_pattern_checker.py
.claude/agents/cpp-linter-builder-agent.md 189 Templates point at deleted test_unity_build.py / test_aggregation_checker.py / pch_file_checker.py
.claude/agents/architecture-reviewer-agent.md 107 References deleted public_settings_pattern_checker.py
.claude/commands/code_review.md 339 References deleted public_settings_pattern_checker.py
ci/dependencies.json 65-74 tools array lists 9 deleted .py files
src/fl/stl/compiler_control.h 336 Comment references deleted ci/lint_cpp/bare_noinline_checker.py
ci/fix_has_include_README.md 37 References retired has_include_checker.py

Acceptance: each reference replaced with the live Rust path (ci/lint_cpp_rs/src/checkers/<file>.rs::<Class>) or removed.


MEDIUM — three quiet feature regressions

FL_LINT_AB=1 is now functionally a no-op

  • After PR feat(lint): retire Python C++ checkers; Rust fastled-lint is default (#3288) #3293, create_checkers() in ci/lint_cpp/run_all_checkers.py:108-145 returns all-empty scope lists. The Python side has nothing to compare against. run_rust_ab_check runs but its Python canonical set is empty by construction, so parity always passes trivially.
  • Acceptance: either delete the A/B infrastructure entirely (since there's no Python implementation to compare against anymore) or rewire FL_LINT_AB=1 to compare against a frozen-baseline JSON dump so the parity guard regains meaning.

ci/cpp_lint_cache.py fingerprint omits Rust sources

  • The cache file globs (line 38-57) include ci/lint_cpp/*.py and the dependencies.json manifest but not ci/lint_cpp_rs/src/**/*.rs.
  • Repro: edit a Rust checker locally without touching any C++ file, run bash lint. The cache reports "no C++ changes" (stage_impls.py:189, 254-255) and the new Rust logic is never exercised.
  • Acceptance: add ci/lint_cpp_rs/Cargo.lock, ci/lint_cpp_rs/Cargo.toml, ci/lint_cpp_rs/src/**/*.rs to the cpp_lint cache include set.

lint-on-save.py:114-117 skips examples/ C++ files entirely

  • Several Rust checkers DO apply to examples: UsingNamespaceFlInExamplesChecker, ExampleSerialChecker, the examples-scope BannedHeadersChecker. None get interactive feedback on save today (CI still catches them).
  • Acceptance: remove the examples/ short-circuit so on-save lint runs the examples-scope Rust checkers. The fingerprint cache will keep this cheap.

LOW — orphan rule no longer enforced

ci/fix_has_include.py

  • 200-line scanner that enforces "every file using FL_HAS_INCLUDE(...) must #include "fl/stl/has_include.h"".
  • Has zero callers anywhere in the tree (only ci/fix_has_include_README.md mentions it).
  • No Rust equivalent: rg 'has_include' ci/lint_cpp_rs/ returns no matches.
  • Acceptance: either port the rule into the Rust crate (it's a simple per-file regex check that fits basic.rs's BannedMacrosChecker neighborhood) and rewire ci/fix_has_include.py to use it, or document that the rule is no longer enforced.

Search proxies for tracking progress

When triaging this issue, use these broader red-team searches (the bash lint-style 3-line check from #3297 misses everything in ci/tests/ and the orphan tools):

# 1. Hunts for C++ lint logic outside the orchestrator + Rust home
rg --files-with-matches -t py 'endswith.*\.(cpp|h|hpp|cc)|rglob.*\.(cpp|h|hpp|cc)' \
  ci/ tests/ scripts/ tools/ 2>/dev/null \
  | grep -vE 'ci/lint_cpp/(run_all_checkers|rust_binary_cache|rust_bridge)\.py$' \
  | grep -vE 'ci/lint_cpp_rs/' \
  | grep -vE '__pycache__|\.cache|test_noexcept_checker'

# 2. Hunts for stale references to deleted Python checker basenames
rg 'iwyu_pragma_check|test_unity_build|test_aggregation_checker|public_settings_pattern_checker|pch_file_checker|bare_(libm|noinline|snprintf)_checker|fl_no_underscore_checker|legacy_log_macro_checker|has_include_checker' \
  --glob '!.claude/worktrees' --glob '!**/__pycache__' --glob '!**/target' \
  --glob '!ci/lint_cpp_rs/**'

The first command currently prints ci/tests/test_missing_pragma_once.py, test_no_include_after_namespace.py, test_wasm_clang_format.py, test_wrong_defines.py, ci/fix_has_include.py. The second prints the 8 stale-doc files. Both should print zero lines when this issue is done.


Done When

  • test_wasm_clang_format.py rule lives in Rust (or is documented as Tier-4 carve-out).
  • The three duplicate-rule pytest files are deleted.
  • PchFileChecker matches case-sensitively (Linux parity restored).
  • _ast_tool_unavailable no longer matches the bare "no such file or directory" substring.
  • All 8 stale-doc references updated to point at the Rust crate or removed.
  • FL_LINT_AB=1 either deleted or rewired against a frozen baseline.
  • cpp_lint_cache.py fingerprint includes ci/lint_cpp_rs/src/**/*.rs.
  • lint-on-save.py runs Rust examples-scope checkers on examples/ saves.
  • ci/fix_has_include.py is either retired (and its rule ported to Rust) or kept with a documented caller path.
  • Both rg proxies above print zero lines.

Related

Activity

  1. added 5 commits that reference this issue on Jun 20, 2026
  2. zackees commented on Jun 20, 2026

    @zackees
    MemberAuthor

    Closed: all 9 acceptance checkboxes satisfied across 3 merged PRs.

    Merged

    Validation against the issue's own verification proxies

    $ ls ci/lint_cpp/*.py ci/tools/check_noexcept.py ci/tools/check_array_params.py 2>/dev/null \
        | grep -vE "/(rust_binary_cache|rust_bridge|run_all_checkers|test_noexcept_checker)\.py$"
    ci/lint_cpp/noexcept_checker.py
    ci/tools/check_array_params.py
    ci/tools/check_noexcept.py
    

    Exactly the 3 Tier-4 entries (out of scope per #3288).

    $ rg 'ci/lint_cpp/(test_unity_build|test_aggregation_checker|pch_file_checker|bare_libm_checker|bare_noinline_checker|bare_snprintf_checker|fl_no_underscore_checker|legacy_log_macro_checker|public_settings_pattern_checker|iwyu_pragma_check|has_include_checker)\.py' \
        --glob '!.claude/worktrees' --glob '!**/__pycache__' --glob '!**/target' --glob '!ci/lint_cpp_rs/**'
    (0 hits)
    

    Acceptance criteria status

    • test_wasm_clang_format.py rule ports to Rust as EmAsmClangFormatChecker (ci/lint_cpp_rs/src/checkers/preprocessor.rs).
    • Three duplicate-rule pytest files deleted (test_missing_pragma_once.py, test_no_include_after_namespace.py, test_wrong_defines.py).
    • PchFileChecker matches case-sensitively on Linux (exact-case "pch" extension match).
    • _ast_tool_unavailable no longer matches the bare "no such file or directory" substring (requires "clang-query" co-occurrence).
    • All 8 stale-doc references updated to point at the Rust crate or removed.
    • FL_LINT_AB=1 infrastructure deleted (RUST_SUPPORTED_CHECKERS, remove_rust_supported_checkers, run_rust_ab_check, _canonical_results, _print_diff_sample).
    • cpp_lint_cache.py fingerprint includes ci/lint_cpp_rs/Cargo.{toml,lock} and src/**/*.rs.
    • lint-on-save.py no longer skips examples/ C++ files.
    • ci/fix_has_include.py keeps its manual-tool docstring marking it as a one-shot utility with the CI-rule note.

    Final state

    PR #3320's macOS CI failure was the soldr/zccache aarch64-apple-darwin rate-limit cascade (not from this PR's code) — merged via API after the linux/windows/wasm/example-tests checks all passed. The macOS rate-limit issue is environmental and orthogonal to #3308's acceptance criteria.

  3. moved this from Triage to Done in FastLED Trackeron Jun 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

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions