Commit Graph

18 Commits

Author SHA1 Message Date
ad714e538b fix(pre-commit): skip deleted/missing python_pkg subpackages
_affected_packages() now ignores subpackages whose tests/ dir doesn't
exist on disk and stops returning None for stray root-level files left
over from rewritten history. Pre-push pytest scope is bounded to the
6 packages with real test suites instead of every diverged path.
2026-05-14 21:05:49 +02:00
89b4f59ce9 chore: consolidate root configs into meta/, drop unused C dir + split/pdfCentered/geo_data
- Move pyproject.toml, .pre-commit-config.yaml, requirements.txt, run.sh,
  lint_python.sh, .fvmrc into meta/ with root symlinks preserving tool
  auto-discovery.
- Combine requirements.txt + requirements-dev.txt into meta/requirements.txt
  (single sorted source of truth).
- Remove setup.sh, .binary-allowlist, C/ (no native code remains),
  python_pkg/{split,pdfCentered,geo_data}, scripts/check_c_cpp_build_files.sh.
- Drop clang-format/cppcheck/flawfinder/check-c-cpp-build-files hooks and
  archived path excludes from pre-commit config.
- Add .secret-patterns to .gitignore and untrack it (sensitive content;
  full history purge is a follow-up step).
2026-05-14 20:40:12 +02:00
84e5d39137 chore: archive 41 unmaintained directories to testsAndMisc-archive
Full per-directory history preserved at https://github.com/kuhyx/testsAndMisc-archive
2026-05-14 20:21:05 +02:00
bc94227b59 chore(agent): add governance checks and artifact workflow scaffolding 2026-05-07 22:03:43 +02:00
59e863f2a5 feat: Add shell script quality enforcement and polling optimization guidelines
- Add pre-commit hook (check_polling_antipatterns.sh) to detect fork-storm anti-patterns
- Update .pre-commit-config.yaml with no-polling-antipatterns hook registration
- Add comprehensive documentation (6 guides, 1000+ lines total)

Detects and blocks:
  * while true + sleep patterns (suggests event-driven I/O)
  * $(date +...) subprocess forks (suggests /proc/uptime or bash printf)
  * pgrep/xdotool in polling functions (expensive fork overhead)
  * aggressive polling (sleep < 1s causing fork storms)
  * heavy piped commands (| awk | grep | tr with multiple forks)

Documentation included:
  - SHELL_SCRIPT_QUALITY_GUIDELINES.md: 3-layer guide for developers/reviewers
  - SHELL_QUALITY_IMPLEMENTATION_SUMMARY.md: Technical implementation reference
  - COMPLETE_IMPLEMENTATION_SUMMARY.md: Full overview and integration guide
  - QUICK_REFERENCE_SHELL_QUALITY.md: Visual checklist and quick lookup
  - DELIVERABLES_INDEX.md: Index of all deliverables and next steps
  - shell.instructions.md: R1-R8 polling optimization rules (in ~/.copilot/instructions/)

System impact:
  - Prevents new scripts from introducing fork-storm regressions
  - Already active optimizations: network_monitor.sh zero-fork, battery 1s->5s, music adaptive sleep
  - Expected daily savings: ~1-2 CPU-hours from eliminated fork overhead

Related: Resolves previous fork-storm issue identified on May 3 causing 728k CPU-seconds
2026-05-03 21:42:49 +02:00
589e059eee feat(phone-focus): add recovery workflow, automation scripts, and docs 2026-05-01 19:07:27 +02:00
ba87b1582e Fix coverage SQLite corruption: isolate each package run with COVERAGE_FILE
Each package subprocess now writes to its own tmpfile via COVERAGE_FILE env.
This prevents sequential subprocess runs from stomping on the .coverage SQLite
DB that the prior run left behind, which caused INTERNALERROR when pytest-cov
tried to combine() parallel data files with incompatible schemas.
2026-04-12 21:58:18 +02:00
6008a4034a Fix coverage race: delete stale .coverage* files before each package test run
Parallel cgroup subprocesses racing on the same .coverage SQLite DB caused
INTERNALERROR (no such table: meta/arc) when combining coverage data files.
Delete all .coverage* files before each package run to prevent corruption.
2026-04-12 21:56:46 +02:00
c47ac8d2eb Fix pytest OOM: nested 2GB cgroup per package with MemorySwapMax=0
Each pytest package runs in its own systemd-run scope with:
- MemoryMax=2G per package (nested inside the 4GB parent cgroup)
- MemorySwapMax=0 to prevent zram thrashing (the real cause of freezes)
- gc.collect() between packages to free Python heap
2026-04-12 21:43:18 +02:00
5fcecd6cf2 Fix pre-commit OOM: oom_score_adj + Node heap caps
- Set oom_score_adj=1000 in git hooks so OOM killer targets
  pre-commit first, never crashing the PC
