Skip to content

fix(events): a saved event or conditional without its id no longer stops the driver from starting - #203

Merged
derek-miller merged 4 commits into
mainfrom
fix/saved-entries-without-ids
Nov 11, 2026
Merged

derek-miller merged 4 commits into
mainfrom
fix/saved-entries-without-ids

Conversation

@derek-miller

Copy link
Copy Markdown
Contributor

At start-up, lib/events.lua restores the saved events, and both it and lib/conditionals.lua look for the next free id. Each of those loops indexed a table by each saved record's id. A record saved without one threw "table index is nil" from OnDriverLateInit, and the driver never finished starting. Two Home Connect controllers in the field hit this through a saved conditional.

What I changed:

  • Restoring events, and finding the next free event or conditional id, skip any saved record without its id. The lines match Home Connect's hotfix word for word.
  • A new test saves a whole record, one without its id and one that isn't a table. It checks that a restart restores only the whole record and that a new record takes the next free id.

Each driver picks this up on its next copier update.

…ops the driver from starting

lib/conditionals.lua and lib/events.lua looped over their saved records indexing by each one's id, so a
record without one, or one that was not a table, threw "table index is nil" from OnDriverLateInit. Each loop
now skips any saved entry without its id.

@svc-finitelabs svc-finitelabs Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approving. The three guards cover every loop that indexes by a saved record's id at start-up, and Select on a string record returns nil, so the not-a-table case is skipped too. events.lua and conditionals.lua are byte-identical to Home Connect #114's head. I ran make render-checks NAME=default and mutation-tested the new test against the rendered driver. Reverting events.lua, conditionals.lua, or only the restoreEvents guard each fails it, so every guard is pinned.

@svc-finitelabs svc-finitelabs Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Merging main (#202) leaves this PR's own changes as they were. The render checks still pass at this head, with the new test running under #202's stricter shim.

@derek-miller
derek-miller merged commit cbbc566 into main Nov 11, 2026
22 checks passed
@derek-miller
derek-miller deleted the fix/saved-entries-without-ids branch November 11, 2026 04:16
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.

1 participant