Skip to content

Commit 94ff573

Browse files
itcmsgrclaude
andcommitted
chore(v1.100.3b): H-01/H-02/H-03 — strip dev-machine paths from 6 tracked files
Mechanical dev-machine path cleanup. Closes repo hygiene audit findings H-01, H-02, and H-03: hardcoded /home/gituser/... defaults that leaked the maintainer's filesystem layout and broke non-author runs. Changes: - scripts/export_cli_inventory.sh (H-01): repo-relative dev fallback via readlink -f "$0" + ../cli/lib/nftban/cli - scripts/validate_cli_help.sh (H-01): same pattern - cli/lib/nftban/tests/selftest.sh (H-01): same pattern using BASH_SOURCE[0] - cli/lib/nftban/core/nftban_health_checks_config.sh (H-02): drop /home/gituser/github/nftban-dev from auto-heal search list; use /usr/share/nftban/src (canonical install-time source) + ${NFTBAN_DEV_SRC_DIR:-} opt-in for maintainers - cli/lib/nftban/core/nftban_health_checks_services.sh (H-02): same pattern for timer auto-install path - tools/expand-config-schema.sh (H-03): INPUT_SKELETON required via :? (no public default for internal skeleton); OUTPUT_SCHEMA resolved repo-relative from the script's own location Verification gate (locked): git grep -nE "/home/gituser|/home/commonfolder|nftban-v1.0-dev" \ -- ":(exclude).claude/*" Remaining 4 hits are intentionally deferred outside this slice: - 3 × H-04 sites (locked to slice 1c) - 1 × scripts/test_server_cleanup.sh:121 (one-shot dev cleanup script, not in audit H-list) Out of scope (deferred): H-04 / H-05 / H-07 / H-08 / H-09 / H-16 / H-19 — separate Phase A slices. Lifecycle completion lane (PR-25..PR-30) remains explicitly OPEN. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent e168a60 commit 94ff573

7 files changed

Lines changed: 69 additions & 13 deletions

File tree

CHANGELOG.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
1212
---
1313