- Cap Node.js heap to 512MB for eslint/prettier/vitest
- Remove broken systemd-run cgroup wrapper (didn't work)
- cppcheck: process files one-at-a-time, --check-level=normal
- pytest: run packages sequentially in separate subprocesses
- Remove --force from cppcheck (exponential memory on #ifdef combos)
2026-04-12 21:34:56 +02:00
dee307700e Fix pytest OOM: wrap each package in 3GB cgroup sub-scope
systemd-run --scope -p MemoryMax=3G per pytest subprocess so each
package gets its own memory cap, freed completely before the next.
Also use shutil.which + pathlib per ruff rules.
2026-04-12 21:27:24 +02:00
030741c315 Fix pytest OOM: run packages sequentially in separate subprocesses
Each python_pkg subpackage now runs in its own pytest subprocess so
memory is freed between packages.  Prevents 4GB+ accumulation when
matplotlib, geopandas, pygame, etc. all load in a single process.
2026-04-12 21:25:58 +02:00
3ebb97b283 chore: optimize pre-commit, remove tracked binaries, fix lint issues
- Move slow hooks (mypy, pylint, bandit, pytest, prettier) to pre-push stage
- Remove redundant autoflake (ruff covers F401/F841)
- Fix shellcheck OOM by batching files with xargs -n 40
- Remove tracked .o, .wav, .pyc binaries from git
- Move pomodoro wav files to ../testsAndMisc_binaries/ with symlinks
- Add *.o, *.so, *.a to .gitignore
- Refactor hltb._pick_best_hltb_entry to fix C901/PLR0911/SIM102
- Fix SC2034 warnings in gif_to_square.sh and upgrade.sh
- Add disk_cleanup_check.sh script
- Various test and code improvements across screen_locker,
  steam_backlog_enforcer, word_frequency, moviepy_showcase
2026-04-10 18:48:37 +02:00
0462565d99 Add VS Code auto-optimizer and selective pytest pre-commit hook
- scripts/optimize_vscode.py: auto-detect hardware (CPU, RAM, GPU, disk)
  and apply optimal VS Code settings and Electron GPU flags
- scripts/pytest_changed_packages.py: pre-commit hook that runs pytest
  only for python_pkg subpackages with changed files
- .pre-commit-config.yaml: use new selective pytest hook
- scripts/check_python_location.sh: allow scripts/ directory
2026-03-25 21:56:37 +01:00
16c6b207e6 Add defense-in-depth binary file protection system
Layer 1: Pre-commit hook (scripts/check_no_binaries.sh) blocks 60+
binary/image extensions with .binary-allowlist for build-essential exceptions.

Layer 2: Comprehensive .gitignore binary patterns with ! overrides
for allowlisted files (app icons).

Layer 3: Agent exclusions - .copilotignore, files.exclude, and
search.exclude all mirror the same patterns to prevent Copilot
from hitting the 20-image URL limit.
2026-03-25 21:09:03 +01:00
72c6c3788c refactor: move Python packages under python_pkg/
- Move puzzle_solver/, poker_modifier_app/, articles/, tests/ into python_pkg/
- Move moviepy_showcase.py and _moviepy_*.py into python_pkg/moviepy_showcase/
- Update all imports to use python_pkg. prefix
- Update pyproject.toml per-file-ignores and pytest testpaths
- Add pre-commit hook to enforce Python files under python_pkg/
2026-03-18 22:54:45 +01:00
253b327b72 fix: bluetooth optimze arch desktop phone foucs mode and no secres 2026-03-02 19:13:22 +01:00
cc8cc53dfb feat: added run sh and makefile scripts 2026-02-22 22:00:50 +01:00