Skip to content

fix(hack): report broken symlinks before exiting#1152

Open
rh-hemartin wants to merge 1 commit into
mainfrom
fix/lint-broken-symlinks-silent-failure
Open

fix(hack): report broken symlinks before exiting#1152
rh-hemartin wants to merge 1 commit into
mainfrom
fix/lint-broken-symlinks-silent-failure

Conversation

@rh-hemartin
Copy link
Copy Markdown
Contributor

@rh-hemartin rh-hemartin commented May 19, 2026

Summary

  • set -e caused silent exit when a tracked path had mode 120000 but wasn't a symlink on disk — readlink aborted before the report block ran
  • Guard loop body with [[ -L ]] so non-symlink tracked paths get an explicit message
  • Tolerate readlink failures with || echo "<unreadable>"
  • Add ERR trap so any unexpected abort still prints line number

Reproducer

# Break a tracked symlink
ln -sfn /nonexistent/target .claude/skills

# Before fix: silent exit 1, no output beyond "INFO: Checking..."
# After fix:
$ hack/lint-broken-symlinks
INFO: Checking for broken symlinks...
========================
Broken symlinks found:
========================
ERROR: .claude/skills -> /nonexistent/target
========================
ERROR: 1 broken symlink(s) found

# Restore
ln -sfn ../skills .claude/skills

Test plan

  • bash hack/lint-broken-symlinks passes on clean repo
  • Manually break a symlink — hook prints path + target before exiting 1

Closes #1106

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 19, 2026

Site preview

Preview: https://9ec0fd59-site.fullsend-ai.workers.dev

Commit: e5a7068e666c3f9eed9be6e90b8bf348e075b85e

@fullsend-ai-review
Copy link
Copy Markdown

fullsend-ai-review Bot commented May 19, 2026

Review

Findings

No findings.

Previous run

Review

Findings

No findings.

@fullsend-ai-review fullsend-ai-review Bot added the ready-for-merge All reviewers approved — ready to merge label May 19, 2026
@rh-hemartin rh-hemartin self-assigned this May 19, 2026
@rh-hemartin rh-hemartin enabled auto-merge May 21, 2026 14:36
@rh-hemartin rh-hemartin disabled auto-merge May 21, 2026 14:49
set -e caused silent exit when a tracked path had mode 120000
but was not a symlink on disk — readlink aborted the script
before the report block ran.

Guard with [[ -L ]] so non-symlink paths get an explicit message,
tolerate readlink failures, and add ERR trap for any other
unexpected abort.

Closes #1106
@rh-hemartin rh-hemartin force-pushed the fix/lint-broken-symlinks-silent-failure branch from 1fed79d to e5a7068 Compare May 21, 2026 14:50
@fullsend-ai-review fullsend-ai-review Bot added ready-for-merge All reviewers approved — ready to merge and removed ready-for-merge All reviewers approved — ready to merge labels May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-merge All reviewers approved — ready to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hack/lint-broken-symlinks silently exits 1 without reporting which symlinks are broken

1 participant