Repository navigation
Say whether the availability estimate measured the machine - #13
Merged
MuteJester merged 1 commit intoNov 15, 2026
Merged
Conversation
CI passed on all fifteen checks with the sampled estimate in place, and that proved nothing about whether the estimate ever ran. On a quiet runner available == cores whether the reading worked or fell back to "assume no contention", so a working estimate and a dead code path produce identical output. The platform report confirms it: macOS resolved 3 threads on 3 cores and Windows 4 on 4, which is what an idle machine gives AND what -1 gives. That is the same shape as the thread-plan wiring line -- a green check whose claim was stronger than its evidence -- so parallel_plan() now reports available_measured beside available. It is filled from the SAME single reading, through beam_available_cores_ex(&measured), not from a second one. Asking twice would take a second sample, and on the sampled platforms a sample consumes the window it is measured over: a probe that re-read would report "not measured" almost always and would perturb the signal it claims to describe. A pin counts as measured, since the estimate then came from outside rather than from the fallback. BeamPlanIn carries it as a reporting-only field. beam_plan_threads() does not read it and must not: a plan that behaved differently depending on whether the estimate was measured would make the fallback a second policy rather than a missing input. The Python test is mutated against the real build, which is the only reason it is worth having. Pointing the Linux reader at /proc/loadavg_absent makes the machine never answer and the test fails with `assert False is True`; restored, it passes. So a pass on the macOS and Windows legs is now evidence that the sampled path MEASURES, rather than evidence that it compiles. Verified: C 452 tests all passing, Python 1242 passed and 2 skipped, gate exit 0 with no FAIL and no note lines, every recorded number byte-identical. Three inventory files moved by four lines in total, named in RERECORDED.md.
MuteJester
deleted the
parallelism/report-whether-availability-was-measured
branch
November 15, 2026 13:05
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.
Follow-up to #12, which merged before this commit landed. #12 gave macOS and
Windows a contention estimate; this is the part that lets anyone check it is
working.
Why #12 is not verifiable as merged
#12 passed all fifteen checks, and that proved nothing about whether the new
estimate ever runs. On a quiet machine
available == coreswhether the readingworked or fell back to "assume no contention", so a working estimate and a dead
code path produce identical output. The platform reports from #12 show exactly
that ambiguity:
threads == coreson every platform — which is what an idle machine gives, andalso what
-1gives. Those platforms could have stayed on the fallback withevery leg green, and so could any future regression that broke the readers.
This is the same shape as the thread-plan wiring line: a green check whose claim
was stronger than its evidence.
What this adds
parallel_plan()reportsavailable_measuredbesideavailable, filled fromthe same single reading via
beam_available_cores_ex(&measured).Not from a second reading, and that matters: on the sampled platforms a sample
consumes the window it is measured over, so a probe that re-read would report
"not measured" almost always and would perturb the signal it claims to describe.
A pin counts as measured — the estimate then came from outside rather than from
the fallback.
BeamPlanIncarries it as a reporting-only field.beam_plan_threads()doesnot read it and must not: a plan that behaved differently depending on whether
the estimate was measured would turn the fallback into a second policy rather
than a missing input.
The test is mutation-tested, which is the whole point
test_the_estimate_says_whether_it_measured_the_machinecallsparallel_plan()twice either side of a 30 ms sleep (the sampled platforms need a window; the
first reading on a thread is only a baseline) and asserts the flag is true.
Pointing the Linux reader at
/proc/loadavg_absentmakes the machine neveranswer, and the test fails with
assert False is True. Restored, it passes.So a pass on the macOS and Windows legs is now evidence that the sampled path
measures, rather than evidence that it compiles. That evidence did not exist
for #12 and cannot be obtained from it.
Two C tests go with it: a pin counts as measured (true on every platform, unlike
a bare reading), and
beam_available_cores()is exactlybeam_available_cores_ex(NULL)under a pin, which removes the per-call freedomthe sampled platforms otherwise have and makes the comparison exact.
Verified
byte-identical
Baselines moved by four lines across three inventory files —
pytest_cases1243→ 1244,
c_cases450 → 452,c_symbols263 → 264 — each named inRERECORDED.md.