8000 fix(libre): scope the private-bench suite to the host it can actually audit by shroominic · Pull Request #179 · shroominic/OpenGlucose · GitHub
[go: up one dir, main page]

Skip to content
8000

fix(libre): scope the private-bench suite to the host it can actually audit - #179

Closed
shroominic wants to merge 1 commit into
release/v0.4.0from
fix/private-bench-host-scope
Closed

shroominic wants to merge 1 commit into
release/v0.4.0from
fix/private-bench-host-scope

Conversation

@shroominic
Copy link
Copy Markdown
Owner

Fixes the CI half of #153. This is the diagnosed cause of the red Unit gate on #128, #136, #139 and #163.

Diagnosis

CI Unit was red on 13 tests in packages/cgm_libre2_glucose/test/private_bench_test.dart:

❌ CLI emits one redacted JSON line and empty stderr (failed)
Expected: <0>
  Actual: <66>

The job log carries the tool's own reason on stdout: {"analyzed":false,"error":"unsupported_platform"}.

That is the tool working as designed, not a regression. tool/analyze_private_bench.dart reads inputs only through _readDescriptorBound, which returns unsupportedPlatform unless Platform.isMacOS and the ABI is macosArm64/macosX64. Its securityFailure decodes audited Darwin stat64 offsets with the note "Only audited Darwin64 ABIs are enabled, never guessed Linux offsets." The suite, however, asserted Darwin analysis results while CI runs it on ubuntu-latest, so it could never pass there — which is why it passed on a macOS host and failed on every CI run of this train.

Change

  • private_bench_test.dart carries @TestOn('mac-os'): every assertion in it describes the audited Darwin path.
  • New private_bench_host_scope_test.dart (@TestOn('!mac-os')) asserts the contract every other host gets instead: analysis fails closed with 66 and {"analyzed":false,"error":"unsupported_platform"}, and the CLI keeps stdout to one redacted JSON line with an empty stderr.

The platform scope is proved on both hosts rather than skipped, and no unaudited Linux stat support is invented.

Verified

  • make bootstrap, make format-check, make lint exit 0 on this branch.
  • dart test in packages/cgm_libre2_glucose on macOS: 33 tests passed.
  • Ubuntu side is the behaviour CI already reports (66 / unsupported_platform); this PR turns that into the assertion.

Base release/v0.4.0 so the aggregate can carry it; the fix also belongs on the libre lane (#119).

… audit

CI Unit was red on 13 private-bench tests with exit 66 and
{"analyzed":false,"error":"unsupported_platform"}. The tool is not broken there:
_readDescriptorBound only reads through the audited Darwin descriptor path and
refuses every other host before it opens a file or parses a byte. The suite
asserted Darwin analysis results on ubuntu-latest.

The Darwin assertions now carry @teston('mac-os'), and the contract every other
host gets is asserted in private_bench_host_scope_test.dart: analysis fails
closed with unsupported_platform, and the CLI keeps stdout to one redacted JSON
line with an empty stderr. No production path changes and no platform support is
claimed that was not audited.
@shroominic
Copy link
Copy Markdown
Owner Author

Superseded by #183 — do not merge both; prefer #183.

Both PRs fix #153's red Unit gate, but in opposite directions. This PR scopes the suite to the host it can audit (@TestOn('mac-os')) and asserts that other hosts fail closed; #183 audits the Linux stat layout instead, so the bench actually reads artifacts on the CI runner and the 13 Linux tests keep their signal. #183 is strictly better coverage and falsifies this PR's Linux assertion: a tree carrying both would fail on ubuntu-latest.

The assembled aggregate (#163) was re-cut to carry #183 and drop this merge, so nothing on the candidate depends on this branch. Left open rather than closed so the decision stays visible; recommend closing it in favour of #183.

@shroominic
Copy link
Copy Markdown
Owner Author

Not absorbed by the GS1 consolidation (#209, feature/cbio-gs1). Left open on purpose: packages/cgm_libre2_glucose/test/private_bench_host_scope_test.dart does not exist in the consolidated tree; the only private-bench work carried is the Linux evidence read (#183). Owner: Libre private-bench lane.

@shroominic
Copy link
Copy Markdown
Owner Author

Closed as superseded on the consolidated line, with the evidence stated plainly.

This PR scopes packages/cgm_libre2_glucose/test/private_bench_test.dart to macOS because, on its base, tool/analyze_private_bench.dart returned unsupported_platform on every non-Darwin host. The consolidated line (#209) already carries a stronger fix: the tool audits a Linux x86_64 descriptor layout as well as Darwin (_hasAuditedDescriptorLayout accepts Abi.linuxX64; _PosixFunctions.securityFailure decodes the audited struct stat offsets with uid 28 / mode_t 24 for Linux, and the descriptor path resolves through /proc/self/fd).

Evidence that the suite needs no scoping here: the CI Unit job on ubuntu-latest ran test/private_bench_test.dart and passed on this branch (3eca4f4, run 35333771402 — "✅ test/private_bench_test.dart: owner600 native-v2 source yields counts only, with no mutation", and the neighbouring cases in the same file). Taking this PR as written would add @TestOn('mac-os') and skip the Darwin-side assertions on Linux, which would be a coverage regression on a line where they pass.

So the red Unit gate described here was fixed a different way on this line. If the 0.4.0 aggregates (#139, #163) still show a red Unit gate for this cause, the fix belongs on those branches; this PR is not the carrier for it. Labeling the reason explicitly rather than leaving the PR in limbo: no owner needed here, and nothing was absorbed from it.

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

0