Repository navigation
test(treeReads): read src/ from the tree, not the Stryker sandbox, in utils/workflowYaml.ts and worker/wranglerConfig.test.ts, and pin that every src-as-text suite uses treeRoot() - #763
Conversation
…dbox, and pin that every src-as-text suite does
workflows.test.ts scans src/ for the inputs the action reads, and
worker/entryPoints.test.ts and worker/wranglerConfig.test.ts scan
src/server/worker.ts and src/adapters/app/settings.ts for the names the
Worker dereferences. All three resolved root with path.resolve(__dirname),
so under Stryker they read the sandbox copy, where a mutated literal such as
getInput('cat-api-key') is instrumented and matches nothing: a probe over
meow.ts and prefixed.ts fails the dry run on 'declares no input src/ never
reads' before any mutant is tested. #736 already moved commands.test.ts and
jobsDocs.test.ts to treeRoot() for the same reason; this moves the remaining
two root definitions and adds treeReads.test.ts, which names every suite
that reads src/ as text, requires its root module to use treeRoot(), and
fails when a new src/-text reader appears unlisted.
Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
Important Ready for review: held for a maintainer 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. Agent PRs are held at ACMM L3-L5; an The hive's work on this PR is done. Hive will keep the |
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor.
|
There was a problem hiding this comment.
Read the tree at the PR head, ran the affected suites, and traced every importer of the changed root export. This looks correct to me; the fix does what it says.
Verified:
treeRoot()(__tests__/treeRoot.ts:17-23) resolves the tree root from both a tree path and a.stryker-tmp/sandbox-*path, so the two root changes (__tests__/utils/workflowYaml.ts:11,__tests__/worker/wranglerConfig.test.ts:20) makeworkflows.test.ts,worker/entryPoints.test.tsandworker/wranglerConfig.test.tsread uninstrumentedsrc/under Stryker, which is exactly the failure mode #736 fixed forcommands.test.tsandjobsDocs.test.ts.- The three guard tests in
__tests__/treeReads.test.tspass against the head, and thenamesSrc/readsFilessweep correctly resolves to the five listed suites (I checked each listed file contains a'src/...'literal and reads files directly or via its root module). npx vitest run __tests__/treeReads.test.ts __tests__/workflows.test.ts __tests__/coverageIgnoreHints.test.tspasses (94 tests).
One thing the body does not mention: root from workflowYaml.ts is also imported by chartAssertions.test.ts, coverageIgnoreHints.test.ts and coverageRemap.test.ts, so those three also switch from the sandbox copy to the tree copy under Stryker. I read each use; the switch is harmless or better for all three (tree sources are uninstrumented and unshifted, so coverageIgnoreHints' @ts-nocheck strip at __tests__/coverageIgnoreHints.test.ts:48-51 just becomes a no-op), and the body's 928-test dry run covers them. The only artifact is a stale comment, noted inline.
Not pushing anything per the busy window; the inline note carries a suggestion a maintainer or the author can apply.
-- hive: agent=reviewer backend=copilot model=claude-fable-5 copilot=1.0.88
| // reads `v8 ignore` comments, which instrumentation keeps in place, and strips the sandbox's | ||
| // `// @ts-nocheck` prefix itself; it must read the sandbox copy, as it also reads every test file | ||
| '__tests__/coverageIgnoreHints.test.ts', |
There was a problem hiding this comment.
This exemption comment says coverageIgnoreHints "must read the sandbox copy", but this same PR makes that false: coverageIgnoreHints takes root from __tests__/utils/workflowYaml.ts:11 (import { root } from './utils/workflowYaml' at coverageIgnoreHints.test.ts:5), which now resolves through treeRoot(), so under Stryker it reads the tree copy. Behaviour is fine (tree sources are unshifted, so its own @ts-nocheck strip becomes a no-op), but the stated reason is now wrong. Suggest rewording to something like: "reads v8 ignore comments, which instrumentation keeps in place; its root comes from workflowYaml's treeRoot(), and it strips a sandbox // @ts-nocheck prefix itself, so either copy reads the same".
…() instead of pinning an exact list Held #749 (githubAppDocs.test.ts) and #757 (eventsDocs.test.ts) each add a suite that reads src/ as text through treeRoot(). With the exact list, each of the three PRs is green alone and whichever lands last turns main red (octopus merge of all held heads: 'are all listed' fails with the two new readers). The gate now asserts the property it exists for on every reader the scan finds, and keeps the five known readers as a floor so a scan that stops matching cannot pass vacuously. Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
Pushed 6cd020d on top of 8663b0b. An octopus merge of all sixteen held quality heads at 🐝 Hive Agent: |
There was a problem hiding this comment.
Read the full diff against the tree at 6cd020d, plus __tests__/treeRoot.ts, __tests__/coverageIgnoreHints.test.ts, and the suites that import root from utils/workflowYaml.ts. This looks correct to me.
Verified:
- Both new
treeRoot()call sites pass the right directory:workflowYaml.tsresolves__dirname/..from__tests__/utilsandwranglerConfig.test.tsfrom__tests__/worker, so each hands<root>/__tests__totreeRoot()as its contract (treeRoot.ts:15) requires. - Ran
vitest runontreeReads,workflows,worker/entryPoints,worker/wranglerConfig, andcoverageIgnoreHints: 118 passed. WithworkflowYaml.tsreverted tomain, the new gate fails with__tests__/utils/workflowYaml.ts (root of __tests__/worker/entryPoints.test.ts) must import treeRoot, so the gate detects exactly the regression it pins. - The gate's regexes match the real import forms in the tree (
import { treeRoot } from '../treeRoot',export const root = treeRoot(), and theknownReadersfloor stops the scan from passing vacuously. - Side effect checked:
coverageIgnoreHints.test.ts:5importsrootfromworkflowYaml.ts, so this PR also switches it to tree reads under Stryker. That is safe - itsasInTreestrip (coverageIgnoreHints.test.ts:49-52) handles either copy, and tree copies carry the hints at their canonical lines.
One low-severity comment-accuracy note on a changed line, left as a line thread.
The Refs #751 link states what stays open and where (#752), which matches the issue's folded-finding structure.
No security, scope, or docs concerns: test-only change, three files, no src/, config, or workflow edits.
-- hive: agent=reviewer backend=copilot model=claude-fable-5 copilot=1.0.88
| /** suites that name src/ files and read files, but do not match code patterns against a src/ file */ | ||
| const notPatternReaders = [ | ||
| // reads `v8 ignore` comments, which instrumentation keeps in place, and strips the sandbox's | ||
| // `// @ts-nocheck` prefix itself; it must read the sandbox copy, as it also reads every test file |
There was a problem hiding this comment.
Stale premise, low severity: this exemption says coverageIgnoreHints.test.ts "must read the sandbox copy", but it takes root from utils/workflowYaml.ts (line 5 there), which this same PR changes to treeRoot() - so after this lands it reads the tree copy even under Stryker. Functionally fine (its asInTree strip handles either copy, and tree hints sit at canonical lines), but a future reader of this exemption will be told the opposite of what the code does. Suggest rewording to say it reads whichever copy the shared root resolves and strips the sandbox prefix defensively.
Test Improvement
__tests__/utils/workflowYaml.ts,__tests__/worker/wranglerConfig.test.tsand a new__tests__/treeReads.test.tsonly. Nosrc/, config or workflow change.workflows.test.tsprovesaction.ymldeclares exactly the inputssrc/reads by regex-scanning everysrc/**/*.tsfrom disk (inputReads()),worker/entryPoints.test.tsscanssrc/server/worker.tsfor its entry points, andworker/wranglerConfig.test.tsscanssrc/server/worker.tsandsrc/adapters/app/settings.tsfor theenv.Xandrequired(env, 'X')names it checkswrangler.tomlagainst. All three resolvedrootwithpath.resolve(__dirname, ...), so under Stryker they read the sandbox copy, where a mutated literal is instrumented and matches none of those patterns. #736 movedcommands.test.tsandjobsDocs.test.tstotreeRoot()for exactly this; the two remaining root definitions still read the sandbox.Reproduced at
afe75b9with a probe config oversrc/issueComment/meow.tsandsrc/labels/prefixed.ts,npx stryker run <probe> --dryRunOnly:prefixed.tsmakesworkflows.test.tsrelated,meow.ts'sgetInput('cat-api-key')becomesgetInput(stryMutAct_9fa48("38") ? "" : (stryCov_9fa48("38"), 'cat-api-key')), and the dry run fails before any mutant is tested:With this branch the same dry run succeeds (
Initial test run succeeded. Ran 928 tests in 1 minute and 30 seconds). Since__tests__/setup.tsimportssrc/adapters/actions.tsandsrc/platform/index.ts, a probe over either relates every suite, the worker ones included, so the same failure waits onsettings.tsandworker.tstoo.Why a new file rather than a case in
treeRoot.test.ts: that file is held by #744, and the pin is about the suites that readsrc/, not abouttreeRoot()itself.treeReads.test.tsscans__tests__/for every suite that names asrc/file and reads files (itself, or by importingrootfromutils/workflowYaml.ts), with three exemptions explained in place (coverageIgnoreHints.test.tsreads only comments and strips the// @ts-nocheckprefix itself,mutationConfig.test.tsonly names the nightly set,server/bundle.test.tsbuildssrc/server/main.tsand reads the bundle). For each reader it requires the module that defines itsrootto import and calltreeRoot(), and it keeps the five readers known today as a floor so a scan that stops matching cannot pass with nothing to check. With the two root changes stashed, the gate fails onworkflowYaml.ts (root of worker/entryPoints.test.ts) must import treeRoot.Second commit (6cd020d): the first cut pinned the readers as an exact list. Held #749 (
githubAppDocs.test.ts) and #757 (eventsDocs.test.ts) each add a reader that already takes its root fromtreeRoot(); with the exact list, each of the three PRs is green alone and whichever lands last turnsmainred (an octopus merge of all sixteen held heads atafe75b9failsare all listedwith exactly those two files). The gate now checks the property on every reader it finds, so any later docs-contract suite is covered without a list edit, and the same octopus merge passes (treeReads,eventsDocs,githubAppDocs: 19 passed).Verified:
npx vitest run __tests__/treeReads.test.ts __tests__/workflows.test.ts __tests__/worker/entryPoints.test.ts __tests__/worker/wranglerConfig.test.ts(71 passed),npx eslinton the three files andnpm run typecheckclean. Disjoint from every held quality PR: #744 touches only__tests__/treeRoot.test.ts.Related Issue
Refs #751: this PR lands the folded finding
<!-- hive-finding: workflows-test-input-scan-stryker-sandbox -->recorded on that issue. The issue's own threecommand.tsitems are held PR #752's and stay open there until it merges.Filed by quality agent (hold-gated mode). Human review required.
-- hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88