Skip to content

fix: _apply_links overwrites related_skills regardless of current value#16

Open
bipinhcs11 wants to merge 1 commit into
mainfrom
fix/apply-links-overwrites-existing-related-skills
Open

fix: _apply_links overwrites related_skills regardless of current value#16
bipinhcs11 wants to merge 1 commit into
mainfrom
fix/apply-links-overwrites-existing-related-skills

Conversation

@bipinhcs11
Copy link
Copy Markdown
Owner

What and why

_apply_links in link.py updates two things in a SKILL.md when cross-domain links are found:

  1. The related_skills: frontmatter field
  2. The ## Related Skills body table

The body table was always rewritten correctly. But the frontmatter was only updated when its current value was a placeholder sentinel — none, PLACEHOLDER, or [PLACEHOLDER]. Any other value (including real skill IDs written by a previous link-ingest run) was silently left stale.

Concrete failure mode

  1. First run: link-ingest sets related_skills: invoice-compare
  2. Code change triggers Phase 2 updater → link-ingest re-runs with a new link to payment-method
  3. Old code: frontmatter still says related_skills: invoice-compare (stale); body table says payment-method (correct) — inconsistent, no error
  4. Fixed code: frontmatter correctly updated to related_skills: payment-method

Changes

File Change
tools/skill_generator/link.py Broadened related_skills: regex from placeholder-only to .*; added if joined: guard so an empty link list doesn't blank the field
tests/test_link.py Added test_existing_real_value_overwritten regression test

All 173 tests pass (172 existing + 1 new).

Follow-ups spotted (not in this PR)

  • _extract_properties_prefixes in crawler.py computes a top variable that is never used (dead code), and the docstring falsely claims it filters by CONFIG_PREFIXES_OF_INTEREST. Separate cleanup PR.
  • CONFIG_PREFIXES_OF_INTEREST constant is defined in crawler.py but never referenced in code — either wire it in or remove it.

Generated by Claude Code

… value

Previously the `related_skills:` frontmatter was only rewritten when its
current value was a placeholder sentinel (`none`, `PLACEHOLDER`, or
`[PLACEHOLDER]`). A second `link-ingest` run — e.g. after the Phase 2
updater triggers a re-link — silently left the frontmatter stale while
still rewriting the body Related Skills table, making frontmatter and body
inconsistent without any error or warning.

Fix: replace the placeholder-only regex with `.*` so any existing value is
overwritten. Guard with `if joined:` so an empty link list doesn't blank
out the field.

Adds `test_existing_real_value_overwritten` to pin the correct behaviour.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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