14+
## [Unreleased] - v1.100.3b Repo hygiene Phase A slice 1b (H-01 / H-02 / H-03)
15+
16+
Mechanical dev-machine path cleanup across 6 files. Closes audit findings **H-01**, **H-02**, and **H-03**: hardcoded `/home/gituser/github/...nftban-v1.0-dev` and `/home/gituser/github/nftban-dev` defaults that leak the maintainer's filesystem layout and break non-author runs.
17+
18+
### Changed
19+
20+
- `scripts/export_cli_inventory.sh:35` (H-01) — replace hardcoded `/home/gituser/...` dev fallback with repo-relative resolution via `readlink -f "$0"` + `../cli/lib/nftban/cli`.
21+
- `scripts/validate_cli_help.sh:32` (H-01) — same pattern.
22+
- `cli/lib/nftban/tests/selftest.sh:1875` (H-01) — same pattern, using `BASH_SOURCE[0]`.
23+
- `cli/lib/nftban/core/nftban_health_checks_config.sh:386` (H-02) — drop `/home/gituser/github/nftban-dev` from the auto-heal completion-source search list. Use `/usr/share/nftban/src` (canonical install-time source location) and add `${NFTBAN_DEV_SRC_DIR:-}` as opt-in env var for maintainers running out of a repo clone.
24+
- `cli/lib/nftban/core/nftban_health_checks_services.sh:520` (H-02) — same pattern for the timer auto-install path.
25+
- `tools/expand-config-schema.sh:22-23` (H-03) — make `INPUT_SKELETON` (positional `$1`) required via `:?` syntax (no public default for the internal skeleton path); resolve `OUTPUT_SCHEMA` (positional `$2`) repo-relative from the script's own location.
26+
27+
### Verification
28+
29+
Locked gate `git grep -nE "/home/gituser|/home/commonfolder|nftban-v1.0-dev" -- ':(exclude).claude/*'` produces only intentionally-deferred hits:
30+
31+
- 3 × H-04 sites (locked to slice 1c): `cli/lib/nftban/lib/nftban_distro_config.sh:296`, `packaging/polkit-1/rules.d/30-nftban-panel.rules:243`, `tests/review/05_feeds_test.sh:28`.
32+
- 1 × `scripts/test_server_cleanup.sh:121` (`/root/nftban-v1.0-dev` in a one-shot dev cleanup script, not in the audit's H-list — handled separately).
33+
34+
### Out of scope (deferred)
35+
36+
- H-04 / H-05 / H-07 / H-08 / H-09 / H-16 / H-19 — separate Phase A slices.
37+
- Larger Phase A items (H-06 / H-11 / H-12 / H-13 / H-14 / H-15 / H-17 / H-18) — separate planning.
38+
39+
Lifecycle completion lane (PR-25..PR-30) remains explicitly **OPEN**.
40+
41+
---
42+
1443
## [Unreleased] - v1.100.3a Repo hygiene Phase A slice 1a (H-10)
1544

1645
Smallest possible doc-only fix from the repo hygiene audit. Closes audit finding **H-10**: broken `[HEADER_SPEC.md]` link in `CONTRIBUTING.md:242` (file does not exist at repo root) and matching dangling reference in `tools/validate-headers.sh`.

cli/lib/nftban/core/nftban_health_checks_config.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,14 @@ nftban_health_check_bash_completion() {
381381
if [[ ! -f "$nftban_completion" ]]; then
382382
# Try to auto-install if auto-heal enabled
383383
if [[ "${NFTBAN_HEALTH_AUTO_HEAL:-false}" == "true" ]]; then
384-
# Try to find source file
384+
# Try to find source file. /usr/share/nftban/src is the
385+
# canonical install-time source location; NFTBAN_DEV_SRC_DIR
386+
# is an opt-in env var for maintainers running out of a
387+
# repo clone.
385388
local completion_src=""
386-
for dir in "/home/gituser/github/nftban-dev" "/usr/src/nftban" "/opt/nftban"; do
389+
local _search_dirs=("/usr/share/nftban/src" "/usr/src/nftban" "/opt/nftban")
390+
[[ -n "${NFTBAN_DEV_SRC_DIR:-}" ]] && _search_dirs=("${NFTBAN_DEV_SRC_DIR}" "${_search_dirs[@]}")
391+
for dir in "${_search_dirs[@]}"; do
387392
if [[ -f "$dir/install/bash-completion/nftban" ]]; then
388393
completion_src="$dir/install/bash-completion/nftban"
389394
break

cli/lib/nftban/core/nftban_health_checks_services.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -515,10 +515,21 @@ nftban_health_check_timers() {
515515
missing=$((missing + 1))
516516
[[ $status -lt $HEALTH_WARNING ]] && status=$HEALTH_WARNING
517517

518-
# Auto-heal: Try to install if from systemd directory
518+
# Auto-heal: Try to install from canonical source location.
519+
# /usr/share/nftban/src is the install-time source dir;
520+
# NFTBAN_DEV_SRC_DIR is an opt-in env var for maintainers
521+
# running out of a repo clone.
519522
if [[ $auto_heal -eq 1 ]]; then
520-
local timer_file="/home/gituser/github/nftban-dev/install/systemd/$timer"
521-
if [[ -f "$timer_file" ]]; then
523+
local timer_file=""
524+
local _src_dirs=("/usr/share/nftban/src")
525+
[[ -n "${NFTBAN_DEV_SRC_DIR:-}" ]] && _src_dirs=("${NFTBAN_DEV_SRC_DIR}" "${_src_dirs[@]}")
526+
for _src in "${_src_dirs[@]}"; do
527+
if [[ -f "$_src/install/systemd/$timer" ]]; then
528+
timer_file="$_src/install/systemd/$timer"
529+
break
530+
fi
531+
done
532+
if [[ -n "$timer_file" ]]; then
522533
echo " 🔧 Auto-heal: Installing $timer..."
523534
if cp "$timer_file" /etc/systemd/system/ 2>/dev/null && systemctl daemon-reload 2>/dev/null; then
524535
timer_issues+=("✓ Installed $timer")

cli/lib/nftban/tests/selftest.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1870,9 +1870,12 @@ run_all_cli_tests() {
18701870

18711871
local cli_dir="${NFTBAN_LIB_DIR:-/usr/lib/nftban}/cli"
18721872

1873-
# Fallback for dev environment
1873+
# Fallback for dev environment: resolve repo-relative cli/lib path
1874+
# from the script's own location so this works on any clone.
18741875
if [[ ! -d "$cli_dir" ]]; then
1875-
cli_dir="/home/gituser/github/nftban-v1.0-dev/cli/lib/nftban/cli"
1876+
local _self_dir
1877+
_self_dir="$(cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" && pwd)"
1878+
cli_dir="${_self_dir}/../cli"
18761879
fi
18771880

18781881
if [[ ! -d "$cli_dir" ]]; then

scripts/export_cli_inventory.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ set -Eeuo pipefail
3030
CLI_DIR="${NFTBAN_LIB_DIR:-/usr/lib/nftban}/cli"
3131
FORMAT="${1:-table}"
3232

33-
# Fallback for development environment
33+
# Fallback for development environment: resolve repo-relative cli/lib path
34+
# from the script's own location so this works on any clone.
3435
if [[ ! -d "$CLI_DIR" ]]; then
35-
CLI_DIR="/home/gituser/github/nftban-v1.0-dev/cli/lib/nftban/cli"
36+
_self_dir="$(cd "$(dirname "$(readlink -f "$0")")" && pwd)"
37+
CLI_DIR="${_self_dir}/../cli/lib/nftban/cli"
3638
fi
3739

3840
if [[ ! -d "$CLI_DIR" ]]; then

scripts/validate_cli_help.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ set -Eeuo pipefail
2727

2828
CLI_DIR="${NFTBAN_LIB_DIR:-/usr/lib/nftban}/cli"
2929

30-
# Fallback for development environment
30+
# Fallback for development environment: resolve repo-relative cli/lib path
31+
# from the script's own location so this works on any clone.
3132
if [[ ! -d "$CLI_DIR" ]]; then
32-
CLI_DIR="/home/gituser/github/nftban-v1.0-dev/cli/lib/nftban/cli"
33+
_self_dir="$(cd "$(dirname "$(readlink -f "$0")")" && pwd)"
34+
CLI_DIR="${_self_dir}/../cli/lib/nftban/cli"
3335
fi
3436

3537
if [[ ! -d "$CLI_DIR" ]]; then

tools/expand-config-schema.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,12 @@
1919

2020
set -Eeuo pipefail
2121

22-
INPUT_SKELETON="${1:-/home/commonfolder/NFTBAN_RECONFIGURATION_JAN_2026/data/registry-skeleton.json}"
23-
OUTPUT_SCHEMA="${2:-/home/gituser/github/nftban/cli/lib/nftban/data/config-schema.json}"
22+
# H-03: skeleton path has no public default — caller must pass it. Output
23+
# defaults to the canonical repo-relative location, resolved from this
24+
# script's own directory so the tool works on any clone.
25+
_self_dir="$(cd "$(dirname "$(readlink -f "$0")")" && pwd)"
26+
INPUT_SKELETON="${1:?usage: $0 <skeleton.json> [output-schema.json]}"
27+
OUTPUT_SCHEMA="${2:-${_self_dir}/../cli/lib/nftban/data/config-schema.json}"
2428

2529
echo "Expanding config schema from: $INPUT_SKELETON"
2630
echo "Output to: $OUTPUT_SCHEMA"

0 commit comments

Comments
 (0)