Repository navigation
test: cover CaseStudies' undated-study comparator arms end to end - #1065
Merged
Merged
Conversation
sortByPublishedAtDesc compares through a fallback on each side, `(b.publishedAt || '').localeCompare(a.publishedAt || '')`. All 213 studies in data/case-studies.json carry a publishedAt, so neither arm can run and the empty arm of the date cell beside it cannot render. A missing date is a property of one record rather than a cleared document-level field, so this uses the additive overlay mechanism: the real studies keep rendering exactly as they did and the undated rows render alongside them, adding the case instead of swapping it. The overlay appends two undated studies. A lone undated record only ever lands on one side of a comparison against the dated ones, leaving the fallback on the other side unreached -- measured at 94.83% with line 25 still uncovered, because that line carries two regions. With two records the pair is also compared against each other and both fallbacks run. End-to-end region coverage for src/components/CaseStudies/index.js goes 92.98% -> 96.55% (uncovered regions [46, 64]) and src files 80.98% -> 81.37%, measured by building both coverage sites and running the instrumented suite locally (299 passed). The remaining two regions are document-level fields that an additive overlay cannot reach. Closes #1064 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: quality <quality@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 |
The spec read data/case-studies.json with E2E_COVERAGE forced to '1', so it always saw the overlaid file and its `test.skip(undated.length === 0)` guard could never fire. The gating "End-to-end tests" job builds with the real data and serves 213 studies, so the spec ran there against a page with no undated row and failed on the row count. Gate the block on the ambient E2E_COVERAGE instead, the way tests/e2e/data-fixtures.spec.js gates its own overlay-only assertions, and read the data file through the ambient environment so the records the spec looks for are the ones the build it is running against actually rendered. Verified locally at this head: the gating lane (`npm run build:production` + `npx playwright test tests/e2e/case-studies.spec.js`) is 7 passed, 1 skipped, and the coverage lane (`npm run build:e2e:coverage` + `npm run test:e2e:coverage`) is 299 passed with the spec running. The coverage report still clears --check-source 100 --check-source-regions 80 with src/components/CaseStudies/index.js at 100.00% lines / 96.55% regions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: quality <quality@hive.kubestellar.io>
This was referenced Oct 5, 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
sortByPublishedAtDesccompares two case studies through a fallback on eachside,
(b.publishedAt || '').localeCompare(a.publishedAt || '')(
src/components/CaseStudies/index.jsline 25). All 213 studies indata/case-studies.jsoncarry apublishedAt, so neither arm can run, and theempty arm of the date cell beside it (line 204) cannot render.
A missing date is a property of one record rather than a cleared
document-level field, so this uses the additive overlay mechanism
(
tests/e2e/fixtures/data/case-studies.json, seetests/tools/e2e-data-fixtures.cjs) rather than the variant build: the realstudies keep rendering exactly as they did and the undated rows render
alongside them, so the arm is added rather than swapped.
npm run build:productionand the gating end-to-end job never load the overlay.The overlay appends two undated studies. A lone undated record only ever
lands on one side of a comparison against the dated ones, leaving the fallback
on the other side unreached — measured at 94.83% with line 25 still listed as
uncovered, because that line carries two regions. With two records the pair is
also compared against each other and both fallbacks run.
tests/e2e/case-studies.spec.jsgains one case asserting that each undated rowrenders with an empty date cell and its neighbouring cells intact, that the
undated studies occupy the final rows (which is what shows the comparator ran
its fallbacks rather than dropping the rows), and that the other rows still
show a formatted date.
Evidence
Measured at
main900592b by building both coverage sites(
npm run build:e2e:coverage) and running the instrumented suite locally(
npm run test:e2e:coveragewithE2E_COVERAGE_DIR/E2E_COVERAGE_RUN_IDset), then sealing and rendering the report:
CaseStudiessrc files[25, 46, 64][46, 64]The baseline render matches job
End-to-end coverageof run37164361552
attempt 1 to within one region (CI 468 / 379 / 80.98%), and
CaseStudiesisidentical in both.
The result is unchanged under the region fold proposed in #1051
(87.73% -> 88.37%
src files,CaseStudies96.55% either way), so this doesnot depend on which of the two lands first and does not touch its files.
The CI gates pass as configured in
.github/workflows/ci.yml:report:e2e:coverage --check-source 100 --check-source-regions 80 --require-source-filesexits 0, as donpm run test:unit:coverage:check,npm run test:unitandnpm run check:format.Not in this PR
The two remaining regions, lines 46 (
!data.generatedAt) and 64(
data.caseStudies || []), are document-level fields that an additive overlaycannot reach. They are out of scope here and called out on the issue.
Related Issue
Closes #1064
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-opus-5 copilot=1.0.88