Repository navigation
feat: keep airing in SQLite so it survives a restart - #27
Merged
Merged
Conversation
Airing was in memory only, so a restart or release during airing left the room off until someone tapped "Heat again". Following ADR-0007 (SQLite per service), the controller now saves each room's airing through a small AiringStore port, implemented by a SQLite adapter (modernc.org/sqlite): - A change that can't be saved isn't made; the API answers 500 and the page shows "Not changed". Only the end of airing goes ahead without a save, so a thermostat never stays off; the store catches up on the next tick. - At startup, airing still running carries on, airing that ended meanwhile restores at once, and a target held during airing comes back with it. - Versioned migrations are embedded and applied at start. - `heating-control backup <file>` writes a consistent copy (VACUUM INTO) while the service runs. - The config requires `dataDir`; the chart adds a 64Mi PVC (kept on uninstall) mounted there. - main is an app struct with serve and backup commands. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
go generate with a newer local Go re-encoded the PNGs; they are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Airing was kept in memory only, so a restart or release during airing left the room off until someone tapped "Heat again". This is the first part of the away mode: the next PR adds "away until …" on top of the same store. It follows the lab rule for persistence: one SQLite database per service on a PVC, with a backup command.
What changes
AiringStoreport. The value it saves isAiring, created throughRestoreAiring, which validates it.internal/sqlite: a pure Go adapter (modernc.org/sqlite).synchronous=FULL, on one connection.PRAGMA user_version. An older binary refuses a newer schema.VACUUM INTOprovides the backup.main: now anappstruct with two commands:serve(the default) andbackup <file>.dataDiris now required.persistenceblock (64Mi by default, kept on uninstall), mounted atconfig.dataDir(default/data).fsGroup: 65532.Verification
go build ./...,go vet ./...,go test -race ./...pass.golangci-lintv2.15.0 (through podman) reports 0 issues.helm lintandhelm templatewith Helm 4.3.2 (through podman) pass withci-values.yaml.backupcommand worked;system_mode: heatwith the held 22 °C;Rollout
The first deploy behaves like today's releases: airing running at that moment is lost once more. From then on it survives restarts. Rolling back to an older chart works, because the old binary ignores the volume.
🤖 Generated with Claude Code