Skip to content

test: guard the member directory freshness note end to end - #1075

Merged
castrojo merged 1 commit into
mainfrom
quality/test-directory-freshness-note
Oct 6, 2026
Merged

castrojo merged 1 commit into
mainfrom
quality/test-directory-freshness-note

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds tests/e2e/member-directory-freshness.spec.js, an end-to-end guard for
the provenance note at the top of /community/members
(src/components/MemberDirectory/DirectoryFreshness.js).

The note's three sentences each come from a different scheduled data file, and
each sits behind a && on its own formatDate() result:

sentence source field
membership data/members.json sources.landscape.collectedAt
architectures data/metrics.json generatedAt
awards data/awards.json verifiedAt

formatDate() returns null for anything Date cannot parse, so a refresh
that writes a malformed timestamp drops that sentence silently; if all
three go, DirectoryFreshness returns null and the note disappears.

Five cases: the note renders exactly once, each of the three sentences is
present, and the two named sources (cncf/landscape, cncf/architecture)
resolve to the absolute https:// URL the data carries and open in a new tab
with rel="noreferrer".

Why the existing tests do not cover this

tests/member-directory.test.mjs:367 and :420 already assert the note, but
through tests/tools/fake-dom.mjs with injected fixtures. They prove that
a good timestamp renders; they never read the committed JSON, so they cannot
fail when a scheduled refresh writes a bad one. These files change with no
source change at all, which is the case the unit suite is blind to. The
repository already applies this reasoning to the analogous PeopleFreshness
note at tests/e2e/community-people.spec.js:116-122.

Asserted, not skipped

Each timestamp is asserted rather than used as a test.skip condition. All
three are already required to be parseable upstream —
scripts/validate-enduser-members.mjs:91, scripts/validate-metrics.mjs:76
and scripts/validate-awards.mjs:51 — so a value that fails the check is the
regression, and skipping on it would hide exactly the failure this spec exists
to catch.

Verification

Run locally at 900592b against npm run build:production, chromium, node
v26.10.0: 5 passed.

Then data/awards.json verifiedAt was set to "not-a-date" and the site
rebuilt. The rendered note became

Directory membership data last synced from cncf/landscape on October 1, 2026.
Architecture-derived profiles last synced from cncf/architecture on September 27, 2026.

— the award sentence gone, with no other symptom — and the new case failed with
data/awards.json verifiedAt must be a parseable timestamp while the other
four stayed green. data/awards.json was restored; this PR changes no data.

npx prettier --check and npx eslint pass on the new file.

Scope and coordination

One new spec file; nothing else is touched. Deliberately not
tests/e2e/member-directory.spec.js (open PR #1060, the directory's four
undriven toolbar controls) or tests/e2e/interactions.spec.js (open PR #1058,
the industry and CNCF-project facet selects). No overlap with the e2e coverage
tooling PRs (#1040, #1051, #1070, #1072), and this is not a coverage-gap fix:
the note already renders on every visit, so its regions are counted covered —
what was missing is any assertion.

Related Issue

Closes #1074


Filed by quality agent (hold-gated mode). Human review required.

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

/community/members renders DirectoryFreshness, whose three sentences each
come from a different scheduled data file and each sit behind a && on their
own formatDate() result. formatDate() returns null for anything Date cannot
parse, so a refresh that writes a malformed timestamp drops that sentence
silently; if all three go, the note disappears entirely.

tests/member-directory.test.mjs asserts the note through a fake DOM with
injected fixtures, so it proves a good timestamp renders but cannot fail when
the committed JSON carries a bad one. This adds the end-to-end counterpart,
reading data/members.json, data/metrics.json and data/awards.json at run time
and asserting what the browser renders from them.

The timestamps are asserted rather than used to skip: all three are already
required to be parseable upstream, so a value that fails the check is the
regression itself and skipping on it would hide the failure this spec exists
to catch.

Verified by mutating data/awards.json verifiedAt to an unparseable value and
rebuilding: the award sentence vanishes from the rendered note and the new
case fails, while every other spec stays green.

Signed-off-by: quality <quality@hive.kubestellar.io>
@hivecommons-hive hivecommons-hive Bot added the hold label Oct 5, 2026
@hivecommons-hive

Copy link
Copy Markdown
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 outreach agent is always held because it publishes project-facing communication.

Hive will automatically remove the hold label once current policy no longer requires a level hold for "quality". If this is an outreach PR, a human must review it and remove the label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] the member directory freshness note is rendered from three scheduled data files and asserted by no e2e test

1 participant