mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-11 16:54:07 +01:00
The bind-mount logic goes to hosts_mount.sh, the Magisk-module and
cache-invalidation logic to hosts_magisk.sh. Both flat siblings, both in
both deploy lists; the two lists were then checked to correspond exactly
in both directions, since a push with no matching cp stages a file that
never lands and the enforcer would fail to source it.
Audited for stdin-draining `while read` loops BEFORE extracting, because
piping one would change behaviour in a way stubs cannot catch. There are
none here. Also confirmed no function writes a global, so there was no
cross-half hazard of the kind that kept NET_BUILT in curfew_enforcer.sh.
69 assertions, 43/43 and 62/62 lines, 17 mutations all killed. Two survived
the first run and both were real findings:
- the unmount give-up threshold was not pinned. Raising it from 5 to 500
changed nothing observable, so the enforcer could have spun 500 times
per poll against a mount that was never going to clear. Now asserted as
a call count.
- the `[ ! -f $HOSTS_TARGET ] && return 1` guard in
is_bind_mounted_correctly is PROVABLY EQUIVALENT: sha256_of returns
empty for a missing file, so the existing -n check already rejects that
case. No test can distinguish it. Equivalent code is a claim of a check
that is not being made, so it is deleted rather than covered by a test
that would pass either way. Old and new bodies were compared across all
four input states -- both-missing, target-missing, match, mismatch --
and agree on every one.
That deletion is the only non-verbatim function; the other 19 moved
untouched, making this the first fully verbatim extraction of the session.
Ordering is asserted where it is load-bearing: /system must go back to ro
after rw, and +i must be restored after being dropped. Presence assertions
alone would pass with either pair reversed.
UNVERIFIED ON DEVICE -- the highest-stakes of the four enforcer splits now
outstanding, since a failure to source leaves nothing blocking while the
phone looks normal. Over-cap count 20 -> 19.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011w2Pj4Ek3ZNMQVYcFHgXDY
22 lines
2.4 KiB
JSON
22 lines
2.4 KiB
JSON
{
|
|
"title": "Split hosts_enforcer.sh into mount and magisk halves, both tested to 100%",
|
|
"objective": "Take hosts_enforcer.sh from 421 lines to under the repo's 250-line cap by extracting its bind-mount logic and its Magisk/cache-invalidation logic into two flat siblings, and cover both at 100%. This is the code that decides whether the DNS blocklist is actually enforced; a probe that reports an OEM overlay as our blocklist means no blocking at all while the status reads green.",
|
|
"acceptance_criteria": [
|
|
"bash meta/scripts/check_file_length.sh --all no longer lists phone_focus_mode/hosts_enforcer.sh, and no new file is over the cap.",
|
|
"shell_coverage.sh reports 100.00% for BOTH hosts_mount.sh and hosts_magisk.sh from the single test entry point.",
|
|
"Every assertion is mutation-proofed with zero survivors. A mutation that proves equivalent must be resolved by removing the equivalent code, not by weakening the mutation.",
|
|
"Ordering is asserted where it is load-bearing: /system must be remounted ro after rw, and the immutable flag re-set after being dropped.",
|
|
"meta/scripts/verify_shell_split.sh reports every function verbatim, except any deliberately changed — for which behavioural equivalence must be demonstrated across every input state.",
|
|
"Both new siblings are added to BOTH of deploy.sh's hardcoded lists, and the two lists remain in exact correspondence with no orphan in either direction.",
|
|
"shellcheck passes on each touched file individually, with no -x and no disable directive; sh -n passes on all three phone-side scripts.",
|
|
"No eval is introduced in test code."
|
|
],
|
|
"out_of_scope": [
|
|
"Deploying to the phone or verifying on-device; there is no device in this session.",
|
|
"Splitting verify_and_restore or main out of the entry script, which is under the cap without the two extracted halves.",
|
|
"Adding the siblings to deploy.sh's chmod list: they are sourced, not executed, matching dns_iptables.sh, tether_iptables.sh and curfew_net.sh.",
|
|
"Changing which domains are blocked or how the canonical blocklist is generated."
|
|
],
|
|
"verifier": "bash phone_focus_mode/lib/tests/test_hosts_libs.sh (expects 69 passed, 0 failed), plus shell_coverage.sh at 100.00% for hosts_mount.sh and hosts_magisk.sh, plus the mutation run at 17 killed / 0 survived, plus check_file_length.sh --all showing 19 files, plus deploy-list parity showing no orphans, plus pre-commit run --files on the touched files."
|
|
}
|