Skip to content

fix(scripts): fail reference links the shared sync cannot see - #816

Open
drakulavich wants to merge 5 commits into
addyosmani:mainfrom
drakulavich:ci/shared-references-on-main
Open

drakulavich wants to merge 5 commits into
addyosmani:mainfrom
drakulavich:ci/shared-references-on-main

Conversation

@drakulavich

@drakulavich drakulavich commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #670: closes the link-form gap @federicobartoli named there.

./references/shared/<file>.md in a SKILL.md and shared/<file>.md in a skill's reference file matched neither the sync script nor the validator: no copy was generated and CI stayed green. The validator now fails a relative path into the skill's own references/shared/ in any spelling but the documented one, even when a copy exists, and names the spelling to use.

Why this changed: the first version added a job for the sync check on push to main. That check already runs there in three jobs (run). Of the last 320 push runs on main one failed, and not at a step before the check, so the job would have caught nothing new. It is reverted.

Red (the old validator exits 0 on the same tree):

L218: ./references/shared/orchestration-patterns.md — the sync script does not see this spelling, write `references/shared/orchestration-patterns.md`

Green: all 8 jobs on my fork (run); locally 43 validator tests and 8 sync tests pass.

drakulavich and others added 3 commits November 24, 2026 14:17
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This reverts commit d58cb89.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@drakulavich drakulavich changed the title ci: check shared-reference copies on push to main fix(scripts): fail reference links the shared sync cannot see Nov 24, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@abhisheksharma2411

Copy link
Copy Markdown
Contributor

This reads well — the escape hatch for shared/x.md being a path in someone's own project is the part I expected to be wrong, and the existence check plus the test for docs/shared/... and ~/shared/... covers it. I checked the lookbehind handles the ~/ case for the reason the test implies (the / before shared is in the excluded class), not by accident.

Two things, one of which isn't really about your PR.

The advice can swap one error for another. For a spelling whose target doesn't exist, following the message lands on a different failure:

$ # before
L8: ./references/shared/renamed.md — the sync script does not see this spelling, write `references/shared/renamed.md`
$ # after doing exactly that
L8: references/shared/renamed.md — resolves to skills/demo/references/shared/renamed.md, which does not exist

Your own test case ['SKILL.md', './references/shared/renamed.md', ...] is this situation, so I think it's deliberate — fix the spelling, then the real problem surfaces. It just reads like the message promises the fix. Maybe worth a word in the message when the target is missing, or maybe not worth the complexity. Your call.

Worth sequencing against #822. This is the one I'd actually act on. stripFencedCodeBlocks only recognises a fence indented up to three spaces, so a fenced block under a list item isn't stripped and its contents are scanned as prose. That's latent on main today, but your new check makes it bite: a skill documenting the wrong spelling as a counter-example — which is exactly what a rule like this invites people to write — now fails CI.

Same file, same tree, only the fence rule differing:

with main's fence rule:   L11: ./references/shared/security-checklist.md — the sync script does not see this spelling …
                          1 skills checked — 1 error(s) — FAILED
with #822's fence rule:   1 skills checked — 0 error(s) — PASSED

where the SKILL.md is

- Contributors sometimes write the link like this, which is wrong:

    ```markdown
    See [it](./references/shared/security-checklist.md).
    ```

Nothing to change here — just that these two probably want to land in that order, and I opened #822 before noticing the overlap.

Rewriting the spelling alone only trades the error for "resolves to ...,
which does not exist" when references/<name> is not at the repo root, so the
spelling message now names the missing source in that case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@drakulavich

Copy link
Copy Markdown
Contributor Author

Thanks for checking the lookbehind and the escape hatch.

On the missing target: 5220bf1 adds the missing source to the spelling message, so the renamed.md case now reads:

L3: ./references/shared/renamed.md — the sync script does not see this spelling, write `references/shared/renamed.md`; references/renamed.md does not exist either

When the source exists, the message stays as it was. The renamed.md rows in scripts/validate-reference-links-test.js assert the new text, and the other rows assert the old text ending at the newline, so an unwanted suffix would fail them. Without the change, the two renamed.md tests fail. 43 validator and 8 sync tests pass, and CI is green.

On #822: agreed. With this check in, a wrong spelling quoted in a fence under a list item would fail CI, so #822 should land first.

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