




















@@ -629,6 +629,83 @@ describe("repairMissingConfiguredPluginInstalls", () => {
629629});
630630});
631631632+it.each([
633+[
634+"npm",
635+{
636+source: "npm",
637+spec: "@openclaw/matrix-fork",
638+resolvedName: "@openclaw/matrix-fork",
639+resolvedSpec: "@openclaw/matrix-fork@1.2.3",
640+installPath: "/missing/matrix-fork",
641+},
642+],
643+[
644+"clawhub",
645+{
646+source: "clawhub",
647+spec: "clawhub:@openclaw/matrix-fork@stable",
648+clawhubPackage: "@openclaw/matrix-fork",
649+installPath: "/missing/matrix-fork",
650+},
651+],
652+])(
653+"keeps %s install records whose package names only share a bundled prefix",
654+async (_, record) => {
655+const records = { matrix: record };
656+mocks.loadInstalledPluginIndexInstallRecords.mockResolvedValue(records);
657+mocks.listChannelPluginCatalogEntries.mockReturnValue([
658+{
659+id: "matrix",
660+pluginId: "matrix",
661+origin: "bundled",
662+meta: { label: "Matrix" },
663+install: {
664+npmSpec: "@openclaw/matrix",
665+},
666+},
667+]);
668+mocks.loadPluginMetadataSnapshot.mockReturnValue({
669+plugins: [
670+{
671+id: "matrix",
672+origin: "bundled",
673+packageName: "@openclaw/matrix",
674+channels: ["matrix"],
675+},
676+],
677+diagnostics: [
678+{
679+pluginId: "matrix",
680+message: "manifest without channelConfigs metadata",
681+},
682+],
683+});
684+685+const { repairMissingConfiguredPluginInstalls } =
686+await import("./missing-configured-plugin-install.js");
687+const result = await repairMissingConfiguredPluginInstalls({
688+cfg: {
689+plugins: {
690+entries: {
691+matrix: { enabled: true },
692+},
693+},
694+channels: {
695+matrix: { enabled: true, homeserver: "https://matrix.example.org" },
696+},
697+},
698+env: {},
699+});
700+701+expect(mocks.updateNpmInstalledPlugins).not.toHaveBeenCalled();
702+expect(mocks.installPluginFromClawHub).not.toHaveBeenCalled();
703+expect(mocks.installPluginFromNpmSpec).not.toHaveBeenCalled();
704+expect(mocks.writePersistedInstalledPluginIndexInstallRecords).not.toHaveBeenCalled();
705+expect(result).toEqual({ changes: [], warnings: [] });
706+},
707+);
708+632709it("defers missing external payload repair during the package update doctor pass", async () => {
633710const records = {
634711discord: {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。