Files
OmniRoute/tests/unit/codex-config-hooks-migration.test.ts
Diego Rodrigues de Sa e Souza d0396c200d Release v3.8.31 (#4377)
Release v3.8.31 — see CHANGELOG.md [3.8.31] for full notes and contributors.

Merged over known non-blocking reds (all correctness gates green): Integration Tests (2/2) is env/flaky (polls a real upstream batch that did not complete in the poll window); SonarQube/SonarCloud is the advisory server-side new-code quality gate. Unit (8 shards), Coverage, Node 22/24/26, Lint, PR Test Policy, Quality Ratchet, Docs-Strict, Quality-Extended and all 4 CodeQL analyses are green.
2026-06-20 14:55:24 -03:00

33 lines
1.5 KiB
TypeScript

import test from "node:test";
import assert from "node:assert/strict";
// Regression for port-from-9router#1327: Codex deprecated the `[features].codex_hooks`
// flag in favor of `[features].hooks`. The codex-settings generator parses an existing
// config.toml and writes it back but never migrated the deprecated key, so users with an
// old config kept a key recent Codex CLI versions ignore.
const { migrateCodexFeatureFlags } = await import("../../src/shared/utils/codexConfig.ts");
test("#1327: renames deprecated [features].codex_hooks to [features].hooks", () => {
const parsed = { _root: {}, _sections: { features: { codex_hooks: true } } };
migrateCodexFeatureFlags(parsed);
assert.deepEqual(parsed._sections.features, { hooks: true });
});
test("#1327: keeps an existing hooks value and removes the deprecated key", () => {
const parsed = { _root: {}, _sections: { features: { codex_hooks: true, hooks: false } } };
migrateCodexFeatureFlags(parsed);
assert.deepEqual(parsed._sections.features, { hooks: false });
});
test("#1327: leaves a config that already uses hooks untouched", () => {
const parsed = { _root: {}, _sections: { features: { hooks: true } } };
migrateCodexFeatureFlags(parsed);
assert.deepEqual(parsed._sections.features, { hooks: true });
});
test("#1327: no-op when there is no [features] section", () => {
const parsed = { _root: { model: "x" }, _sections: {} };
migrateCodexFeatureFlags(parsed);
assert.deepEqual(parsed._sections, {});
});