From c029cb3358a974a916228ec683dc1c8864d7f211 Mon Sep 17 00:00:00 2001 From: shin-core <153108882+shin-core@users.noreply.github.com> Date: Mon, 27 Jul 2026 00:33:27 +0900 Subject: [PATCH] fix(engine): remove the dead AMS_POLICY_SPEC_FILENAMES discovery constant AMS_POLICY_SPEC_FILENAMES claimed a documented 4-path first-match-wins discovery order "mirroring MINER_GOAL_SPEC_FILENAMES", but the real consumer resolves AMS policy from a single operator-config-dir filename and never imported the constant -- so it was dead (referenced only by its own declaration, the barrel export, and tests asserting the literal array) and its comment misdescribed the actual behavior. AMS policy is deliberately operator-local, not repo-discovered, so the misleading constant is removed rather than wiring a discovery chain that the resolver is not meant to have. Delete the constant and its doc comment, drop the barrel export, and remove the two barrel tests' assertions of it. No other code referenced it. Closes #8863 --- packages/loopover-engine/src/ams-policy-spec.ts | 3 --- packages/loopover-engine/src/index.ts | 1 - .../loopover-engine/test/ams-policy-spec-parser.test.ts | 7 ------- test/unit/ams-policy-spec-parser.test.ts | 7 ------- 4 files changed, 18 deletions(-) diff --git a/packages/loopover-engine/src/ams-policy-spec.ts b/packages/loopover-engine/src/ams-policy-spec.ts index f437c28565..abdc7899a8 100644 --- a/packages/loopover-engine/src/ams-policy-spec.ts +++ b/packages/loopover-engine/src/ams-policy-spec.ts @@ -407,6 +407,3 @@ export function parseAmsPolicySpecContent(content: string | null | undefined): P } return parseAmsPolicySpec(parsed); } - -/** The documented `.loopover-ams` file-discovery order (first match wins), mirroring `MINER_GOAL_SPEC_FILENAMES`. */ -export const AMS_POLICY_SPEC_FILENAMES = [".loopover-ams.yml", ".github/loopover-ams.yml", ".loopover-ams.json", ".github/loopover-ams.json"] as const; diff --git a/packages/loopover-engine/src/index.ts b/packages/loopover-engine/src/index.ts index 29272ae686..86fb9fcf78 100644 --- a/packages/loopover-engine/src/index.ts +++ b/packages/loopover-engine/src/index.ts @@ -559,7 +559,6 @@ export { DEFAULT_AMS_POLICY_SPEC, parseAmsPolicySpec, parseAmsPolicySpecContent, - AMS_POLICY_SPEC_FILENAMES, AMS_NETWORK_ALLOWLIST_ECOSYSTEMS, type AmsCapLimits, type AmsNetworkAllowlist, diff --git a/packages/loopover-engine/test/ams-policy-spec-parser.test.ts b/packages/loopover-engine/test/ams-policy-spec-parser.test.ts index 4de08f1c98..91ae7a286d 100644 --- a/packages/loopover-engine/test/ams-policy-spec-parser.test.ts +++ b/packages/loopover-engine/test/ams-policy-spec-parser.test.ts @@ -1,7 +1,6 @@ import { test } from "node:test"; import assert from "node:assert/strict"; import { - AMS_POLICY_SPEC_FILENAMES, DEFAULT_AMS_POLICY_SPEC, parseAmsPolicySpec, parseAmsPolicySpecContent, @@ -10,12 +9,6 @@ import { test("barrel: the public entrypoint re-exports the AmsPolicySpec parser API", () => { assert.equal(typeof parseAmsPolicySpec, "function"); assert.equal(typeof parseAmsPolicySpecContent, "function"); - assert.deepEqual(AMS_POLICY_SPEC_FILENAMES, [ - ".loopover-ams.yml", - ".github/loopover-ams.yml", - ".loopover-ams.json", - ".github/loopover-ams.json", - ]); }); test("parseAmsPolicySpec: missing raw input returns an absent safe-default spec with no warnings", () => { diff --git a/test/unit/ams-policy-spec-parser.test.ts b/test/unit/ams-policy-spec-parser.test.ts index cda09b041b..ecc909e080 100644 --- a/test/unit/ams-policy-spec-parser.test.ts +++ b/test/unit/ams-policy-spec-parser.test.ts @@ -1,6 +1,5 @@ import { describe, expect, it } from "vitest"; import { - AMS_POLICY_SPEC_FILENAMES, DEFAULT_AMS_POLICY_SPEC, parseAmsPolicySpec, parseAmsPolicySpecContent, @@ -10,12 +9,6 @@ describe("AmsPolicySpec parser (#5132)", () => { it("re-exports the parser API from the engine barrel", () => { expect(typeof parseAmsPolicySpec).toBe("function"); expect(typeof parseAmsPolicySpecContent).toBe("function"); - expect(AMS_POLICY_SPEC_FILENAMES).toEqual([ - ".loopover-ams.yml", - ".github/loopover-ams.yml", - ".loopover-ams.json", - ".github/loopover-ams.json", - ]); }); it("treats missing raw input as an absent safe-default spec", () => {