Skip to content

test: kill the surviving mutants in the external source and URL safety helpers - #1790

Merged
mrbobbytables merged 2 commits into
cncf:mainfrom
mrbobbytables:copilot/mutants-group-d
Oct 22, 2026
Merged

mrbobbytables merged 2 commits into
cncf:mainfrom
mrbobbytables:copilot/mutants-group-d

Conversation

@mrbobbytables

Copy link
Copy Markdown
Member

Group D of the surviving-mutant backlog in #1788: the external source and URL safety helpers.

Adds tests/cncf-wp-api.test.mjs and tests/git-source.test.mjs, and extends the GitHub pagination, changelog, project-assets and URI-safety tests, so each remaining behavioural mutant in scripts/lib/cncf-wp-api.mjs, github.mjs, changelog.mjs, git-source.mjs, url-safety.mjs, uri-safety.mjs and project-assets.mjs is distinguished: exact page URLs and query separators, x-wp-totalpages boundaries, rel="next" parsing and the cross-origin token guard, conventional-commit anchoring and the overflow note boundary, shallow clone and rev-parse arguments, image-syntax parsing in artwork URLs, and remoteTarget host boundaries. Test-only change; no source file is modified.

Scoped mutation score for the seven files: 77.48% (437 killed / 47 survived / 80 no coverage) to 97.87% (552 killed / 12 survived / 0 no coverage). Every file is at or above 96.4%.

The 12 survivors left are equivalent: a '1' to '' page default that Number() reads as the same stop condition, a fallback Link header that never matches rel="next", https? to https where artworkPath already rejects http, un-anchoring regexes that can only match at index 0, and the path and field of an error list that isSafeUrl discards.

Validation: focused tests, scoped Stryker run, npm run test:unit:coverage:check, and the six lint gates all pass.

Refs #1788

…y helpers

Pin the behaviour of the seven Group D helpers with in-process tests: the
exact cncf.io and GitHub page URLs, headers, Link rel="next" parsing and
same-origin guard of the fetch walkers, the real git invocations in
git-source.mjs (depth-1 clone, trimmed HEAD, inherited stdio), every month
name and both changelog regex anchors, the remoteTarget and decodeEntities
boundaries, and the artworkUrls image-syntax pattern on its own. The scoped
mutation score rises from 77.48% (437 killed, 47 survived, 80 without
coverage) to 97.87% (550 killed, 2 timeouts, 12 survived, 0 without
coverage). The twelve survivors are equivalent: cncf-wp-api.mjs L32 ('1'
default, Number('') also ends the walk at page 1), github.mjs L61 (the
missing-header fallback never matches rel="next"), project-assets.mjs L88
(a dotless file never carries a mirrorable extension), L121 and L126 (http
URLs are rejected by artworkPath either way), uri-safety.mjs L86 (a global
replace removes every character with or without +), L111 and L163 (both
regexes can only match at index 0 for the inputs that reach them),
url-safety.mjs L126 (value is already a string past the requireNonEmptyString
guard), L142 (only observable with a protocols entry no URL.protocol can
equal) and L192 (path and field of an error list isSafeUrl discards).

Refs cncf#1788

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: mrbobbytables <mrbobbytables@users.noreply.github.com>
@netlify

netlify Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for endusers ready!

Name Link
🔨 Latest commit 6ba9dc8
🔍 Latest deploy log https://app.netlify.com/projects/endusers/deploys/6ada62a612e8bc76e40a36c1
😎 Deploy Preview https://deploy-preview-1790--endusers.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Comment thread tests/lib-github.test.mjs Fixed
Comment thread tests/lib-github.test.mjs Fixed
CodeQL flagged the hand-rolled regex escape of the page URL as an
incomplete sanitization; an exact message match needs no escaping.

Refs cncf#1788

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: mrbobbytables <mrbobbytables@users.noreply.github.com>
@mrbobbytables
mrbobbytables added this pull request to the merge queue Oct 22, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

Overlap warning: this PR and open hold-gated #1792 (test: pin the decodeEntities bound, bare named reference and remoteTar) both edit tests/uri-safety.test.mjs in the same three places — the header comment block, the import list, and the tail of the file — so whichever merges second will conflict and need a rebase.

Beyond the mechanical conflict, the two PRs add duplicated coverage:

Options: (a) land this PR first and have #1792 rebase and drop its duplicated decodeEntities cases, keeping only what this table does not cover; or (b) land #1792 first and trim this file's overlap on rebase. Either way the REMOTE_TARGETS table here is the superset for remoteTarget.

Everything else in the diff (cncf-wp-api, git-source, lib-github, generate-changelog, project-assets) is disjoint from all open hold-gated PRs. The deletions in tests/lib-github.test.mjs are an import reformat and a headers param added to the jsonResponse helper — no coverage lost.


🐝 Hive Agent: scanner | Instance: hosted-available-lke648397-260827-5n31 | SHA: unknown

— hive: agent=scanner backend=copilot model=kimi-k3 copilot=1.0.88

Merged via the queue into cncf:main with commit bbdfd7f Oct 22, 2026
14 checks passed

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the full diff against main at 6ba9dc8 and ran the touched suites locally after npm ci: 90/90 pass across cncf-wp-api, git-source, generate-changelog, lib-github, project-assets, plus the extended uri-safety cases (15/15). Test-only as stated; the WP-API tests stub globalThis.fetch and restore it, and the git-source tests shim PATH with saved/restored env, so nothing reaches the network. Looks correct to me.

Two things for the maintainer merging this:

  1. Conflict with #1792. Both PRs edit tests/uri-safety.test.mjs — the same header comment (lines 8–16) and the same three behaviours (highest code point, bare &colon, mid-path remoteTarget anchors). I read both diffs in full: overlapping in substance, different in text, so whichever merges second needs a rebase. #1792 is the hive's targeted fix for #1791; this PR's uri-safety hunk is a superset for remoteTarget boundaries but covers slightly different decodeEntities cases (&Tab; here vs &sol + the normalizeUri collapse there).

  2. The REMOTE_TARGETS row ['http:\\\\', 'http://'] pins hostless output. It matches current behaviour (the lookahead at scripts/lib/uri-safety.mjs:148 fails with nothing after the separators, and the rewrite at :163 then returns 'http://'), but the comment above that code says a value with no host "fetches nothing to report". #1792's body records that inconsistency as a possible production change; if remoteTarget is later fixed to return null for host-less values, this row (and the http://?x row) will need updating. Worth a maintainer's eye on whether to pin it now.

No defects found; this is a solid strengthening of the external-source tests.

— hive: agent=reviewer backend=copilot model=claude-fable-5 copilot=1.0.88

github-merge-queue Bot pushed a commit that referenced this pull request Oct 22, 2026
…rayDeclaration (#1807)

Annotate the 41 surviving mutants that the backlog groups in #1788
verified as equivalent (#1789, #1790, #1793, #1794, #1795) with
Stryker disable directives that carry the reason, so they report as
Ignored instead of Survived and no longer surface as mutation findings.
Exclude the ArrayDeclaration mutator in stryker.config.mjs: every
instance that survived on main seeded an accumulator or fallback whose
contents are unobservable. Hoist the landscape source URL in
DirectoryFreshness into a const so its directive can attach outside the
JSX. Document the directive placement rules in CONTRIBUTING.

Refs #1788

Signed-off-by: mrbobbytables <mrbobbytables@users.noreply.github.com>
Co-authored-by: mrbobbytables <mrbobbytables@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants