testsAndMisc/NEXT_SESSION_RESTRUCTURE.md
Krzysztof kuhy Rudnicki 4f2b0ccdf7 Dissolve linux_configuration/scripts/ and single_use/
Two levels of pure taxonomy carrying no information, and a 2-directory
cap leaves no room for them. Categories now sit directly under
linux_configuration/: features, fixes, utils, misc, fresh-install,
installers, diagnostics, gaming, boot_recovery, periodic_background, lib,
meta, tests. A script's own lib/ and tests/ are exempt from the cap, so
those stay put.

Depth violations 248 -> 139; roughly 40 of the remainder are inside
digital_wellbeing and hosts, deferred until the guard-lib repoint.

The moves are the easy half. What breaks is every path that counted
levels, and three classes of it had to be found by resolving paths rather
than reading diffs:

  - 52 relative `source` lines for lib/common.sh and lib/android.sh. The
    correct prefix differs per file: 40 were ../../ and 12 were ../../../,
    so a blanket replace would have fixed one set and broken the other.
  - REPO_ROOT in 7 fixes/lib/tests harnesses and setup_syncyomi_guard.sh,
    each walking up four levels from a directory now two levels shallower.
    This caused a real regression -- the fixes suite went red with
    "log_warn: command not found" -- caught by running it and comparing
    against the pre-move baseline worktree.
  - conftest.py's sys.path entries, which took the pytest gate down with
    14 collection errors, and the `# shellcheck source=` directives, which
    took shellcheck down with SC1091.

16 symlinks in $HOME broke, including the entire i3blocks bar. All
repointed, and cpu_monitor/memory/disk/time/volume were run to confirm
they emit real output rather than merely resolving.

Verified: 1798 tests pass at 100% coverage, 8 of 9 lib/tests suites pass
(the ninth needs the coverage jail, identically at baseline), pre-commit
is clean, and the two untracked secret configs are still ignored after
their gitignore paths changed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PJrqKERAo5QUeEHWS5Asgp
2026-08-23 18:53:30 +02:00

4.7 KiB

testsAndMisc restructure — where it stands

Plan: ~/.claude/plans/after-refactor-of-testsandmisc-modular-wigderson.md Live-state checklist: docs/restructure-live-state.md (regenerate with ./meta/scripts/report_live_state.sh)

Done

Archived to github.com/kuhyx/testsAndMisc-archive, full history: bucket_catch, poker-stakes, billsplit (+ python_pkg/billsplit_coverage, its CI workflow, the app_icons registry entry, and the paired .binary-allowlist / .gitignore icon rules — .binary-allowlist now has no patterns at all).

Extracted to public repos, full history, each with CI it did not have here: reverse-survivors, kcd2-dice-solver (cloned to ~/kcd2-dice-solver), focus-owner, mtk-root (took the four mtk_* libs and three suites that lived in lib/).

Gates written, deliberately NOT wired: meta/scripts/check_directory_depth.sh (cap 2; exempts third_party/, docs/superpowers/, .github/skills/ by prefix and lib/ / tests/ by path segment). Violations 556 → 294.

Depth, tests and pre-commit verified green at every commit; nothing used --no-verify.

Decisions taken this session

  • Depth cap is 2, with lib/ and tests/ exempt — so the ~118 single_use lib files stay put and step D only flattens entry scripts.
  • meta/ is in scope for the cap.
  • lib/common.sh STAYS. Measured: 55 consumers, 51 of which remain here. The .githooks use a separate common.sh, so the ">2 units" rule selects nothing worth moving. Deviation from the original instruction, agreed after measurement.
  • periodic_background/lib/ STAYS — 9 files, one consumer (check_and_enable_services.sh), not a shared library.
  • New repos are public; vmbox pass required for all four subsystems.

Remaining, in order

  1. hosts — owns /etc/guard-lib/targets/{resolved,nsswitch}.conf plugin paths. Confirm guardctl status after, not just that files moved.
  2. phone_focus_mode + python_pkg/focus_policy — must come after hosts: deploy_phases.sh:73 executes hosts' generate_hosts_file.sh.
  3. digital_wellbeing last — pacman wrapper, chattr +i, the 12 hardcoded orchestrator paths in check_and_enable_services.sh:61-74 / setup_periodic_system.sh:20-23, and now heavy_job_lock.sh, which moved in with it. It also owns test_shutdown_timer_monitor.sh, the pair test left behind here.
  4. Step D: flatten the 207 remaining entry-script violations (single_use/** is ~130 of them). Deduplicate the two Nextcloud implementations first — ~2,780 lines for one capability.
  5. Step E: wire both gates, close the boot-repair hole (756 lines, escapes the 250-line cap because is_source_file() needs a dot in the filename), prune docs/superpowers/ churn.

Traps already paid for

  • Run the thing, don't read it. Repointing kcd2 surfaced three failures no grep would have found: pnpm ignoring the package.json "pnpm" field, pnpm refusing to purge node_modules without a TTY, and the Docker container still bind-mounting the deleted monorepo path.
  • /usr/local/bin holds copies that name repo paths — invisible to a repo grep, and periodic-system-maintenance.sh runs hourly with three such paths into digital_wellbeing and hosts. Any extraction of those two must reinstall it, not just edit the repo copy.
  • Removing a file can break a suite that stays. Deleting mtk_harness.sh broke test_common_datetime.sh, which sources it. Check both directions.
  • pre-commit's patch restore can silently revert an edit made before the commit — the app_icons change had to be applied twice. Re-grep after committing.
  • shell-tests.yml discovers some suites by glob and names others in an explicit list. A removal breaks the list (CI fails on the missing file) and silently shrinks the glob. Check both.
  • Never let a test fall back to /usr/local/bin. The installed copy can be older than source — shutdown-timer-monitor.sh is, on this machine — so the test compares an installer template against a binary it never generated. It hung. Prefer a sibling checkout and SKIP when absent.
  • Extractions keep surfacing pre-existing bugs. update_android_hosts.sh pointed GUARDIAN_MODULE_DIR at a sibling that never existed. Fix them rather than carrying them forward, and guard at the single funnel.

Unrelated: syncyomi-guard is red

Failing since 00:00 on 2026-08-23, ~17h before this session — nothing to do with the restructure. It is working as designed: the library collapsed from 2185 manga / 68902 chapters to 8 / 895. See the syncyomi-restore-silent-partial memory; do NOT checkpoint the WAL before recovering. Newest snapshot in ~/syncyomi/snapshots/ is 2026-08-15.