Add thv skill upgrade: re-resolve pinned skills to newer content#5896
Open
samuv wants to merge 2 commits into
Open
Add thv skill upgrade: re-resolve pinned skills to newer content#5896samuv wants to merge 2 commits into
samuv wants to merge 2 commits into
Conversation
samuv
requested review from
ChrisJBurns,
JAORMX,
amirejaz,
aponcedeleonch,
jhrozek,
rdimitrov and
reyortiz3
as code owners
July 21, 2026 15:02
This was referenced Jul 21, 2026
samuv
force-pushed
the
skills-lock/05-upgrade
branch
from
July 21, 2026 15:31
dd81407 to
a7e9269
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## skills-lock/04-sync #5896 +/- ##
======================================================
Coverage ? 71.73%
======================================================
Files ? 709
Lines ? 72653
Branches ? 0
======================================================
Hits ? 52115
Misses ? 16767
Partials ? 3771 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
samuv
force-pushed
the
skills-lock/04-sync
branch
from
July 21, 2026 16:58
9c2d5f5 to
06a66f8
Compare
samuv
force-pushed
the
skills-lock/05-upgrade
branch
from
July 21, 2026 16:58
a7e9269 to
9deff64
Compare
samuv
force-pushed
the
skills-lock/04-sync
branch
from
July 21, 2026 17:08
06a66f8 to
42a03de
Compare
samuv
force-pushed
the
skills-lock/05-upgrade
branch
from
July 21, 2026 17:08
9deff64 to
3e750f4
Compare
samuv
force-pushed
the
skills-lock/04-sync
branch
from
July 21, 2026 17:14
42a03de to
4604083
Compare
samuv
force-pushed
the
skills-lock/05-upgrade
branch
from
July 21, 2026 17:14
3e750f4 to
cf3c890
Compare
samuv
force-pushed
the
skills-lock/05-upgrade
branch
from
July 21, 2026 17:17
cf3c890 to
aecb406
Compare
samuv
force-pushed
the
skills-lock/05-upgrade
branch
from
July 21, 2026 17:34
664f512 to
7aa5c69
Compare
15 tasks
Contributor
Author
|
Tracked in #5899 (RFC THV-0080 stack). |
RFC THV-0080 needs a controlled way to pull newer content for skills pinned by source, without silently drifting the lock file on every install. This adds the full upgrade vertical slice: service logic, HTTP endpoint, client, and CLI command. - Upgrade re-resolves each targeted entry's Source (via the same git/OCI/registry dispatch order Install uses, stopping short of extraction — resolveLatestState) and installs newer content when the digest changed; Source itself is never rewritten - Entries pinned to an immutable reference (an OCI digest or full git commit hash) report not-upgradable — there's nothing newer to resolve to - --preview reports what would change without persisting it; --allow-ref-change permits the resolved reference itself changing; --fail-on-changes gives CI a freshness gate - var _ skills.SkillLockService = (*service)(nil) lands here now that both Sync and Upgrade exist; SkillsRouter widens from the narrow skillSyncer interface (PR4) to the full interface - `thv skill upgrade [name...]` CLI Part of the production stack for #5715 (RFC THV-0080). Stack: 5/6.
Upgrade installed each target in sequence and only checked FailOnChanges after each one returned, so a multi-skill upgrade would install the first changed skill for real before reporting the conflict — a partial mutation a read-only CI gate must never produce. Split into a resolve-only planning pass (also reused to avoid re-resolving Source a second time when applying) and an apply pass that only runs once every target has been checked. Upgrade also now preserves a skill's existing clients instead of expanding to every detected client, matching Sync's behavior.
samuv
force-pushed
the
skills-lock/04-sync
branch
from
July 22, 2026 20:13
d94ef78 to
e4b12ca
Compare
samuv
force-pushed
the
skills-lock/05-upgrade
branch
from
July 22, 2026 20:13
7aa5c69 to
16a5271
Compare
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
upgradevertical slice in one PR, matching PR4's precedent (the CLI command can't exist without its API endpoint).Upgradere-resolves each targeted entry'sSource— via the same git/OCI/registry dispatch orderInstalluses (resolveLatestState), stopping short of extraction/DB/lock writes — and installs newer content only when the digest actually changed.Sourceitself is never rewritten.isImmutableSource, added in PR4'spin.go) reportnot-upgradable: there's nothing newer to resolve to.--previewreports what would change without persisting it (still fetches to compare digests — an OCI pull has no lighter "digest only" primitive, matching the RFC's own "preview is not side-effect-free" note; git sources resolve without touching disk).--allow-ref-changepermits the resolved reference itself changing.--fail-on-changesgives CI a freshness gate.var _ skills.SkillLockService = (*service)(nil)lands here now that bothSync(PR4) andUpgradeexist;SkillsRouterwidens from PR4's narrowskillSyncerinterface to the fullskills.SkillLockService.thv skill upgrade [name...]CLI.Part of the production stack for #5715 (RFC THV-0080). Stack: 5/6 — lockfile → lock-service → install-hooks → sync → upgrade → cli-exitcodes. Based on #5895 (PR4).
Type of change
Test plan
task test)task test-e2e, scoped:ginkgo --label-filter=skills-lock)task lint-fix)Unit tests cover: up-to-date (source unchanged), installs newer content and preserves
Source, preview reports without persisting, not-upgradable for an immutable source, unknown name returns 404,--fail-on-changesstops at the first change. API handler tests including the 501 path and a--fail-on-changes409 propagation. New E2E spec: build+push v1 → install → republish newer content at the same OCI reference →upgrade --previewreports the change without touching the lock file →upgradeapplies it and the lock file records the new digest withSourceunchanged.Does this introduce a user-facing change?
Not yet — same
TOOLHIVE_SKILLS_LOCK_ENABLEDgate as the rest of the stack. Once the full stack lands:thv skill upgradere-resolves and updates a project's pinned skills.Special notes for reviewers
resolveLatestState/resolveOCILatest/resolveGitLatestintentionally duplicate a slice ofInstall's dispatch logic rather than refactoringInstallto expose a resolve-only phase — a deeper split felt like more surgery than this PR should carry; flagging for a second opinion on whether that tradeoff is right.UpgradeResultoutcomes when--fail-on-changestrips (only the error is returned) — a caller doesn't currently see which earlier entries already succeeded before the stop. Noting as a known simplification, not fixed here.🤖 Generated with Claude Code