mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-24 16:06:17 +01:00
Compare commits
2 Commits
6b5fe8e7a7
...
840df29818
| Author | SHA1 | Date | |
|---|---|---|---|
| 840df29818 | |||
| b50b146dad |
78
NEXT_SESSION_RESTRUCTURE.md
Normal file
78
NEXT_SESSION_RESTRUCTURE.md
Normal file
@ -0,0 +1,78 @@
|
||||
# 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 `scripts/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.
|
||||
- **`scripts/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. `system-maintenance` — no cross-unit source edges.
|
||||
2. `android_guardian` (`periodic_background/utils/`) — settle
|
||||
`heavy_job_lock.sh`. The seam is already clean: consumers read the
|
||||
_installed_ `/usr/local/bin/heavy_job_lock.sh` and
|
||||
`meta/scripts/run_with_heavy_lock.sh` documents a "missing lock ⇒ run
|
||||
unserialised" fallback.
|
||||
3. `hosts` — owns `/etc/guard-lib/targets/{resolved,nsswitch}.conf` plugin
|
||||
paths. Confirm `guardctl status` after, not just that files moved.
|
||||
4. `phone_focus_mode` + `python_pkg/focus_policy` — must come after `hosts`:
|
||||
`deploy_phases.sh:73` executes hosts' `generate_hosts_file.sh`.
|
||||
5. `digital_wellbeing` **last** — pacman wrapper, `chattr +i`, and the 12
|
||||
hardcoded orchestrator paths in `check_and_enable_services.sh:61-74` /
|
||||
`setup_periodic_system.sh:20-23`.
|
||||
6. 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.
|
||||
7. 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 suites by glob, so a removal shrinks CI coverage
|
||||
with a green build. Record the suite count before and after.
|
||||
@ -1,13 +1,19 @@
|
||||
# Live state pointing into testsAndMisc
|
||||
|
||||
Generated by `meta/scripts/report_live_state.sh` at 2026-08-23T16:56:34+02:00.
|
||||
Baseline commit: f4535b6b
|
||||
Generated by `meta/scripts/report_live_state.sh` at 2026-08-23T17:43:44+02:00.
|
||||
Commit: 6b5fe8e7
|
||||
|
||||
This is the checklist for the repo restructure. Every entry below names
|
||||
an absolute path inside this repo; when that path moves, the referring
|
||||
file must be repointed in the same step. Re-run the script with
|
||||
`--check` after each move to prove nothing was left behind.
|
||||
|
||||
The "installed scripts" section was added after `/usr/local/bin/`
|
||||
copies were found naming repo paths. Those are the easiest references to
|
||||
miss: the installed copy is what actually runs, so grepping the repo for
|
||||
its own paths never finds them, and a stale one fails at whatever hour
|
||||
its timer next fires.
|
||||
|
||||
```
|
||||
## systemd units
|
||||
/etc/systemd/system/dns-blocklist-refresh.service
|
||||
@ -18,9 +24,6 @@ file must be repointed in the same step. Re-run the script with
|
||||
3:Documentation=file:///home/kuhy/testsAndMisc/endurain/README.md
|
||||
11:WorkingDirectory=/home/kuhy/testsAndMisc
|
||||
21:ExecStart=/usr/bin/bash -c 'ENDURAIN_API_KEY="$(cat /home/kuhy/testsAndMisc/endurain/.api_key)" /home/kuhy/testsAndMisc/.venv/bin/python -m python_pkg.endurain_import'
|
||||
/home/kuhy/.config/systemd/user/kcd2-dice-build.service
|
||||
7:WorkingDirectory=/home/kuhy/testsAndMisc/kcd2_dice_solver
|
||||
8:ExecStart=/home/kuhy/testsAndMisc/kcd2_dice_solver/deploy_build.sh
|
||||
/home/kuhy/.config/systemd/user/morning-routine.service
|
||||
13:Environment=PYTHONPATH=%h/testsAndMisc
|
||||
16:WorkingDirectory=%h/testsAndMisc
|
||||
@ -34,6 +37,16 @@ file must be repointed in the same step. Re-run the script with
|
||||
/etc/guard-lib/targets/resolved.conf
|
||||
4:PLUGIN="/home/kuhy/testsAndMisc/linux_configuration/scripts/periodic_background/hosts/guard/plugins/resolved-plugin.sh"
|
||||
|
||||
## installed scripts referencing the repo
|
||||
/usr/local/bin/hosts-file-monitor.sh
|
||||
10:HOSTS_INSTALL_SCRIPT="/home/kuhy/testsAndMisc/linux_configuration/scripts/periodic_background/hosts/install.sh"
|
||||
/usr/local/bin/periodic-system-maintenance.sh
|
||||
26:PACMAN_WRAPPER_INSTALL="/home/kuhy/testsAndMisc/linux_configuration/scripts/periodic_background/digital_wellbeing/pacman/install_pacman_wrapper.sh"
|
||||
27:MAKEPKG_WRAPPER_INSTALL="/home/kuhy/testsAndMisc/linux_configuration/scripts/periodic_background/digital_wellbeing/pacman/install_makepkg_wrapper.sh"
|
||||
28:HOSTS_INSTALL_SCRIPT="/home/kuhy/testsAndMisc/linux_configuration/scripts/periodic_background/hosts/install.sh"
|
||||
/usr/local/bin/wsg-grabber
|
||||
4:export PYTHONPATH="/home/kuhy/testsAndMisc${PYTHONPATH:+:$PYTHONPATH}"
|
||||
|
||||
## symlinks into the repo
|
||||
/home/kuhy/.config/i3blocks/claude_usage.sh -> /home/kuhy/testsAndMisc/linux_configuration/scripts/periodic_background/i3-configuration/i3blocks/claude_usage.sh
|
||||
/home/kuhy/.config/i3blocks/config -> /home/kuhy/testsAndMisc/linux_configuration/scripts/periodic_background/i3-configuration/i3blocks/config
|
||||
@ -56,49 +69,10 @@ file must be repointed in the same step. Re-run the script with
|
||||
/home/kuhy/.oh-my-zsh/custom/token-savers.zsh -> /home/kuhy/testsAndMisc/linux_configuration/zsh/token-savers.zsh
|
||||
```
|
||||
|
||||
## Depth-cap dry run (step 0)
|
||||
## Depth-cap progress
|
||||
|
||||
`meta/scripts/check_directory_depth.sh --all` at baseline:
|
||||
|
||||
| Bucket | Files |
|
||||
| --------------------------------------- | ------- |
|
||||
| Total violations | 556 |
|
||||
| Disappear with the archives/extractions | 349 |
|
||||
| **Remain — the step D worklist** | **207** |
|
||||
|
||||
Step D worklist by directory:
|
||||
|
||||
```
|
||||
36 linux_configuration/scripts/single_use/utils
|
||||
24 linux_configuration/scripts/single_use/features
|
||||
18 linux_configuration/scripts/single_use/misc/testsAndMisc-bash
|
||||
17 linux_configuration/scripts/single_use/fixes
|
||||
14 linux_configuration/scripts/single_use/fresh-install
|
||||
13 linux_configuration/scripts/periodic_background/i3-configuration/i3blocks
|
||||
10 linux_configuration/scripts/single_use/misc/testsAndMisc-bash/tools
|
||||
9 linux_configuration/C/atop_agg
|
||||
7 python_pkg/artgate/routes
|
||||
6 meta/scripts/fixtures/mutations
|
||||
6 meta/scripts/fixtures
|
||||
6 linux_configuration/scripts/single_use
|
||||
6 linux_configuration/docs/security-hardening
|
||||
5 linux_configuration/dwm/bin
|
||||
3 python_pkg/artgate/styles
|
||||
3 linux_configuration/scripts/diagnostics
|
||||
3 linux_configuration/scripts/boot_recovery
|
||||
2 linux_configuration/scripts/single_use/features/systemd
|
||||
2 linux_configuration/scripts/periodic_background/i3-configuration
|
||||
2 linux_configuration/scripts/periodic_background
|
||||
2 linux_configuration/scripts/gaming
|
||||
2 linux_configuration/scripts/boot_recovery/hooks
|
||||
2 linux_configuration/dwm/patches
|
||||
1 meta/scripts/run_all
|
||||
1 linux_configuration/zsh/scratchpad
|
||||
1 linux_configuration/scripts/single_use/utils/data
|
||||
1 linux_configuration/scripts/single_use/misc/testsAndMisc-bash/.vscode
|
||||
1 linux_configuration/scripts/single_use/feedback-appimage
|
||||
1 linux_configuration/scripts/periodic_background/i3-configuration/i3
|
||||
1 linux_configuration/scripts/meta
|
||||
1 linux_configuration/.github/workflows
|
||||
1 linux_configuration/docs/pacman-wrapper
|
||||
```
|
||||
| Bucket | Files |
|
||||
| ---------------------------------------- | ------- |
|
||||
| Violations now | 294 |
|
||||
| Disappear with the remaining extractions | 87 |
|
||||
| **Remain — the step D worklist** | **207** |
|
||||
|
||||
@ -0,0 +1,37 @@
|
||||
{
|
||||
"intent": "Close a gap in the live-state inventory: scripts installed under /usr/local that hardcode repo paths were invisible to the checklist the restructure relies on.",
|
||||
"scope": [
|
||||
"meta/scripts/report_live_state.sh - new report_installed section scanning /usr/local/bin and /usr/local/lib",
|
||||
"docs/restructure-live-state.md - regenerated",
|
||||
"Non-goal: repointing the references it found; each travels with its own subsystem extraction"
|
||||
],
|
||||
"changes": [
|
||||
"Added report_installed(), which greps /usr/local/bin and /usr/local/lib for the repo path and prints each hit with line numbers, matching the existing sections' shape and feeding the same --check exit code.",
|
||||
"Regenerated the inventory doc and folded in current depth-cap progress."
|
||||
],
|
||||
"verification": [
|
||||
{
|
||||
"command": "./meta/scripts/report_live_state.sh",
|
||||
"result": "pass",
|
||||
"evidence": "Found 3 installed scripts naming repo paths that no prior section reported: /usr/local/bin/periodic-system-maintenance.sh (3 paths into digital_wellbeing and hosts), /usr/local/bin/hosts-file-monitor.sh (1 into hosts), /usr/local/bin/wsg-grabber (PYTHONPATH into the repo root)."
|
||||
},
|
||||
{
|
||||
"command": "./meta/scripts/report_live_state.sh --check; echo $?",
|
||||
"result": "pass",
|
||||
"evidence": "Exit 1, correct while references remain; the new section participates in the same aggregate."
|
||||
},
|
||||
{
|
||||
"command": "shellcheck meta/scripts/report_live_state.sh",
|
||||
"result": "pass",
|
||||
"evidence": "Clean, no findings at any severity."
|
||||
}
|
||||
],
|
||||
"risks": [
|
||||
"The scan covers /usr/local/bin and /usr/local/lib. A reference installed elsewhere on PATH would still be missed; those two are where this machine's installers write.",
|
||||
"periodic-system-maintenance.sh runs hourly and names install scripts in two subsystems that are about to move, so those extractions must reinstall it rather than only editing the repo copy."
|
||||
],
|
||||
"rollback": [
|
||||
"git revert; the section is additive and nothing depends on its output yet.",
|
||||
"Re-run report_live_state.sh to confirm the remaining sections still report."
|
||||
]
|
||||
}
|
||||
@ -63,6 +63,23 @@ report_etc() {
|
||||
return "$found"
|
||||
}
|
||||
|
||||
# Scripts INSTALLED outside the repo that name a path inside it. These are the
|
||||
# easiest references to miss: the copy under /usr/local/bin is what actually
|
||||
# runs, so grepping the repo for its own paths never finds them, and a stale
|
||||
# one fails at whatever hour its timer next fires.
|
||||
report_installed() {
|
||||
echo "## installed scripts referencing the repo"
|
||||
local found=0 path
|
||||
while IFS= read -r path; do
|
||||
[[ -n "$path" ]] || continue
|
||||
found=1
|
||||
printf ' %s\n' "$path"
|
||||
grep -n "$REPO" "$path" 2>/dev/null | sed 's/^/ /'
|
||||
done < <(grep -rl "$REPO" /usr/local/bin /usr/local/lib 2>/dev/null | sort)
|
||||
((found)) || echo " (none)"
|
||||
return "$found"
|
||||
}
|
||||
|
||||
# Symlinks anywhere in $HOME resolving into the repo: i3blocks, ~/.local/bin,
|
||||
# oh-my-zsh custom. Depth 4 covers every known location without walking the
|
||||
# whole home directory.
|
||||
@ -86,6 +103,8 @@ main() {
|
||||
echo
|
||||
report_etc || any=1
|
||||
echo
|
||||
report_installed || any=1
|
||||
echo
|
||||
report_symlinks || any=1
|
||||
|
||||
if ((CHECK_ONLY)); then
|
||||
|
||||
Loading…
Reference in New Issue
Block a user