Skip to content

Make the docs say what the code does about modifiers and lifecycle - #163

Merged
ewowi merged 2 commits into
MoonModules:mainfrom
AnjinMeili:docs-match-code
Oct 29, 2026
Merged

ewowi merged 2 commits into
MoonModules:mainfrom
AnjinMeili:docs-match-code

Conversation

@AnjinMeili

Copy link
Copy Markdown
Contributor

Two places where the docs describe behavior the code no longer has, and one rule they never stated, found while mapping the repository for a maintainer's index:

  • moonmodule.md still named the lifecycle hooks onBuildState() and teardown(), renamed to prepare() and release() in fa3066a.
  • The modifier docs said a layer applies its whole stack in child order. Live modifiers are skipped in the static fold (Layer.h around lines 365 and 441) and run every frame after all effects, on the logical buffer the static mapping then carries to the lights. The catalog intro, its appendix and moonlight.md now say so.
  • Added: a fixture slot past the layer's width widens the layer, and setChannelsPerLight rejects zero.

Comments and docs only, plus the regenerated help.json. FixtureChannels.h is cut to one line per paragraph with an @xref into each appendix section, since the change touched it.

One thing found on the way and left out of this PR: a frame on which a modifier asks for a rebuild re-prepares the layer, and Layer::prepare() clears the buffer, so that frame composites black. If an animated modifier rebuilds on its own clock, that may show as a flicker. Not reproduced; worth a look on its own.

What an agent wrote: Claude found the mismatches and drafted the edits; two independent agent reviews checked them against the code; I verified each and reviewed every line.

Tested: desktop: build_docs --strict, build_desktop and test_desktop, check_code, check_docgen, check_specs; the esp32s3-n16r8 firmware builds. check_prose reports a rise in two rules against the committed counts that this branch does not cause (details in the commit). Not flashed: comments and docs only.

Two places described behavior the code no longer has, the lifecycle hook names and where live modifiers run, and the fixture slots gain the rule for how they widen a layer.

**Light domain**
- ModifierBase.h, the class comment that feeds the modifier catalog: static modifiers fold in child order into the mapping; a dynamic modifier runs a pass every frame after all effects, on the logical buffer the static mapping then carries to the lights, whatever its place. The appendix's fold covers each enabled static modifier.
- FixtureChannels.h: a slot past the layer's width widens the layer, and `setChannelsPerLight` rejects zero. The appendix is cut to one line per paragraph and each section gets an `@xref` from the member it explains, so the file leaves the docgen warning list.

**Docs/CI**
- moonmodule.md: `applyState()` calls `prepare()` and `release()`, the names since fa3066a.
- moonlight.md: static modifiers chain in child order; the live pass runs after the effects, before the static mapping reaches the lights.
- help.json regenerated for the ModifierBase comment.

**Tests**
- build_docs --strict: PASS. build_desktop: PASS, no warnings. check_code: PASS, counts unchanged. test_desktop: PASS, 2,844 test cases, 179,476 assertions.
- check_specs: PASS. check_docgen: PASS, 0 errors, warnings 2050 → 2043.
- check_esp32_built --firmware esp32s3-n16r8: PASS, rebuilt with these sources, no warnings.
- collect_kpi: SKIP, comments and docs only.
- check_prose: NegatedHeading 6→8 and SelfReference 17→18 against the committed counts with no change of ours, the same rise in the other branch, which changes no prose (Vale 3.25.1); left for the maintainer.

**Reviews**
Iterative review of all efforts using repo guides.
- Fable review, round one: "after the static fold" read backwards for a catalog reader, done; the triggered checks listed, done; "Static modifiers are reorderable" narrowed a true sentence, done; a sentence in past tense, done.
- Fable review, round two: a rebuild frame shows black, since `prepare()` clears the buffer, not the static result, so the sentence is cut; the appendix's fold named every modifier, done; "four places" corrected to two corrections and an addition, done; one word, live, for one concept in moonlight.md, done; the S3 build rebuilt rather than skipped, done.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 29, 2026 10:59
@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The mirror/rotate example incorrectly claims that reordering the modifiers changes output, even though separate static and live processing stages leave the result unchanged.

1 open issue
What changed in this PR

This documentation-only PR aligns MoonLight’s lifecycle and modifier descriptions with the existing implementation. It also documents fixture-channel width behavior; runtime code is unchanged.

Changes:

  • Updates lifecycle hook names to prepare() and release().
  • Distinguishes static modifier folding from per-frame live passes and regenerates help text.
  • Documents layer widening and zero-width rejection, while condensing fixture-channel comments.
File Description
src/​light/​util/​FixtureChannels.h Clarifies channel-slot behavior and adds appendix cross-references.
src/​light/​modifiers/​ModifierBase.h Corrects static and live modifier descriptions.
docs/​help/​help.json Regenerates modifier help from the updated comments.
docs/​explanation/​architecture/​moonmodule.md Uses current resource-lifecycle hook names.
docs/​explanation/​architecture/​moonlight.md Documents separate static and live modifier stages.

Review effort: Balanced

Comment thread docs/explanation/architecture/moonlight.md Outdated
Order composes the static modifiers only, so the example that shows it names two of them.

**Docs/CI**
- moonlight.md: order is meaningful among the static modifiers, shown by multiply and checkerboard; the mirror and rotate pair goes, since Rotate is live and runs after the static chain wherever it sits.

**Reviews**
- Copilot: the mirror/rotate example contradicted the static/live rule, since swapping a live Rotate with a static Mirror changes nothing; done, the example names two static modifiers.
@ewowi
ewowi merged commit ee61d59 into MoonModules:main Oct 29, 2026
10 checks passed
@ewowi

ewowi commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Merged, thanks James! Every claim checked out against the code: live modifiers skip the static fold and run after the effects, and a slot past the width widens the layer in allocateBuffer. The "work archive" FixtureChannels.h credits became closed plan issues in a merge today, so we'll point that line at the issue in our next commit. Your lead that a rebuild clears the buffer for one frame is a good catch, and we'll take it up.

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