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;