test(metrics): cover validate-metrics optional-section branches - #263
Open
kubestellar-hive[bot] wants to merge 1 commit into
Open
kubestellar-hive[bot] wants to merge 1 commit into
kubestellar-hive[bot] wants to merge 1 commit into
Conversation
…ches Adds 14 fixture-driven cases to tests/validate-metrics.test.mjs for validation outcomes that were never exercised: missing/duplicate metric ids, null metric values, an empty metrics array, omitted entries missing an id, lifecycle card and omission validation, time-series sourceUrl and non-finite point values, and breakdown shape, label and value checks. Each case asserts the specific error string emitted by its branch, and the valid-section cases pin the accepting path. Tests only; no production code is changed. Suite goes from 55 to 69 passing tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: kubestellar-hive[bot] <kubestellar-hive@hive.kubestellar.io>
Contributor
Author
|
Important Held for human review by the hive's ACMM level gate. This PR was opened by the "quality" agent while Hive policy required a human checkpoint for that agent. Non-outreach agents are held at ACMM L3–L5; the Hive will automatically remove the |
This was referenced Sep 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test Improvement
Adds 14 fixture-driven cases to
tests/validate-metrics.test.mjscoveringscripts/validate-metrics.mjsvalidation outcomes that were never exercised:id, and metric with anullvaluemetricsarray (accepting path)idreason; fully-populated valid lifecyclesourceUrl; series point with a non-finite value; fully-populated valid seriesvaluesis not an array; breakdown missing itslabel; non-finite breakdown value; fully-populated valid breakdownThese are the guards that only run when a metrics file carries the optional
referenceArchitectureLifecycle,series, orbreakdownsections.data/metrics.jsonis a generated artifact, so a partially-written regeneration is precisely what they exist to catch.Each case asserts the specific exit status and the specific validator error string for its branch, and the valid-section cases pin the accepting path, so the tests fail loudly if a guard is removed or its message drifts.
Tests only — no production code is changed. Suite goes from 55 to 69 passing tests (
node --test, node v26.8.2), rebased on currentmain.Note on the coverage number
The reported branch percentage for
scripts/validate-metrics.mjswill not move when these land.tests/helpers.mjsrunScriptWithFixturesruns a temp-dir copy of the script in a subprocess, whichnode --testcoverage instrumentation does not attribute back to the repo path. The evidence of added coverage here is behavioral, not a percentage. That measurement limitation is tracked separately and is not something this PR tries to fix.Related Issue
Closes #262 (merging this adds every test the issue asks for, leaving nothing further for it to track)
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-opus-5