Skip to content

repo root: 75 tracked symlinks, most are tab-completion stubs that run a full rebuild when typed #12668

Open

Description

@dezren39

Finding

The repo root tracks 75 symlinks (git ls-files -s mode 120000, no path separator). Many are tab-completion prefix stubs of lib/*.sh helpers, so ./a, ./f, ./r or ./s silently run a host rebuild.

Evidence (HEAD, verified with git cat-file -p HEAD:<name>):

  • a, au, aut, f, fu, ful, r, re, reb, rebu, rebui, rebuil → ./lib/auth-rebuild-full.sh
  • o, of, off, offl, offli, offlin → ./lib/auth-rebuild-offline.sh
  • s, si, sim, simp, simpl → ./lib/auth-rebuild-simple.sh
  • n, nv, nvi, v, vi → lib/nvim.sh

lib/auth-rebuild-full.sh:2 is ./lib/auth.sh ./lib/rebuild-full.sh, so invoking the stub runs the full rebuild path. offl, offli, offlin, rebu, rebui, rebuil, simp, simpl and nvi have zero textual references anywhere in the tree. The real entry points (rebuild, full, offline, simple, nvim) are referenced, for example in comments at nixos/environment/default.nix:18 and :45.

Related but distinct: #12137 (one root scratch symlink with a missing target) and #12136 (stale slice-1 status files).

Why it matters

  • Risk: a mistyped one-letter command at the repo root runs a full NixOS rebuild with no confirmation. The stub names give no signal of what they run.
  • Cost: 75 root entries bury the real layout, and make the root listing noisy for humans and agents.

Suggested fix shape

  1. Confirm with git grep which stub names are used by anyone (scripts, docs, shell history notes).
  2. Delete the stubs with no references. Keep the documented entry points.
  3. Add a guard (or a note in the root README) so new root symlinks need a reason.

Refs #12664

Activity

  1. added
    kind/choreRoutine maintenance, housekeeping, dependency hygiene
    effort/sSmall: expected under 2 hours of work
    on Nov 22, 2026
  2. developing-today commented on Nov 22, 2026

    @developing-today
    Contributor
  3. dezren39 commented on Nov 22, 2026

    @dezren39
    MemberAuthor

    Refs #12664 (suggestions pass, dispatch #21076): this is one of four findings filed from that pass.

  4. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Pickup — xaltha taking #12668.

    Claim-check (live, just now): issue OPEN, no assignees, no claims in comments, no open PR referencing #12668. Shortlist entry consumed via fleet agent shortlist take.

    Plan, following the issue's suggested fix shape:

    1. Enumerate all root symlinks (mode 120000, no path separator) at HEAD and git grep each stub name for real references (scripts, docs, notes).
    2. Delete the stubs with no references; keep the documented entry points (rebuild, full, offline, simple, nvim, and any name with a real reference).
    3. Add the root-README note so new root symlinks need a stated reason (the issue's narrower guard option).

    Branch: xaltha/12668-symlink-rebuilds (pushed empty first, per house rules). Verification will be static + structural (stub targets resolve to the rebuild path before; stub paths gone and entry points intact after) — the stubs will not be executed, since executing one is exactly the hazard the issue files.

  5. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Progress — slice landed as PR #13041 (OPEN, MERGEABLE, 30 files: 28 symlink deletions + README.md + CLAUDE.md). Says Closes #12668.

    Remedy chosen: the issue's fix shape with its narrower guard option — delete unreferenced stubs + root README note, no new guard script.

    Evidence:

    • Reference check: git grep for ./<name> invocations and alias definitions across the tree — all 28 deleted names (a au aut f fu ful r re reb rebu rebui rebuil o of off offl offli offlin si sim simp simpl n nv nvi v vi ss) have zero invocation references; single-letter alias-shaped hits are shell variables, ./a hits are URI docs/test fixtures.
    • Before: root symlinks 75; ./a → ./lib/auth-rebuild-full.sh → ./lib/auth.sh ./lib/rebuild-full.sh (hazard chain confirmed at HEAD, not executed).
    • After: root symlinks 47; all deleted paths absent; every kept entry point resolves to an existing target; post-deletion whole-word grep for the distinctive deleted names finds only the README removal note itself.
    • Exception found by the grep, kept deliberately: ./s is load-bearing — the switch recipe in root.just runs ./s (and the generated just-recipes.json snapshots carry it). Kept alongside the documented entry points (rebuild, rebuild-simple, rebuild-offline, full, offline, simple, nvim, script).
    • Guard: "Root symlinks" section added to README.md (entry points + stated-reason rule); CLAUDE.md example list updated to surviving aliases (it had named n and v).

    Housekeeping note: fleet agent shortlist take pops the top entry rather than a named one, so it consumed #12788's entry instead of this issue's; re-adding #12788 was refused by the tool ("handed out in the last two hours"), so #12788 will resurface via the next refill. This issue's entry was verified in the list before starting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/sSmall: expected under 2 hours of workkind/choreRoutine maintenance, housekeeping, dependency hygienestatus:in-review

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions