Repository navigation
test: pin contributor template link form and fix the PR template's CONTRIBUTING link - #1018
Merged
Merged
Conversation
…NTRIBUTING link GitHub prefills .github/PULL_REQUEST_TEMPLATE.md into the pull request body, where a relative link target is resolved against the /compare URL rather than the repository. The checklist's only link, ../CONTRIBUTING.md, therefore 404s for every contributor opening a PR, even though it resolves correctly in the file viewer where it was written. Point it at an absolute URL, and guard the form of every link in a file GitHub renders into an issue or PR body so the next relative target is rejected by npm run test:unit instead of reaching contributors. check:links never saw this: _check:links-md is 'for f in *.md', which iterates root-level markdown and never descends into .github/. The guard asserts link form, not liveness, for the same reason check:links is listed in GATES_NOT_RUN_BY_CI. 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 |
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
.github/PULL_REQUEST_TEMPLATE.mdis read in two places, and its only linkworked in just one of them. In the GitHub file viewer — where anyone editing
the template looks at it —
[CONTRIBUTING.md](../CONTRIBUTING.md)resolves.Where the template is actually read it does not: GitHub prefills it into a pull
request body, and a relative target there is resolved against the
/compareURL the contributor is on rather than against the repository, so the checklist
item every contributor sees points at a 404.
Nothing in the repository would have caught it:
tests/issue-template-contract.test.mjswas the only thing reading the file,and it asserted presence and non-emptiness only.
npm run check:linksnever sees it._check:links-mdinpackage.jsonisfor f in *.md, which iterates root-level markdown and never descends into.github/.npm run check:markdownlints style, not resolution.So this PR fixes the link and adds the guard that makes the next one fail at
npm run test:unitinstead of reaching contributors.What this adds
Five tests in
tests/issue-template-contract.test.mjs, built on three helpers:markdownLinkTargets()— reads targets out of markdown, ignoring the titlein
[a](url "t")and skipping HTML comments, since a link parked in acomment is shown to nobody.
badLinkTarget()— accepts anhttps://URL or a#anchor, and explainswhy anything else is unusable in a rendered body.
formLinkProblems()— applies that to everything GitHub renders out of anissue form: the form
description, eachmarkdownelement'svalue, andeach field's
attributes.description.Two decisions worth reviewing:
resolves it. Fetching targets is exactly what
check:linksis exempted fromCI for in
tests/workflow-scripts.test.mjs(GATES_NOT_RUN_BY_CI): athird-party outage must not fail an unrelated pull request. The same
reasoning applies here.
assertion that "no link is relative" passes just as well over a template with
no links at all, so one test pins that the PR template still carries a
CONTRIBUTING.md link for the others to judge.
The issue forms carry no relative links today
(
grep -nE '\]\([^)h#][^)]*\)' .github/ISSUE_TEMPLATE/*.ymlis empty), so forthem the guard is preventive;
formLinkProblemsis covered directly by asynthetic form rather than by a defect that does not exist.
Files and functions claimed
.github/PULL_REQUEST_TEMPLATE.md— the checklist's CONTRIBUTING.md linkonly.
tests/issue-template-contract.test.mjs— newmarkdownLinkTargets,badLinkTarget,renderedFormText,formLinkProblems, and five tests. Theexisting tests are unchanged except that the PR template path moved into a
shared
PULL_REQUEST_TEMPLATEconstant.No production code, no workflow changes. Disjoint from every open PR: none of
#989, #991, #994, #996, #998, #1000, #1002, #1004, #1007, #1008, #1010, #1012,
#1014 or #1016 touches
.github/PULL_REQUEST_TEMPLATE.md,.github/ISSUE_TEMPLATE/**ortests/issue-template-contract.test.mjs(verified with
gh pr view <n> --json filesover all fourteen).Verification
TZ=UTC node --test tests/issue-template-contract.test.mjs— 15/15 pass.../CONTRIBUTING.md,the pull request template links only with absolute URLs or anchorsfails with../CONTRIBUTING.md is relative; GitHub resolves it against the /compare URL when the template is rendered into a body, not against the repository.npm run test:unit:coverage:check— exits 0.src files 100.00% lines (8351/8351), 100.00% regions (2395/2395),unchanged. Repository-wide region coverage moves 95.02% → 95.04%.
npx prettier --check— clean on both files.Related Issue
Closes #1017
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-opus-5 copilot=1.0.88