From 0a14c451d7e2680fb929b5985eaeec6ab9be5849 Mon Sep 17 00:00:00 2001 From: Krzysztof kuhy Rudnicki Date: Sun, 16 Aug 2026 23:13:07 +0200 Subject: [PATCH] Resolve the symlink in lint_python.sh's SCRIPT_DIR The previous commit broke `./lint_python.sh` from the repo root. That path is a symlink into meta/, and `dirname` does not resolve symlinks, so SCRIPT_DIR became the repo root and the new `source "$SCRIPT_DIR/lib/..."` line pointed at a lib/ that does not exist -- an instant exit under set -euo pipefail. The bug was latent before the split: the same unresolved SCRIPT_DIR only fed PROJECT_ROOT, so a root-path run degraded quietly. Adding a source line is what turned a wrong value into a hard failure. It was invisible because every check I ran used `bash meta/lint_python.sh` -- the one entry point that could not fail. Both paths are now verified: `./lint_python.sh` exits 0 through the symlink, and the direct invocation still diffs byte-identical against the pre-split baseline. No CI job, hook or wrapper calls it, so nothing automated was broken in the interim. Recorded in docs/shell-split-verification.md as its own trap, with the commands to enumerate a script's other entry points before splitting it. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_011w2Pj4Ek3ZNMQVYcFHgXDY --- docs/shell-split-verification.md | 27 +++++++++++ .../lint-python-symlink-fix-2026-08-16.json | 45 +++++++++++++++++++ meta/lint_python.sh | 6 ++- 3 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 docs/superpowers/evidence/lint-python-symlink-fix-2026-08-16.json diff --git a/docs/shell-split-verification.md b/docs/shell-split-verification.md index fc2fd151..c5d31541 100644 --- a/docs/shell-split-verification.md +++ b/docs/shell-split-verification.md @@ -114,6 +114,33 @@ Note the knock-on: renaming the nameref local hides the array from shellcheck through a variable (`CODE_FILES_MAP="LANG_CODE_FILES"`) so the reference is real, rather than suppressing. +### Verify through every entry point, especially symlinks + +Adding a `source "$SCRIPT_DIR/lib/..."` line to `meta/lint_python.sh` broke +`./lint_python.sh` from the repo root, because that root path is a **symlink** +into `meta/` (so are `pyproject.toml`, `requirements.txt`, `run.sh`, `.fvmrc`). +`SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"` does not resolve +symlinks — `dirname` is string manipulation — so it became the repo root, where +`lib/` does not exist, and `set -euo pipefail` turned that into an instant exit. + +It was invisible because every check used `bash meta/lint_python.sh`, the one +path that cannot fail. Before splitting a script, ask how else it is reachable: + +```bash +find . -maxdepth 2 -type l -lname '*