Skip to content

refactor(repo): move the dev-install symlinking into its own guarded script - #138

Merged
azlekov merged 1 commit into
developfrom
refactor/narrow-d-0004-guard
Sep 2, 2026
Merged

refactor(repo): move the dev-install symlinking into its own guarded script#138
azlekov merged 1 commit into
developfrom
refactor/narrow-d-0004-guard

Conversation

@azlekov

@azlekov azlekov commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

D-0004 guarded the whole justfile. It is the only guard in the repo pointing at a multi-purpose file — every other one names a Rust module, a workflow, or a single-purpose install script:

D-0004  cli/dira/src/update/replace.rs
D-0004  install.sh
D-0004  install.ps1
D-0004  justfile          ← ~6 of 190 lines are actually D-0004's business

So it fired on every unrelated recipe. It tripped while editing pricing-sync, which fetches model prices from models.dev and has nothing to do with installs.

Why this is more than noise

The guard wall requires a decision trailer on any commit touching a guarded path — I confirmed a justfile-only edit with no trailer is blocked locally and in CI:

$ printf 'justfile\n' | zavet gate --paths-from - --message "chore(repo): tweak a recipe" --guards-only
Staged changes touch paths guarded by: D-0004. Reference the decision in the commit message with a trailer...
exit=1

So unrelated justfile edits had to cite D-0004 in their commit message, polluting git log --grep D-0004 and training readers to skim past a guard that is usually irrelevant.

Why the guard is not simply dropped

The protection is real. Nothing else in the repo would notice just link changing from ln -sf to cp — and that change would leave a dev install indistinguishable from a managed one, silently defeating every refusal D-0004 describes (discover_install reads the PATH entry with symlink_metadata precisely because current_exe() resolves symlinks away).

So the symlinking moves into dev-install.sh and the guard follows it there. Every path D-0004 now names is install-path logic end to end, and the invariant is documented at the edit site rather than three files away.

Two things that fall out of it

  • Lint coverage. The dev-install symlinking is install-path logic that had been escaping the shellcheck/shfmt standard this repo already applies to install.sh, purely by hiding in a justfile. The shell-lint job now covers both. (The job's name changes; develop has no branch protection, so no required-check breakage.)
  • A missing-build check. The inline recipe would happily ln -sf a binary that had not been built, leaving a dangling symlink on PATH. The script fails with a message pointing at just release.

Verification

just ci passes. shellcheck -s sh and shfmt -d -s -ln posix -i 2 clean on both scripts.

Guard matching flipped as intended:

zavet match justfile        → (nothing)
zavet match dev-install.sh  → D-0004
zavet match install.sh      → D-0003 D-0004 D-0007 D-0014 DIRASH-0029

just link produces byte-identical symlinks — tested against a scratch bin dir (never ~/.local/bin), along with idempotent re-runs, the missing-build path, and missing arguments.

🤖 Generated with Claude Code

…script

D-0004 guarded the whole `justfile`, which is the only guard in the repo
pointing at a multi-purpose file — every other one names a Rust module, a
workflow, or a single-purpose install script. About six of the justfile's
190 lines are D-0004's business, so the guard fired on every unrelated
recipe: it tripped while editing `pricing-sync`, which fetches model prices
and has nothing to do with installs.

That is not just noise. The guard wall also requires a decision trailer on
any commit touching a guarded path, so unrelated justfile edits had to cite
D-0004 in their commit message — polluting `git log --grep` and training
readers to skim past a guard that is usually irrelevant.

The protection was real, though, and is kept intact rather than dropped:
nothing else in the repo would notice `just link` changing from `ln -sf` to
`cp`, which would leave a dev install indistinguishable from a managed one
and silently defeat every refusal D-0004 describes. So the symlinking moves
to `dev-install.sh` and the guard follows it there. Every path D-0004 now
names is install-path logic end to end.

Extracting it also brings that logic under the shellcheck/shfmt standard the
repo already applies to install.sh — it had been escaping it only by hiding
in a justfile — and the script gains a missing-build check the inline recipe
never had, where `ln -sf` would happily create a dangling symlink.

`just link` produces byte-identical symlinks; verified against a scratch bin
dir, along with idempotent re-runs and both failure paths.

Why: a guard that fires on edits it does not govern teaches readers to ignore it.
Rejected: dropping `justfile` from the guards outright — the `ln -sf` to `cp`
regression would then go unguarded, which is the one thing D-0004 must catch.
Refs: D-0004
Refs: D-0012

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Asen Lekov <asenlekoff@gmail.com>
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Knowledge layer

Check Result
Decision checks passed
Guard trailers passed

Spec currency is reported in the job summary and never fails a build, the same severity the local pre-commit hook uses.

@azlekov
azlekov merged commit 7007a5b into develop Sep 2, 2026
8 checks passed
@azlekov
azlekov deleted the refactor/narrow-d-0004-guard branch September 2, 2026 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant