Skip to content

omamobile-audio 0.5.5: the tests' state files are written atomically - #107

Merged
derekross merged 3 commits into
derekross:mainfrom
W4HO-ham:audio-test-atomic-state
Oct 28, 2026
Merged

derekross merged 3 commits into
derekross:mainfrom
W4HO-ham:audio-test-atomic-state

Conversation

@W4HO-ham

@W4HO-ham W4HO-ham commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

CI failed several times tonight on unrelated branches (omarchy-mobile #100, #101, and this one's first push) in the watchdog's temperature-jump tests, with a JSONDecodeError from the fake mixer: a read of its state file landed mid-write and saw an empty file.

There were two writers. The fake mixer and fake PipeWire rewrote their state in place, and so did JsonCtl, the json: control backend the tests run the speaker code against, on every heartbeat read (the watchdog reads the heartbeat constantly). All three now write a temporary file and rename it over the state, so a reader sees the old file or the new one, never half of one.

Nothing changes on the palmtop: JsonCtl is used only with OMAMOBILE_CTL_BACKEND=json:. The version goes to 0.5.5 because lib/speaker_dsp.py ships in the package. test/all passes three times in a row locally and tools/pr-check is clean. The same two commits are on #100 and #101 so their CI can pass; whichever lands first, the others merge clean.

…atomically

The watchdog's jump test changes a control from a background job while the watchdog reads the fake mixer's state file, and CI once caught the read halfway through the write (JSONDecodeError, the test failed). Both fakes now write a temporary file and rename it over the state.
The flake had a second writer: JsonCtl, the json: control backend the tests run the speaker code against, rewrites the fake mixer's state on every heartbeat read, in place. The fake mixer reading at that moment saw an empty file. JsonCtl now writes a temporary file and renames it, as the fakes do. Nothing changes on the palmtop: JsonCtl is used only with OMAMOBILE_CTL_BACKEND=json:.
@W4HO-ham W4HO-ham changed the title omamobile-audio tests: the fake mixer and PipeWire write their state atomically omamobile-audio 0.5.5: the tests' state files are written atomically Oct 28, 2026
…s first reading

The jump tests changed the estimate 0.4 s after starting the watchdog. On a slow CI runner the watchdog wasn't reading yet, took the raised value as its baseline, saw no jump and didn't mute. The jump now waits for the watchdog's start line and a few intervals, and the watchdog runs 60 iterations.
@W4HO-ham

Copy link
Copy Markdown
Contributor Author

Third commit: with the decode errors gone, the jump test still failed once on CI for a timing reason. It changed the temperature 0.4 s after starting the watchdog, and a slow runner's watchdog took the raised value as its baseline. The jump now waits for the watchdog's start line and a few intervals. CI is green here and on #100 and #101, which carry the same commits. Under a much heavier load than CI (two busy loops per core) one other timing test, feedback: runs during the stream, failed once; CI hasn't hit it, so I've left it alone.

@derekross

Copy link
Copy Markdown
Owner

Thanks for tracking this down, @W4HO-ham. Two writers, both fixed with a rename, and a jump test that waits for the watchdog's first reading instead of a fixed 0.4 s: that's the right fix, and it explains every red run we've had on that test.

I checked that JsonCtl is only reached through OMAMOBILE_CTL_BACKEND=json:, so nothing changes on a phone, and the suite passes here on top of all your open PRs.

One thing on my side: my unmerged speaker-earpiece branch is also omamobile-audio 0.5.5. I'll merge this one first as 0.5.5 and move the earpiece work to 0.5.6, so you don't need to change anything. Once this is in, the copies of these commits on #100, #101, #115 and #117 become no-ops; you can drop them when you next push those branches, but you don't have to.

@derekross
derekross merged commit 87454f9 into derekross:main Oct 28, 2026
2 checks passed
derekross added a commit that referenced this pull request Oct 31, 2026
… rounds

L-348 to L-361: shared drivers judged against every int-line user (#150),
board pins against every stock user (#151), ownership flags under the
consumer's lock (#152), /chosen children and Google's panel constants
(#154), same-day notes PRs on one device (#208/#209), merge simulations for
DEVICES rows, ours included (#165), stacked PRs that merged main (#115/#117),
titles behind renumbered versions, a contributor merge that dropped the PR
(#99), smoke package lists as provenance and "owner-authorized" writes
(#200), promised fixes and named tags checked on the remote (#153/#157/#158),
and file swaps into old packages (#193). C-23 (usbc-deadman's device scope,
kernel #107) and C-24 (BNEP in a lynx-only fragment, #98).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
robertzas pushed a commit to robertzas/omarchy-mobile that referenced this pull request Nov 14, 2026
… rounds

L-348 to L-361: shared drivers judged against every int-line user (derekross#150),
board pins against every stock user (derekross#151), ownership flags under the
consumer's lock (derekross#152), /chosen children and Google's panel constants
(derekross#154), same-day notes PRs on one device (derekross#208/derekross#209), merge simulations for
DEVICES rows, ours included (derekross#165), stacked PRs that merged main (derekross#115/derekross#117),
titles behind renumbered versions, a contributor merge that dropped the PR
(derekross#99), smoke package lists as provenance and "owner-authorized" writes
(derekross#200), promised fixes and named tags checked on the remote (derekross#153/derekross#157/derekross#158),
and file swaps into old packages (derekross#193). C-23 (usbc-deadman's device scope,
kernel derekross#107) and C-24 (BNEP in a lynx-only fragment, derekross#98).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants