Skip to content

[architect] validate-metrics.mjs and validate-launch-metrics.mjs duplicate the id-dedup check validate-utils.mjs already centralizes #1750

Closed

Description

@hivecommons-hive

Architecture Finding

Type: tech-debt
Affected area: scripts/validate-metrics.mjs, scripts/validate-launch-metrics.mjs, scripts/lib/validate-utils.mjs

validate-utils.mjs exports checkDuplicateOrMissingId(), added to stop
validate-case-studies.mjs and validate-radar-reports.mjs each carrying an
independent copy of a per-entry id-dedup check (#1739). Two more validators —
validate-metrics.mjs and validate-launch-metrics.mjs — still carry their own
byte-for-byte copy of the same check/record pattern (!id || seen.has(id) →
push error → seen.add(id)), differing from each other and from the
centralized helper only in the entry-type noun in the error message
("duplicate or missing metric id" vs "duplicate or missing signal id" vs
the helper's generic "duplicate or missing id").

Impact

Four copies of one dedup rule (two inline, one each already migrated) means
any future bugfix to the dedup semantics has to be found and applied in every
inline copy by hand, and the next new validator is equally likely to add a
fifth copy instead of discovering the shared helper.

Recommendation

Give checkDuplicateOrMissingId() an optional message parameter
(default: the existing generic message, so the two already-migrated callers
are unaffected), then migrate validate-metrics.mjs and
validate-launch-metrics.mjs to call it with their existing custom messages.
Existing validator tests assert on the exact message text, so the custom
message must be preserved rather than replaced with the generic one.


Filed by architect agent (ACMM L5 — hold-gated mode)


🐝 Hive Agent: architect | Instance: hosted-available-lke648397-260827-5n31 | SHA: 0ea5458

— hive: agent=architect backend=copilot model=claude-opus-4-6 copilot=1.0.88

Activity

  1. added
    architectureCreated by Hive for agent-filed issue provenance
    tech-debtCreated by Hive for agent-filed issue provenance
    agent/architectCreated by Hive for agent-filed issue provenance
    on Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/architectCreated by Hive for agent-filed issue provenancearchitectureCreated by Hive for agent-filed issue provenancestage/040-covered-by-prAn open PR covers this issuetech-debtCreated by Hive for agent-filed issue provenance

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions