Skip to content

fix(lint): detect transitive Arduino.h dependencies in native ESP implementations #4891

Closed

Description

@zackees

Context

The new EspArduinoHeaderChecker rejects direct Arduino/stream headers and availability probes throughout ESP platform source. It is lexical: the current banned-header regex does not establish transitive include closure.

Concrete gap: platforms/esp/fs/embedded_fs_esp.hpp includes FS.h, and the actual Arduino 2.0.17 FS.h includes Arduino.h. The source passes direct-name enforcement while still relying on Arduino.h transitively. The explicit Arduino SPI backend also includes SPI.h; audit its include closure and ownership as part of this work.

Proposal

Extend existing lint/build dependency checks so native ESP implementations cannot accidentally acquire Arduino.h through wrapper headers. Separate explicitly application-owned Arduino adapters from native implementations. Keep the narrow old-core C UART HAL compatibility case from #4887 working when its include closure is Arduino.h-free.

Acceptance criteria

  • RED -> GREEN: demonstrate current lint missing a fixture native ESP source -> FS.h -> Arduino.h, then make the normal existing lint entry point reject it with an actionable diagnostic.
  • Cover direct and transitive dependencies, real SDK/build include paths, inactive-source policy, and explicit adapter boundaries; do not claim dependency scans alone cover inactive branches.
  • Native SDK-only and small C HAL fixtures pass; comments, unrelated headers and application-owned adapters do not produce false positives.
  • Test representative classic ESP32 and native USB configurations. Coordinate storage/SPI migrations so enforcement does not strand supported builds.
  • Run via existing ./lint and focused tests, with no new GHA workflow and documented cost/toolchain requirements.

Decisions

  • This closes an identified enforcement gap; do not pretend a direct regex already guarantees transitive independence.
  • Prefer a bounded include/dependency check or narrowly justified header policy to an unrestricted recursive scan of every installed SDK.
  • Avoid broad exclusions that allow native implementations to hide Arduino dependencies in arbitrary wrapper headers.

Related issues

#4887 adds the direct policy/checker; the storage child supplies a real regression case.

Tracked under #4888.

Activity

  1. zackees commented on Oct 22, 2026

    @zackees
    MemberAuthor

    Implementation and local verification are complete on feat/esp32-transitive-arduino-lint (f43f21d04), stacked on #4896. The new whole-project Rust pass is part of existing bash lint, with no new workflow.

    • Production CLI tests: 26 pass, with genuine RED -> GREEN for the original transitive FS wrapper and reviewer-found metadata/search-order/wrapper gaps.
    • Selectively restoring the old FastLED.h Arduino import makes normal bash lint --cpp fail with platforms/esp/compile_test.hpp -> FastLED.h -> fl/system/arduino.h; restored fix and final full lint pass.
    • Rust171pass/2ignored; full native debug326units/95examples pass; independent review has no remaining blocker.
    • Classic IDF4.4 and P4 IDF5.5.5 explicit legacy/Arduino SPI adapter SDK probes pass; canonical S3 native USB Serial/JTAG compile/link passes.
    • Physical classic ESP32 canonical AutoResearch RMT passes3scenarios, both payload checks4/4. Canonical image remains installed.
    • Matched fbuild bloat, Lolin D32 / Arduino2.0.17 / IDF4.4.7: noSPI231094flash/21000static before and after; native HOST2 APA102304154/23040 before and after. Attributed symbols identical. This policy repair shows no memory saving for those workloads.

    docs/ESP32_ARDUINO_DEPENDENCY_LINT.md documents actual scope, SDK metadata/toolchain requirements, cost, macro-expansion limits and the explicit legacy adapter exception. Stack/master full CI integration remains pending; physical USB evidence stays in #4893. Parent #4888 remains open.

  2. zackees commented on Oct 22, 2026

    @zackees
    MemberAuthor

    Resolved by #4897 (merged to master 2026-10-22, merge commit 2d83b42).

  3. moved this from Triage to Done in FastLED Trackeron Oct 22, 2026
  4. added a commit that references this issue on Dec 3, 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