refactor(config): PSRAM-axis Kconfig derives, snap static_asserts, heap-classifier coverage (B1-434, B1-435, B1-439)#616
Merged
Conversation
Coverage Report for CI Build 28481948377Coverage increased (+0.4%) to 100.0%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
…ap-classifier coverage (B1-434, B1-435, B1-439) PART 1 — DERIVE (B1-435) bb_pub/Kconfig: BB_PUB_TELEM_SNAP_MAX and BB_PUB_TELEM_SERIALIZE_MAX now derive from SPIRAM: default 1024 when CONFIG_SPIRAM=y (bitaxe), default 512 otherwise (wroom32, tdongle-s3, c3-supermini, s2-mini). Kconfig defaults are lowest precedence, so TaipanMiner's explicit sdkconfig fragment values still win — no behavior change on any currently-shipped board. The derive closes the silent-misconfiguration window for boards that don't carry an explicit fragment entry (the TA-505 S2 root cause: sdkconfig.defaults=1024 was inherited because the S2-mini fragment lacked the override; TM #607 fixed it with an explicit override, this derive prevents the class from recurring). bb_mdns/Kconfig: BB_MDNS_BATCH_RING_DEPTH derives SPIRAM-axis: default 4 with SPIRAM (ring lives in SPIRAM, large batches affordable), default 3 without (internal heap bottleneck; aligns with TaipanMiner sdkconfig/no-psram which sets 3 explicitly). BB_MDNS_BATCH_MAX is intentionally NOT derived here — it is set for DIFFERENT reasons by both single-core and no-PSRAM TM fragments (the single-core axis is orthogonal to the PSRAM axis). RING_DEPTH is the cleanly PSRAM-axis knob. TaipanMiner cross-repo note (do NOT change TM in this PR): after this lands, the following TM fragment lines become REDUNDANT and can be dropped in a re-pin: sdkconfig/no-psram: BB_PUB_TELEM_SERIALIZE_MAX=512, BB_PUB_TELEM_SNAP_MAX=512, BB_MDNS_BATCH_RING_DEPTH=3 sdkconfig/esp32-s2-mini: any duplicated 512 caps that chain from no-psram PART 2 — ENFORCE (B1-434) Add compile-time static_assert (negative-array-size idiom) for every telem snap_t struct that was missing one: - bb_pub_power.c → _power_snap_size_check - bb_pub_fan.c → _fan_snap_size_check - bb_pub_wifi.c → _wifi_snap_size_check - bb_pub_thermal.c → _thermal_snap_size_check - bb_net_health_espidf.c → _net_health_snap_size_check (ESP-IDF only) bb_pub_telemetry_host.c (_meta_snap_size_check) and bb_pub_info.c (_info_snap_size_check) already had their guards from PR #615 — not touched. Each host+ESP file also adds the CONFIG_BB_PUB_TELEM_SNAP_MAX host fallback (512, matching the no-PSRAM default) so the assert compiles on host where sdkconfig.h is absent. The host assert conservatively checks the no-PSRAM floor, catching snap growth before it reaches constrained hardware. B1-374 (Kconfig bridge macro): the existing bridge instances in the files touched here use the correct CONFIG_-prefixed pattern (not the broken bare BB_-prefix form). No mis-bridged symbols found in this scope. The macro itself (BB_KCONFIG_INT/BB_KCONFIG_BOOL) is deferred — add it when more instances are found across the codebase (the DERIVE changes in Part 1 reduce the surface area of the problem). PART 3 — COVERAGE (B1-439) bb_net_health.c had 86% branch coverage (lines 17, 20, 40 uncovered): - bb_net_health_classify_heap: CRITICAL and LOW branches never exercised - bb_heap_state_str: default (unknown enum) branch never exercised Eight new tests in test_bb_net_health.c: test_bb_net_health_classify_heap_{ok,low,critical,zero} test_bb_heap_state_str_{ok,low,critical,unknown_returns_ok} Branch coverage: 99.6% → 100.0% (1813/1820 → 1820/1820) Test count: 2918 → 2925 (+7) DEFERRED COUPLINGS (B1-434 full audit not yet complete): - OTA heap/chunk bounds (BB_OTA_PULL_HTTP_CHUNK_SIZE vs OTA_PULL buffer) - net-health threshold crossing (HEAP_LOW > HEAP_CRITICAL enforce) - WDT reboot race (B1-353 safeguard window vs AP recovery window) - HTTP header buffer overflow (BB_SINK_HTTP_HEADERS_MAX vs buf allocation) - MQTT/HTTP TLS stack depth (BB_PUB_WORKER_STACK vs TLS chain budget) - Single-core panic on pinned worker core (BB_PUB_WORKER_CORE=0 on S2) - Auto-register conflict (BB_OTA_PULL vs BB_OTA_BOOT double-owner) These will be addressed in subsequent PRs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
9e74c7f to
c0e10b0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PART 1 — DERIVE (B1-435)
bb_pub/Kconfig: BB_PUB_TELEM_SNAP_MAX and BB_PUB_TELEM_SERIALIZE_MAX now
derive from SPIRAM: default 1024 when CONFIG_SPIRAM=y (bitaxe), default 512
otherwise (wroom32, tdongle-s3, c3-supermini, s2-mini). Kconfig defaults are
lowest precedence, so TaipanMiner's explicit sdkconfig fragment values still
win — no behavior change on any currently-shipped board. The derive closes
the silent-misconfiguration window for boards that don't carry an explicit
fragment entry (the TA-505 S2 root cause: sdkconfig.defaults=1024 was
inherited because the S2-mini fragment lacked the override; TM #607 fixed it
with an explicit override, this derive prevents the class from recurring).
bb_mdns/Kconfig: BB_MDNS_BATCH_RING_DEPTH derives SPIRAM-axis: default 4
with SPIRAM (ring lives in SPIRAM, large batches affordable), default 3
without (internal heap bottleneck; aligns with TaipanMiner sdkconfig/no-psram
which sets 3 explicitly). BB_MDNS_BATCH_MAX is intentionally NOT derived here
— it is set for DIFFERENT reasons by both single-core and no-PSRAM TM
fragments (the single-core axis is orthogonal to the PSRAM axis). RING_DEPTH
is the cleanly PSRAM-axis knob.
TaipanMiner cross-repo note (do NOT change TM in this PR): after this lands,
the following TM fragment lines become REDUNDANT and can be dropped in a
re-pin:
sdkconfig/no-psram: BB_PUB_TELEM_SERIALIZE_MAX=512, BB_PUB_TELEM_SNAP_MAX=512,
BB_MDNS_BATCH_RING_DEPTH=3
sdkconfig/esp32-s2-mini: any duplicated 512 caps that chain from no-psram
PART 2 — ENFORCE (B1-434)
Add compile-time static_assert (negative-array-size idiom) for every telem
snap_t struct that was missing one:
bb_pub_telemetry_host.c (_meta_snap_size_check) and bb_pub_info.c
(_info_snap_size_check) already had their guards from PR #615 — not touched.
Each host+ESP file also adds the CONFIG_BB_PUB_TELEM_SNAP_MAX host fallback
(512, matching the no-PSRAM default) so the assert compiles on host where
sdkconfig.h is absent. The host assert conservatively checks the no-PSRAM
floor, catching snap growth before it reaches constrained hardware.
B1-374 (Kconfig bridge macro): the existing bridge instances in the files
touched here use the correct CONFIG_-prefixed pattern (not the broken bare
BB_-prefix form). No mis-bridged symbols found in this scope. The macro
itself (BB_KCONFIG_INT/BB_KCONFIG_BOOL) is deferred — add it when more
instances are found across the codebase (the DERIVE changes in Part 1 reduce
the surface area of the problem).
PART 3 — COVERAGE (B1-439)
bb_net_health.c had 86% branch coverage (lines 17, 20, 40 uncovered):
Eight new tests in test_bb_net_health.c:
test_bb_net_health_classify_heap_{ok,low,critical,zero}
test_bb_heap_state_str_{ok,low,critical,unknown_returns_ok}
Branch coverage: 99.6% → 100.0% (1813/1820 → 1820/1820)
Test count: 2918 → 2925 (+7)
DEFERRED COUPLINGS (B1-434 full audit not yet complete):
These will be addressed in subsequent PRs.
Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com