Repository navigation
wled_sync: drive every WLED device on the LAN to one look - #31
Conversation
aphelps-claude-bot
left a comment
There was a problem hiding this comment.
Reviewed at fcf64ee. Read the files rather than the diff, ran make test-sync (23 tests green on Python 3.9.12, stdlib only), and exercised --dry-run plus GET-only queries against Trancender (10.1.10.227). Nothing was written to it.
Confirmed sound, so the inline comments below are the exceptions rather than the rule:
selis in the serialized segment state (json.cpp:627), soverify_applied's filter is real and not a guess — Trancender returns"sel": true.- RGBW does not false-fail.
serializeSegmentemits four channels whenstrip.hasWhiteChannel()(json.cpp:602), and the[:3]truncation handles it:verify_applied({"seg":[{"sel":true,"col":[[255,0,0,0]]}]}, col=[255,0,0])returns[]. - Usermod palette IDs survive the round trip:
getValignoresvmin/vmaxfor integer input (util.cpp:71-75), sopal=255is not clamped by the0..getPaletteCount()bound atjson.cpp:299. RSVDis the only duplicated name on the live device (4 of 220), so rejecting by name rather than index is fine — and WLED itself walks forward past reserved slots (FX_fcn.cpp:592), so a stray RSVD index would silently land on a neighbouring effect. Refusing is the better behaviour./json/palis a static PROGMEM list of exactly the fixed palettes (json.cpp:1339-1341), so custom palettes can never shift the positions the fixed block is addressed by.
Test-quality nits — none blocking, but they weaken what the suite claims:
tests/test_wled_sync.py:59-62asserts onlyerr is None, never that the returned index points atHiphotic. It would stay green if resolution landed on the wrong entry.tests/test_wled_sync.py:152-155locks in the invertedcolour_is_mootbehaviour — see the first inline comment. Both assertions need flipping alongside the fix.- The
class Aargparse stubs (:244,:259) hand-copy dest names. Renaming--color's dest would leave these green whilemain()broke. Factoring theArgumentParserinto abuild_parser()and callingparse_args([...])would tie the test to the real surface. EFF_16/EFF_014are padding (["RSVD"] * 138,["Android"] * 36), sotest_same_name_resolves_per_deviceproves the mechanism but not the plan's measured claim of "zero renames across the 178 shared effects". Worth saying so in the docstring so nobody later reads it as version evidence.
PR description: says "21 host tests"; make test-sync reports Ran 23 tests (fcf64ee added two timebase tests). Its --color paragraph repeats the palette-0 error called out inline. Separately, CUSTOM_PALETTE_ID_BASE (wled_sync.py:42) is defined and never referenced — use it in resolve_palette's error message ("custom palettes are not addressable by name") or drop it.
|
Addressed in 1 (HIGH) — the colour warning was inverted. Confirmed, and the names are actively misleading in both directions:
So it warned exactly when it shouldn't and stayed silent exactly when it should have spoken. The set is now derived from the palette switch (2-5 build 2 (MEDIUM-HIGH) — 3 (MEDIUM) — one exception discarded the report. Fixed; failures are now caught per-device into a 4 (MEDIUM) — verifier crying wolf. Both cases fixed using fields WLED already returns:
Thanks for confirming 5 (MEDIUM-LOW) — exit code. Now non-zero if any device didn't get the look; Not yet addressed, and I'd rather flag than silently skip:
27 tests, |
|
Remaining three cleared in (7) The dry-run test genuinely couldn't fail — worth spelling out, because you were more right than I gave you credit for. The stub had no I mutation-checked it rather than assuming — disabling the dry-run branch: It fails now, as it should have from the start. (6) Dead constant removed — with the reason recorded instead, since "why is this unused" is the question a reader would otherwise ask: WLED exposes no names for custom palettes, so they're unreachable by name by construction. Also correcting the PR description: it says 21 host tests; there are now 27.
|
aphelps-claude-bot
left a comment
There was a problem hiding this comment.
Re-reviewed fcf64ee..bc29037. Read the files, re-read the WLED sources each claim cites, ran make test-sync (27 tests green, Python 3.9.12, stdlib only), mutation-tested every new assertion, and ran --dry-run + GETs against Trancender. Nothing was written to it.
Prior issues — status
- ✅
colour_is_mootinversion.random cyclecorrectly leaves the set: palette 1 is_randomPalette(FX_fcn.cpp:248-249) and never readscolors[]. The tests now pin it, and they are not vacuous — droppingdefaultor re-addingrandom cycleeach makes the suite red. - ✅
verify_applied'sor segsfallback. Theselearly return matchesjson.cpp:470-474exactly. - ✅
CUSTOM_PALETTE_ID_BASEdropped, no dangling references. - ✅ The dry-run stub. This is the best change in the batch — I forced
sync_onepast thedry_runbranch andtest_dry_run_writes_nothinggoes red, which it could not have done before. - ✅ Per-device exception isolation is correct: the
futsdict recoversdev, and the synthesised row carries all four keys thewidths/table code indexes, so a failure there cannotKeyErrorthe report. - ❌ Test nits unaddressed (fine to leave, but they still weaken the suite):
tests/test_wled_sync.py:59-62still asserts onlyerr is Noneand never that the index points atHiphotic; nobuild_parser(), so theclass Astubs still hand-copy dest names;EFF_16/EFF_014padding still undocumented. - ❌ PR description still misstates two things. It says "21 host tests" —
make test-syncnow reportsRan 27 tests. And its--colorparagraph still reads "palette 0 or any gradient palette", which is the exact error this batch fixed in the code. Thevrow of the four-fields table also still sells read-back on "palis silently ignored for non-RGB segments" — the change below deliberately stops checking that.
New — seg.fxdef is the one to reconsider. Details inline at wled_sync.py:185, but the shape of it: fxdef is not "reload sx/ix", it is "reload the effect's entire default profile", and two of those defaults are not part of a look. FX_fcn.cpp:609 resets map1D2D to M12_Pixels whenever the effect does not declare m12= (174 of 220 effects), and FX_fcn.cpp:616-617 calls setPalette() from the effect's pal= default (60 effects declare one). WLED's own call site carries the warning: json.cpp:291 — // use transition (WARNING: may change map1D2D causing geometry change). The plan asks for "a 2D matrix and a 1D strip in one run"; on the matrix this silently discards its expansion mode. If the goal is speed parity, sx/ix in the body is the narrow instrument — fxdef is the wide one, and it also does not achieve the goal on a device already running the target effect (both json.cpp:291 and FX_fcn.cpp:595 gate on fx != mode).
Everything else in the batch is sound. The new argparse help, --discovery-timeout/--discovery-workers and the exit-code rule all behave as described — verified live: --effect 'Nonexistent Effect' --dry-run now exits 1 where it previously exited 0.
aphelps-claude-bot
left a comment
There was a problem hiding this comment.
Re-reviewed bc29037..d45b830. Read both files, re-read json.cpp / util.cpp / FX_fcn.cpp and the vendored ArduinoJson for every claim, ran make test-sync under Python 3.9.12 (31 green, stdlib only), mutation-tested each new assertion, and ran --dry-run + GETs against Trancender. Nothing was written to it.
Prior issues — status
- ✅
fxdefis gone cleanly. Noload_defaultsparameter, no dangling references — the only surviving mentions are the docstring and the regression test, which is where they belong. And the replacement beatsfxdefon its own terms:json.cpp:294-295appliessx/ixunconditionally, after theif (fx != seg.mode)gate at:291, so--speedreaches a device already running the target effect — the exact casefxdefcould not fix. - ✅
sx/ixare the right keys on both sides of the wire (json.cpp:294-295in,:621-622out). - ✅ The two new tests are not vacuous. I re-added
seg["fxdef"] = Trueand madesxunconditional;test_fxdef_is_never_sentandtest_speed_and_intensity_sent_only_when_askedboth go red. - ✅
colour_is_moot's docstring now matches the code — checked againstFX_fcn.cpp:1168-1170(palette == 0 && mcol < NUM_COLORS) and the doxygen at:1162("If >2, Party palette is used instead"). The "a minority pass 255" hedge is accurate, not hand-waving. - ✅
--hosthelp is now correct:args.hostdoes skiplocal_subnets()(:394) and is probed under--discovery-timeout(:413). - ✅ PR description: "31 host tests" matches
make test-sync, and the--colorparagraph is fixed. - ❌ The
vrow of the four-fields table is now self-contradictory. It still sells read-back with "palis silently ignored for non-RGB segments (json.cpp:298)" — butverify_applieddeliberately stopped checking exactly that (wled_sync.py:242,and is_rgb). Raised last round; the other two description items were fixed, this one wasn't. The checks that still earn read-back are thefxcomparison and the "no segment selected" diagnosis — cite those instead. - ❌ Nit, still open: the module
Usage:block (wled_sync.py:19-23) doesn't mention the two new flags.
New. Most of this batch is deletion and it is the right deletion — no objection to the revert itself, and the narrow sx/ix replacement is correctly placed. Three things, all inline. The one you flagged yourself is real: TestExitRule re-implements the rule and proves nothing (I mutated main() to return 0 and the suite stayed green). The other two are --speed/--intensity being under-defended — out-of-range doesn't clamp, it zeroes, and --dry-run can't see the flag at all.
|
Ready for review. CI green on I'm stopping the self-review cycle here deliberately, so it's a decision rather than a drift. Four rounds each found something real, so the process earned its cost — the tally is worth recording:
The last delta is corrective only: extracting Three of the tests in this PR could not fail when written. That's a pattern in my work, not bad luck: a test written from the same understanding as the code inherits its blind spots unless it's forced through the shipped path. All three now mutation-checked. Still not run against hardware. Every live check was |
aphelps-claude-bot
left a comment
There was a problem hiding this comment.
Re-reviewed d45b830..9ad0dd0 — 47/13 lines, corrective. Read both files, re-read json.cpp / util.cpp / the vendored ArduinoJson for the zeroing claim, ran make test-sync under Python 3.9.12 (32 green, stdlib only), mutation-tested the new exit-rule test and the stub change, and ran a live --dry-run against Trancender. Nothing was written to it.
This batch is essentially clean. The two substantive items both hold up under test, and I could not find a defect in them. What is below is one test-quality issue and two nits.
Prior issues — status
- ✅ The exit-rule test is real now. Mutated
exit_codetoreturn 0and three tests go red — last round the same mutation left the suite green. And the extracted rule is semantically identical to what it replaced:rows and len(ok) == len(rows)has the same truth table aslen(ok) == len(rows) and rows(empty → 1, verified), andr.get("status")vsr["status"]cannot diverge because every row-construction path inmain()setsstatus. - ✅ The range check is right, and the premise checks out.
getVal(elem["sx"], seg.speed)(json.cpp:294) passes no bounds;val = elemconverts throughconvertNumber<T>(ArduinoJson-v6.h:1385) =canConvertNumber ? TOut(value) : 0, so 999 →sx=0. Empirically:-1/256/999→ exit 2,0/1/255accepted, and the error prints beforeScanning …, i.e. beforeload_scanner()and any socket.ap.erroris the right mechanism. - ✅
--speed/--intensitystandalone works, including--speed 0— theis not Noneguards are correct where a truthiness test would have silently rejected 0. - ✅ Dry-run detail carries sx/ix. Live against Trancender:
would apply fx=180 sx=128 ix=0— noteix=0renders, so theis not Noneguard is right there too. GETs only; state untouched. - ✅ The
vrow of the four-fields table now reads consistently ("200 ≠ applied" + non-RGB as the deliberate exemption). Closed. - ❌ Stale count in the PR description. The
## Testssection says 32 (correct —make test-syncreports 32), but the trailing### Updatesection still says "31 tests, CI green". - ❌ Nit, third round: the module
Usage:block (wled_sync.py:19-23) still doesn't mention--speed/--intensity.
New. Nothing fleet-affecting. Three inline, all low: the getattr in the dry-run detail line makes item 6 (the stub attributes) a no-op and hides the very asymmetry it was added to prevent; there is no dry_run=False test of sync_one, so the line that forwards speed=args.speed into build_body has zero coverage; and the rewritten verify_applied docstring still slightly overstates the non-RGB exemption.
aphelps
left a comment
There was a problem hiding this comment.
This should be in a separate "scripts" directory
|
Moved to
Two things worth flagging:
|
ReviewCross-session review, read-only. Short version: this is in good shape. The tests are genuinely load-bearing (I mutation-tested them — 14/14 breakages go red), the Makefile wiring really runs them, and every empirical claim in the PR body that I could check held up exactly. Four real findings below, one of which I'd fix before this is pointed at hardware. 1. Correctness: a single shared
|
aphelps
left a comment
There was a problem hiding this comment.
Please add to the README a description and basic use of this new script.
Then file a task to write a comprehensive top level README
|
Both items addressed in Why this sat for ~11 hours. My hourly check polled only The import. No good reason — a slip, not a decision. The README. Added
A check confirms every flag the parser defines appears in the README — 15 flags, none undocumented. One thing to flag: this file will conflict with the Top-level README task filed — it is in Ready Tasks. Worth saying plainly: there is no 33 host tests pass. |
aphelps-claude-bot
left a comment
There was a problem hiding this comment.
Approved, but held: blocked on human testing, not on code.
## Testing Required has four items and I cannot honestly tick any of them — every one needs two or more physical devices, and only one is reachable right now (2cbcbbd98960 at 192.168.1.39). Merge is gated until you /ack-tested.
- Two or more physical devices driven to the same look, confirmed visually — ideally one on a different firmware version, since mismatched effect/palette indices between builds are exactly what this tool avoids by matching on names. One device cannot demonstrate that.
- A 2D matrix and a 1D strip in one run — the effect is sensible on both, or the mismatch is reported rather than silently rendering oddly.
- Re-running is idempotent — no visible flicker or restart.
- Confirm which other devices can be powered on, or accept the stub-server test as the cross-version evidence.
The last one is really a question for you rather than a test: the host suite covers cross-version behaviour against a stub server, and if you would rather accept that than power up a second board, say so and I will record it as the evidence and tick it.
Code side is done: the import is hoisted, scripts/README.md documents the script, the thread is resolved, and CI is green.
aphelps-claude-bot
left a comment
There was a problem hiding this comment.
Approved, but held: blocked on human testing, not on code.
## Testing Required has four items and I cannot honestly tick any of them — every one needs two or more physical devices, and only one is reachable right now (2cbcbbd98960 at 192.168.1.39). Merge is gated until you /ack-tested.
- Two or more physical devices driven to the same look, confirmed visually — ideally one on a different firmware version, since mismatched effect/palette indices between builds are exactly what this tool avoids by matching on names. One device cannot demonstrate that.
- A 2D matrix and a 1D strip in one run — the effect is sensible on both, or the mismatch is reported rather than silently rendering oddly.
- Re-running is idempotent — no visible flicker or restart.
- Confirm which other devices can be powered on, or accept the stub-server test as the cross-version evidence.
The last one is really a question for you rather than a test: the host suite covers cross-version behaviour against a stub server, and if you would rather accept that than power up a second board, say so and I will record it as the evidence and tick it.
Code side is done: the import is hoisted, scripts/README.md documents the script, the review thread is resolved, and CI is green.
|
Approved, but held: blocked on human testing, not on code.
The last one is really a question for you rather than a test: the host suite covers cross-version behaviour against a stub server, and if you would rather accept that than power up a second board, say so and I will record it as the evidence and tick it. Code side is done: the import is hoisted, |
The self-review found six issues; four were real and are fixed here. The embarrassing ones are in the checker I added to prevent exactly this. **Commands in the README did not run when pasted.** `make test-bridge# HMTL wire format (run twice: ...)` — `#` glued to the target is not a bash comment, so pasting it gave `No rule to make target 'test-libs#'` and a bash syntax error on the parentheses. Both reproduced. In a document whose whole purpose is being followable by someone who cannot ask a question, that is the worst defect in the PR. The columns are now aligned so every `#` is a real comment, and two checks guard it: `bash -n` per line, plus an assertion that `#` is preceded by whitespace — because `bash -n` only catches syntax errors, and `make test-libs# note` parses fine while invoking a target that does not exist. **Two assertions could never fail.** - The submodule check used a substring test, and `aphelps/WLED` is a substring of the clone URL `aphelps/WLED_dev.git`, so it passed with the entire WLED row deleted. Strengthened to require the path and its upstream URL on the same line — which also fixes a second weakness found while mutation-testing: `| \`WLED/\`` appears in the Repo layout table too, so "does this path appear anywhere" was still satisfiable. - The env and .gitmodules sections announced they were checking the README while testing hardcoded literals. They now parse the README's own tables, so a typo or a rename fails. **`make test` broke unhelpfully on an uninitialised clone** — `test-readme` was the only suite with no `require_submodule` guard, so it died on a FileNotFoundError traceback instead of the deliberate "run ./setup.sh" message. Guarded, and the script now resolves paths from its own location rather than the cwd. Also added the drift-prone numbers the docstring claimed to protect but did not check: WLED version, env count, default_envs count, default device IP. Writing that check found my own error — the first regex ran past the blank line terminating `default_envs` and reported 36 where the answer is 23. The README was right; the check was wrong. Every check is now mutation-tested: 10 deliberate defects introduced, 10 caught. One apparent miss was a mis-specified mutation that changed a link label while leaving the URL correct — passing was the right answer, and mutating the URL itself is caught. Not fixed, deliberately: the fleet-scripts pointer. `scripts/` is untracked on main until #31/#32 land, so linking it would fail the link checker. A follow-up adds it. make test green. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
aphelps-claude-bot
left a comment
There was a problem hiding this comment.
Re-reviewed 9ad0dd0..ca374e0 — the scripts/ move, the new scripts/README.md, and the apply-path test. Checked out ca374e0 in a temp worktree, ran make test-sync (33 green, Python 3.9.12), confirmed scripts/wled_sync.py --help runs from the new path, verified the README's options table against the actual argparse defaults and its colour-driven palette list against COLOUR_DRIVEN_PALETTES (both match), and grepped the test suite against the README's claims. No device was contacted this round — no GETs, no writes.
Prior issues — status
- ✅ Stale count in the PR description:
## Testsand### Updateboth say 33 now, andmake test-syncreports exactly 33. - ✅ Module
Usage:block now shows--speed 128 --intensity 200. - ✅
getattrno-op: replaced with plainargs.speed is not None/args.intensity is not None, so the stub attributes are load-bearing — proven by the new apply-path test, which drivessync_onethrough a bare attribute class. - ✅ Apply-path coverage:
test_apply_forwards_speed_and_intensityrunssync_onewithdry_run=Falseand assertssx/ix/tb/udpn.nnon the actual wire body — exactly the uncovered forwarding line flagged last round, plus a bonus re-assertion of the broadcast-suppression flag on the live path. - ✅
verify_applieddocstring now scopes the non-RGB exemption topal/coland statesfxis still verified.
New
- One real finding, inline: the README's Tests paragraph describes a different test suite.
- One nit, inline: the exit-status sentence overlooks usage errors exiting 2.
- TOP-LEVEL: the PR is now
CONFLICTINGagainstmain.git merge-treeshows theMakefileis the only conflicted file — the recently merged top-level-readme work touched it, and this branch adds thetest-synctarget there. Needs a rebase/merge before it can land; the CI pass on ca374e0 predates the conflict, so let CI re-run on the rebased head.
Scans the local subnet and applies the same effect, colour and palette to every
device it finds, turning them on in the process.
Resolution is BY NAME, per device. Effect and palette numbers are
firmware-specific — 220 effects on 16.0.1 against 187 on 0.14.4 — so the same
index is a different effect on different hardware, which would silently produce a
mismatched fleet that looks like a wiring or timing fault. Names are stable:
diffing mode-data strings between v0.14.4 and 16.0.1 shows zero renames across
the 178 shared effects, only Police and Meteor Smooth removed. A device missing
the requested name is skipped and said so, never given a near-miss substitute.
Four things in the request body are there for non-obvious reasons:
udpn.nn suppresses WLED's own UDP sync. Without it, deserializeState ->
stateUpdated -> notify() (led.cpp:95) re-broadcasts the RAW effect and
palette bytes (udp.cpp:51,69) to every device with sync receive on --
which Trancender has -- undoing the per-device name resolution through
a side channel and racing our own POSTs.
tb one timebase shared across the whole run, so devices agree on
strip.now and animate in step rather than drifting apart.
v makes WLED return the full state instead of {"success":true}, folding
verification into the same round trip with no window for a playlist or
another operator to slip in. Needed because a 200 does not mean
applied: pal is silently ignored for non-RGB segments (json.cpp:298).
on a reachable device is powered, so light it. No brightness is imposed --
toggleOnOff restores the device's own briLast (led.cpp:44-47), so
per-device levels survive.
Palette IDs are not one contiguous list: fixed palettes are their position in
/json/pal, usermod palettes are 255-j and are named only in info.umpalnames, and
custom are 200-k with no names at all. Position is the ID for the fixed block
only. /json/pal also decorates five entries with a leading '*', so "Random Cycle"
must match "* Random Cycle".
--color warns when the chosen palette will make it invisible: under palette 0 or
any gradient palette most effects take colour from the palette and ignore col
entirely, and a flag that silently does nothing reads as a bug.
21 host tests, wired into the top-level Makefile as test-sync so CI's
`make test STRICT=1` actually runs them. The cross-version case stands up two
stub HTTP servers rather than needing two firmware versions on the bench -- only
one device is currently reachable. Highest-value assertion is that every
generated body carries udpn.nn: that regression would be silent and fleet-wide.
Verified live in --dry-run against the one reachable device: resolved Hiphotic to
fx=180 and Random Cycle to pal=1, independently matching what it already runs,
and left its state byte-identical.
WLED parses `tb` into `long tr` (json.cpp:398) and ignores it unless `tr >= 0` (json.cpp:417-418). `long` is 32-bit signed on ESP32, but the tool was sending `int(time.time()*1000) & 0xFFFFFFFF` — 3124561992 today, well above INT32_MAX. That value does not survive the parse, so `strip.timebase` was never assigned and devices kept their own phase while the tool reported success. Exactly the silent no-op this tool is built to avoid. The failure is intermittent, which is worse than a constant one: bit 31 of epoch-milliseconds flips about every 24.8 days, so alignment would have worked for ~25 days, quietly stopped for ~25 days, then resumed — reading as "sometimes the lights drift" rather than as a bug. Masks to 31 bits instead. The absolute value is arbitrary: `strip.timebase = tb - millis()` means only agreement between devices matters, not the epoch. The existing test missed this by asserting on a small literal (1234567) rather than what the tool actually generates. Added two regressions: one constructing the overflow half explicitly (0x1C0000000, so it does not depend on when the suite runs — my first attempt used a "realistic" epoch that happened to land in the safe half and passed against the broken code), and one asserting the anchor is shared across devices, since alignment depends on every device getting the same value.
…ted the sync
colour_is_moot had the two palettes that matter exactly backwards, so the tool
warned precisely when it should have stayed quiet and stayed quiet precisely when
it should have warned. Both were verified in WLED's source rather than inferred
from the names, which mislead in both directions:
"Default" (0) color_from_palette short-circuits to getCurrentColor()
(FX_fcn.cpp:1168-1170), so --color is at its MOST effective
here — the tool called it moot.
"* Random Cycle" (1) wears the same '*' as the colour palettes but uses
_randomPalette and never reads colors[] (FX_fcn.cpp:248-249),
so --color does nothing — the tool called it effective.
Palettes 2-5 build their CRGBPalette16 from colors[0..2] and are genuinely
colour-driven. The set now cites the switch it came from.
Effect changes now send fxdef. setMode only reloads speed/intensity under
loadDefaults (FX_fcn.cpp:600-611), so without it every device kept its own sx/ix
and ran the same effect at a different rate — the exact divergence the shared
timebase exists to prevent, arriving through another door.
One device's exception no longer discards the whole report. f.result() re-raised
inside the as_completed loop and the traceback escaped before the table printed;
urlopen does not wrap http.client exceptions, so this was reachable rather than
theoretical.
verify_applied stops crying wolf in two knowable cases, both distinguishable from
fields WLED already returns. A seg body with no id only touches SELECTED segments
(json.cpp:470-474), so when none are selected nothing was written — previously
reported as a phantom "wrong effect" via an `or segs` fallback. And non-RGB
segments have pal skipped and col forced to white, which would have pinned the
exit code to 1 forever; lc (json.cpp:597) identifies them.
Exit code now reflects whether devices actually got the look: skipped and
unreachable count as failure. A run where every device was skipped was exiting 0.
27 tests, including the RGBW four-channel and unselected-segment cases that the
reviewer asked about specifically — neither false-fails.
The dry-run test could not fail. Its stub had no do_POST, so a write got a 501, which post_json swallows into a quiet "failed" row — the test would have passed even if --dry-run had written. The stub now accepts POSTs and records them, and the test asserts nothing was recorded. Mutation-checked by disabling the dry-run branch: the test fails, as it should have all along. --timeout and --workers governed only the apply phase while discovery was pinned to hardcoded 1.0s/64. Split into explicit --discovery-timeout/--discovery-workers so the fast-sweep defaults stay visible rather than hidden, and gave every flag help text. Dropped CUSTOM_PALETTE_ID_BASE. It was never used, and the reason is worth stating rather than leaving an unused constant to puzzle over: WLED exposes no names for custom palettes, so they cannot be selected by name at all.
…x/ix The previous commit sent seg.fxdef to equalise speed across devices. That was overreach and would have damaged the one device we actually have. setMode(fx, true) resets far more than sx/ix. It resets map1D2D UNGUARDED for any effect that does not declare m12=, and WLED's own call site carries the warning: "may change map1D2D causing geometry change" (json.cpp:291). On a matrix that destroys the expansion mode, and re-running does not undo it — Trancender is a 54x24 matrix, so the fix targeted exactly the hardware it would have broken. It also applies the effect's default palette (FX_fcn.cpp:616-617), silently overriding colour whenever --palette was not given: --effect "Noise 1" --color red would have applied gradient palette 20 and made the red invisible, with no warning, verification passing, and the row reporting success. It would not even have fixed the problem it was for: both call sites gate on fx != mode, so a device already running the target effect keeps its drifted speed. Broken on the second run, destructive on the first. Replaced with explicit --speed/--intensity, which are narrower and idempotent. They are NOT sent by default: speed is often deliberately tuned per installation, so normalising it silently is its own kind of wrong. Documented that a shared effect can still run at different rates without them. Also: the verify_applied and colour_is_moot docstrings still described pre-fix behaviour and contradicted the code beneath them; softened the "Default is where --color is MOST effective" claim, since it holds only for call sites passing mcol < NUM_COLORS and a minority pass 255; and corrected --host's help, which claimed to skip discovery when the host is still probed. Added the exit-code tests that were missing — the only change in the last batch that was not mutation-proof. Verified the new rule differs from the old on all four cases that matter (skipped, unreachable, mixed, empty), so the tests would genuinely fail against the previous behaviour.
TestExitRule was vacuous — it hand-copied the rule into the test file instead of calling it, so mutating main() to `return 0` left all 31 tests green. The rule is now exit_code() at module level and the test calls it; mutation-checked, two tests go red. This is the third test in this PR that could not fail, so the pattern is mine, not bad luck: a test written from the same understanding as the code inherits its blind spots unless it is forced through the shipped path. --speed/--intensity are now range-checked. WLED does not clamp: getVal passes no bounds (json.cpp:294) and ArduinoJson's convertNumber returns 0 when the value will not fit a uint8_t, so `--speed 999` would have set sx=0 on every device — a visible freeze on most effects — while verify_applied never checks sx/ix, every row read "applied" and the exit code stayed 0. Silent, fleet-wide, and only catchable by looking at the lights. They can also now be used alone; requiring --effect/--palette/--color to accompany them was arbitrary, since a speed-only run is valid on every device. And --dry-run prints sx/ix, without which the safety valve was blind to the one knob nothing downstream verifies. verify_applied's docstring claimed both the non-RGB and no-selected-segment cases were exempt from reporting. Only the first is; the second is reported, with the real reason instead of a misleading "wrong effect". The test asserted the opposite of the paragraph above it.
Nothing ran sync_one with dry_run=False, so the line forwarding args.speed into build_body had zero coverage and the stubs' speed/intensity attributes were decorative — removing them left the suite green. There is now an apply-path test asserting what actually goes on the wire (sx, ix, tb, udpn.nn), and both mutations bite: dropping the forwarding fails it, and so does removing the stub attributes. Replaced getattr(args, "speed", None) with plain attribute access in the dry-run detail. The defensive form hid exactly the mismatch the stub attributes existed to catch — dry-run tolerated a missing attribute while the apply path raised AttributeError on it. The verify_applied docstring said non-RGB segments are "EXEMPT", but fx is still checked on them and the suite asserts that. Only pal and col are exempt. Sharpened the range-check message: WLED's two out-of-range behaviours differ. A value above 255 becomes 0 via convertNumber, freezing the fleet; a negative one is ignored outright (util.cpp:73). Rejecting both is right, but the message claimed zeroing for both. Module usage block now shows --speed/--intensity.
Puts it alongside wled-ap-hop.sh rather than at the repo root. REPO_ROOT now walks one level up so the scanner path and the seam stay repo-relative, and the test loads it from its new location. Tests stay in tests/, which is where the Makefile target expects them. Note scripts/ was previously untracked — this commit starts tracking it, but only this file. promote-base-to-main.sh and wled-ap-hop.sh remain untracked and are not mine to add.
Both from Adam's review of 2026-08-07. The import first, since it is the shorter answer: there was no reason for `import ipaddress` to sit inside main(). It is stdlib, there is no circular import to break and no optional dependency to guard — it was a slip, not a decision. It is the only mid-file import in the module; the other ten were already at the top. Moved. scripts/README.md documents what wled_sync does and how to run it, leading with dry-run. The parts that earn their space are the behaviours that surprise people rather than the flag list: - a palette can silently override --color, because most palettes supply their own colours and the effect ignores the segment colour; the tool warns, and the README says which palettes are colour-driven - --speed/--intensity are deliberately unset by default, since they are usually tuned per installation and overwriting them fleet-wide destroys that - out-of-range speed/intensity is rejected up front because WLED does not clamp — above 255 becomes 0, freezing every device at once - effect and palette are matched by NAME because the numbers differ between firmware builds A check confirms every flag the parser defines appears in the README: 15 flags, none undocumented. Note this file will conflict with the one PR #32 adds, which documents wled_apjoin in the same shape. Written to match its structure so resolving is mechanical — two sections in one index. The separate task for a comprehensive top-level README is filed; there is no README.md at the repo root at all today. 33 host tests pass. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…it 2 Co-Authored-By: Claude Fable 5 <[email protected]>
ca374e0 to
b9d7e0a
Compare
* add a top-level README, verified against the source files There was no README.md at the repo root, so a newcomer landed on CLAUDE.md (written for agents) or skills/README.md (skills only). Neither answers "what is this and where do I start". Adam's three decisions shaped it, and the first two changed the task: - **Audience is him plus collaborators who may be remote and setting up while he is unavailable.** So it has to stand alone: a "when it goes wrong" section, and the traps documented rather than just the happy path. - **"Quick deploy on clone should be the standard."** Clone -> setup -> build -> flash -> verify is the spine, not an appendix. Flashing and confirming /json/info matches what you built are part of the main path. - **Reference only files in this repo.** That rule and the gitlink problem agree: submodule docs (BACKBONE_ROUTER.md, SENSOR_SYNC.md, the rs485_bridge readme) are named as plain-text paths, never linked — they are not this repo's files and they 404 on github.com because GitHub renders a submodule as a commit pointer. It deliberately does not send the reader to CLAUDE.md for any setup step. CLAUDE.md is written for agents, and it carries at least three claims that are no longer true — the default build env, the number of make targets, and the WLED version (it says 0.15.3; package.json says 16.0.1). Propagating those to the people least able to spot them would be the worst outcome. That is also why tools/check_readme.py exists, wired in as `make test-readme` and part of `make test`. It verifies the README against platformio.ini, the Makefile and .gitmodules rather than trusting anyone's memory: links resolve to tracked files, no link points into a submodule, every make target and [env:] named exists in the file it is attributed to, the submodule table matches .gitmodules, and setup.sh/upload_wled.py really support the flags shown. My own first draft inherited two of CLAUDE.md's stale claims, which is the failure this guards against. Scoped to what is on main today: scripts/ and tests/ arrive with #31/#32, so nothing references them yet and `make test` is described as four suites. A follow-up adds the scripts section once those land. make test green. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * address self-review: a checker whose checks could not fail The self-review found six issues; four were real and are fixed here. The embarrassing ones are in the checker I added to prevent exactly this. **Commands in the README did not run when pasted.** `make test-bridge# HMTL wire format (run twice: ...)` — `#` glued to the target is not a bash comment, so pasting it gave `No rule to make target 'test-libs#'` and a bash syntax error on the parentheses. Both reproduced. In a document whose whole purpose is being followable by someone who cannot ask a question, that is the worst defect in the PR. The columns are now aligned so every `#` is a real comment, and two checks guard it: `bash -n` per line, plus an assertion that `#` is preceded by whitespace — because `bash -n` only catches syntax errors, and `make test-libs# note` parses fine while invoking a target that does not exist. **Two assertions could never fail.** - The submodule check used a substring test, and `aphelps/WLED` is a substring of the clone URL `aphelps/WLED_dev.git`, so it passed with the entire WLED row deleted. Strengthened to require the path and its upstream URL on the same line — which also fixes a second weakness found while mutation-testing: `| \`WLED/\`` appears in the Repo layout table too, so "does this path appear anywhere" was still satisfiable. - The env and .gitmodules sections announced they were checking the README while testing hardcoded literals. They now parse the README's own tables, so a typo or a rename fails. **`make test` broke unhelpfully on an uninitialised clone** — `test-readme` was the only suite with no `require_submodule` guard, so it died on a FileNotFoundError traceback instead of the deliberate "run ./setup.sh" message. Guarded, and the script now resolves paths from its own location rather than the cwd. Also added the drift-prone numbers the docstring claimed to protect but did not check: WLED version, env count, default_envs count, default device IP. Writing that check found my own error — the first regex ran past the blank line terminating `default_envs` and reported 36 where the answer is 23. The README was right; the check was wrong. Every check is now mutation-tested: 10 deliberate defects introduced, 10 caught. One apparent miss was a mis-specified mutation that changed a link label while leaving the URL correct — passing was the right answer, and mutating the URL itself is caught. Not fixed, deliberately: the fleet-scripts pointer. `scripts/` is untracked on main until #31/#32 land, so linking it would fail the link checker. A follow-up adds it. make test green. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * address review: block-level bash -n, narrowed glued-# check, scoped and guarded ini lookups Co-Authored-By: Claude Fable 5 <[email protected]> * address review: glued-# check also covers tabled env names Co-Authored-By: Claude Fable 5 <[email protected]> --------- Co-authored-by: aphelps-claude-bot <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
aphelps-claude-bot
left a comment
There was a problem hiding this comment.
Re-reviewed ca374e0..b9d7e0a. Content-wise this delta is a rebase onto b20f900 plus one docs commit — the only new authored change is the scripts/README.md paragraph in b9d7e0a; the Makefile/HMTL hunks are main's #33 being picked up. The rebase resolution is faithful: git diff b20f900:Makefile b9d7e0a:Makefile is exactly the test-sync additions and nothing else, so nothing changed behaviour beyond what the commit messages claim. Ran make test-sync on the head (33 green, Python 3.9.12), then mutation-tested the suite — 44 mutations of scripts/wled_sync.py, suite re-run per mutation. No device was contacted this round: no GETs, no writes.
Prior issues — status
- ✅ Exit-status sentence now mentions exit
2, and that is right —ap.errorgoes through argparse's exit 2. (SIGINT's 130 is still unmentioned; not worth a round-trip.) - ✅ README Tests paragraph now describes this suite rather than the ordering/convergence suite. But two of its four claims are still inaccurate — inline.
- ❌ Still
CONFLICTING, same file, same place. The rebase landed onb20f900, butmainhas since moved tof2e9378(#34 top-level README, #35 HMTL bump).git merge-tree b20f900 b9d7e0a origin/mainreports exactly one conflicted file,Makefile: main's line is nowtest: … test-router test-readme, this branch's istest: … test-router test-sync. Resolution is the union in both thetest:and.PHONY:lines. Needs another rebase, and CI should re-run on the new head.
Mutation testing — the half that holds up
The pure layer is genuinely non-vacuous. 31 of 33 mutations to build_body, resolve_effect, resolve_palette, verify_applied, exit_code, parse_colour, colour_is_moot and make_timebase turned the suite red — including udpn.nn → False, USERMOD_PALETTE_ID_BASE 255 → 200, dropping the *-strip, dropping the RSVD skip, removing the tb 31-bit mask, computing make_timebase() per device, and emitting fxdef. The three commits claiming to have made tests real did deliver on the functions they name: exit_code and the apply-path body assertion are both load-bearing, and test_apply_forwards_speed_and_intensity genuinely kills the forwarding mutations.
Mutation testing — the half that does not (TOP-LEVEL)
Everything above those functions is effectively untested. All 11 mutations of sync_one's decision/reporting wiring and of main()'s guards left all 33 tests green:
mutation applied to scripts/wled_sync.py |
suite |
|---|---|
sync_one never reports mismatch (if problems: → if False:) |
green |
sync_one skips verify_applied entirely |
green |
verify_applied called with fx=None |
green |
POST error → row "applied" instead of "failed" |
green |
unreadable /json/eff → "applied" instead of "unreachable" |
green |
effect resolution error ignored — body sent with no fx, row still says applied |
green |
| palette resolution error ignored — same | green |
dev.get("umpalnames") → None |
green |
| the "nothing to sync" guard removed | green |
| the colour-is-moot warning never printed | green |
--no-phase ignored (always phase-align) |
green |
the --speed/--intensity range check removed |
green |
Four of those are the exact failure modes the plan exists to prevent: "a device lacking the requested name is skipped with a clear message, never given a near-miss substitute", the --color warning an earlier round found inverted, per-device usermod-palette resolution, and the --speed 999 freeze that round four caught. Each is guarded by code no test can distinguish from a no-op. Suggested test: items inline.
Name resolution — checked against the firmware, and it is correct
/json/eff←serializeModeNames(WLED/wled00/json.cpp:1205-1217):@-stripped, and it does silently drop modes with an empty data string — which is exactly what thefxcountguard catches._data_RESERVEDis literally"RSVD"(FX.cpp:10947)./json/pal←JSON_palette_namesserved verbatim (json.cpp:1340) — fixed palettes only, so list position == palette ID. The ID-bearingserializePalettesis/json/palx, correctly not used.umpalnamesis a top-level key of/json/info(json.cpp:797-804), present only when usermod palettes exist, andwled-scan.probe()returns the whole info dict — sodev.get("umpalnames")is the right lookup, notdev["info"]["umpalnames"].255-jsurvives the wire even though the call site looks like it bounds to 75:getVal(elem["pal"], pal, 0, getPaletteCount())ignoresvmin/vmaxfor integer values (util.cpp:val = elem; return true;), andSegment::setPaletterange-checks the usermod band itself (FX_fcn.cpp), falling back to 0 only when the band is empty — whichverify_appliedwould then catch. Worth recording; it is not obvious fromjson.cpp:299.- Failures are per-device rows carrying a reason, and
exit_codemakes anyskippeda non-zero exit. The design is right; only the wiring between it andmain()is unproven.
Phase-locking — real, but narrower than the docstring claims (TOP-LEVEL)
The plan's open subtask ("verify toggleOnOff()'s restartRuntime() does not fight a tb sent in the same request") resolves favourably on ordering: toggleOnOff() runs at json.cpp:383, tb at json.cpp:417-418, so strip.timebase = tb - millis() is applied last and is not clobbered. So the mechanism is real, not merely apparent. But restartRuntime() → resetIfRequired() zeroes step, call, aux0, aux1 and clears the segment data buffer (FX_fcn.cpp:212-225), and tb restores none of that. tb aligns strip.now and nothing else: effects that advance via those accumulators rather than strip.now are not phase-locked by it, and on the first sync of a fleet where some devices were dark and some lit, only the dark ones are reset — an asymmetry tb cannot correct. FX.cpp carries 194 strip.now references against 234 SEGENV.step/.call ones, so this is not a corner case. Inline suggestion to scope the claim; it also predicts the still-open "re-running is idempotent" item without needing eyes on the LEDs first.
Nits
Makefile:8— the header usage block lists every target except the one this PR adds. (Not inline: that line falls outside the PR's diff hunks.) Add# make test-sync # just the wled_sync host testsafter thetest-routerline.- After a rebase onto current
main,scripts/andmake test-syncwill be missing from the new top-levelREADME.md— both its## Testingtarget list (README.md:100-107) and its## Repo layouttable (:132-140).tools/check_readme.pyonly checks that targets the README names exist, not the reverse, somake test-readmestays green; this is a doc gap, not a CI break. resolve_effect's empty-name guard (wled_sync.py:90-91) is unreachable from the CLI —if args.effect:already filters""— and deleting it leaves the suite green. Harmless; flagged only so it is not mistaken for tested behaviour.
Verdict: the code is sound, and the delta's claims about making tests real are true for the functions those commits name. The remaining gap is one layer up — sync_one and main() are almost entirely unproven — and the new README paragraph overstates what the suite actually covers.
| on — a reachable device is powered, so light it. WLED restores its own briLast, so no | ||
| brightness is imposed and per-device levels survive. | ||
| tb — shared phase anchor; strip.timebase = tb - millis(), so all devices agree on | ||
| strip.now and animate in step. |
There was a problem hiding this comment.
"so all devices agree on strip.now and animate in step" — the first clause is right, the second does not follow, and I think the gap explains the still-open "re-running is idempotent" item.
Good news first: the plan's open worry (does toggleOnOff()'s restartRuntime() fight a tb in the same request?) resolves in your favour on ordering — toggleOnOff() is at json.cpp:383, tb at json.cpp:417-418, so strip.timebase is written last and survives.
But restartRuntime() → resetIfRequired() zeroes step, call, aux0, aux1 and clears the segment data buffer (FX_fcn.cpp:212-225), and tb restores none of it. tb aligns strip.now; effects that advance via those accumulators instead are not phase-locked by it, and on a first sync of a mixed on/off fleet only the dark devices get reset — an asymmetry no shared tb can correct. FX.cpp has 194 strip.now references against 234 SEGENV.step/.call ones, so it is not a corner case. Suggest scoping the claim to what tb actually guarantees, e.g. "…so all devices agree on strip.now. Effects driven by strip.now therefore animate in step; those driven by SEGENV.step/call accumulators are not aligned by tb, and a device that was dark has those accumulators zeroed by toggleOnOff()→restartRuntime() in this same request."
There was a problem hiding this comment.
Leaving this open — it is a real finding and not something a doc edit should paper over. tb aligns strip.now, but restartRuntime() zeroes step/call/aux0/aux1 and tb restores none of it, so effects driven by those accumulators are not phase-locked. That is a design question for Adam (does the tool need to reset runtime state too, or is the claim simply narrowed?), and it also predicts the still-open 'sync is idempotent on a re-run' bench item without needing eyes on LEDs. Flagged to him rather than silently rewording the comment.
…main Re-review mutation-tested this branch with 44 mutations: the pure layer held up (31 of 33 went red) but ALL 11 mutations of the glue left the suite green — including deleting the --speed/--intensity range check outright. That check is the other half of c5a8b63 ("...and reject out-of-range speed") and it shipped with no coverage at all, while b9d7e0a's README advertises its exit-2 behaviour to users. TestArgRanges closes that one. It drives main() rather than calling the validator, so deleting the CALL SITE fails too, not just gutting the function. Verified by re-running the same mutation: 3 failures where the old suite gave 0. It also asserts the boundaries are ACCEPTED. 0 is a legal value and it is falsy, so a validator written as `if not val` would reject it — the half a one-sided test would miss. Every invocation is pinned with --host and --dry-run. Without that the tool sweeps the whole subnet: the first run of these tests contacted all three real WLED devices on the LAN and printed "would apply sx=999" against them. Dry-run meant nothing changed, but a unit test has no business reaching the network at all. README corrected, since the commit that set out to "describe the actual test suite" replaced one wrong description with another: * the stub tables are SYNTHETIC, not "captured" — real names at the indices that matter, padded with ["RSVD"] * 138 and friends. That tests the property just as well, but calling it captured misleads anyone who goes looking for the capture. * "verify-after-apply catches a deliberately wrong application" overstated it: no stub serves /json/state, so verify_applied is exercised directly and the apply-then-verify path over HTTP is not. Now says so. * the range-check behaviour it advertises is now actually tested. Makefile: fourth union resolution of the same two lines this session (test-hmtl, test-readme, test-apjoin, test-sync). Both recipes and both prerequisite lists kept; all four targets dry-run. 37 tests pass. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01F4oTr1YW3z7ozksMUT1z5j
Same correction as the README one, in the file it describes. "Real name tables, trimmed" sends anyone chasing a discrepancy off to look for a capture that does not exist; they are real names at the indices under test with repeated padding between, which establishes the cross-version index property exactly as well. Lengths stated so the next reader does not have to count: EFF_16 is 220, EFF_014 is 186. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01F4oTr1YW3z7ozksMUT1z5j
Two more of the re-review's confirmed-uncovered paths, each verified by re-running
the mutation that exposed it.
usermod palette end-to-end: resolve_palette's 255-j arithmetic was well unit-tested,
but nothing drove it through sync_one, so replacing dev.get("umpalnames") with None
left every test green. The new test stands up a stub advertising umpalnames and
asserts the wire body carries pal=255-j rather than a list index. Mutation
re-applied: now fails.
verify-after-apply wiring: verify_applied was covered directly, but the code that
CONSUMES its verdict was not — `problems = []` left the suite green. Now fails.
Worth recording precisely, because my first version of that test described a
mechanism it does not use: sync_one checks the POST *response* (wled_sync.py:361),
not a later GET of /json/state. I had added a /json/state fixture and written a
docstring claiming the stub "answers with a state that does not hold what was asked
for". The fixture was never read — the stub answers every POST with `{}`, and that
is what fails verification. The test was passing for a reason its own comment got
wrong, so the fixture is gone and the docstring now says what actually drives it.
39 tests pass.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01F4oTr1YW3z7ozksMUT1z5j
The last two confirmed-uncovered paths from the re-review. Both mutations re-applied and both now fail, where the old suite gave 0 failures for each: timebase = make_timebase() (drop the --no-phase conditional) -> fails if False: (suppress the colour-moot warning) -> fails --no-phase is asserted on the WIRE body, not the local variable: what matters is that no tb reaches the device. It also asserts the other direction — that tb IS sent without the flag — because a test checking only for absence would pass against a build that never sends a timebase at all. The colour-moot test likewise asserts a colour-DRIVEN palette does NOT warn. A warning that fires on everything is one people learn to ignore, so the suppression half is the half worth pinning. 41 tests pass. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01F4oTr1YW3z7ozksMUT1z5j
wled_sync landed on main (#31) while this branch was open, and both added scripts/README.md and a test target. Resolved by keeping both rather than picking a side: - Makefile: `test` runs test-sync AND test-apjoin, both target bodies kept. This is the merge hot spot the Makefile task already describes. - scripts/README.md: one intro covering both tools and the scan skill they bracket, each tool's section intact, and a Tests section split per tool so neither set of caveats is lost.
Scans the local subnet and drives every WLED device it finds to the same effect, colour and palette — turning them on in the process. Implements the approved plan; all eight decisions are recorded there.
Why name resolution, not indices
Effect and palette numbers are firmware-specific: 220 effects on 16.0.1 against 187 on 0.14.4, and our fork reports 222. So
{"fx":180}is a different effect on different hardware — a fleet that silently ends up mismatched, looking like a wiring or timing fault rather than a protocol mistake.Names are stable enough to rely on, and I measured rather than assumed: diffing effect mode-data strings between
v0.14.4and 16.0.1 gives zero renames across the 178 shared effects — onlyPoliceandMeteor Smoothwere removed. A device missing the requested name is skipped and reported, never given a near-miss substitute.Four fields that aren't obvious
udpn.nndeserializeState→stateUpdated()→notify()(led.cpp:95) re-broadcasts the raw effect/palette bytes (udp.cpp:51,69) to every device with sync receive enabled — which Trancender has. That undoes the per-device name resolution through a side channel and races our own POSTs.tbstrip.nowand animate in step instead of drifting. Same knob WLED's own sync uses.v{"success":true}, folding verification into the same round trip. Needed because 200 ≠ applied — WLED accepts and then drops things. (Non-RGB segments are the one case deliberately not verified: WLED skipspaland forcescolto white there, so checking would fail forever on working hardware.)ontoggleOnOff()restores the device's ownbriLast(led.cpp:44-47), so per-device levels survive.Palette IDs are not one list
Fixed palettes are their position in
/json/pal; usermod palettes are255-jand named only ininfo.umpalnames; custom are200-kwith no names at all. Position is the ID for the fixed block only — treating the array as authoritative would make usermod palettes unaddressable./json/palalso decorates five entries with a leading*, so"Random Cycle"has to match"* Random Cycle".--colorwarns when the chosen palette makes it invisible. Note the palette names mislead in both directions —Default(0) short-circuits to the segment colour so--colorworks there, while* Random Cycle(1) uses_randomPaletteand ignorescolentirely — so the set is derived from WLED's palette switch, not from names. An earlier revision had both backwards.Tests
33 host tests, wired into the top-level
Makefileastest-syncand added totest:— so CI'smake test STRICT=1actually runs them rather than the suite existing but never executing.The cross-version case stands up two stub HTTP servers instead of requiring two firmware versions on the bench (only one device is currently reachable), and asserts the same name resolves to different indices per version. The highest-value assertion is that every generated body carries
udpn.nn— that regression would be silent and fleet-wide.Verified
make test STRICT=1green, including the new suite.--dry-run: resolvedHiphotic→fx=180andRandom Cycle→pal=1, independently matching what the device already reports running, and left its state byte-identical before/after.--colorwarning paths exercised against the live device.--dry-runor a GET. The visual confirmation in## Testing Required— two devices in step, 2D and 1D together, idempotent re-run — is still outstanding and needs his go-ahead.🤖 Generated with Claude Code
Update
Self-review and re-review found several real defects, all fixed. Two worth calling out:
tbis parsed intolong trand ignored unlesstr >= 0; the tool sent an unmasked epoch-ms that overflows signed 32-bit. Intermittent — bit 31 flips ~every 24.8 days, so it would work for ~25 days and quietly stop for ~25.seg.fxdefto equalise speed; it resetsmap1D2Dunguarded (WLED's own call site warns "may change map1D2D causing geometry change") and applies the effect's default palette. On a 54×24 matrix that destroys geometry, unrecoverably by re-running. Reverted for explicit--speed/--intensity.33 tests, CI green, all review threads resolved.