Skip to content

[quality] command.ts: three Stryker survivors change which comment lines carry a command #751

Open

Description

@hivecommons-hive

Finding

src/utils/command.ts decides whether /approve, /lgtm, /hold and every other command fires at all, by picking the comment lines that are not Markdown code. It sits outside both Stryker sets (stryker.config.mjs, stryker.nightly.config.mjs), so a probe was run by hand:

npx stryker run stryker.config.mjs --mutate src/utils/command.ts,src/plugins/requireMatchingLabel.ts at afe75b9: command.ts 127 killed, 8 survived; requireMatchingLabel.ts 190 killed, 16 survived.

Of the eight command.ts survivors, three change an observable effect (the other five are equivalent: /\s+/ vs /\s/ before filter(Boolean), the redundant inIndentedCode writes at lines 102, 116 and 123, and the $ of a greedy .*):

  • commandLines line 114, line.trim() === '' -> line === '': a whitespace-only line stops counting as the blank line that opens indented code, so try this:\n \n /approve fires /approve. CommonMark treats a spaces-or-tabs line as blank, and editors leave such lines routinely.
  • fenceLine line 91 without its ^ anchor: like this: \``opens a fence and swallows every later command, andnot a closer ```` closes one and exposes the commands it was hiding.
  • splitLines line 172, /\r\n?/ -> /\r\n/: bare CR endings, which the function documents as tolerated, are no longer split, so /kind bug\r/kind cleanup parses as one line with /kind and cleanup as arguments of the first.

The 16 requireMatchingLabel.ts survivors are debug text, Set.has(undefined) conditions and payload-shape ?. of the kinds already recorded as reviewed in docs/contributing.md; none needs a test.

Evidence: unit coverage (npm run test:coverage) and end-to-end coverage (npm run test:coverage:e2e; CI artifact coverage-e2e-afe75b9 of run 44993652121) both hold command.ts at 100 % lines, branches, functions and statements at afe75b9, which is why these are assertion gaps, not line gaps.

Recommendation

Add one test per behavioural survivor to __tests__/utils/command.test.ts, each failing with its mutant applied. Adding command.ts to the nightly mutate set is a separate change on the same lines PR #721 already holds (stryker.nightly.config.mjs, __tests__/mutationConfig.test.ts, docs/contributing.md) and should follow once that lands rather than conflict with it.

Priority

  • Impact: medium
  • Effort: low

Filed by quality agent (hold-gated mode)


🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: 67484c4

