Skip to content

fix(engine): normalizeSelfPlagiarismPolicy silently clamps an out-of-range similarityThreshold with no warning #8862

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/miner-goal-spec.ts:247-270's normalizeSelfPlagiarismPolicy only warns when similarityThreshold isn't a number (line 262); an out-of-range numeric value (e.g. 5, -1) falls through to self-plagiarism.ts's Math.min(1, Math.max(0, value)), silently clamping to 1 with zero warnings and marked "present"/configured. Every sibling numeric normalizer in the same file (normalizePositiveInteger, lines 313-323) and in ams-policy-spec.ts's normalizePositiveNumber (lines 192-199) rejects out-of-range values, warns, and falls back to the default instead.

Requirements

Warn and fall back to the module's documented default when the numeric similarityThreshold value is outside [0,1] or non-finite, matching the sibling normalizer convention (normalizePositiveInteger/normalizePositiveNumber) exactly -- same warning-message style, same fallback-to-default behavior.

Deliverables

  • normalizeSelfPlagiarismPolicy warns and falls back to the default when similarityThreshold is a finite number outside [0,1]
  • A test asserting an out-of-range numeric value (e.g. 5 or -1) produces a warning and the default threshold, not a silently-clamped value with no warning

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

Test Coverage Requirements

packages/loopover-engine/** -- 99%+ patch coverage, branch-counted, on the new out-of-range warning path.

Expected Outcome

A misconfigured similarityThreshold outside [0,1] produces a visible warning and falls back to the safe default, matching every sibling numeric config normalizer in this codebase.

Links & Resources

  • packages/loopover-engine/src/miner-goal-spec.ts:247-270,313-323
  • packages/loopover-engine/src/ams-policy-spec.ts:192-199

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