Close the remaining validation gaps: "Push now" off the day plan, unbounded segment fields, import paths, and the AI's effect list #169

Open
opened 2026-09-26 09:12:52 +00:00 by claude-bot · 0 comments
Collaborator

Found while building #149 (#162) and #150 (#167). The two most important are the first two below.

1. "Push now" resolves the night on its own

POST /wled/push (routers/wled.py) finds its own scheme instead of calling day_plan.plan_for_date. It is guarded by #150's translator, but it doesn't follow unapproved_policy, it returns 404 on an unapproved night, and it can drift from what the on job pushes. That is exactly the #93 failure, which #74 had already had to fix once for this same button. Move it onto plan_for_date, and add a parity test between Push now and the on job.

Other places that still resolve a night themselves, as candidates for the same change:

  • schedule_service._active_brightness_baseline
  • calendar_feed._resolve_day

2. SchemeSegmentUpdate has no bounds

effect_speed, effect_intensity, palette and brightness accept any integer. #150 bounded effect_id at the endpoint. Add schema bounds of 0–255 (palette bounded by palcount, the same way effect_id is bounded by fxcount). First check for existing rows that are out of range: building a response model from a bad row would then return a 500, so either clamp on read or add a data migration.

3. Preset and config import don't bound effect_id

POST /import/config (#23) and preset import (preset_io) accept any effect id. Apply the same fxcount bound, and reject the file with a message that names the offending scheme.

4. The AI never sees the live effect list

Neither generate_scheme nor refine_scheme (routers/schemes.py) passes wled_effects, so generation always gets FALLBACK_EFFECTS and refinement gets no catalogue at all. Pass the live list, from the controller when it can be reached and the shipped 16.0.0 catalogue otherwise. #150 already filters unsafe effects out of that path.

5. Small UI gaps

  • EffectPicker's "Custom ID" box can select an effect that the photosensitivity guard hides. The API still guards it, but the picker should warn.
  • /remote's speed and intensity sliders may push a stale value on keyboard input. The same stale-closure pattern that #150 fixed for effect selection is used in onValueCommit.
Found while building #149 (#162) and #150 (#167). The two most important are the first two below. ## 1. "Push now" resolves the night on its own `POST /wled/push` (`routers/wled.py`) finds its own scheme instead of calling `day_plan.plan_for_date`. It is guarded by #150's translator, but it doesn't follow `unapproved_policy`, it returns 404 on an unapproved night, and it can drift from what the on job pushes. That is exactly the #93 failure, which #74 had already had to fix once for this same button. **Move it onto `plan_for_date`**, and add a parity test between Push now and the on job. Other places that still resolve a night themselves, as candidates for the same change: - `schedule_service._active_brightness_baseline` - `calendar_feed._resolve_day` ## 2. `SchemeSegmentUpdate` has no bounds `effect_speed`, `effect_intensity`, `palette` and `brightness` accept any integer. #150 bounded `effect_id` at the endpoint. **Add schema bounds of 0–255** (palette bounded by `palcount`, the same way `effect_id` is bounded by `fxcount`). First check for existing rows that are out of range: building a response model from a bad row would then return a 500, so either clamp on read or add a data migration. ## 3. Preset and config import don't bound `effect_id` `POST /import/config` (#23) and preset import (`preset_io`) accept any effect id. Apply the same `fxcount` bound, and reject the file with a message that names the offending scheme. ## 4. The AI never sees the live effect list Neither `generate_scheme` nor `refine_scheme` (`routers/schemes.py`) passes `wled_effects`, so generation always gets `FALLBACK_EFFECTS` and refinement gets no catalogue at all. Pass the live list, from the controller when it can be reached and the shipped 16.0.0 catalogue otherwise. #150 already filters unsafe effects out of that path. ## 5. Small UI gaps - `EffectPicker`'s "Custom ID" box can select an effect that the photosensitivity guard hides. The API still guards it, but the picker should warn. - `/remote`'s speed and intensity sliders may push a stale value on keyboard input. The same stale-closure pattern that #150 fixed for effect selection is used in `onValueCommit`.
claude-bot added this to the v1.2.0 milestone 2026-09-26 09:13:03 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
rbrooks/Iris-WLED#169
No description provided.