testsAndMisc/phone_focus_mode/lib/tests
Krzysztof kuhy Rudnicki 9f2e208257 curfew_enforcer: split 367 -> 244 + 156, net layer at 100%
The nine network-curfew functions -- the per-UID iptables allow-list that
cuts every app outside $NIGHT_WHITELIST off the network overnight -- move
into curfew_net.sh. NET_BUILT stays in the enforcer: both files write it,
so it is a genuine shared global rather than a seam violation.

Placed as a FLAT sibling, not under lib/. deploy.sh pushes phone scripts
into one directory, so a lib/ path would simply not exist on the device;
dns_iptables.sh and tether_iptables.sh sit beside their enforcers for the
same reason. Added to BOTH deploy lists, and deliberately not to the chmod
list -- sourced files need no exec bit there, matching the other two.

41 assertions, 60/60 lines, 17 mutations all killed. The one that matters
most flips the 10000-19999 REJECT to ACCEPT, which would silently disable
the entire cut-off while leaving a chain that looks populated. The suite
also asserts rule ORDER, not just presence: every ACCEPT must precede that
REJECT, or the whitelist blocks the very apps it exists to permit.

night_uids and fill_net_chain are reported as non-verbatim by
verify_shell_split.sh, correctly: both ended in `done < file`, a line kcov
instruments and bash never reports, which alone held the file at 96.77%.
Both are now piped. Neither loop reads stdin internally, so the subshell is
immaterial -- unlike pull_apks in backup_capture.sh, where the same change
would reintroduce a known bug. Behaviour was checked rather than assumed:
night_uids emits the same uids, and fill_net_chain emits an identical
11-rule sequence, diffed against the pre-split bodies.

UNVERIFIED ON DEVICE -- joins tether_enforcer.sh and dns_enforcer.sh.
Over-cap count 21 -> 20.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011w2Pj4Ek3ZNMQVYcFHgXDY
2026-08-17 16:18:05 +02:00
..
adb_test_harness.sh phone_focus_mode: split test_adb_common.sh 287 -> 134 + 105 2026-08-17 10:34:55 +02:00
backup_capture_harness.sh phone_backup: split 333 -> 229 + 114, with the library at 100% 2026-08-17 16:02:25 +02:00
curfew_net_cases_chain.sh curfew_enforcer: split 367 -> 244 + 156, net layer at 100% 2026-08-17 16:18:05 +02:00
curfew_net_cases_lifecycle.sh curfew_enforcer: split 367 -> 244 + 156, net layer at 100% 2026-08-17 16:18:05 +02:00
curfew_net_harness.sh curfew_enforcer: split 367 -> 244 + 156, net layer at 100% 2026-08-17 16:18:05 +02:00
dns_iptables_harness.sh meta: measurable shell coverage, and dns_iptables.sh at 100% 2026-08-17 15:29:08 +02:00
monitor_cases_health.sh monitor: backfill to 100% coverage, fixing two defects it exposed 2026-08-17 15:54:04 +02:00
monitor_cases_policy.sh monitor: backfill to 100% coverage, fixing two defects it exposed 2026-08-17 15:54:04 +02:00
monitor_harness.sh monitor: backfill to 100% coverage, fixing two defects it exposed 2026-08-17 15:54:04 +02:00
test_adb_common.sh phone_focus_mode: split test_adb_common.sh 287 -> 134 + 105 2026-08-17 10:34:55 +02:00
test_adb_trusted.sh phone_focus_mode: split test_adb_common.sh 287 -> 134 + 105 2026-08-17 10:34:55 +02:00
test_backup_capture.sh phone_backup: split 333 -> 229 + 114, with the library at 100% 2026-08-17 16:02:25 +02:00
test_curfew_net.sh curfew_enforcer: split 367 -> 244 + 156, net layer at 100% 2026-08-17 16:18:05 +02:00
test_dns_iptables.sh meta: measurable shell coverage, and dns_iptables.sh at 100% 2026-08-17 15:29:08 +02:00
test_magisk_service.sh feat(phone-focus): add recovery workflow, automation scripts, and docs 2026-05-01 19:07:27 +02:00
test_monitor.sh monitor: backfill to 100% coverage, fixing two defects it exposed 2026-08-17 15:54:04 +02:00
test_tether_enforcer.sh tether_enforcer: split 267 -> 182 + 103, and grow both deploy lists 2026-08-17 14:38:53 +02:00