Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions plugins/magpie-setup/hooks/drift-check.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
11 changes: 10 additions & 1 deletion plugins/magpie-setup/hooks/drift-check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down