Skip to content

fix(engine): AMS_POLICY_SPEC_FILENAMES documents a 4-path discovery order the real resolver never uses #8863

Description

@JSONbored

⚠️ Definition of Done: this issue must be completed in full, in a single PR. Do not split this
work across multiple PRs, and do not defer any Deliverable below to a follow-up issue. A PR that
satisfies only some of the Deliverables, stubs a required test, or leaves a checkbox
partially-done does NOT resolve this issue and will be closed.

Context

packages/loopover-engine/src/ams-policy-spec.ts:411-412 exports AMS_POLICY_SPEC_FILENAMES = [".loopover-ams.yml", ".github/loopover-ams.yml", ".loopover-ams.json", ".github/loopover-ams.json"], explicitly claiming first-match-wins discovery "mirroring MINER_GOAL_SPEC_FILENAMES". But the actual consumer, packages/loopover-miner/lib/ams-policy.ts, hardcodes a single filename (.loopover-ams.yml) resolved only via the operator config dir -- it never imports the constant, has no fallback chain, and doesn't support the .github/ or .json variants the constant documents as valid. An operator using either alternate path silently gets defaults with no warning. Confirmed dead via grep: referenced only in its own declaration, the barrel export, and a test asserting just the literal array -- no discovery-behavior test exists (unlike MinerGoalSpec's dedicated test).

Requirements

Either (a) delete the misleading constant and its "mirrors MINER_GOAL_SPEC_FILENAMES" comment if AMS policy is deliberately meant to be operator-local-only, not repo-discovered, or (b) wire packages/loopover-miner/lib/ams-policy.ts to actually use the documented discovery order via a real discovery helper (mirroring discoverMinerGoalSpecPath's tested implementation). Pick one and make the code and the documentation agree -- do not leave the mismatch in place. Prefer option (b) unless there's a concrete reason AMS policy must stay operator-local (state that reason in the PR if you choose (a)).

Deliverables

  • Either AMS_POLICY_SPEC_FILENAMES and its doc comment are deleted (with ams-policy.ts unchanged), or ams-policy.ts is wired to use the documented 4-path discovery order via a new discovery helper mirroring discoverMinerGoalSpecPath
  • If wiring: a discovery-behavior test mirroring MinerGoalSpec's dedicated test, covering all four filename variants
  • If deleting: confirmation (in the PR description) that no other code references the deleted constant

All of the above Deliverables are required in the same PR unless the deliverable text itself states otherwise.

Test Coverage Requirements

packages/loopover-engine/**/packages/loopover-miner/** -- 99%+ patch coverage on whichever path is chosen.

Expected Outcome

The documented AMS policy discovery order and the real resolver's behavior agree -- either both support the 4-path fallback, or neither claims to.

Links & Resources

  • packages/loopover-engine/src/ams-policy-spec.ts:411-412
  • packages/loopover-miner/lib/ams-policy.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:bugGittensor-scored bug fix — scores a 0.05x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions