Serialize skill sync and upgrade under the lock - #6352
Conversation
JAORMX
left a comment
There was a problem hiding this comment.
Reviewed the full PR against main. The single-key context marker does not safely model nested dependency locks, and direct Git/OCI installs still release the lock before lock-file/group bookkeeping, so the intended serialization is incomplete and can deadlock. Requesting changes for the two inline blockers.
Update
|
|
Rebased onto current |
4439ba5 to
79a7cdb
Compare
Aug-18 review round addressed
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #6352 +/- ##
==========================================
+ Coverage 73.04% 73.06% +0.01%
==========================================
Files 745 746 +1
Lines 79208 79505 +297
==========================================
+ Hits 57857 58088 +231
- Misses 17300 17337 +37
- Partials 4051 4080 +29 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
79a7cdb to
c776a3d
Compare
Patch coverage improved
Also rebased onto current |
A stale lock/DB snapshot can resurrect uninstalls, and default sync must expand to newly detected clients like install does. Signed-off-by: Samuele Verzi <samu@stacklok.com>
Replace context lock reentrancy with a project-root mutex held through install bookkeeping and dependency materialization. Signed-off-by: Samuele Verzi <samu@stacklok.com>
Fix snapshot file-copy checks and annotate the transactional install helpers that exceed the gocyclo budget. Signed-off-by: Samuele Verzi <samu@stacklok.com>
Replace temp-dir copies with in-memory snapshots and reject escaping relative paths to clear CodeQL path-injection alerts. Signed-off-by: Samuele Verzi <samu@stacklok.com>
Extraction paths snapshot every target through os.Root, remove fresh trees and restore prior content on any failure, surface all compensation errors, and stripe the project transaction locks. Signed-off-by: Samuele Verzi <samu@stacklok.com>
Cover snapshot/restore units, rollback storage and lock-snapshot failures, adopt compensation, group removal, and corrupt-lock sync/upgrade entry points flagged by patch coverage. Signed-off-by: Samuele Verzi <samu@stacklok.com>
c776a3d to
e315a1a
Compare
…ync-upgrade # Conflicts: # pkg/skills/skillsvc/service.go
|
Resolved the merge conflict with The repo dismisses stale approvals on push, so the earlier approval was auto-dismissed; re-requested review. Tests and lint pass on the merged head. |
Summary
The plugin lock-file review found that sync/upgrade can mutate from a stale lock/DB snapshot (resurrecting a concurrent uninstall, or overwriting a newer install) and that default sync never expands to newly detected clients. Skills had the same shapes.
thv skill sync(no--clients) keeps Install’s all-detected default, and--checkis not current unless every detected client is present.Type of change
Test plan
task test) — rango testfor./pkg/skills/skillsvc/(TestSync_,TestUpgrade_,TestInstall)task test-e2e)task lint-fix)Changes
pkg/skills/skillsvc/service.golockSkillpkg/skills/skillsvc/install.go/_git.go/_oci.go/uninstall.golockSkillso sync/upgrade can call them while holding the keypkg/skills/skillsvc/sync.gopkg/skills/skillsvc/upgrade.gopkg/skills/skillsvc/*_test.goDoes this introduce a user-facing change?
Yes.
thv skill syncwithout--clientsnow materializes newly detected skill-supporting clients instead of keeping only the clients recorded on the previous install.thv skill upgradeis unchanged: it still preserves the existing client list.Special notes for reviewers
This is the skills counterpart of the plugin lock-file review on #6316 / #6317. Plugin-only issues (lock-restore callback errors, Materialize-after-extract cleanup) do not apply here: skills uninstall still treats installed-but-unlocked as the safe inconsistency, and skills extract without a post-extract marketplace/settings step.