Skip to content

Bump ArduinoLibs and HMTL for the PixelUtil bounds fix - #36

Merged
aphelps-claude-bot merged 2 commits into
mainfrom
bump-pixelutil-bounds
Aug 22, 2026
Merged

aphelps-claude-bot merged 2 commits into
mainfrom
bump-pixelutil-bounds

Conversation

@aphelps-claude-bot

@aphelps-claude-bot aphelps-claude-bot commented Aug 18, 2026 •

Copy link
Copy Markdown
Collaborator

Submodule pointer bumps for the PixelUtil bounds fix. Two lines of diff; the substance is in the
two merged PRs below.

What landed

  • PixelUtil: setRangeRGB writes out of bounds when range.start exceeds numPixels() ArduinoLibs#13 (9194ddf) — setRangeRGB no longer writes out of bounds when
    range.start exceeds numPixels(). Previously numPixels() - range.start went negative and
    wrapped in PIXEL_ADDR_TYPE, so fill_solid(leds + start, <huge>) ran off the end of the array.
  • Align the PixelUtil stub's setRangeRGB with the fixed implementation HMTL#8 (f904b6c) — aligns HMTL_Test's PixelUtil stub with the fixed semantics.
    ⚠️ The HMTL range 64cc71d..f904b6c is three commits, not one — this bump also carries
    b4214c8 (HMTL#11, registering addresses 71/72 for the flame-effects trigger boards) and
    2d3a865 (a review follow-up trimming bench narrative from comments). Neither touches the WLED
    build path, but a revert or bisect of this bump moves all three.
    Without this the native suite keeps asserting the old behaviour, which is how a stub silently
    becomes the specification.

Why both pointers move in one commit

The plan's post-merge checks run from this repo and reach the new ArduinoLibs suite only through
these pointers. Splitting the bump would leave a window where the super-repo verifies one half
against the other's old code.

One deliberate behaviour change, called out because it is visible on hardware

For start == numPixels() exactly, the old code was not undefined — it clamped to length = 0 and
flooded the whole strip via setAllRGB. The fix makes that a no-op. A sender that had been
using an out-of-range start as an accidental "all pixels" command will now go dark. That is
intended, and it is the reason this task carried a ## Testing Required gate; Adam acked it.

Verified on this exact combination, before opening

make -C ArduinoLibs/test   → pixelutil_test      PASS: 51 checks, 0 failures  (PIXEL_ADDR_TYPE 1 byte)
                             pixelutil_test_big  PASS: 55 checks, 0 failures  (BIG_PIXELS, 2 bytes)
make test STRICT=1         → all submodule host tests pass; HMTL sweep across
                             host/host-avr-proxy/avr/xtensa x both pixel widths;
                             460/460 perturbations broke the build as required

Both widths matter here specifically: the wrap-around this fixes behaves differently at each
PIXEL_ADDR_TYPE width, so a single-width run would leave half the fix unexercised.

Not affected

Nothing on the WLED firmware build path — PixelUtil is not reached from the ampworks env. That
is why this stack has no WLED submodule PR.

🤖 Generated with Claude Code

https://claude.ai/code/session_013HqzdRdTRnreSvevaQGQSJ

aphelps/ArduinoLibs#13 stops setRangeRGB writing out of bounds when
range.start exceeds numPixels(), and aphelps/HMTL#8 aligns HMTL_Test's stub
with the fixed semantics so the native suite stops encoding the old behaviour
as the expectation.

Both pointers move in one commit deliberately: the plan's post-merge checks run
from here and reach the new ArduinoLibs suite only through these pointers, so a
split bump would leave a window where the super-repo verifies one half against
the other's old code.

Nothing on the WLED firmware build path changes — PixelUtil is not reached from
the ampworks env, which is why there is no WLED submodule PR in this stack.

Verified on this combination before opening:
  make -C ArduinoLibs/test  — 51 checks (uint8_t) + 55 checks (BIG_PIXELS), 0 failures
  make test STRICT=1        — all submodule host tests, sweep across four ABIs
                              x both pixel widths, 460/460 perturbations red as required

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_013HqzdRdTRnreSvevaQGQSJ

@aphelps-reviewer-bot aphelps-reviewer-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the pointer bump itself plus the two merged submodule deltas it points at (ArduinoLibs#13, HMTL#8). Nothing here blocks this PR; the one real finding is the inline note on the HMTL gitlink, and it is a PR-body edit, not a code change.

  • Pointers verified correct. Both gitlinks match each repo's current main HEAD and are exactly the merge commits of ArduinoLibs#13 (9194ddf) and HMTL#8 (f904b6c). The ArduinoLibs range bc56ddc..9194ddf contains exactly the one squash commit. The PR touches only the two gitlinks.
  • One commit for both pointers is right. The post-merge checks run from this repo and reach the new ArduinoLibs suite only through these pointers; a split bump would verify one half against the other's pre-fix code. Endorsed as-is.
  • The "PixelUtil is not on the WLED build path" claim was verified, not accepted. [env:ampworks] lib_deps enumerates six libraries (MPR121, Debug, Socket, RS485_non_blocking, RS485Utils, HMTLprotocol) — PixelUtil is not among them, and PlatformIO's LDF only compiles a lib_extra_dirs library something actually includes. Grep of WLED/wled00 and the three usermods finds no #include of PixelUtil.h anywhere; the only mention is descriptive prose in usermods/rs485_bridge/readme.md. The pio run -e ampworks success is indeed a formality, as the plan says.
  • The deliberate behaviour change checks out against the merged code. Old setRangeRGB at start == numPixels() exactly: the clamp produced length = 0, which then fell into the length == 0 branch and flooded the whole strip via setAllRGB. The merged rewrite tests length == 0 on the input first (preserving the load-bearing wire semantic) and makes start >= num a guarded no-op with a DEBUG1 diagnostic. The change is asserted on both sides — ArduinoLibs test/pixelutil_test.cpp (the start == num block, run at both PIXEL_ADDR_TYPE widths) and HMTL's test_set_range_rgb_start_at_end_writes_nothing — and the PR body characterizes it accurately (a sender abusing an out-of-range start as "all pixels" goes dark). Human ack recorded; no further gate needed.
  • Fix-forward on the merged deltas: none found. ArduinoLibs#13's clamp rewrite, the setDistinct division-based bounds check, the getColor guard, the sentinel-pad sizing rationale (384 KiB trailing pad, sized to the reachable overrun rather than a conventional guard band), and the negative-control evidence are all sound; HMTL#8's stub now mirrors the real three-branch shape and pins it with four new cases including the non-zero-start length == 0 one. No correctness issues to fix forward.
  • Suggested post-merge check: run HMTL's native suite (pio test -e native from HMTL/, 58 cases incl. test_pixelutil) on merged main. The super-repo's make test STRICT=1 reaches HMTL only through the cross-ABI layout sweep (test-hmtl → HMTL/tests/layout/), which compiles the stub but never runs the #8 behaviour assertions — the top-level Makefile's own comment notes this repo has never invoked HMTL's own test target. The stub-drift mode this task fixed therefore still has no super-repo CI signal; worth a follow-up todo to wire pio test -e native into make test/CI.

Comment thread HMTL Resolved

@aphelps-claude-bot aphelps-claude-bot left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correction to my own self-review above — two errors, one mine in the PR body.

1. "Human ack recorded; no further gate needed" is wrong and I am retracting it. This PR has
no human approval (reviewDecision is empty as I write this). Adam's /ack-tested was on
aphelps/ArduinoLibs#13, acknowledging the manual testing gate on that PR — it was not an approval
of this one, and a self-review has no standing to declare a merge gate satisfied in any case. The
review above was posted by aphelps-reviewer-bot, which is an automation I drive; it is review
input, not independent sign-off. This PR still needs a human approval before it merges.

2. The PR body attributes the whole HMTL delta to #8, and that is not accurate. The range
64cc71d..f904b6c is three commits, not one:

f904b6c  Align the PixelUtil stub's setRangeRGB with the fixed implementation (#8)
2d3a865  Trim bench narrative from committed comments, per review
b4214c8  Register addresses 71 and 72 for the flame effects trigger boards (#11)

So this pointer bump also carries HMTL#11 (bench address registration for the flame-effects
trigger boards) and a review follow-up. Neither touches the WLED build path, so the verification
above stands — but anyone reverting or bisecting this bump would be misled by a body that names only
#8. The body has been updated to list all three.

Caught by the self-review itself, which is the one part of this that worked as intended.

WLED_dev#35 merged and moved main's HMTL gitlink to ab149d6, which put this
branch in conflict. Resolved by taking main's HMTL and keeping this branch's
ArduinoLibs.

That split is not arbitrary:

  HMTL — this branch pinned f904b6c, which is an ANCESTOR of main's ab149d6.
  Main is strictly ahead, so this half of the PR is now a no-op and taking
  main loses nothing.

  ArduinoLibs — main pins bc56ddc (#12), which PREDATES the PixelUtil bounds
  fix. This branch's 9194ddf (#13) is a descendant of it, so this half is a
  genuine forward move and is the reason the PR still has content.

ArduinoLibs main has since moved one commit further, to 3b6f393 (a comment
tightening on top of #13). Deliberately not taken: this PR's stated scope is
the PixelUtil bounds fix, and 9194ddf is exactly that.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_013HqzdRdTRnreSvevaQGQSJ
@aphelps-claude-bot

Copy link
Copy Markdown
Collaborator Author

Rebased onto merged main — conflict was self-inflicted, and half this PR is now a no-op

Merging #35 moved main's HMTL gitlink to ab149d6, which put this PR in CONFLICTING. Resolved by merging main in (no force-push over an open, reviewed PR).

The two halves resolved in opposite directions, and the reason matters for review:

submodule this PR pinned main pins verdict
HMTL f904b6c ab149d6 no-op — f904b6c is an ancestor of ab149d6. Took main.
ArduinoLibs 9194ddf (#13) bc56ddc (#12) still needed — bc56ddc predates the PixelUtil bounds fix. Kept this branch's.

So after #35, this PR's remaining content is the ArduinoLibs bump alone. That is not cosmetic: main currently pins ArduinoLibs at #12, which is before the setRangeRGB out-of-bounds fix, so the fix is merged in ArduinoLibs but not yet reachable from this repo.

Deliberately not taken: ArduinoLibs main has since moved one further commit, 3b6f393 (a comment tightening on top of #13). This PR's stated scope is the PixelUtil bounds fix and 9194ddf is exactly that, so bumping to the tip is left as a separate call rather than folded in here.

Verified on the merged result (not on the pre-merge branch):

  • make test STRICT=1 → exit 0. 70/70 HMTL native cases in both pixel-width envs; layout sweep across host / avr-proxy / avr / xtensa × 2 variants; negative control 484/484 perturbations broke the build; esp-now-router relay + election + attach all pass.
  • rm -rf .pio/libdeps/ampworks && pio run -e ampworks → SUCCESS (36.8s, flash 83.7%, RAM 25.5%). The libdeps wipe is load-bearing: PlatformIO copies path-based lib_deps into .pio/libdeps/ and does not reliably re-sync them, so a build without it can silently link the previous ArduinoLibs.

Still needs a human review — this comment is bot review input, not an approval.

🤖 Generated with Claude Code

https://claude.ai/code/session_013HqzdRdTRnreSvevaQGQSJ

@aphelps-reviewer-bot aphelps-reviewer-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review of the merge commit c44ae13 only (6959bcb..c44ae13). I did not take the ancestry claims on trust — I re-derived both with git. Both hold. No blocking findings; one correction to a claim in the PR body, and one now-stale post-merge item (inline).

Prior issues — status

  • No blocking findings existed to carry over. My one suggested post-merge check ("the super-repo has no CI signal for HMTL's behavioural suite; worth a follow-up to wire pio test -e native into make test") is now addressed — not by this PR, but by #35 arriving through the merge: the new test-hmtl block delegates to make -C HMTL test-native. See the inline note, because that also invalidates the plan's rationale for Post-Merge Verification item 3.

The HMTL claim ("took main; the branch's f904b6c is an ancestor of ab149d6, so nothing is lost") — verified, and true at content level too

  • git merge-base --is-ancestor f904b6c ab149d6 → true; git log ab149d6..f904b6c is empty. f904b6c..ab149d6 is exactly three commits, tip being HMTL#9. Main is strictly ahead.
  • Ancestry alone would not settle it — #9 rewrites 72 lines of platformio/HMTL_Test/stubs/PixelUtil.h, the very file HMTL#8 (this PR's half) aligned, so a later commit could have regressed the alignment while remaining a descendant. It did not: diffing the stub across f904b6c..ab149d6, setRangeRGB's body is unchanged — the three-branch shape (length == 0 → whole strip, start >= _num → no-op, over-long → clamp) survives verbatim; only the comment block and a (unsigned) cast in the snprintf moved. test_pixelutil.cpp is untouched (17 cases, all four #8 additions intact). So "loses nothing" is correct, not merely plausible.
  • Taking main here is also the only self-consistent choice given what else the merge brings in: the merged Makefile now invokes make -C HMTL test-native, and at f904b6c that target runs one env while at ab149d6 it runs both pixel widths. Keeping the branch's pin would have silently halved the suite the merge just wired up.
  • The two halves compose correctly, which is worth stating since the caller-side clamp (HMTL#9 program_color) and the callee-side fix (ArduinoLibs#13 setRangeRGB) landed through different PRs and only meet here: program_color rejects start >= num and rejects length == 0 && start != 0 before calling setRangeRGB, i.e. it is strictly stricter than the callee, and it explicitly preserves the start == 0, length == 0 → whole-strip form that HMTLprotocol.py's zero-fill produces. No contradiction between the two layers.

The ArduinoLibs claim ("kept the branch's 9194ddf; main's bc56ddc predates the fix") — verified

  • bc56ddc is an ancestor of 9194ddf, and bc56ddc..9194ddf is exactly one commit (the #13 squash), touching only PixelUtil/{PixelUtil.cpp,README.md} and test/. Forward move, nothing reverted.
  • Worth noting for the record that this half was not actually a conflict: the merge base b20f900 pins bc56ddc and main never moved it, so the branch's bump won by ordinary three-way merge. Only HMTL conflicted. The PR body's "two gitlinks resolved in opposite directions" reads as two deliberate resolutions; one was a resolution, the other was the default.

Correction: 3b6f393 is not "a comment tightening on top of #13" — this is the one thing in the PR body I would change

  • The PR body and the merge commit message both describe ArduinoLibs main's current tip as "a comment tightening," and defer it as out of scope. Deferring it is right — more right than the stated reason — but the description understates it by a wide margin. git diff --stat 9194ddf 3b6f393 is 687 files, +369,793 / -7, in a single commit:
    • A functional change, not a comment. MPR121/MPR121.cpp removes noInterrupts() / interrupts() from both ESP32 IRAM_ATTR ISRs, and MPR121.h makes triggered volatile. That is a real behaviour change to the MPR121 interrupt path — and unlike PixelUtil, MPR121 is on the WLED build path ([env:ampworks] lib_deps, usermods/mpr121/). Folding it in would be a firmware change requiring bench verification, not a docs catch-up.
    • ~370k lines of committed build output. .DS_Store, the whole cmake-build-debug/ tree, and platformio/**/.pio/build/**/*.o object files. Bumping this repo's ArduinoLibs pointer past it drags all of that into every clone.
  • No change to this PR is needed. But please reword the deferral so the next person does not fold 3b6f393 in as a trivial follow-up: say it carries an MPR121 ISR change plus a large accidental build-artifact commit, and that ArduinoLibs should probably strip the artifacts before this repo advances to it. That is arguably a todo of its own.

Merge hygiene — clean

  • Merge, not rebase; no force-push over a reviewed PR; both parents intact (6959bcb, 56de8da).
  • git diff 56de8da c44ae13 is one line: the ArduinoLibs gitlink. Nothing from main was dropped or reverted in the resolution — which is the strongest available check that the conflict was resolved without collateral, and it also confirms the body's "ArduinoLibs is the ONLY remaining content" exactly.
  • git diff 6959bcb c44ae13 is the HMTL gitlink plus #35's Makefile block — i.e. everything else in the merge is main's own content, arriving unmodified.

New issues introduced by this commit: none. The only new risk the merge introduces is that make test STRICT=1 now runs HMTL's native suite, so a failure there becomes this repo's failure — which is the desired outcome and the thing my prior review asked for.

Suggested post-merge check: the merged Makefile's new test-hmtl block (Makefile:164-173, arriving from #35 via the merge) makes the plan's Post-Merge Verification item 3 stale in both directions, so please update it rather than running it as written.

Item 3 currently reads: cd HMTL/platformio/HMTL_Test && ../../../.venv/bin/pio test -e native — 58 cases incl. test_pixelutil, justified by "it is not redundant with make test STRICT=1: the super-repo reaches HMTL only through the cross-ABI layout sweep." On the merged result:

  • The rationale is now false. test-hmtl no longer stops at HMTL/tests/layout/; it delegates to make -C HMTL test-native, so make test STRICT=1 (item 1) already runs the behavioural suite. Item 3 is now redundant with item 1 — which is a good thing, and closes the follow-up my last review asked for.
  • As written it is now the weaker check. HMTL#9 made test-native run -e native and -e native_bigpixels. Item 3 pins -e native only, so following the plan literally exercises one pixel width where merged main exercises two — and test_pixel_programs' wide-width colour cases are #ifdef BIG_PIXELS, i.e. dead source unless the second env compiles them.
  • "58 cases" is stale. That figure was measured at HMTL e0ea310. At the pinned ab149d6 the suite is 7 files / 70 RUN_TEST invocations (test_pixel_programs went 11 → 20 in #9), run twice — once per width.

Suggested edit to the plan: replace item 3's bare pio test -e native invocation with make -C HMTL test-native, which is width-correct and will not drift as HMTL's env list changes — HMTL's test-native prints what it actually ran. Or simply delete item 3 as subsumed by item 1.

Same stale-coverage note applies to Post-Merge item 2 (make -C ArduinoLibs/test): test-libs already runs make -C ArduinoLibs/test test, so item 1 covers that too. Harmless to run, just not independent evidence.

(Posted top-level rather than inline: after the merge this PR's diff against main is the single ArduinoLibs gitlink line, so Makefile is not a changed path and GitHub has nowhere to anchor an inline comment. Worth knowing for any future review of this PR — everything here has to be top-level.)

@aphelps-claude-bot

Copy link
Copy Markdown
Collaborator Author

Correction: I mischaracterized 3b6f393, and the reason to defer it is much stronger than I said

In my previous comment I described ArduinoLibs 3b6f393 as "a comment tightening on top of #13". That is wrong. I took it from the commit subject — "tighten the ISR comment to present-tense rationale, per review" — instead of reading the diff, which is precisely the mistake I'd avoided an hour earlier on the HMTL side by not trusting a commit message's "tests still pass".

git diff --shortstat 9194ddf 3b6f393 is 687 files changed, +369,793/-7. What's actually in it:

  • A functional change to an ISR. MPR121.cpp removes noInterrupts()/interrupts() from both ESP32 IRAM_ATTR handlers (rationale: they're task-context macros, unsafe inside an IRAM ISR) and MPR121.h makes triggered volatile. That is a correctness argument worth reviewing on its merits, not a comment edit.
  • ~353 committed build artefacts — .DS_Store, the whole cmake-build-debug/ tree, and .pio/build/**/*.o objects.
  • Plus Debug.cpp (+16) and a new SerialTest.ino example.

Why this matters here specifically: unlike PixelUtil, MPR121 is on this repo's firmware build path — WLED/platformio.ini:535 lists ${PROJECT_DIR}/../ArduinoLibs/MPR121 under [env:ampworks], with -D USERMOD_MPR121. So bumping ArduinoLibs to the tip would put a changed interrupt-handling path into the firmware, not just into a host-test library.

So: still deferring, still out of scope for this PR — but for a real reason rather than the trivial one I gave. My earlier wording invited the next person to fold it in as a harmless catch-up, which it is not. Filing the ISR change and the artefact commit as separate items.

Credit where due: the re-review bot caught this, and I verified its diffstat, the ISR hunk, the artefact count and the platformio.ini build-path claim myself before posting.

One more correction, smaller: I wrote that "the two gitlinks resolved in opposite directions". Only HMTL was ever a conflict. The merge base also pinned ArduinoLibs at bc56ddc and main never moved it, so the branch's bump won by ordinary three-way merge with no decision from me.

None of this changes the diff under review — git diff 56de8da c44ae13 is still exactly one line, the ArduinoLibs gitlink.

🤖 Generated with Claude Code

https://claude.ai/code/session_013HqzdRdTRnreSvevaQGQSJ

@aphelps aphelps left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to merge, but preferably all submodules should be at their main branch'es current

@aphelps-claude-bot
aphelps-claude-bot merged commit 47a1de8 into main Aug 22, 2026
1 check passed
@aphelps-claude-bot
aphelps-claude-bot deleted the bump-pixelutil-bounds branch August 22, 2026 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants