linux/bridge: inject the default-inbound stance into to_result - #18
Merged
Merged
Conversation
…he host inside it The bridge tests asserted on rows built partly from /etc/default/ufw — present on every Ubuntu runner, absent on the dev box — so CI failed on totals_reflect_everything_counted_so_far from the moment the synthetic default-policy row landed. The host read now happens at the call sites; tests state their stance explicitly, and the stance-present path gets the coverage it was missing.
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.
Four commits.
main's gate has been red since 2026-08-10 — twelve consecutive runs — and this is the fix,plus the two things that had to be true before it could land.
1.
752c237Inject the default-inbound stance intoto_result.to_resultread/etc/default/ufwitself, so the bridge tests asserted on rows built partly from thehost. That file is present on every Ubuntu runner and absent on the dev box, so
totals_reflect_everything_counted_so_farfailed on CI from the moment the synthetic default-policy rowlanded. The host read moved to the call sites; the tests state their stance explicitly.
2.
3de3c10Satisfy clippy 1.98'schunks_exact_to_as_chunkslint.Unrelated, and found only because fixing (1) let CI reach clippy at all. CI's stable toolchain moved to
1.98; the dev box is on 1.97, so this lint is invisible locally.
decode_provider_datanow usesas_chunks::<2>()— clippy's own suggestion, one call site, Windows-only code. Nothing silenced.3.
6b77365Read the Linux default stance through one testable seam.Commit (1) traded host-dependent tests for three untested call sites. A red-team pass proved it by
mutation: replacing all three
default_policy::read(backend)arguments withNoneleft the gate at224 passed; 0 failed, so a regression that silently drops the default-inbound row from the evidenceheader, the rule table and the socket list would have shipped green.
linux::default_policynow exposesSources/read_from, so a test can point the ufw defaults-file walkat a temp path and run the genuine production path without root and without a live firewall.
bridgehasone stance read (
to_result_from) instead of three, andfoldis the oldto_resultbody byte-for-byte.The same mutation now fails:
the_ufw_default_stance_is_read_through_the_supplied_sources,left: 1, right: 2.4.
0fde32bthe run record for the line.Verified
6b77365;0fde32bre-checked on push)./scripts/gate.sh— green;229 passed; 0 failed(was 224 before the new tests)Nonestance on every call path, an ordering skew betweenthe stance and the counters, a per-tick
firewall-cmdcost regression on the 5s auto-refresh, and"unreadable" degrading into a deny. Proved commit (2) equivalent over every length 0..64 and 2000 random
blobs.
6b77365: every substantive check PASS, including a brace-matched extraction provingfoldis the previousto_resultbody byte-for-byte (1916 bytes each), and that the ufw walk keepsfirst-readable-file-wins with a readable-but-keyless file yielding
Nonewithout falling through.forbidden from touching an assertion. Recorded in
factory/runs/20260906-112236-bridge-totals-flake.json.NOT verified
this session and has no run record at all; for (3), tests and implementation share one commit, so the
diff alone cannot show who wrote which. The record above is the evidence, not the diff.
to_resultnamesSources::system(). The hole shrank from three callsites to one line; it is not closed. Stated in the plan, not discovered late.
main.rs:655print_linux_report(--no-ui) still reads the stance itself, unguarded — the samesilent-deletion shape, out of scope here. Worth its own issue.
decode_provider_datahas no test; commit (2) rests on the two expressions being equivalent, which wasdemonstrated differentially but not pinned by a test.
Deploy the collectorshowsskippedon a PR by design — it only runs onmain. Its first real runwill be the merge commit.