From 55c56ffc3a8e9760104c6407be6b48d97f08ac6e Mon Sep 17 00:00:00 2001 From: Jarek Potiuk Date: Tue, 13 Oct 2026 13:34:43 +0100 Subject: [PATCH] fix(setup): treat method:local as adopted without drift in drift-check The session-start drift check only knew the marketplace and snapshot methods, so the framework checkout's own self-adoption lock (`method: local`) fell through to "Malformed .apache-magpie.lock (unknown or missing method)" on every session, pointing at an upgrade that cannot fix it. A local adoption links the in-tree skills/ source, so there is no snapshot or floor to drift; report it as adopted with no drift, matching setup-preflight's LOCAL_METHOD handling. Generated-by: Claude Code (Opus 5.5) --- plugins/magpie-setup/hooks/drift-check.test.ts | 15 +++++++++++++++ plugins/magpie-setup/hooks/drift-check.ts | 11 ++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/plugins/magpie-setup/hooks/drift-check.test.ts b/plugins/magpie-setup/hooks/drift-check.test.ts index 370074a27..a6aebdaf6 100644 --- a/plugins/magpie-setup/hooks/drift-check.test.ts +++ b/plugins/magpie-setup/hooks/drift-check.test.ts @@ -171,6 +171,21 @@ ref: v1.0.0 assert(result.message?.includes('Local snapshot lockfile missing')); }); + test('returns false drift for local self-adoption method', async () => { + const fs = createTestEnv(); + const exists = async (p: string) => await fs.exists(p); + const read = async (p: string) => await fs.read(p); + const lockContent = `method: local +source: skills/ +`; + fs.set(joinPath(workspaceDir, '.apache-magpie.lock'), lockContent); + + const result = await checkSetupDrift(exists, read, workspaceDir, pluginDir); + assertStrictEqual(result.isAdopted, true); + assertStrictEqual(result.hasDrift, false); + assertStrictEqual(result.message, undefined); + }); + test('resolves plugin version correctly from candidate paths', async () => { const fs = createTestEnv(); const exists = async (p: string) => await fs.exists(p); diff --git a/plugins/magpie-setup/hooks/drift-check.ts b/plugins/magpie-setup/hooks/drift-check.ts index 83bc4649a..e86597407 100644 --- a/plugins/magpie-setup/hooks/drift-check.ts +++ b/plugins/magpie-setup/hooks/drift-check.ts @@ -396,7 +396,16 @@ export async function checkSetupDrift( }; } - // 2. Snapshot methods (git-tag, git-branch, svn-zip) + // 2. Method: local (the framework checkout's self-adoption). Skills link + // the in-tree skills/ source, so there is no snapshot that can drift. + if (method === 'local') { + return { + isAdopted: true, + hasDrift: false, + }; + } + + // 3. Snapshot methods (git-tag, git-branch, svn-zip) if (method === 'git-tag' || method === 'git-branch' || method === 'svn-zip') { const localLockPath = joinPath(workspaceDir, '.apache-magpie.local.lock'); const committedPin = lockData.ref || lockData.commit;