Repository navigation
feat(light): the Light V2 library joins the template behind the light token - #201
derek-miller wants to merge 3 commits into
Conversation
… token The shared light library (DRV-152, T3 e33d44bf21 on v0.9.41) ported onto main as it stands, with no behavior change. A `light` token on vendor_modules gates the library, its kit and its two suites, as expressions and ui gate theirs, so a light repo's make test runs them and other repos carry none of it. The render leg runs the fuzzer long (20,000 runs); a repo's make test runs its first 300. example_light follows the example driver's DriverCentral client, and colour is color.
…xample driver only A render with more than one driver, such as the light render's example_light, has no probe in the others, so the property check now names the example's package.
There was a problem hiding this comment.
One must-fix, inline: the shim's color header carries a plan for two conversions it leaves out, tied to another repo's test suites. Plus one nit.
Beyond CI, I ran make render-checks NAME=light here, including the 20,000-run fuzz, and it passes. I also mutated a rendered src/lib/light/fade.lua to call GetDriverVersion without its require. test_lib_dependencies.lua now fails on it, and passes once the file is restored, so the recursive walk does reach the subdirectory. I checked F.virtualClock's repeating timer too: cancelling it from inside its own callback cancels the entry it just re-armed.
| -- string passes as its number. ColorRGBtoXY and ColorXYtoRGB stay out until | ||
| -- zigbee3's light suites stop stubbing them only where the shim has none. |
There was a problem hiding this comment.
Must-fix: "ColorRGBtoXY and ColorXYtoRGB stay out until zigbee3's light suites stop stubbing them only where the shim has none" says why two functions are missing and when they will be added. It also hangs that on one consumer repo's test code. That reasoning belongs in the PR, and it goes stale the moment zigbee3 changes. The rest of the header already describes what the shim answers. Drop the sentence.
| end | ||
| end | ||
|
|
||
| -- The device side's read after a command's transition, as zigbee3's device driver reads one back. |
There was a problem hiding this comment.
Nit: "as zigbee3's device driver reads one back" points the kit at one consumer. In the template, this reads better as the behavior it models: the device side reading back after a command's transition.
… they model, naming no repo
There was a problem hiding this comment.
Both findings are fixed in bdf69d8: the color header in c4_shim.lua now ends at what the shim models, and the light_harness.lua read-back comment no longer names another repo. The commit changes only those two comment lines, and nothing the PR adds still names zigbee3. The remaining "Zigbee bulb" mentions describe the device being modelled, so they hold.
The shared Light V2 library (DRV-152) joins the template as an opt-in module, ported as it stands from T3 (
e33d44bf21, built on v0.9.41). It behaves exactly as T3 did and no driver uses it yet. It is the base the v4 contract PRs build on (design revision 4.1, section 8).What a repo gets with
lightinvendor_modules, gated likeexpressionsandui:src/lib/light.luaandsrc/lib/light/, the library (13 parts).test/light_harness.luaandtest/light_setup/, the kit: a fake proxy, a reference device and the contract run.test/test_light_proxy.lua(1,454 checks) andtest/test_light_fuzz.lua. A repo'smake testruns the fuzzer's first 300 seeded runs from seed 1, about 3 s.Derek's 11-09 call puts the library's tests in
template/test/, rendered into each light repo like the template's other libraries, with a short fixed seed set in driver CI and a long run in the template's CI.What every repo gets (test support only):
F.virtualClockinc4_fixtures.lua, the shim'sC4:Color*conversions,C4:SendUIRequestanswerable throughShimSetUIRequest,C4:GetProxyDevices,GetBoundConsumerDevicesanswering no value at all when unbound (as 4.3.0 does), andtest_lib_dependencies.luawalkingsrc/libat any depth.Template CI. A new
lightrender (lightpluscloud_diagnostics, as every light repo has it) with its snapshot. Its build leg addsexample_lightand builds it in both distributions, the only proof that everylib.lightpart squishes. The render leg's newrender-light-fuzzruns the fuzzer 20,000 runs;make render-light-fuzz NAME=light LIGHT_FUZZ_SEED=<n>runs other seeds before a library change. CONTRIBUTING's light section is checked against the token. Every other render's snapshot is unchanged, so nothing outside the token renders a light file.Redone by hand rather than merged (six files conflicted):
lightrender and a copy intemplate_renders.py example.example_lightfollows main's example driver:lib.drivercentralstartClientandstartGate, the Support Code, the update settings, aDYNAMIC_LISTLog Level.o.colour, which no caller set, and the rename would have read the fuzzer's booleano.colorinstead. The device starts at D65 as before.After merge. The ruleset needs
render (light)andbuild (light).Memory. Not measured here: zigbee3's move PR records its light items' Lua memory before and after on dev.