Skip to content

[quality] DirectoryFreshness's unparseable-timestamp arms and formatDate's NaN guard have no end-to-end coverage #1103

Description

@hivecommons-hive

Finding

src/components/MemberDirectory/utils.js line 16 — formatDate's
Number.isNaN guard — and two short-circuited operands in
src/components/MemberDirectory/DirectoryFreshness.js (lines 19 and 49) are
reachable only when one of the three provenance timestamps does not parse.
No build the end-to-end suite visits has such a timestamp, so all three sit
uncovered in the "End-to-end coverage" job.

// src/components/MemberDirectory/utils.js
14 export function formatDate(isoDate) {
15   const parsed = new Date(isoDate);
16   if (Number.isNaN(parsed.getTime())) return null;   // uncovered e2e
// src/components/MemberDirectory/DirectoryFreshness.js
16   const architecturesDate = formatDate(metrics?.generatedAt);
17   const landscapeDate = formatDate(landscape?.collectedAt);
18   const awardsDate = formatDate(awardsData?.verifiedAt);
19   if (!landscapeDate && !architecturesDate && !awardsDate) return null;   // uncovered
...
49       {(landscapeDate || architecturesDate) && awardsDate && ' '}         // uncovered

data/members.json always carries a parseable
sources.landscape.collectedAt, so landscapeDate is always truthy and the
second and third operands of line 19 and the right operand of line 49 are
never evaluated. formatDate never sees an unparseable value either.

This is the arm that stops a malformed timestamp from a scheduled refresh
rendering the literal string Invalid Date into the directory's provenance
note. A browser has never taken it.

Evidence and provenance

  • Unit — covered. tests/member-directory.test.mjs:280 drives
    formatDate('not a date') directly, and the same file drives
    DirectoryFreshness. npm run test:unit:coverage
    (TZ=UTC node tests/tools/coverage-report.mjs, node v26.10.0) run locally at
    8afaa67 reports no sub-100% region for either file.
  • E2E — not covered. CI artifact e2e-coverage, id 11348560988, from run
    37317061554,
    workflow Validate repository, job End-to-end coverage, main at
    8afaa67 — the same revision as the unit run. report.json:
    {"file":"src/components/MemberDirectory/utils.js","regions":18,"coveredRegions":17,"uncoveredRegions":[16]}
    and
    {"file":"src/components/MemberDirectory/DirectoryFreshness.js","regions":9,"coveredRegions":4,"uncoveredRegions":[19,30,44,49]}.
  • Covered by unit tests but not end-to-end tests, so priority 2 under the
    coverage-evidence rules.

Recommendation

A variant build, not an overlay on the ordinary coverage build: clearing the
timestamp there would trade the membership sentence for these arms rather than
add a case. Add
tests/e2e/fixtures/data-variants/members.json setting
sources.landscape.collectedAt to an unparseable string, and a spec pairing
/community/members with /e2e-coverage-variant/community/members.

Verified locally at 8afaa67 (npm run build:e2e:coverage, then the coverage
Playwright run, chromium, node v26.10.0, 300/300 passed):

  • src/components/MemberDirectory/utils.js 17/18 → 21/21 regions, 100%
  • src/components/MemberDirectory/DirectoryFreshness.js 4/9 → 7/14
  • src files 377/429 (87.88%) → 385/438 (87.90%)

Note the region totals rise as well: the variant build compiles a second copy
of these files, and the reporter's union does not fold every one of its regions
onto its real-build twin — the drift already tracked by #1066 and #1079. One
visible consequence is that DirectoryFreshness.js line 35 joins the uncovered
list; it is an unfolded twin of a region the real build covers, not a lost
case. Nothing in this change alters the gate, which is on src files
(--check-source-regions 80).

Lines 30 and 44 — the no-URL fallbacks for cncf/landscape and
cncf/architecture — are out of scope here. They need sourceUrl /
repository to be null while the dates still parse, which contradicts the
overlay above, and line 44's half would have to go in
tests/e2e/fixtures/data-variants/metrics.json, which #1093 is editing.

  • tests/e2e/fixtures/data-variants/members.json added
  • a spec pairs the real and variant /community/members routes
  • src/components/MemberDirectory/utils.js leaves the uncovered-region list

Coordination

Disjoint from #1075, which adds tests/e2e/member-directory-freshness.spec.js
and asserts the note's present sentences against the real route only; this
work adds its own spec file and does not touch that one. Disjoint from #1093
(data-variants/metrics.json), #1098 (data-variants/radar-reports.json) and
#1034/#1078 (tests/e2e-data-fixtures.test.mjs, which this does not edit: once
#1100 lands, its directory-wide integrity check covers the new overlay).

Priority

  • Impact: medium (takes one file to 100% of e2e regions; guards the
    Invalid Date arm of a note fed by three scheduled refreshes)
  • Effort: low

🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5n31 | SHA: 8afaa67

— hive: agent=quality backend=copilot model=claude-opus-5 copilot=1.0.88

Activity

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/qualityApproved by a Hive merger/owner for auto-merge on green CIhive/covered-by-prHive verified that an open PR references or claims this issue; still actionable until confirmedhive/hosted-available-lke648397-260827-5n31Approved by a Hive merger/owner for auto-merge on green CIqualityApproved by a Hive merger/owner for auto-merge on green CItestingApproved by a Hive merger/owner for auto-merge on green CI

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions