Skip to content

Commit d9de3e8

Browse files
fix: resubmit config keys redeclared by later flow steps (#2087)
* fix: resubmit config keys redeclared by later flow steps (#2057) The shared flow walker popped each consumed key out of the pending config at the first form step whose data_schema declared it, so a later step declaring the same field name was submitted without it and Home Assistant rejected the step with "required key not provided". Consumed values are now recorded by leaf field name, and a supplied config key applies to every form step that declares it rather than only the first. Reuse never overrides a default or suggested value the step's own serialized schema carries: it fires only where the redeclared field is required and has no default of its own, which is exactly where omitting the key is a guaranteed voluptuous failure. A redeclared field that does carry a default belongs to an edit-style form HA pre-filled with the current value, and resubmitting there would change data the caller never named for that step. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix: scope flow-key resubmission to step-owned data and surface it Rebuild the gate that decides what to submit for a form field the caller named no key for at this step. A "default" key now means omit and let voluptuous fill it in, tested by key presence so default:None counts, while HA's edit-style pre-fill and constant fields — which serialize a value with no default at all — get that step-owned value submitted instead of an earlier step's caller value written over the data being edited. Only a required field with no default and no value of its own falls through to resubmitting the caller's value, and never into an optional field or a section neither marked required nor named by the caller. Records are now scoped: a value taken out of an explicitly supplied section dict can only resurface at that dotted path, so {"left": {"name": ...}} never fills right.name, while a flat key stays position-agnostic. Every resubmission adds a warning to the success response naming the field and step, and fires at most once per step, so a flow that keeps re-presenting one form gets HA's own error naming the field rather than a run of silent rewrites. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix: record the effective value for flat-overridden section paths A flat key overrides an explicit section value at the step that declares both, but the reuse record kept the overridden section value under its dotted path, so a later redeclaration of that path resubmitted the stale value instead of the one actually submitted. Flat-origin records now replace an existing scoped entry for the same path. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix: prefer a step's suggestion over its coexisting static default add_suggested_values_to_schema copies the voluptuous marker and overwrites only its description, so a marker that already carried a default serializes with both keys; omitting such a field let voluptuous substitute the static default over the stored current value, while the same field inside a required section already submitted the suggestion. The gate now checks the step-owned value before the default so the suggestion wins at every declaration site, and the docstrings that overgeneralized the no-default claim are corrected. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * test: retry docker exec while the dev addon restarts underneath it The dev addon self-restarts mid-suite (settings /restart in test_addon_debug_log_level.py), tearing its container down for 5-25s. A docker exec issued from the other xdist worker during that window fails with "No such container", which was not in ssh_exec's transient set, so the persistence-failure E2E flaked whenever the two modules overlapped. The container returns on its own, so the miss retries like the SSH races from the same restart window. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * test: outlast a full addon restart when retrying docker exec The container-absence window is a real Supervisor restart of the dev addon (test_supervisor_inaddon.py::TestSettingsUiRestartReal runs one at random overlap on the sibling xdist worker) and can exceed the 60s retry ceiling on a loaded runner — run 30548328308 outlasted 30 attempts. docker_exec_in_addon now passes a 180s retry deadline through ssh_exec. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * test: capture VM container and addon state on persistent name miss A container absent through the entire retry window while the addon's HTTP endpoint still serves means the container exists under a name the test did not predict. Attach docker ps and the Supervisor addon list to the error so the failing run itself reports the actual names. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * test: resolve the addon container name instead of assuming its prefix Supervisor's addon container prefix changed from addon_ to app_ (the add-ons to apps rename), and HAOS self-updates Supervisor at boot, so which prefix a CI VM uses depends on the Supervisor build it booted with. Run 30553159100's instrumented capture shows app_local_ha_mcp_dev up and serving while addon_local_ha_mcp_dev resolves to nothing, which is why the docker-exec E2E failed on every VM that booted an updated Supervisor. docker_exec_in_addon now reads the actual name from docker ps, accepting either prefix, with the legacy name as the fallback. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * test: discriminate the per-step write bound and the scoped-lookup preference Two mutation-surviving guards from review get pinning tests: the same field redeclared by two later steps is resubmitted at each with a warning naming each step, which fails if the write bound loses its step_id half; and a scoped record beats a flat one for the same leaf name at lookup, which fails if the preference is inverted. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: kingpanther13 <kingpanther13@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent 46d600f commit d9de3e8

2 files changed

Lines changed: 1459 additions & 52 deletions

File tree

0 commit comments

Comments
 (0)