Skip to content

fix(install): name the symlink target when writing CLAUDE.md (#3805) - #3950

Closed
bercedev wants to merge 1 commit into
Graphify-Labs:v8from
bercedev:fix/claude-md-symlink-target
Closed

bercedev wants to merge 1 commit into
Graphify-Labs:v8from
bercedev:fix/claude-md-symlink-target

Conversation

@bercedev

Copy link
Copy Markdown
Contributor

What does this PR do?

Refs #3805 (ask 1 only).

When ~/.claude/CLAUDE.md is a symlink, install writes the registration block into the file the link points to, but the output only named the link:

  CLAUDE.md        ->  skill registered in ~/.claude/CLAUDE.md

So a rules file somewhere else got changed and nothing in the output said so. This adds a small _shown_path helper that prints link -> target when the path is a symlink, and uses it in the three places that report a write to that file: skill registered in, created at, and the project-scoped registration removed from. Paths that aren't symlinks print the same as before.

The issue's repro, after the fix:

$ mkdir -p /tmp/t/.claude && printf '# my rules\n' > /tmp/t/rules.md
$ ln -s /tmp/t/rules.md /tmp/t/.claude/CLAUDE.md
$ HOME=/tmp/t graphify install --platform claude | grep CLAUDE.md
  CLAUDE.md        ->  skill registered in /tmp/t/.claude/CLAUDE.md -> /tmp/t/rules.md

The link itself is left alone, and the block still goes into rules.md exactly as before. The only change is in what gets printed.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Tests or CI
  • Refactor
  • Security fix

Verification & Invariants

Invariant: when install or uninstall edits a file through a symlink, the output names the file that was actually changed. Where the block is written, what it contains, and the link are all unchanged.

  • Read the CONTRIBUTING.md guide.
  • Reproduced the issue and identified the invariant.
  • Made the smallest fix necessary.
  • Added a regression test (if bug fix) or isolated boundary test.
  • Kept the PR description synchronized with the final implementation.
  • Documented any limitations / unsupported cases explicitly.

Limitations:

  • This covers ask 1 of the issue only. Ask 2 (a --no-claude-md / --skill-only opt-out) and ask 3 (whether the block is still needed for --platform claude) add a CLI flag or change a default, so I left them for you to decide. I'm happy to follow up on either one.
  • When removal empties the file, it still unlinks the path it was given (the link, not the target), same as before. I didn't change that behaviour.

How was this tested?

# new tests against the unchanged v8 install.py
.venv/bin/python -m pytest -q tests/test_install.py -k symlink_target
3 failed

# with the fix
.venv/bin/python -m pytest -q tests/test_install.py
111 passed

.venv/bin/python -m pytest -q
6164 passed, 14 skipped

The new tests cover a symlink to an existing file, a symlink whose target doesn't exist yet (so created at), and the project-scoped removal. The symlink tests are skipped on Windows, because creating symlinks there needs admin rights.

I also ran the repro above with a fake HOME, before and after the change. Before, the output named only the link. After, it names both the link and rules.md.

Graphify-specific checklist

  • I updated generated skill artifacts (uv run python -m tools.skillgen --bless) when changing their source fragments.
  • I confirmed that AST/structural extraction remains deterministic (no ambient state dependencies like ENV variables).
  • I reviewed changes for security implications (no unsafe interpolation into shell/Python).
  • I confirmed no API keys or local-only graph data are included.
  • (If applicable) I disclosed AI authorship in my commit messages.

Note: I used Claude Code while working on this fix. I reviewed and ran all of it myself.

…y-Labs#3805)

When ~/.claude/CLAUDE.md is a symlink, the registration block is written
into the file it points to, but install only printed the link path, so a
rules file elsewhere changed without any mention. Print `link -> target`
for symlinks on install and on the project-scoped removal path.
@github-actions

Copy link
Copy Markdown

Thanks for the pull request, @bercedev. A maintainer will review it soon.

Want to talk it through while it is in review? Come join us on our Discord server. For longer-form discussion there is also GitHub Discussions.

A couple of things that speed up review: make sure the test suite passes on Python 3.10 and 3.13, and that the change keeps extraction deterministic.

@graphify-labs graphify-labs Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Graphify reviewed this change.

Worth a look — the grounded gate found no coupling regressions or blocking issues, but 1 advisory finding(s) below merit a look before merge.

Formal verification. 2 change(s) tested, no difference found (not proven).


Graphify review — findings

When CLAUDE.md (or another always-on registration target) is a symlink, install and uninstall output now names both the link and the file it resolves to (link -> target). Writes go through to the target, and printing only the link hid which file actually changed. _shown_path handles this, falling back to the plain path for regular files, so non-symlink output is unchanged.

Worth a look

  • Symlink-only CLAUDE.md uninstall leaves registration in target — graphify/install.py:425 · Escalate · medium
    • agreed by 2 of 2 members but NOT verified (no proof, no reproducing execution) — consensus is not a verdict; needs human review
Analysis details — impact, health, verification

Impact & health

Graphify review

Impact — 594 functions depend on the 325 functions this change touches.

Health — this change adds coupling hotspots:

  • new: main() — 98 callers, 3 callees
  • new: dispatch_command() — 2 callers, 126 callees
  • new: install() — 14 callers, 11 callees
  • new: _copy_skill_file() — 15 callers, 7 callees
  • new: codebuddy_install() — 20 callers, 5 callees
  • new: _refresh_stale_skills() — 25 callers, 4 callees
  • new: gemini_install() — 11 callers, 7 callees
  • new: claude_install() — 19 callers, 4 callees
  • …and 20 more — each is listed as a finding

Verification — 594 functions in the blast radius were not formally verified this run (proofs are advisory here).

Gate & verification

graphify gate

PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.

Advisory (not blocking):

  • verification_scope: 513 function(s) in the blast radius were not formally verified this run

Test selection

Test selection

32 of 308 test file(s) selected (10%) via static blast radius.

  • tests/test_affected_cli.py — impact
  • tests/test_agents_platform.py — impact
  • tests/test_atomic_version_stamp.py — impact
  • tests/test_claude_md.py — impact
  • tests/test_codebuddy.py — impact
  • tests/test_devin.py — impact
  • tests/test_explain_cli.py — impact
  • tests/test_extract_cli.py — impact
  • tests/test_gemini_hook.py — impact
  • tests/test_global_add_tag_inference.py — impact
  • tests/test_god_nodes_cli.py — impact
  • tests/test_hollow_chunks_arm_shrink_guard.py — impact
  • tests/test_home_sandbox.py — impact
  • tests/test_hook_strict.py — impact
  • tests/test_incomplete_build_guard.py — impact
  • tests/test_install.py — impact, changed-test
  • tests/test_install_references.py — impact
  • tests/test_install_strings.py — impact
  • tests/test_install_version_warning.py — impact
  • tests/test_merge_chunks_validation.py — impact
  • tests/test_multigraph_diagnostics.py — impact
  • tests/test_no_dedup_flag.py — impact
  • tests/test_path_cli.py — impact
  • tests/test_query_cli.py — impact
  • tests/test_query_induced_edges.py — impact
  • tests/test_read_hook.py — impact
  • tests/test_replace_or_append_section.py — impact
  • tests/test_search_hook.py — impact
  • tests/test_skill_auto_refresh.py — impact
  • tests/test_skill_version_warning.py — impact
  • tests/test_uninstall_scope.py — impact
  • tests/test_unverified_semantic_shrink.py — impact

Selection is safe under the controlled-regression assumption; always-run tests + a periodic full run are the backstops. Advisory — it never changes the check verdict.

Formal verification

No difference found (not proven): No behavior difference found in \_register\_always\_on\_block (not a proof).

The verifier ran both versions of \_register\_always\_on\_block on many inputs and saw identical behavior every time. Strong evidence the change is safe, but evidence, not a proof.

Guarantee: Empirical: differential testing (both versions run on many generated inputs). A divergence on an untested input remains possible, so this is 'no counterexample found', not 'proven equivalent'.

Note: An input the sampler did not try could still differ.

No difference found (not proven): No behavior difference found in \_remove\_claude\_skill\_registration (not a proof).

The verifier ran both versions of \_remove\_claude\_skill\_registration on many inputs and saw identical behavior every time. Strong evidence the change is safe, but evidence, not a proof.

Guarantee: Empirical: differential testing (both versions run on many generated inputs). A divergence on an untested input remains possible, so this is 'no counterexample found', not 'proven equivalent'.

Note: An input the sampler did not try could still differ.

· 28 more finding(s) on lines outside this diff (see the check run).

safishamsi added a commit that referenced this pull request Sep 30, 2026
Solidity free functions (#3906), VB.NET qualified calls (#3909), Astro
frontmatter-only AST pass (#3902), surprise bonus/reason alignment (#3934),
exclude-hubs stranded-neighbour (#3933), graph-DB push index (#3957),
label retry keep-named (#3956), stale-hook status (#3951), virtual-workspace
Cargo.toml skip (#3930), and symlinked-instructions install/uninstall
handling (#3950/#3953).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@safishamsi

Copy link
Copy Markdown
Member

Shipped in v0.9.73 (now on PyPI) via an authorship-preserving cherry-pick, so your commit keeps contributor-graph credit. Thanks @bercedev!

Release: https://github.com/Graphify-Labs/graphify/releases/tag/v0.9.73

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.

2 participants