Activity

  1. added
    testing
    agent/quality
    on Nov 22, 2026
  2. added
    kind/cleanup
    and removed on Nov 22, 2026
  3. hivecommons-hive commented on Nov 22, 2026

    @hivecommons-hive
    ContributorAuthor

    Folded finding. This was filed as a separate issue, but 1 open agent-filed issue (plus 3 closed as completed in the last 14 days) already cite docs/contributing.md, so it was folded into the oldest of them instead of opening another. Treat this issue as the tracker for that component: prefer one structural fix that covers every folded variant over a PR per variant.

    [quality] Add src/utils/auth.ts, owners.ts and pullRequestOwners.ts to the nightly mutation set

    Finding

    The scheduled mutation job (stryker.nightly.config.mjs, run by .github/workflows/test.yml) guards the merge decision: mergeGate.ts, labelMatch.ts, labels/hold.ts, duration.ts, tide.ts, mergeQueue.ts, approve.ts (and, once #721 lands, lgtmBinding.ts and labels/lgtm.ts). It does not guard the code that decides who may run the commands that feed that decision: src/utils/auth.ts (policyAllows, assertPolicy, closePolicyAllows, assertAuthorizedByOwnersOrMembership, the OWNERS role checks), src/utils/owners.ts (parseOwners, ownersInclude, expandGroups, the directory walk) and src/utils/pullRequestOwners.ts.

    Line coverage cannot see a regression there. At afe75b9 the unit run holds these files at 100 % lines/functions/statements (npm run test:coverage: 1903/1905 branches overall, the two misses being the phantom await branches docs/contributing.md documents), and the bundle run of the same commit does too (e2e-coverage job of run 44993652121, artifact coverage-e2e-afe75b9...: 1763/1765 branches, same two phantoms). So an inverted guard in policyAllows (an outsider admitted under trusted, say) keeps both coverage gates green, and nothing scheduled would notice until a user did.

    The good news is that the suite already kills nearly everything. Probe at afe75b9, npx stryker run --mutate src/utils/auth.ts,src/utils/owners.ts,src/utils/pullRequestOwners.ts (perTest, 2 runners, 20 min):

    File Mutants Killed Timeout Survived Score
    src/utils/auth.ts 284 281 0 3 98.94 %
    src/utils/owners.ts 340 331 8 1 99.71 %
    src/utils/pullRequestOwners.ts 57 57 0 0 100 %

    The four survivors were each re-read and are equivalent (table below). The eight timeouts are the ownersDir walk-up loop (owners.ts:210-263) made non-terminating, which Stryker counts as killed. This is a gate-coverage finding, not a coverage gap: there is no test to add today, only a gate to extend so tomorrow's regression fails a scheduled run.

    Recommendation

    Add the three files to the nightly set, the way #721 adds the lgtm pair. The change is mechanical and touches the same three files as #721, so it should land after #721 merges (a second PR on the same lines would only force a rebase):

    1. stryker.nightly.config.mjs, the mutate line:

      mutate: [...base.mutate, 'src/plugins/tide.ts', 'src/utils/mergeQueue.ts', 'src/plugins/approve.ts', 'src/plugins/lgtmBinding.ts', 'src/labels/lgtm.ts', 'src/utils/auth.ts', 'src/utils/owners.ts', 'src/utils/pullRequestOwners.ts'],

      and extend the doc comment with the probe figures above (99.41 % over 681 mutants at afe75b9; the break of 94 holds, the combined set rises to about 96.5 %).

    2. __tests__/mutationConfig.test.ts, the "adds the files" assertion: add 'src/utils/auth.ts', 'src/utils/owners.ts', 'src/utils/pullRequestOwners.ts' to the sorted expected list (the test is what fails without the config change).

    3. docs/contributing.md, "Mutation checks": name the three files next to tide.ts / mergeQueue.ts / approve.ts (the is documented file for file test requires it) and add their reviewed survivors:

      Mutant Why it is left
      auth.ts:439 contents === '' guard of rootOwnersIncludes → false / placeholder / empty block parseOwners('OWNERS', '') yields empty roles and ownersInclude with an empty list returns false before expandGroups makes any request, so the guard only saves a parse; the same guard in assertRootOwner (:378) is killed because there the two arms differ (fall back to membership versus throw)
      owners.ts:39 contents.trim() === '' → contents === '' yaml.load of a whitespace-only string returns undefined, which the following typeof loaded === 'object' guard turns into the same {}

    Runtime: the mutation job took 19 minutes at afe75b9 for 1329 mutants; with #721 (+194) and this (+681) it lands near 30 minutes, inside its timeout-minutes: 60.

    Decision taken by hive: nightly set rather than the local default (stryker.config.mjs), for the reason #721 gives: the per-push npm run test:mutation round-trip cannot absorb 681 more mutants, the scheduled job can.

    Priority


    Filed by quality agent (hold-gated mode)


    🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: afe75b9


    Folded finding. This was filed as a separate issue, but 1 open agent-filed issue (plus 3 closed as completed in the last 14 days) already cite docs/contributing.md, so it was folded into the oldest of them instead of opening another. Treat this issue as the tracker for that component: prefer one structural fix that covers every folded variant over a PR per variant.

    [quality] Gate proposal: every implemented command must have a bundle scenario (11 of 42 undriven at afe75b9, including /remove-approve and /remove-hold)

    Finding

    __tests__/commands.test.ts already pins two contracts: every command the dispatcher implements has a row in docs/commands.md, and every documented row has a handler. Nothing pins the third leg: that each implemented command is actually driven through dist/index.js by the bundle acceptance harness under __tests__/bundle/.

    At main@afe75b9, taking the same implemented set that commands.test.ts computes (hand-written handlers, the dispatcher's commandAliases table, prefixedLabelCommands and fixedLabelCommands plus their /remove- forms: 42 commands) and searching every __tests__/bundle/*.test.ts for the command as a quoted comment body, 11 are never the body of any bundle scenario:

    • /remove-approve (its own hasCommand('/remove-approve', commentBody) operand in the approve handler's isCancel)
    • /remove-hold (its own hasCommand('/remove-hold', commentBody) operand in the hold handler's cancel)
    • /area, /priority (exclusive: true), /stage, /status
    • /remove-area, /remove-priority, /remove-lifecycle, /remove-stage, /remove-status

    The e2e coverage gate (vitest.e2e-coverage.config.mjs, 99 % lines and branches) cannot see this: /remove-approve and /remove-hold are left-hand operands of || chains whose right-hand operand always runs, so lines and v8 branches read as covered when only /approve cancel and /hold cancel / /unhold are driven. The prefixed commands share one code path with /kind, so they too are line-covered while their data rows (exclusive, registry defaults) are exercised by unit tests only.

    Coverage evidence at afe75b9, both reproduced locally this kick: unit npm run test:coverage 100 / 99.89 / 100 / 100 (3012 tests; the two branch misses are the post-await v8 artefacts documented in docs/contributing.md); e2e npm run test:coverage:e2e 100 / 99.88 / 100 / 100 (581 tests, same two artefacts). Nightly run 44993652121 on the same SHA: every job green. This is therefore not a coverage-gap filing: every line is reached by both suites. It is a measurement blind spot of the e2e gate.

    Why a gate and not another finding

    This is at least the sixth instance of the class "unit-covered command or arm that no bundle scenario drives" this lane has filed in this repository (#251 for the /hold aliases and /remove success, #295 for the plain /close and /milestone refusals, the status-event path of the check-suite tide hook, root-OWNERS authorization, the configured blunderbuss section). #251 named /remove-hold specifically; the PR that closed it (#252) added dispatcherArms.test.ts for the prow-commands input arms and never drove /remove-hold, and nothing since has noticed, which is what a missing gate looks like.

    Proposed gate

    Extend __tests__/commands.test.ts (same file, same implemented set, no new tooling) with a third contract:

    // the commands no bundle scenario drives yet; this list may only shrink
    const undrivenInBundle = new Set([
      '/remove-approve', '/remove-hold',
      '/area', '/priority', '/stage', '/status',
      '/remove-area', '/remove-priority', '/remove-lifecycle', '/remove-stage', '/remove-status',
    ])
    
    it('drives every other implemented command through dist/index.js', () => {
      const bodies = readdirSync(bundleDir).filter(f => f.endsWith('.test.ts'))
        .map(f => read(join(bundleDir, f))).join('\n')
      for (const cmd of implemented) {
        const driven = new RegExp(`['"\`]${cmd}(?:[ '"\`\\\\\\n]|$)`).test(bodies)
        if (undrivenInBundle.has(cmd))
          expect(driven, `${cmd} now has a bundle scenario; remove it from undrivenInBundle`).toBe(false)
        else
          expect(driven, `${cmd} is implemented but no __tests__/bundle scenario drives it`).toBe(true)
      }
    })

    Seeded with today's 11 so it is green on main from the first commit; a new command or alias without a bundle scenario fails build-test, and a scenario that lands for a seeded command fails until the seed entry is removed, so the list only ratchets down. A follow-up PR would then drive /remove-approve and /remove-hold (one scenario each, modelled on the existing /hold cancel and /approve cancel bundle cases) and delete those two entries; the nine prefixed-command rows can follow at the maintainers' pace or stay seeded if the shared /kind path is judged sufficient.

    Decision taken by hive: the gate lives in the existing commands.test.ts rather than a new file, matches on quoted comment bodies (the form every bundle scenario uses), and is seeded rather than enforced from zero so it lands without any new scenario. Test-only change; no src/ or workflow edit.

    Note: a first copy of this proposal was folded by the hive into #748 (a docs-table finding already covered by PR #749) on a component key it does not share; this standalone filing is the one to decide on.

    What is being asked

    Accept or decline the gate. If accepted, the lane opens one hold-gated PR with the contract test and the two alias scenarios. If declined, the lane resumes filing the individual gaps above as separate findings.

    Risk: governance

    Priority

    • Impact: medium
    • Effort: low

    Filed by quality agent (hold-gated mode)


    🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: unknown


    Folded finding. This was filed as a separate issue, but 1 open agent-filed issue (plus 3 closed as completed in the last 14 days) already cite docs/contributing.md, so it was folded into the oldest of them instead of opening another. Treat this issue as the tracker for that component: prefer one structural fix that covers every folded variant over a PR per variant.

    [quality] Three JSON fixtures under tests/fixtures are imported by no test; add a guard so fixtures cannot go orphan again

    Finding

    At main (afe75b9) three recorded GitHub payloads under __tests__/fixtures are imported by no file under __tests__ (searched every .ts, .cjs, .mjs for the string fixtures/ followed by the file's path; nothing loads fixtures dynamically):

    • __tests__/fixtures/pullReq/pullCommentEvent.json (14.6 KB)
    • __tests__/fixtures/pullReq/pullReqListFiles.json
    • __tests__/fixtures/issues/unassign/issueListAssignees.json

    Their last consumers were removed in #143 (pr-labeler cron job) and #146 (routing rework); the fixtures stayed. Dead fixtures read as tested cases and have no test to fail when the recorded shape drifts. No existing gate catches this: the repo has no unused-file detector (no knip / ts-prune / depcheck), coverageIgnoreHints.test.ts checks hint-to-test links but not fixture-to-test links, and docs/contributing.md describes fixture mutation hazards only.

    Not a coverage gap: unit coverage at afe75b9 is 100 stmts / 99.89 branches / 100 funcs / 100 lines (npm run test:coverage), e2e 100 / 99.88 / 100 / 100 (nightly coverage-e2e-afe75b9); the only branch misses are the documented v8 post-await phantoms. This is test-infrastructure hygiene.

    Recommendation

    One PR:

    • Delete the three orphan fixtures.
    • Add __tests__/fixturesReferenced.test.ts: a static walker in the style of coverageIgnoreHints.test.ts that asserts every __tests__/fixtures/**/*.json is named by its fixtures-relative path in at least one .ts, .cjs or .mjs file under __tests__. It fails on today's tree (3 failures) and passes once the orphans are gone.

    Decision taken by hive: a static reference walker is the smallest additive gate; a dependency-level tool (knip) would be a new devDependency and a wider policy than this finding needs.

    Priority

    • Impact: low
    • Effort: low

    Filed by quality agent (hold-gated mode)


    🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: afe75b9


    Folded finding. This was filed as a separate issue, but 1 open agent-filed issue (plus 3 closed as completed in the last 14 days) already cite stryker.nightly.config.mjs, so it was folded into the oldest of them instead of opening another. Treat this issue as the tracker for that component: prefer one structural fix that covers every folded variant over a PR per variant.

    [quality] parseOwners: whitespace-only OWNERS file parses as empty only because of .trim(); no test pins it (sole behavioural mutation survivor in src/utils/owners.ts)

    Finding

    parseOwners in src/utils/owners.ts:39 trims the file contents before handing them to yaml.load:

    const loaded: unknown = contents.trim() === '' ? {} : yaml.load(contents)

    That .trim() is load-bearing since the js-yaml 5 bump (#126): js-yaml 5.x throws YAMLException: expected a document, but the input is empty on whitespace-only input, where 4.x returned undefined. An OWNERS file that holds only a newline (a common state for a file created and left empty by an editor) therefore parses as "no owners" only because of the trim. Without it, every command that reads OWNERS (/lgtm, /approve, /assign, owners-label, blunderbuss, the merge decision) would fail the run with a YAML error instead.

    No test pins this. __tests__/utils/owners.test.ts ("treats an empty role and an empty file as no members") checks '' only, which yaml.load is never reached for either way.

    Evidence (a Stryker probe at afe75b9, npx stryker run stryker.config.mjs --mutate src/utils/owners.ts, 340 mutants, 26m53s): 327 killed, 12 timeouts, 1 survived, the MethodExpression mutant contents.trim() === '' to contents === '', with "Ran all tests for this mutant". Every other mutant in the file died. src/utils/owners.ts is not in the Stryker mutate set (default or nightly), so the mutation job would not have caught this survivor; a sibling probe of src/utils/auth.ts (284 mutants) left only one equivalent survivor (rootOwnersIncludes's contents === '' shortcut, unobservable because ownersInclude([]) makes no call), so this is the one behavioural survivor across both files.

    Unit coverage at afe75b9 (vitest run --coverage): 100 / 99.89 / 100 / 100; e2e bundle coverage (npm run test:coverage:e2e, 93 files, 581 tests): 100 / 99.88 / 100 / 100. Both reach line 39, so this is not a line-coverage gap, which is why it shows up only under mutation.

    Recommendation

    • Add a parseOwners case to __tests__/utils/owners.test.ts that feeds whitespace-only contents ('\n', blank lines, spaces and tabs) and asserts the full empty OwnersFile shape. It passes on main and fails with 4 failures when the .trim() is removed.

    Adding src/utils/owners.ts to the nightly Stryker set is deliberately left out of this issue: stryker.nightly.config.mjs is being changed by #721 and a second edit to that file would conflict with it.

    Priority

    • Impact: medium (a one-newline OWNERS file would turn every OWNERS-backed command into a run failure if the trim were lost; no test would notice)
    • Effort: low

    Filed by quality agent (hold-gated mode)


    🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: afe75b9


    Folded finding. This was filed as a separate issue, but 1 open agent-filed issue (plus 3 closed as completed in the last 14 days) already cite docs/contributing.md, so it was folded into the oldest of them instead of opening another. Treat this issue as the tracker for that component: prefer one structural fix that covers every folded variant over a PR per variant.

    [quality] contributing.md still lists hold.ts:27 and hold.ts:70-71 as reviewed mutation survivors; #737 kills them

    Finding

    docs/contributing.md, table "Reviewed survivors of the default set" (lines 271-272 at afe75b9), still records two src/labels/hold.ts mutants as equivalent survivors:

    Mutant Why it is left
    hold.ts:27 context.payload.comment?.body → .comment.body Every issue_comment event carries comment; the two differ only on a payload GitHub never sends
    hold.ts:70-71 present.length === 0 guard and its platform().log.debug text removeLabels with an empty list issues no request, so the guard only saves a loop; the debug message is not asserted

    #737 (merged) added the tests that kill them. The scheduled mutation job at afe75b9 (run 45125155064, artifact mutation-afe75b97240692e3a3ec7da91a3195a1ce321200) reports hold.ts 42 killed / 0 survived; the six mutants on those lines (:27 OptionalChaining; :70 ConditionalExpression x2, BlockStatement, EqualityOperator; :71 StringLiteral) are all Killed. The table therefore documents an equivalence that no longer holds, and a reader deciding whether a future hold.ts survivor is "already reviewed" would be misled.

    Recommendation

    Delete the two rows quoted above from the "Reviewed survivors of the default set" table in docs/contributing.md. Nothing else in the section refers to them; the sentence at line 183 naming src/labels/hold.ts as part of the default mutate set stays correct.

    Decision taken by hive: this is filed as an issue rather than a PR because the same section of docs/contributing.md is already being edited by held PR #721 (it appends the lgtmBinding/lgtm survivor tables). Landing a second PR over the same section would only create a rebase for whichever merges last; whoever lands #721, or a follow-up once it merges, can drop the two rows in the same pass.

    • hold.ts:27 row removed
    • hold.ts:70-71 row removed

    Priority

    • Impact: low (documentation of the mutation gate, no code or gate behaviour changes)
    • Effort: low (two-line deletion)

    Filed by quality agent (hold-gated mode)


    🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: afe75b9


    Folded finding. This was filed as a separate issue, but 1 open agent-filed issue (plus 3 closed as completed in the last 14 days) already cite docs/contributing.md, so it was folded into the oldest of them instead of opening another. Treat this issue as the tracker for that component: prefer one structural fix that covers every folded variant over a PR per variant.

    [quality] Nightly mutation gate: break 94 admits up to 19 new survivors; check survivors against an explicit allowlist

    Finding

    The scheduled mutation job of .github/workflows/test.yml runs stryker.nightly.config.mjs with thresholds.break: 94. The config comment states the intent: the break is set "just under what main reaches ... so a new behavioural survivor fails the nightly run instead of waiting for someone to run the check by hand".

    A percentage threshold cannot deliver that. At afe75b9 the job (run 45125155064, job mutation) reports 1268 killed, 1 timeout, 60 survived over 1329 mutants, a score of 95.49 %. Every one of those 60 survivors is already triaged as equivalent in the three tables of docs/contributing.md ("Mutation checks"). But 94 % of 1329 allows 79 survivors, so:

    • one new behavioural survivor scores 95.41 % and the job stays green;
    • 19 new survivors pass before the job goes red;
    • the gate cannot tell a triaged-equivalent survivor from a new one, so a surviving mutant only becomes visible when someone reads the clear-text log and compares it against the tables by hand.

    Each file added to the nightly mutate set (as #721 proposes) widens that headroom further, because the break is a percentage of a growing total.

    This is a gate-configuration finding about stryker.nightly.config.mjs and the test:mutation:nightly npm script. It is not a coverage gap: unit and bundle coverage at the same revision are at 100 % lines, statements and functions, and the only branch misses are the documented negative-count await artefacts.

    Recommendation

    Make the nightly gate exact instead of proportional: fail the run on any survivor that is not on an explicit allowlist, and keep the break score only as a backstop.

    Decision taken by hive: an allowlist checked after stryker run, rather than raising break to just under the current score. A tighter percentage would still admit one survivor whenever the total grows, and would need to move every time a file joins mutate.

    • Add a committed allowlist of reviewed survivors (one file:line per entry, for example reports/mutation/allowed-survivors.txt or a JSON file next to the Stryker configs), seeded from the three tables in docs/contributing.md.
    • Add a small Node script (for example __tests__/mutation/checkSurvivors.mjs) that reads reports/mutation/report.json (the json reporter already writes it), collects mutants with status: "Survived" as file:line, and exits non-zero listing any entry not on the allowlist, and any allowlist entry that no longer survives (so the list cannot rot).
    • Chain it into the existing npm script: "test:mutation:nightly": "stryker run stryker.nightly.config.mjs && node __tests__/mutation/checkSurvivors.mjs". No workflow change is needed; the job already runs that script.
    • Extend __tests__/mutationConfig.test.ts to pin that every allowlist entry is named in a docs/contributing.md table row and vice versa, so the "why" and the gate stay in step.
    • Update the break comment in stryker.nightly.config.mjs to describe it as the backstop it is.

    Sequencing: #721 edits stryker.nightly.config.mjs, __tests__/mutationConfig.test.ts and docs/contributing.md, the same files this change needs. The PR for this issue should be cut after #721 lands (or on top of it) to avoid two held PRs over the same lines.

    Priority

    • Impact: medium (the gate exists and is green, but it does not detect the regression class its own comment says it is there for)
    • Effort: low

    Filed by quality agent (hold-gated mode)


    🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: afe75b9


    Folded finding. This was filed as a separate issue, but 1 open agent-filed issue (plus 3 closed as completed in the last 14 days) already cite docs/contributing.md, so it was folded into the oldest of them instead of opening another. Treat this issue as the tracker for that component: prefer one structural fix that covers every folded variant over a PR per variant.

    [quality] Gate proposal: nightly mutation job checks survivors against an explicit allowlist (break 94 admits up to 19 new survivors)

    Risk: governance

    Maintainer decision requested: accept or decline replacing the proportional nightly mutation gate with an exact survivor allowlist that must be updated whenever a reviewed-equivalent survivor is added to the tables in docs/contributing.md.

    Finding

    The scheduled mutation job of .github/workflows/test.yml runs stryker.nightly.config.mjs with thresholds.break: 94. The config comment states the intent: the break is set "just under what main reaches ... so a new behavioural survivor fails the nightly run instead of waiting for someone to run the check by hand".

    A percentage threshold cannot deliver that. At afe75b9 the job (run 45125155064, job mutation) reports 1268 killed, 1 timeout, 60 survived over 1329 mutants, a score of 95.49 %. Every one of those 60 survivors is already triaged as equivalent in the three tables of docs/contributing.md ("Mutation checks"). But 94 % of 1329 allows 79 survivors, so:

    • one new behavioural survivor scores 95.41 % and the job stays green;
    • 19 new survivors pass before the job goes red;
    • the gate cannot tell a triaged-equivalent survivor from a new one, so a surviving mutant only becomes visible when someone reads the clear-text log and compares it against the tables by hand.

    Each file added to the nightly mutate set (as #721 proposes) widens that headroom further, because the break is a percentage of a growing total.

    This is a gate-configuration finding about stryker.nightly.config.mjs and the test:mutation:nightly npm script. It is not a coverage gap: unit and bundle coverage at the same revision are at 100 % lines, statements and functions, and the only branch misses are the documented negative-count await artefacts.

    Recommendation

    Make the nightly gate exact instead of proportional: fail the run on any survivor that is not on an explicit allowlist, and keep the break score only as a backstop.

    Decision taken by hive: an allowlist checked after stryker run, rather than raising break to just under the current score. A tighter percentage would still admit one survivor whenever the total grows, and would need to move every time a file joins mutate.

    • Add a committed allowlist of reviewed survivors (one file:line per entry, for example reports/mutation/allowed-survivors.txt or a JSON file next to the Stryker configs), seeded from the three tables in docs/contributing.md.
    • Add a small Node script (for example __tests__/mutation/checkSurvivors.mjs) that reads reports/mutation/report.json (the json reporter already writes it), collects mutants with status: "Survived" as file:line, and exits non-zero listing any entry not on the allowlist, and any allowlist entry that no longer survives (so the list cannot rot).
    • Chain it into the existing npm script: "test:mutation:nightly": "stryker run stryker.nightly.config.mjs && node __tests__/mutation/checkSurvivors.mjs". No workflow change is needed; the job already runs that script.
    • Extend __tests__/mutationConfig.test.ts to pin that every allowlist entry is named in a docs/contributing.md table row and vice versa, so the "why" and the gate stay in step.
    • Update the break comment in stryker.nightly.config.mjs to describe it as the backstop it is.

    Sequencing: #721 edits stryker.nightly.config.mjs, __tests__/mutationConfig.test.ts and docs/contributing.md, the same files this change needs. The PR for this issue should be cut after #721 lands (or on top of it) to avoid two held PRs over the same lines.

    Priority

    • Impact: medium (the gate exists and is green, but it does not detect the regression class its own comment says it is there for)
    • Effort: low

    Filed by quality agent (hold-gated mode)


    🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: afe75b9


    Folded finding. This was filed as a separate issue, but 1 open agent-filed issue (plus 3 closed as completed in the last 14 days) already cite docs/contributing.md, so it was folded into the oldest of them instead of opening another. Treat this issue as the tracker for that component: prefer one structural fix that covers every folded variant over a PR per variant.

    [quality] config.ts: a bare section key (yaml null) is rejected only by isMapping's null guard, and no test pins it

    Finding

    Unit and end-to-end coverage are both saturated on main @ afe75b9 (npm run test:coverage: 100 % lines/functions/statements, 99.89 % branches; npm run test:coverage:e2e: 100 % lines, 99.88 % branches; the two branch misses in each are the v8 phantom arms documented in docs/contributing.md). So this is not a line-coverage gap; it comes from a mutation probe of a file outside the nightly set:

    npx stryker run --mutate src/utils/config.ts --ignoreStatic stryker.config.mjs   # @ afe75b9
    # 730 mutants: 712 killed, 12 timeout, 6 survived

    The survivor that matters is src/utils/config.ts:876, isMapping's value !== null replaced by true. A bare key in prow.yaml (tide: with nothing under it, which is what a file looks like after its nested lines are commented out) loads as null. That is not undefined, so parseProwConfig hands it to the section's normalizer, and the null half of isMapping is the only thing between the user and a TypeError: Cannot read properties of null on the first property read. Today every mapping section (tide, hold, blunderbuss, approve, lgtm, sweep, authorization) answers x: <key> must be a mapping, require_matching_label: answers must be a list, and a bare labels: or a bare section under it answers the malformed-section message, but no test passes null to any of them: the existing "must be a mapping" cases in __tests__/utils/config.test.ts and configTypeGuards.test.ts use a list, string, number or boolean.

    The other five survivors look equivalent and are not findings: L243 (debug log text), L312 (kind: 'repo' is only ever compared with 'url'), L618 (undefined < n is false either way), L765 (the sweep.lookback label in resolveSweepLookback is unreachable once normalizeSweep has validated the string), L799 (case-folding direction of the dedupe key).

    Recommendation

    Pin the bare-key behaviour in __tests__/utils/configTypeGuards.test.ts: one it.each over the seven mapping sections, one case for require_matching_label:, and one for a bare labels: / bare section under labels. Eight of those cases fail under the L876 mutant.

    Decision taken by hive: src/utils/config.ts is not added to stryker.nightly.config.mjs here. #721 already edits that file's mutate list and is awaiting review, and config.ts alone adds ~730 mutants (about 35 minutes at 4 workers with static mutants ignored) to the nightly job. Whether to grow the nightly set that much is a separate call once #721 lands.

    Priority

    • Impact: medium (a regression in the guard turns a friendly config error into a raw TypeError on a common misconfiguration)
    • Effort: low

    Filed by quality agent (hold-gated mode)


    🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: afe75b9


    Folded finding. This was filed as a separate issue, but 1 open agent-filed issue (plus 3 closed as completed in the last 14 days) already cite docs/contributing.md, so it was folded into the oldest of them instead of opening another. Treat this issue as the tracker for that component: prefer one structural fix that covers every folded variant over a PR per variant.

    [quality] workflows.test.ts input scan reads the Stryker-instrumented src/ and fails the dry run once meow.ts joins the mutate set

    Finding

    __tests__/workflows.test.ts (inputReads()) proves action.yml declares exactly the inputs src/ reads by regex-scanning the src/ tree from disk:

    /\b(?:get(?:Boolean|Multiline)?Input|inputs\s*\.\s*get)\(\s*(['"`])([^'"`]+)\1/g

    Under Stryker that scan reads the instrumented copy in .stryker-tmp/sandbox-*/src, where a string argument becomes

    platform().inputs.get(stryMutAct_9fa48("38") ? "" : (stryCov_9fa48("38"), 'cat-api-key'), ...)

    and no longer matches. cat-api-key is read only by src/issueComment/meow.ts, so with meow.ts in the mutate set the key disappears from reads and declares no input src/ never reads fails:

    ERROR DryRunExecutor One or more tests failed in the initial test run:
      action.yml mirrors the inputs src/ reads > declares no input src/ never reads
        expected [ 'config', 'dry-run', …(4) ] to deeply equal [ 'cat-api-key', 'config', …(5) ]
    ERROR Stryker There were failed tests in the initial test run.
    

    Reproduced at afe75b9 with @stryker-mutator/core / vitest-runner 10.1.1:

    • npx stryker run --mutate src/issueComment/meow.ts,src/labels/prefixed.ts fails the initial test run as above.
    • npx stryker run --mutate src/issueComment/meow.ts,src/plugins/tide.ts --dryRunOnly passes: the vitest runner's vitest.related (default on) only runs test files that import a mutated file, and workflows.test.ts imports labels/fixed, labels/prefixed, utils/config and utils/labelCatalog, none of which is mutated in that pair.
    • The nightly set is safe today only by accident: tide.ts is its one inputs.get reader, and Stryker's nested conditional mutants on line 313 copy the original inputs.get('merge-method', { text verbatim into the mutant arms, so the regex still finds it.

    So the failure needs two things at once: a sole-reader file in mutate (today only meow.ts), and any of those four imports in mutate. The nightly set has grown three times (tide, mergeQueue, approve; #721 proposes lgtmBinding and labels/lgtm); the next person to add meow.ts next to prefixed.ts or config.ts gets a red mutation job that points at action.yml rather than at the cause.

    Recommendation

    Decision taken by hive: keep the regex and the test as they are (they guard a real property of action.yml) and make the scan read the committed tree, not the sandbox copy, when Stryker is active. Stryker exposes the original project root to the sandboxed process; the smallest change that keeps every assertion is in __tests__/utils/workflowYaml.ts, where root is derived:

    // Stryker runs the suite from a sandbox copy whose src/ is instrumented; the
    // workflow and input scans must read the committed tree, so resolve the root
    // through the sandbox's symlinked node_modules back to the real checkout.
    export const root = realpathSync(path.resolve(__dirname, '../../node_modules/..'))

    (.stryker-tmp/sandbox-*/node_modules is a symlink to the project's node_modules, so realpathSync lands on the real checkout; outside Stryker it is a no-op.) Alternatives considered and not taken: excluding workflows.test.ts in vitest.mutation.config.mjs loses its kill power over labelCatalog.ts and prefixed.ts should either join the set; loosening the regex to accept the stryMutAct_... wrapper couples a test to Stryker's instrumentation format.

    A one-line pin belongs next to it: a test under __tests__/ that asserts root is a directory containing action.yml and .git (the sandbox copy has no .git), so the resolution cannot silently fall back to the sandbox.

    Not opened as a PR this kick because #721 (open, hold-gated) already edits docs/contributing.md "Mutation checks" and __tests__/mutationConfig.test.ts, where the explanatory note and the pin would otherwise go; land this after #721 or rebase it on top.

    Priority

    • Impact: low (latent; only bites when the mutate set grows to include meow.ts)
    • Effort: low

    Filed by quality agent (hold-gated mode)


    🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: afe75b9


    Folded finding. This was filed as a separate issue, but 1 open agent-filed issue (plus 3 closed as completed in the last 14 days) already cite stryker.nightly.config.mjs, so it was folded into the oldest of them instead of opening another. Treat this issue as the tracker for that component: prefer one structural fix that covers every folded variant over a PR per variant.

    [quality] workflows.test.ts, worker/entryPoints.test.ts and worker/wranglerConfig.test.ts read src/ from the Stryker sandbox copy; no test pins that src-as-text suites use treeRoot()

    Finding

    #736 added __tests__/treeRoot.ts and switched commands.test.ts and jobsDocs.test.ts to read the dispatchers from the tree rather than from the Stryker sandbox copy, where mutated files are instrumented and the text patterns no longer match. Three suites that pattern-match src/ text still resolve root with path.resolve(__dirname, ...):

    • __tests__/utils/workflowYaml.ts (root for workflows.test.ts, whose inputReads() scans every src/**/*.ts for getInput('...'), and for worker/entryPoints.test.ts, which scans src/server/worker.ts)
    • __tests__/worker/wranglerConfig.test.ts (scans src/server/worker.ts for env.X and src/adapters/app/settings.ts for required(env, 'X'))

    Reproduced at afe75b9 with a probe config over src/issueComment/meow.ts and src/labels/prefixed.ts (npx stryker run <probe> --dryRunOnly): prefixed.ts makes workflows.test.ts related, the instrumented getInput(stryMutAct_9fa48(...) ? "" : (..., 'cat-api-key')) in meow.ts no longer matches, and the dry run fails before any mutant is tested:

    ERROR DryRunExecutor One or more tests failed in the initial test run:
    	action.yml mirrors the inputs src/ reads > declares no input src/ never reads
    		expected [ 'config', 'dry-run', ...(4) ] to deeply equal [ 'cat-api-key', 'config', ...(5) ]
    

    __tests__/setup.ts imports src/adapters/actions.ts and src/platform/index.ts, so a --mutate over either relates every suite, including the worker ones. Any extension of stryker.nightly.config.mjs to a file that reaches these suites would turn the scheduled mutation job red for a reason that has nothing to do with the tests' assertions.

    This is the fifth site of one class (two fixed in #736, three remaining), and nothing pins the remedy: a new suite that reads src/ as text would read the sandbox copy again.

    Recommendation

    Decision taken by hive: this is not filed as a parked gate proposal because the maintainers already chose the remedy in #736; the pin only extends it to the remaining sites and keeps it from regressing. No src/ or workflow change is involved.

    Priority

    • Impact: medium (blocks widening the nightly mutation set; no production behaviour affected)
    • Effort: low

    Filed by quality agent (hold-gated mode)


    🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: afe75b9

  4. hivecommons-hive commented on Nov 22, 2026

    @hivecommons-hive
    ContributorAuthor

    Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor.

    • quality (2026-11-22 21:14 UTC): Correction to the folded "Add src/utils/auth.ts, owners.ts and pullRequestOwners.ts to the nightly mutation set" finding above, so its reviewed-survivor table is not copied into docs/contributing.md as written.

      The row for owners.ts:39 (contents.trim() === '' to contents === '') says yaml.load of a whitespace-only string returns undefined. That is js-yaml 4 behaviour. This repository pins js-yaml ^5.5.0 (chore(deps-dev): Bump js-yaml from 4.3.2 to 5.4.1 #126), and 5.x throws instead:

      $ node -e "require('js-yaml').load('\n')"
      YAMLException: expected a document, but the input is empty
      

      So the mutant is behavioural, not equivalent: without the trim, an OWNERS file holding only a newline fails every OWNERS-backed command with a YAML error. Re-probed at afe75b9 (npx stryker run stryker.config.mjs --mutate src/utils/owners.ts, 340 mutants, 26m53s): 327 killed, 12 timeouts, that one survivor, "Ran all tests for this mutant". The auth.ts:439 row stands (re-probed too: 281/284, the same three equivalent survivors, ownersInclude([]) makes no request).

      test(owners): pin that a whitespace-only OWNERS file parses as empty, not as invalid YAML #756 adds the four whitespace-only parseOwners cases that kill it (they fail, 4 cases, with the trim removed). When the nightly-set extension lands after test(mutation): add lgtmBinding.ts and labels/lgtm.ts to the nightly mutation set #721, owners.ts should then need no reviewed-survivor row at all; only the auth.ts:439 row remains to document.

  5. hivecommons-hive commented on Nov 24, 2026

    @hivecommons-hive
    ContributorAuthor

    Distinct finding, folded here by the hive (three attempts to open it standalone were consolidated into this issue on the shared docs/contributing.md mention; it is not about command.ts and PR #752 does not address it).

    Nightly mutation gate cannot detect a single new survivor. stryker.nightly.config.mjs sets thresholds.break: 94 with the stated intent that "a new behavioural survivor fails the nightly run". At afe75b9 the scheduled job (run 45125155064, job mutation) reports 1268 killed, 1 timeout, 60 survived over 1329 mutants = 95.49 %. All 60 survivors are already triaged as equivalent in the three tables of docs/contributing.md. 94 % of 1329 admits 79 survivors, so one new behavioural survivor scores 95.41 % and the job stays green; 19 pass before it goes red. Every file added to mutate (#721) widens the headroom, because the break is a percentage of a growing total.

    Proposal (maintainer decision, Risk: governance): make the gate exact. Keep break as a backstop and additionally fail the nightly run on any survivor not on a committed allowlist:

    • allowlist of reviewed survivors, one file:line per entry, seeded from the docs/contributing.md tables
    • __tests__/mutation/checkSurvivors.mjs reads reports/mutation/report.json (the json reporter already writes it), exits non-zero on any Survived mutant not on the list and on any list entry that no longer survives
    • "test:mutation:nightly": "stryker run stryker.nightly.config.mjs && node __tests__/mutation/checkSurvivors.mjs" (no workflow change needed)
    • __tests__/mutationConfig.test.ts pins allowlist entries and table rows against each other
    • reword the break comment in stryker.nightly.config.mjs as the backstop it is

    Decision taken by hive on approach: an allowlist rather than a tighter percentage, which would still admit one survivor whenever the total grows. Sequencing: the PR must be cut after #721 lands, since it edits the same three files.

    Not a coverage gap: unit (build-test, Node 24.22.3) and bundle (e2e-coverage) runs at the same revision are 100 % lines/statements/functions; the two branch misses are the documented negative-count await artefacts.

    • hive: agent=quality

    🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: afe75b9

  6. hivecommons-hive commented on Nov 25, 2026

    @hivecommons-hive
    ContributorAuthor

    Distinct finding, folded here by the hive on the shared docs/contributing.md mention; it is not about command.ts and no open PR addresses it.

    __tests__/workflows.test.ts reads the Stryker-instrumented src/ and fails the dry run once meow.ts joins the mutate set.

    inputReads() proves action.yml declares exactly the inputs src/ reads by regex-scanning src/ from disk. In the Stryker sandbox that is the instrumented copy, where inputs.get('cat-api-key', ...) has become inputs.get(stryMutAct_9fa48("38") ? "" : (stryCov_9fa48("38"), 'cat-api-key'), ...) and no longer matches. cat-api-key is read only by src/issueComment/meow.ts, so with meow.ts mutated the key vanishes from reads and declares no input src/ never reads fails:

    ERROR DryRunExecutor One or more tests failed in the initial test run:
      action.yml mirrors the inputs src/ reads > declares no input src/ never reads
        expected [ 'config', 'dry-run', …(4) ] to deeply equal [ 'cat-api-key', 'config', …(5) ]
    

    Reproduced at afe75b9 (@stryker-mutator/core and vitest-runner 10.1.1):

    • npx stryker run --mutate src/issueComment/meow.ts,src/labels/prefixed.ts fails the initial test run as above.
    • npx stryker run --mutate src/issueComment/meow.ts,src/plugins/tide.ts --dryRunOnly passes: the runner's vitest.related (default on) runs only test files that import a mutated file, and workflows.test.ts imports labels/fixed, labels/prefixed, utils/config and utils/labelCatalog, none of which is in that pair.
    • The nightly set is safe today by accident: tide.ts is its one inputs.get reader, and the nested conditional mutants on its line 313 copy the original inputs.get('merge-method', { text verbatim into the mutant arms, so the regex still finds it.

    So it needs two things at once: a sole-reader file in mutate (today only meow.ts) and any of those four imports in mutate. The nightly set has grown three times and #721 proposes two more files; the next person to add meow.ts next to prefixed.ts or config.ts gets a red mutation job pointing at action.yml instead of the cause.

    Decision taken by hive: keep the regex and the assertions (they guard a real property of action.yml) and make the scan read the committed tree when Stryker is active. The sandbox's node_modules is a symlink to the real checkout's, so in __tests__/utils/workflowYaml.ts:

    // Stryker runs the suite from a sandbox copy whose src/ is instrumented; the
    // workflow and input scans must read the committed tree, so resolve the root
    // through the sandbox's symlinked node_modules back to the real checkout.
    export const root = path.dirname(realpathSync(path.resolve(__dirname, '../../node_modules')))

    (Not realpathSync(path.resolve(__dirname, '../../node_modules/..')): path.resolve normalises the .. away before the symlink is followed and lands back in the sandbox.) Outside Stryker it is a no-op. Pin it with a test asserting root holds action.yml and .git (the sandbox copy has no .git). Alternatives not taken: excluding workflows.test.ts in vitest.mutation.config.mjs loses its kill power over labelCatalog.ts and prefixed.ts should either join the set; loosening the regex to accept the stryMutAct_... wrapper couples a test to Stryker's instrumentation format.

    Not opened as a PR this kick: #721 (hold-gated) already edits the docs/contributing.md "Mutation checks" section and __tests__/mutationConfig.test.ts, where the note and the pin would go; land this after #721 or rebase onto it.

    • root in __tests__/utils/workflowYaml.ts resolves to the committed checkout under Stryker, with a pin

    🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: afe75b9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/qualitykind/cleanupstage/040-covered-by-prtesting

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions