From 9d058b7d410c3a1111ddfbf642d618d29c19266f Mon Sep 17 00:00:00 2001 From: he Date: Fri, 14 Aug 2026 15:44:03 -0400 Subject: [PATCH] fix: make gen deterministic with LC_ALL=C byte-order sort Plain sort in scripts/gen-docs.sh is locale-dependent: category-less tool keys start with '|', which collates after letters under the CI container's locale (pos-config/pos-tree moved to the end of the tree/dispatch/filetable blocks). The new Gitea Actions gate caught this as a gen-drift failure on a clean checkout. Force LC_ALL=C for byte-order sort and regenerate the doc (config/tree now deterministically sort after the letter categories). --- AGENT_TODO.md | 6 +++++- DOC/AGENT_Context_Project.md | 6 +++--- scripts/gen-docs.sh | 4 ++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/AGENT_TODO.md b/AGENT_TODO.md index 0cc9b53..46bcce8 100644 --- a/AGENT_TODO.md +++ b/AGENT_TODO.md @@ -16,10 +16,14 @@ summary (newest last). ## Next -- Register a Gitea **act_runner** on `gitea.skink-platy.ts.net` (Docker: `gitea/act_runner` with a `ubuntu-latest` label) so `.gitea/workflows/lint.yml` actually runs — until a runner connects, the gate stays queued and local `make lint` remains the only enforcement. +- (None queued.) ## Done +- **2026-08-14** — Gitea Actions gate is now **live and green end-to-end**: act_runner (v0.6.1, labels `ubuntu-latest`) registered on `100.100.1.2` (`~/srv/gitea/runner/`, standalone compose next to the ScaleTail gitea; `CONFIG_FILE=/config.yaml` env required or `run.sh` never reads the config; `--add-host gitea.skink-platy.ts.net:100.111.241.54` so the job container reaches gitea). First real runs **caught a deterministic gen-drift**: plain `sort` in `scripts/gen-docs.sh` is locale-dependent (category-less tool keys start with `|`, which collates after letters under the CI container's locale → `pos-config`/`pos-tree` reordered), so the `git diff --exit-code` step failed. Fixed with `export LC_ALL=C` in gen-docs.sh (byte-order sort) + regenerated `DOC/AGENT_Context_Project.md` (config/tree now sort after the letter categories); `make check` OK, `make lint` 0 FAIL / 0 WARN. Also two intentionally-empty verification commits on main (`e0b5b11` parent tests): `98a767c` (empty trigger). + +- **2026-08-14** — Gitea Actions gate added: `.gitea/workflows/lint.yml` runs `make gen` + `git diff --exit-code` (gen-drift) + `make check` + `make lint` on every push/PR. Verified locally the exact four steps pass (gen idempotent, check OK, lint 0 FAIL / 0 WARN). "no CI" lines updated in AGENTS.md (Quick facts → CI bullet, notes a registered act_runner is required) and DEV.md (stub harnesses note: CI runs static gates only, not behaviour suites). Gitea 1.26.4 confirmed reachable; runner setup still pending (see Next). + - **2026-08-14** — Gitea Actions gate added: `.gitea/workflows/lint.yml` runs `make gen` + `git diff --exit-code` (gen-drift) + `make check` + `make lint` on every push/PR. Verified locally the exact four steps pass (gen idempotent, check OK, lint 0 FAIL / 0 WARN). "no CI" lines updated in AGENTS.md (Quick facts → CI bullet, notes a registered act_runner is required) and DEV.md (stub harnesses note: CI runs static gates only, not behaviour suites). Gitea 1.26.4 confirmed reachable; runner setup still pending (see Next). - **2026-08-14** — Convention-drift maintenance fix session (completed the audit backlog `MAINTENANCE.md`, M-001..M-023, all VERIFIED; gate `scripts/lint-conventions.sh` + `make lint` now 0 FAIL / 0 WARN; `make gen && make check` green). P0 bugs: M-002/003/004 added `docker-compose docker-vbox network-hotspot` to `INTERACTIVE_CMDS` (stdin/log-pipe prompt swallow); M-005 `install.sh --steps` now expands documented `N-M` ranges via `normalize_steps_spec()` (dry-run verified); M-006 feature-vs-docs decision: `--send`/`--markdown` **not restored** (health is a console-only reporter by design since fe7708f; scheduler `NOTIFY=always` covers delivery) — 5 docs corrected instead; M-007 `lib/notify.sh:57` fallback routed to stderr (stdout-leak on standalone source). P1: M-008..M-014 deps guards moved **before** `-h|--help` in docker-health/docker-ps (converted to `command -v X || err`), network-scan, share-usb-server, media-mp3/mp4 (guards before help with a `--dry-run` pre-scan preserving the documented no-deps preview); system-health documented as the sanctioned graceful-degradation no-guard pattern in DEV.md — lint refined accordingly (`first_guard_line` only matches real guards; `first_line` skips comments; precision fixes, not weakenings); M-015 system-firewall gained `usage()`+`-h|--help` (root-gated first; verified via sudo); M-016 `ffmpeg` added to preinstall PACKAGES. P2: M-017/M-018 autostart + usb-automount gained the feature-template preamble (flags.sh load, usage); M-019 `chmod +x apps/media/scrcpy.sh`; M-020 `SCALE_DIR`/`CONFIG_ENV` `:-` seams in pos-docker-compose (verified via overrides; follow-on fix: `DIM` color var missing from common.sh crashed `pos docker compose config` — added it); M-021 `CONFIG_DIR` centralized as the canonical XDG-aware seam in common.sh, per-file duplicates dropped (standalone-sourced notify.sh/config-ui.sh/matrix+telegram tools keep an identical guarded copy — "no shared lib? inline fallbacks"); M-022 `plugin_*` prefix collision resolved by renaming the internal registry helpers to `ent_plugin_*` (the documented plugin-authoring API `plugin_have`/`plugin_require`/`plugin_load_config`/`plugin_http_json` kept for user plugins); M-023 six tools (pos-config, pos-tree, pos-entertainment-{config,enable,disable,status}) now filename-referenced in DOC/POS.md. Hand-maintained AGENT_Context line-count rows bumped (install.sh 223→248, preinstall 75→76, common.sh 144→151, notify.sh 76→87 stale-corrected, autostart 14→50, usb-automount 134→138); `make lint` target wired in the Makefile. `MAINTENANCE.md` kept as the working record (uncommitted by design). diff --git a/DOC/AGENT_Context_Project.md b/DOC/AGENT_Context_Project.md index b4e067b..411ee6d 100644 --- a/DOC/AGENT_Context_Project.md +++ b/DOC/AGENT_Context_Project.md @@ -67,7 +67,6 @@ Linux_post_install/ │ ├── pos-communication-scrcpy # Mirror/control an Android device via scrcpy+adb (mirror, devices, record, tcpip, connect, push, pull, screenshot, info) │ ├── pos-communication-telegram-listener # Telegram bot listener: map /command → bash, run them on chat messages │ ├── pos-communication-telegram-sender # Send Telegram messages/files/links/stickers via Bot API (send, test) -│ ├── pos-config # Interactive editor for the tools' runtime config (reads # POS_CONFIG: registry) │ ├── pos-docker-compose # Docker Compose service manager (ls/up/down/restart/logs/update/config) │ ├── pos-docker-health # One-glance container health dashboard (exits 1 if unhealthy) │ ├── pos-docker-ps # Enhanced container overview (health, IPs, ports, uptime) @@ -94,6 +93,7 @@ Linux_post_install/ │ ├── pos-system-firewall # Interactive UFW management │ ├── pos-system-health # Host health dashboard (disk, RAM, services, backup age, fail2ban, docker); exit 1 if any FAIL │ ├── pos-system-schedule # Scheduled jobs: run a command on a timer; notify on threshold/change/error/always or silently +│ ├── pos-config # Interactive editor for the tools' runtime config (reads # POS_CONFIG: registry) │ ├── pos-tree # Show the pos CLI command tree: categories, commands, and subcommands │ ├── flag-reader # Inspect feature flags (list/status/--raw) @@ -268,7 +268,6 @@ All non-interactive `pos` commands log output to `~/.local/share/linux_post_inst | communication | scrcpy | `pos-communication-scrcpy` | Mirror/control an Android device via scrcpy+adb (mirror, devices, record, tcpip, connect, push, pull, screenshot, info) | | communication | telegram-listener | `pos-communication-telegram-listener` | Telegram bot listener: map /command → bash, run them on chat messages | | communication | telegram-sender | `pos-communication-telegram-sender` | Send Telegram messages/files/links/stickers via Bot API (send, test) | -| | config | `pos-config` | Interactive editor for the tools' runtime config (reads # POS_CONFIG: registry) | | docker | compose | `pos-docker-compose` | Docker Compose service manager (ls/up/down/restart/logs/update/config) | | docker | health | `pos-docker-health` | One-glance container health dashboard (exits 1 if unhealthy) | | docker | ps | `pos-docker-ps` | Enhanced container overview (health, IPs, ports, uptime) | @@ -295,6 +294,7 @@ All non-interactive `pos` commands log output to `~/.local/share/linux_post_inst | system | firewall | `pos-system-firewall` | Interactive UFW management | | system | health | `pos-system-health` | Host health dashboard (disk, RAM, services, backup age, fail2ban, docker); exit 1 if any FAIL | | system | schedule | `pos-system-schedule` | Scheduled jobs: run a command on a timer; notify on threshold/change/error/always or silently | +| | config | `pos-config` | Interactive editor for the tools' runtime config (reads # POS_CONFIG: registry) | | | tree | `pos-tree` | Show the pos CLI command tree: categories, commands, and subcommands | @@ -585,7 +585,6 @@ Use conventional prefixes: `feat:`, `fix:`, `docs:`, `refactor:`, `chore:` | `bin/pos-communication-scrcpy` | 254 | Mirror/control an Android device via scrcpy+adb (mirror, devices, record, tcpip, connect, push, pull, screenshot, info) | | `bin/pos-communication-telegram-listener` | 566 | Telegram bot listener: map /command → bash, run them on chat messages | | `bin/pos-communication-telegram-sender` | 221 | Send Telegram messages/files/links/stickers via Bot API (send, test) | -| `bin/pos-config` | 80 | Interactive editor for the tools' runtime config (reads # POS_CONFIG: registry) | | `bin/pos-docker-compose` | 366 | Docker Compose service manager (ls/up/down/restart/logs/update/config) | | `bin/pos-docker-health` | 107 | One-glance container health dashboard (exits 1 if unhealthy) | | `bin/pos-docker-ps` | 125 | Enhanced container overview (health, IPs, ports, uptime) | @@ -612,6 +611,7 @@ Use conventional prefixes: `feat:`, `fix:`, `docs:`, `refactor:`, `chore:` | `bin/pos-system-firewall` | 308 | Interactive UFW management | | `bin/pos-system-health` | 209 | Host health dashboard (disk, RAM, services, backup age, fail2ban, docker); exit 1 if any FAIL | | `bin/pos-system-schedule` | 81 | Scheduled jobs: run a command on a timer; notify on threshold/change/error/always or silently | +| `bin/pos-config` | 80 | Interactive editor for the tools' runtime config (reads # POS_CONFIG: registry) | | `bin/pos-tree` | 112 | Show the pos CLI command tree: categories, commands, and subcommands | | `completions/pos.bash` | 292 | Dynamic bash completion | diff --git a/scripts/gen-docs.sh b/scripts/gen-docs.sh index 3cda987..e053152 100755 --- a/scripts/gen-docs.sh +++ b/scripts/gen-docs.sh @@ -15,6 +15,10 @@ root="$(cd "$(dirname "$0")/.." && pwd)" mode="write" [ "${1:-}" = "--check" ] && mode="check" +# Deterministic byte-order sorting regardless of host/CI locale (category-less +# tool keys start with "|", which collates differently per-locale). +export LC_ALL=C + ctx="$root/DOC/AGENT_Context_Project.md" comp="$root/completions/pos.bash"