Files
msd-core/tests/bug-492-effort-manifest-fallback.test.cjs
Tom Boucher ba231ecbfc chore: clean up clear-cut ESLint warnings (#732) (#734)
Pay down pre-existing error→warn lint debt. Removes dead imports/vars, unused functions, redundant regex/string escapes, and stale eslint-disable directives; converts unused `catch (_e)` to optional catch binding (src/*.cts).

No behavior change. Lint 345→125 warnings (0 errors); deferred categories (n/no-process-exit, test-sleeps, control-regex) tracked in #732 for follow-up. Full test suite green (0 failures); code-review verified all removals unused and all escape fixes semantics-preserving.

Closes #732

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-06 11:24:48 -04:00

50 lines
2.0 KiB
JavaScript

'use strict';
process.env.GSD_TEST_MODE = "1";
const { describe, test, beforeEach, afterEach } = require("node:test");
const assert = require("node:assert/strict");
const { createTempProject, cleanup } = require("./helpers.cjs");
const { resolveEffortInternal } = require("../gsd-core/bin/lib/core.cjs");
const { CONFIG_DEFAULTS: CANONICAL_CONFIG_DEFAULTS } = require("../gsd-core/bin/lib/configuration.cjs");
describe("#492 manifest effort fallback", () => {
let tmpDir;
beforeEach(() => { tmpDir = createTempProject(); });
afterEach(() => { cleanup(tmpDir); });
test("routing_tier_defaults manifest fallback still works", () => {
assert.strictEqual(resolveEffortInternal(tmpDir, "gsd-planner"), "xhigh");
});
test("manifest effort.agent_overrides wins over routing_tier_defaults when no project config", () => {
const original = CANONICAL_CONFIG_DEFAULTS.effort.agent_overrides;
try {
CANONICAL_CONFIG_DEFAULTS.effort.agent_overrides = { "gsd-planner": "max" };
assert.strictEqual(resolveEffortInternal(tmpDir, "gsd-planner"), "max");
} finally {
CANONICAL_CONFIG_DEFAULTS.effort.agent_overrides = original;
}
});
test("manifest effort.default consulted for unknown agent with no project config", () => {
const original = CANONICAL_CONFIG_DEFAULTS.effort.default;
try {
CANONICAL_CONFIG_DEFAULTS.effort.default = "max";
assert.strictEqual(resolveEffortInternal(tmpDir, "fictional-agent-xyz-492"), "max");
} finally {
CANONICAL_CONFIG_DEFAULTS.effort.default = original;
}
});
test("manifest agent_overrides takes precedence over manifest routing_tier_defaults", () => {
const originalAgentOverrides = CANONICAL_CONFIG_DEFAULTS.effort.agent_overrides;
try {
CANONICAL_CONFIG_DEFAULTS.effort.agent_overrides = { "gsd-planner": "minimal" };
assert.strictEqual(resolveEffortInternal(tmpDir, "gsd-planner"), "minimal");
} finally {
CANONICAL_CONFIG_DEFAULTS.effort.agent_overrides = originalAgentOverrides;
}
});
});