Repository navigation
fix(install): verify curated skill content against the lockfile integrity - #3512
Merged
Merged
Conversation
…rity Reusing a locked source only checked that each curated skill directory existed, so a skill edited, extended or trimmed in place under .rulesync/skills/.curated/ was treated as up to date by `install` and `install --frozen`, while curated rules were already hashed against the lockfile. Hash every file of each locked skill and compare it with the recorded integrity before reusing the cache, so a modified skill is fetched again at its locked ref and restored, as a rule is. The same check now gates the "fully installed" test for existing sources when adding a source. Closes #3493 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012y9fNo2AAJdGocxvsHtDhv
…integrity check A skill name provided by two sources is installed by the earlier one, so a later source's locked copy no longer matches its integrity. That made the later source refetch on every install and, through cleanPreviousCuratedSkills, delete the earlier source's copy before skipping the name as a duplicate. Only check presence for locked skills an earlier source already took, protect those names from the refetch cleanup, and apply the same rule when checking that existing sources are fully installed. Entries migrated from the legacy lockfile carry an empty integrity and are checked for presence only too. Add regression tests for both cases and an install round-trip test. Refs #3493 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012y9fNo2AAJdGocxvsHtDhv
… can be reused The prefetch awaited every earlier source's skill claim before deciding whether a source's lock entry could be reused, so a source without a reusable entry could no longer list its skills until all earlier sources had listed theirs. Pass the earlier claims as a thunk that is awaited only once the ref, update flag and selection already allow the reuse, and cover the parallel listing with a test. Document the two presence-only cases of the curated skill integrity check. Refs #3493 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012y9fNo2AAJdGocxvsHtDhv
…ozen-skill-integrity
This was referenced Oct 17, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
rulesync install(andinstall --frozen) decided whether a locked source could be reused by checking only that each curated skill directory existed. Curated rules were already hashed against the lockfile integrity, so a rule edited in place was restored, but a skill edited in place under.rulesync/skills/.curated/was silently kept.This PR replaces the presence check with a content check:
checkLockedSkillsAreValidhashes every file of each locked curated skill (hidden files included) withcomputeSkillIntegrityand compares the result with the integrity recorded inrulesync.lock/rulesync-npm.lock.json. An edited, added or removed file makes the cache unusable, so the skill is fetched again at its locked ref and restored to the locked content, as a rule is. Under--frozenthe lockfile is still not written.docs/guide/declarative-sources.mdnow states that skill content is verified too (docs-content regenerated).Not included
The issue also floats failing
--frozenwith a non-zero exit on a mismatch instead of restoring the file. That is a behavior change for rules as well and is left for a separate decision; this PR keeps skills consistent with how rules behave today.Tests
src/lib/sources.test.ts: frozen install re-fetches a skill whose file was edited, added or removed; an existing source with an edited skill is not counted as fully installed. They fail onmain.writeFileContent/readFileContent/listFilePathsRecursivelynow share an in-memory file map, so cached-skill tests seed real content and integrities instead of placeholder hashes.pnpm cicheckpasses locally.Closes #3493
🤖 Generated with Claude Code
https://claude.ai/code/session_012y9fNo2AAJdGocxvsHtDhv