mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-11 19:14:02 +01:00
The iptables chain machinery (ensure_chain, trusted_dot_ips, fill_chain_v4/v6, expected_rule_count, chain_intact, enforce_iptables) moves into dns_iptables.sh — a sibling, not a lib/ member, because lib/ does not exist on the phone and deploy.sh copies these files flat into $REMOTE_DIR. Both deploy lists grew the entry, matching how tether_iptables.sh is carried; it is correctly absent from the chmod 755 line, since a sourced library needs read, not execute. extract_shell_functions.py refuses to anchor a source line in a #!/system/bin/sh script, as documented — but when it refuses it still writes the library and does NOT remove the functions from the source, so a naive run leaves every function defined twice and the entry script longer than it started. The excision was done separately; the hash tool confirms all 14 functions moved verbatim. test_dns_enforcer.sh is deleted rather than repaired. Its six assertions targeted extract_ping_ip, extract_package_uid and append_unique_line — none of which dns_enforcer.sh has ever defined. It died at its source line and had never run a single assertion since it was added. Its replacement, test_dns_iptables.sh, covers all seven moved functions with 20 assertions, staged the way test_tether_enforcer.sh stages its subject. Three independent mutations were each caught: undercounting the trusted-resolver ACCEPT, miscounting rules per DoH IP, and moving the ACCEPT after the blanket REJECT. Shared staging lives in dns_iptables_harness.sh so both test files stay under the cap. Not verified on the phone — no deploy has run, by instruction. Over-cap count 23 -> 22. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011w2Pj4Ek3ZNMQVYcFHgXDY
19 lines
1.3 KiB
JSON
19 lines
1.3 KiB
JSON
{
|
|
"title": "split dns_enforcer.sh and give its chain code a real test",
|
|
"objective": "Move the iptables chain machinery out of dns_enforcer.sh so both files are under 250 lines, carry the new sibling in both deploy.sh lists, and replace the dead test_dns_enforcer.sh with a suite that actually exercises the moved code.",
|
|
"acceptance_criteria": [
|
|
"verify_shell_split.sh reports all 14 top-level functions moved verbatim",
|
|
"test_dns_iptables.sh reports 20 passed, 0 failed, and fails under each of three independent mutations",
|
|
"dns_iptables.sh appears in BOTH the adb_cmd push list and the adb_root cp list in deploy.sh",
|
|
"Sourcing dns_enforcer.sh with main() disabled resolves all seven moved functions at runtime",
|
|
"shellcheck is clean on every changed shell file, standing alone, with zero suppressions",
|
|
"check_file_length.sh --all drops from 23 over-cap files to 22, with no new file over the cap"
|
|
],
|
|
"out_of_scope": [
|
|
"Deploying to the phone or verifying on-device behaviour — explicitly excluded by the user this session",
|
|
"Repairing test_dns_enforcer.sh, which is deleted rather than fixed",
|
|
"Any behavioural change to the chain functions themselves"
|
|
],
|
|
"verifier": "bash phone_focus_mode/lib/tests/test_dns_iptables.sh + meta/scripts/verify_shell_split.sh + shellcheck + check_file_length.sh"
|
|
}
|