Skip to content

[quality] test: cover data/projects-born.json contract (tests/projects-born-data.test.mjs) - #239

Open
kubestellar-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-projects-born-data
Open

kubestellar-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-projects-born-data

Conversation

@kubestellar-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds tests/projects-born-data.test.mjsthe only file this PR touches.

data/projects-born.json is hand-maintained source data with no validator, unlike every other rendered corpus in this repo (data/metrics.jsonvalidate-metrics.mjs, data/awards.jsonvalidate-awards.mjs, architectures → validate-architectures.mjs / validate-architecture-assets.mjs). src/components/ProjectsBorn/index.js renders it directly with no defensive handling, so malformed entries fail silently in the published page rather than failing the build.

The test asserts the invariants the component actually depends on:

  • the file parses, is a non-empty array, and every entry is a plain object
  • name, origin, description, url are each present and a non-empty string
  • name values are unique — name is the React list key, so a duplicate silently drops a card
  • every url parses via new URL(), uses the https: protocol, and has a host — a missing url renders a dead anchor, an http: url is mixed content
  • no entry carries fields outside the four the component reads, catching a typo'd key that would render nothing
  • no field has padded whitespace, and the file ends with a trailing newline

Verification

node --test tests/projects-born-data.test.mjs: 9 tests pass, 0 fail. Full suite node --test after this change: 64 pass, 0 fail (55 before). npx prettier --check tests/projects-born-data.test.mjs is clean.

All 5 current entries are already well-formed, so this is a regression guard rather than a repair. The guard was mutation-checked — each of these mutations to data/projects-born.json turns the suite red, and reverting it turns it green again:

mutation caught
duplicate a name across two entries
change a url to http://
delete an origin field
add an unrecognised extra field
pad a name with surrounding whitespace

Coverage evidence

  • Unit: node --test --experimental-test-coverage, fresh clone of cncf/endusers at parent revision 00b44df after npm ci, 2026-09-17. Baseline: 55 tests, data/projects-born.json referenced by no test and no validator. After: 64 tests.
  • End-to-end: unavailable — this repository has no end-to-end or browser suite and publishes no coverage artifact from any suite (tracked in [quality] CI publishes no coverage evidence, so coverage findings cannot be verified #186). No claim is made that this path lacks end-to-end coverage.

Scope boundary against open PRs

This PR claims tests/projects-born-data.test.mjs and nothing else. It is disjoint from every open quality PR: #235 covers data/milestones.json, #208 covers scripts/generate-members.mjs, #214 covers scripts/fetch-community-people.mjs, #229 covers src/components/ArchitectureFilters. No package.json, no workflow file, and no shared helper is touched, so it cannot conflict with #225 or #229.

Related Issue

Closes #237


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

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

data/projects-born.json is rendered directly by
src/components/ProjectsBorn/index.js and has no validator, unlike every
other rendered corpus in the repo. Add a contract test asserting the
invariants the component depends on: required non-empty string fields,
unique names (the React list key), absolute https urls, no unrecognised
fields, and no padded whitespace.

Signed-off-by: kubestellar-hive[bot] <kubestellar-hive@hive.kubestellar.io>
@kubestellar-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

agent/quality Approved by a Hive merger/owner for auto-merge on green CI hive/hosted-available-lke648397-260827-5n31 Approved by a Hive merger/owner for auto-merge on green CI hold quality Approved by a Hive merger/owner for auto-merge on green CI testing Approved by a Hive merger/owner for auto-merge on green CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] data/projects-born.json has no validator or test, and ProjectsBorn renders it unchecked

0 participants