From b2ec8bff0a371f7c04046b39b78d44cac85c7bf3 Mon Sep 17 00:00:00 2001 From: Eduardo Marquez <55303379+DocksDocks@users.noreply.github.com> Date: Tue, 1 Dec 2026 17:08:57 -0300 Subject: [PATCH 1/3] Pin the OpenCode boundary of sync in tests - Sync prunes commands.enableOpencodeUser and commands.enableOpencodeProject at the old kit value false and keeps true with the file unchanged. - A fresh-home sync writes no commands key and no OpenCode key, and its output names no OpenCode setup. Refs #285 Verified: bun x --no-install vitest run --reporter=verbose cli/test/unit/ompRemovals.test.ts cli/test/unit/ompRetiredSync.test.ts --- cli/docs/omp-context.md | 11 +++++++++++ cli/test/unit/ompRemovals.test.ts | 22 ++++++++++++++++++++++ cli/test/unit/ompRetiredSync.test.ts | 25 +++++++++++++++++++++++++ 3 files changed, 58 insertions(+) diff --git a/cli/docs/omp-context.md b/cli/docs/omp-context.md index 109553905..0147926d9 100644 --- a/cli/docs/omp-context.md +++ b/cli/docs/omp-context.md @@ -174,6 +174,17 @@ Sync cannot tell the old kit value from the same value that you set again. It prunes both on every sync. To keep an old kit value, set it in a project configuration or in a `PI_CONFIG_FILES` file, which sync does not write. +The kit writes no OpenCode setting. Sync still prunes +`commands.enableOpencodeProject: false` (the row above) and +`commands.enableOpencodeUser: false`, which the kit dropped in the omp 18.19.0 +cleanup, while they hold that old kit value, also when you set that value +yourself. omp's own defaults then apply. `commands.enableOpencodeProject: +false` turns off the project OpenCode commands, so to keep that opt-out, set +it in a project configuration or a `PI_CONFIG_FILES` file. +`commands.enableOpencodeUser` only adds the user OpenCode commands: `false` +is omp's default, and it does not turn them off when `enabledProviders` opts +OpenCode in. + The `github` tool is off by default. Its `pr_push` operation runs git directly, so the `bash.patterns` guards do not see it. The `issue://` and `pr://` read schemes do not need the tool. omp reads them through its GitHub diff --git a/cli/test/unit/ompRemovals.test.ts b/cli/test/unit/ompRemovals.test.ts index 366818efd..eaa7c4541 100644 --- a/cli/test/unit/ompRemovals.test.ts +++ b/cli/test/unit/ompRemovals.test.ts @@ -169,6 +169,28 @@ describe("retired omp config keys", () => { }); }); + // An older kit wrote both OpenCode command switches as `false`. Sync prunes + // them at that value only; any other value stays, with the rest of the file. + it("prunes both OpenCode command switches at the old kit value false", () => { + const { file, root } = deployConfig( + "commands:\n enableOpencodeUser: false\n enableOpencodeProject: false\nuserOnly: 1\n", + ); + + expect(syncOmpRemovals(testCtx(root), file, false)).toBe(2); + expect(parse(readFileSync(file, "utf8"))).toEqual({ userOnly: 1 }); + }); + + it.each([["enableOpencodeUser"], ["enableOpencodeProject"]])( + "keeps commands.%s: true and leaves the file unchanged", + (key) => { + const text = `commands:\n ${key}: true\nuserOnly: 1\n`; + const { file, root } = deployConfig(text); + + expect(syncOmpRemovals(testCtx(root), file, false)).toBe(0); + expect(readFileSync(file, "utf8")).toBe(text); + }, + ); + // The owner returned these 18 overrides to the omp 19.0.0 defaults. Each one // holds its shipped value here, so sync prunes all 18 in one pass. The user // edited `compaction.thresholdTokens`, which an earlier kit retired at -1 diff --git a/cli/test/unit/ompRetiredSync.test.ts b/cli/test/unit/ompRetiredSync.test.ts index 7c6e17a59..165dc9c5c 100644 --- a/cli/test/unit/ompRetiredSync.test.ts +++ b/cli/test/unit/ompRetiredSync.test.ts @@ -123,3 +123,28 @@ describe("public sync over a config.yml from an earlier kit", () => { SPAWN_TIMEOUT_MS, ); }); + +/** Every key name of a parsed YAML value, nested keys included. */ +function keyNames(node: unknown): Array { + if (typeof node !== "object" || node === null) return []; + return Object.entries(node).flatMap(([key, value]) => [key, ...keyNames(value)]); +} + +describe("public sync of a fresh home", () => { + it( + "writes no OpenCode setting and names no OpenCode setup", + () => { + const nativeHost = { nativeHost: true } as const; + const run = runPublicCli(["sync"], "home-fresh", makeStubDir({}, nativeHost), nativeHost); + + expect(run.exitCode, run.stderr).toBe(0); + const config: unknown = parse( + readFileSync(join(run.home, ".omp", "agent", "config.yml"), "utf8"), + ); + expect(valueAt(config, "commands")).toBeUndefined(); + expect(keyNames(config).filter((key) => /opencode/i.test(key))).toEqual([]); + expect(`${run.stdout}${run.stderr}`).not.toMatch(/opencode/i); + }, + SPAWN_TIMEOUT_MS, + ); +}); From f6438698cc230f37702628a8153fbd18e6aa52ed Mon Sep 17 00:00:00 2001 From: Eduardo Marquez <55303379+DocksDocks@users.noreply.github.com> Date: Tue, 1 Dec 2026 17:17:01 -0300 Subject: [PATCH 2/3] Fix round 1 review findings on the OpenCode boundary - The fresh-home test also checks a shipped setting and that enabledProviders opts in no OpenCode, `*`, or `all`. - omp-context: after the prune, omp uses another settings layer, or else its default. Refs #285 Verified: bun x --no-install vitest run cli/test/unit/ompRetiredSync.test.ts cli/test/unit/ompRemovals.test.ts; bun run check:types; bun run lint --- cli/docs/omp-context.md | 8 +++++--- cli/test/unit/ompRetiredSync.test.ts | 6 ++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/cli/docs/omp-context.md b/cli/docs/omp-context.md index 0147926d9..40f7a13ac 100644 --- a/cli/docs/omp-context.md +++ b/cli/docs/omp-context.md @@ -178,9 +178,11 @@ The kit writes no OpenCode setting. Sync still prunes `commands.enableOpencodeProject: false` (the row above) and `commands.enableOpencodeUser: false`, which the kit dropped in the omp 18.19.0 cleanup, while they hold that old kit value, also when you set that value -yourself. omp's own defaults then apply. `commands.enableOpencodeProject: -false` turns off the project OpenCode commands, so to keep that opt-out, set -it in a project configuration or a `PI_CONFIG_FILES` file. +yourself. omp then uses the value of another settings layer, such as a +project configuration or a `PI_CONFIG_FILES` file, or else its own default. +`commands.enableOpencodeProject: false` turns off the project OpenCode +commands, so to keep that opt-out, set it in a project configuration or a +`PI_CONFIG_FILES` file. `commands.enableOpencodeUser` only adds the user OpenCode commands: `false` is omp's default, and it does not turn them off when `enabledProviders` opts OpenCode in. diff --git a/cli/test/unit/ompRetiredSync.test.ts b/cli/test/unit/ompRetiredSync.test.ts index 165dc9c5c..3df9cc2ea 100644 --- a/cli/test/unit/ompRetiredSync.test.ts +++ b/cli/test/unit/ompRetiredSync.test.ts @@ -141,8 +141,14 @@ describe("public sync of a fresh home", () => { const config: unknown = parse( readFileSync(join(run.home, ".omp", "agent", "config.yml"), "utf8"), ); + // A shipped setting first, so an empty or scalar file cannot pass. + expect(valueAt(config, "astGrep.enabled")).toBe(true); expect(valueAt(config, "commands")).toBeUndefined(); expect(keyNames(config).filter((key) => /opencode/i.test(key))).toEqual([]); + // A provider opt-in would import the user OpenCode commands. + const providers = valueAt(config, "enabledProviders"); + const optIns = Array.isArray(providers) ? providers.map(String) : []; + expect(optIns.filter((name) => ["opencode", "*", "all"].includes(name))).toEqual([]); expect(`${run.stdout}${run.stderr}`).not.toMatch(/opencode/i); }, SPAWN_TIMEOUT_MS, From 20b4d7a7ee5bed0a1ec85535a29d23bd817f721b Mon Sep 17 00:00:00 2001 From: Eduardo Marquez <55303379+DocksDocks@users.noreply.github.com> Date: Tue, 1 Dec 2026 17:19:09 -0300 Subject: [PATCH 3/3] Assert that a fresh-home sync ships no enabledProviders - A bare or path-scoped provider opt-in would import user OpenCode commands; the kit ships none, so the deployed config.yml must hold no key for it. Refs #285 Verified: bun x --no-install vitest run cli/test/unit/ompRetiredSync.test.ts; bun run lint --- cli/test/unit/ompRetiredSync.test.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cli/test/unit/ompRetiredSync.test.ts b/cli/test/unit/ompRetiredSync.test.ts index 3df9cc2ea..239b48501 100644 --- a/cli/test/unit/ompRetiredSync.test.ts +++ b/cli/test/unit/ompRetiredSync.test.ts @@ -145,10 +145,9 @@ describe("public sync of a fresh home", () => { expect(valueAt(config, "astGrep.enabled")).toBe(true); expect(valueAt(config, "commands")).toBeUndefined(); expect(keyNames(config).filter((key) => /opencode/i.test(key))).toEqual([]); - // A provider opt-in would import the user OpenCode commands. - const providers = valueAt(config, "enabledProviders"); - const optIns = Array.isArray(providers) ? providers.map(String) : []; - expect(optIns.filter((name) => ["opencode", "*", "all"].includes(name))).toEqual([]); + // A provider opt-in, bare or path-scoped, would import the user OpenCode + // commands. The kit ships no `enabledProviders`, so none may appear. + expect(valueAt(config, "enabledProviders")).toBeUndefined(); expect(`${run.stdout}${run.stderr}`).not.toMatch(/opencode/i); }, SPAWN_TIMEOUT_MS,