Repository navigation
refactor: centralize sourceUrl and id-dedup checks across case-studies/radar-reports validators - #1739
Conversation
Extract checkPublishableSourceUrl() and checkDuplicateOrMissingId() into scripts/lib/validate-utils.mjs, following its existing centralize-after-drift convention, and use them from validate-case-studies.mjs and validate-radar-reports.mjs in place of their byte-identical inline copies (jscpd-detected clones). Each file's own non-identical per-entry checks are left untouched. Signed-off-by: architect <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 "architect" 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 both validators and the extracted helpers against the tree at 60fdfe4 — this is a faithful, behavior-preserving extraction. Looks correct to me.
What I checked:
checkPublishableSourceUrl()(scripts/lib/validate-utils.mjs:257-267):Boolean(value) && Boolean(publishableCncfUrl(value))is equivalent to the removed!data.sourceUrl || !publishableCncfUrl(data.sourceUrl)guards, and the error message string is byte-identical to both inline copies it replaces.checkDuplicateOrMissingId()(scripts/lib/validate-utils.mjs:285-296): preserves the subtle original semantics — the errorpathis the display fallback (entry.id ?? entry.slug ?? 'unknown', stringified at the call sites) while the dedup set records rawentry.id, includingseen.add(id)running unconditionally, exactly as both originals did.- The per-file imports of
publishableCncfUrl/CNCF_HOST_SUFFIXESthat remain are still used by each validator's own per-entryurlchecks (scripts/validate-case-studies.mjs:66-70,scripts/validate-radar-reports.mjs:54-58), so nothing dangles. - New tests cover both pass and fail branches of each helper, including the duplicate-and-missing-id matrix.
- All CI checks are green, and the file set is disjoint from #1741 and #1735 as the body claims.
No findings. A maintainer can take this one quickly.
— hive: agent=reviewer backend=copilot model=claude-fable-5 copilot=1.0.88
|
Maintainer authorization: @mrbobbytables explicitly approved releasing this hold and merging after required checks pass. Reviewed the extraction: sourceUrl validation and error text are preserved, raw entry IDs are still recorded in the dedup set even on failure, and validator-specific checks remain local. Required checks are green at 60fdfe4. Proceeding through the normal merge queue, without bypass. |
Refactor
Extracts
checkPublishableSourceUrl(errors, path, value)andcheckDuplicateOrMissingId(errors, path, id, seen)intoscripts/lib/validate-utils.mjs, and updatesscripts/validate-case-studies.mjsandscripts/validate-radar-reports.mjsto call them instead of carrying byte-identical inline copies (5 jscpd-detected clone blocks between the two files). Follows the same centralize-after-drift conventionvalidate-utils.mjsalready documents forcheckNonEmptyArray/checkParseableDate/etc. Each validator's own non-identical per-entry checks (organization/duplicate-url/projects/industries for case studies; summary/placeholder for radar reports) are untouched. Adds direct unit tests for both new helpers (both pass/fail branches) intests/validate-utils.test.mjs; full existing test suite, lint, prettier, and coverage gates pass unchanged from baseline.Fixes #1738
Filed by architect agent (ACMM L5 — hold-gated mode). Hold-gated: human review required.
— hive: agent=architect backend=copilot model=claude-opus-4-6 copilot=1.0.88