Repository navigation
test: pin the enduser-landscape classifier's role and scope rules - #1771
Conversation
scripts/lib/enduser-landscape.mjs scored 83.54% under StrykerJS with 27 of 164 mutants surviving -- half a point above the repo's break threshold of 83. The survivors were behavioural: the ROLE_SUFFIX end anchor, the sourceName.trim() emptiness check, the '<unknown>' subcategory fallback in the unnamed-item error, the record's mirrored enduser flag, the authoritative-subcategory half of the supporter relevance test, and the optional chaining that keeps a stray null YAML list entry from crashing the collector. Add tests that assert each of those decisions directly. The module now scores 93.90%; the 10 mutants that remain are equivalent -- item is provably non-null past the name guard, and the '|| []' fallbacks reach the same thrown error either way. Closes #1770 Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
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. Agent PRs are held at ACMM L3–L5; an Hive will keep the |
✅ Deploy Preview for endusers ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Read the classifier at scripts/lib/enduser-landscape.mjs and traced each new test against it; all six pin behavior the source actually implements. Looks correct to me.
Verified against the tree at b10cacf:
ROLE_SUFFIX(enduser-landscape.mjs:5) is$-anchored, soAcme (member) Holdingswithenduser: truematches no role and hits theenduser record without a member role suffixthrow at line 80 — exactly what the first test asserts, and the trailing-suffix variant strips only the final(member)viadisplayName()(line 8).- The unnamed-item message interpolates
subcategoryName || '<unknown>'(line 45), so both the named and fallback assertions match the real template. !sourceName.trim()(line 43) rejects the whitespace-only name; anullitem makesitem?.nameundefined and takes the same path, andentry?.name/subcategory?.items || [](lines 25, 41) skip null categories/subcategories — matching the null-tolerance test.- A
(supporter)suffix inGoldis neither included nor relevant (lines 84–93), so the empty-records assertion holds;enduser: item?.enduser === true(line 112) is independent ofincluded, so asserting a contributor record withenduser: falseis the right separation.
Ran TZ=UTC node --test tests/enduser-landscape.test.mjs on the PR head: 15 pass, 0 fail. The diff touches only the test file — the body's claim of no production changes and disjointness from #1761/#1763/#1765/#1767/#1769 checks out. All required checks (including Mutation testing) are green.
— hive: agent=reviewer backend=copilot model=claude-fable-5 copilot=1.0.88
|
Maintainer-delegated P2 disposition: reviewed exact head b10cacf against classifyLandscapeDocument. The added assertions distinguish trailing-role anchoring, nonblank names, null data diagnostics, supporter subcategory scope and the landscape enduser flag from inclusion. They exercise production classifier behavior rather than test-tree guards; no production semantics or policy changes. Required CI and all fresh-head checks are green. The maintainer explicitly approved this designated P2 hold release and protected merge. Agent inspection is not independent human approval. Releasing only this hold and submitting the exact head through the queue, with no bypass. |
Test Improvement
scripts/lib/enduser-landscape.mjs— the classifier that turnscncf/landscapeentries into End User directory records — scored 83.54% under StrykerJS,
with 27 of 164 mutants surviving. The repo's
breakthreshold is 83, so themodule was sitting half a point above the gate while its central rules went
unasserted.
This adds six tests to
tests/enduser-landscape.test.mjs(no production codechanges) covering the behavioural survivors:
ROLE_SUFFIXis anchored to the end of the name, soAcme (member) Holdingsis not classified as a member and its display name is not rewritten from the
middle.
sourceName.trim()), not emitted asa blank directory card.
<unknown>rather than interpolating
undefined.enduserflag mirrors the landscape's own flag and is assertedapart from
included(a contributor is included without it).(supporter)suffix outsideEnd User Supporter and Contributorisignored — the authoritative-subcategory half of the relevance rule.
nulllandscape entry, subcategory or item is skipped or reported asa data error, not a
TypeErrornaming no entry.Verified locally at
b490a7f:The 10 remaining mutants are equivalent:
itemis provably non-null past thename guard, and the
|| []fallbacks ondocument.landscape/category.subcategoriesreach the same thrown error either way. They are notworth contorting the tests to kill.
TZ=UTC node --test tests/enduser-landscape.test.mjs,npx prettier --checkand
npx eslint --max-warnings 0are green on the changed file.This touches only
tests/enduser-landscape.test.mjsand no production source,so it is disjoint from the open hold-gated PRs (#1761
tests/validate-utils,#1765
tests/svg-active-content, #1767scripts/lib/duplicate-checkand fourvalidators, #1763
scripts/audit-gate, #1769scripts/pr-queue-hygiene).Related Issue
Closes #1770
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-opus-5 copilot=1.0.88