✅ test(pariksha): no surviving mutant in doc-identifiers, doc-links, doc-paths and doc-references-config (#473)

Merged
AT
3d ago
+432-72

Brings doc-identifiers.ts, doc-links.ts, doc-paths.ts and doc-references-config.ts (all in packages/pariksha/src/) to no Survived and no NoCoverage mutant. Every checker reads the same as on main. One exported helper, manifestObject, now returns {} where it returned undefined; its three callers read the same either way (see "Code").

Measured on main

pnpm exec agnipariksha --lane pariksha --files <the four files> --no-reuse on origin/main (6afb12e):

pariksha: 1506 killed of 1668 in 4 file(s) (5 NoCoverage, 1344 Killed, 157 Survived, 162 RuntimeError; 22 timeout(s) retried) - REFUSED

162 blocking: 94 in doc-identifiers, 60 doc-paths, 8 doc-references-config, none in doc-links (its one inventory survivor is killed on main now). The inventory listed 165. The REFUSED was the timeout-retry pass running past its 15-minute budget on a busy machine.

What changes

Tests, each in its file's owning suite, with literal expected values and fixtures built inside their own test:

  • doc-references-config: the html, code and codeExclude lists read under their own names; flags given as a list; an extension with a capital after its letters; a manifest named package.json.bak; a scope with a name after it or text before it; links that is not an object; a jobs section with no workflows.
  • doc-identifiers:
    • Spans: each kind with text before or after it names nothing, and so does a roles span with two blanks in a row. Every part of a name and every digit of a version is read, and a call is looked up by its last name.
    • Prisma: models, fields, uniques and roles count only where the schema starts them; a role value is read with blanks after it.
    • Routes: a parameter only as a whole segment, a decorator with more arguments, a route with no segment as no one's, and brace expansion against a plain comma.
    • Jobs and cited files: a job named as one only from the blanks right after it; a cited file only after a whole in or from, with its line suffix dropped and nothing else; a cited file with nothing to read is not judged.
    • Lockfile and code search: the lockfile's own entries only, scoped ones and long versions included; a second own scope; no lockfile is asked for when none is configured; no code is read for no words, and files stop being pulled once every word is found, with a migration beside a symbol included; no span inside a fence.
    • Binary files: told apart by their last extension only.
  • doc-paths:
    • pathRef: a token is read whole. Text before or after a form, an origin/…: blob, or a line break leaves it no path. Every digit of a line or column is read, and the last extension of a name.
    • Untracked folders and layouts: a path under any listed untracked folder is left out, and a layout matches from any listed pattern.
    • Symbols: the symbol beside a citation is read only in the forms it takes, a link label in a code comment included.
    • Paths: a path above the root is reported, a problem with a tracked file stands under an ignore-everything rule, and a bare name resolves beside the doc before any other file of that name, and the tree is scanned once per glob however often a doc names it (the glob cache's two mutants: a hit and a miss give the same answer, so only the scans tell them apart).
    • Lines: a shell line ends at a word that starts a comment; a frontmatter value is read only from a line that starts one.

Code, where no test could tell a mutant from the code:

ChangeWhy
CALL and doc-paths' IDENTIFIER capture the last name, which is the word looked for.The spans already matched, so replace(/^.*\./, '') and replace(/\(\)$/, '') decided nothing. boundedWord reads a kept () as an empty group.
ROUTE takes one blank.A span with two blanks in a row is null before ROUTE runs.
A @@unique list and a @Roles list are read from their pattern's group.The spans matched the whole pattern, so the anchors of the strip regexes decided nothing.
A model's uniques are a Set.A [] seed could be told apart only by a unique named "Stryker was here".
Workflows are read through yamlObject, which gives {} for a document that is no object or does not parse.The catch fell through to the same skip.
A job's name, and a manifest's, is held whatever its type (Set<unknown>).Only strings are asked for, so the typeof checks decided nothing.
manifestObject gives {} where it gave undefined; doc-paths reads pkg[list].The catch fell through to undefined, which callers read as no name and no lists, as {} reads. doc-references-gate.ts keeps its manifestObject(text)?.['scripts'], which reads the same; this pull request leaves that file, outside the slice, alone.
The lockfile is scanned when it reads as text. A version's digits past its last dot are matched as \d, then the tail.''.matchAll matched nothing, as a seeded string did; the tail [^:'(]* took the digits \d+ would.
The Model.field, route and package destructures are casts.Their patterns matched, so the defaults and ?? [] never ran.
A route's prefixes are dropped with slice(findIndex(…)).When every segment is a prefix, slice(-1) keeps one that no controller knows, which is judged unknown below as [] was.
[?#].* drops $..* reads to the end of a path with no line break.
HISTORICAL_BLOB is origin/…: only.A hex, HEAD or main blob keeps its : in the first segment, which the segment test refuses. A corpus of 12,350 tokens (prefixes, bodies and suffixes crossed, requireSlash both ways) reads the same through main's pathRef and this one.
--x= is matched as -[\w-]+=.[\w-] takes the second dash.
The extension is read with ?.[1].toLowerCase() and the set is asked about it as it is.A match always holds its group, and the set holds no undefined.
anchored asks the folder set about a candidate above the root (null) too.The set holds no null.
symbolNear takes its own span as given.index comes from the same list.
Words split on \s and [\s,]; a frontmatter value starts after -\s or :\s.An empty word between two blanks is no path.
doc-paths reads a file only when it is Markdown or code, and a code line's comment through String().A kind === null file was skipped either way, and a line with no comment (null) holds no span.

No // Stryker disable, and no change to agnipariksha.json, stryker/, eslint-suppressions.json or any other file.

Checked

  • The same command at 56eabd3:

    pariksha: 1591 killed of 1592 in 4 file(s) (1429 Killed, 1 Survived, 162 RuntimeError; 0 timeout(s) retried) - 1 blocking
    

    e66e2c0 kills the one survivor, line 49's two-blank check read as false, when applied by hand. f0b59b2 keeps the glob cache with a test that kills both its mutants by hand. CI's Mutation check judges the four files whole.

  • This branch's suites against main's sources: only manifestObject's own test fails, on the {} above.

  • pnpm --dir packages/pariksha test at e66e2c0: 4640 of 4640 pass, coverage thresholds included; the four files are at 100% lines, branches and functions. One earlier full run exited 1 at a load average near 120 (two other repositories' mutation sweeps), its failing test cut from the output. The three changed suites then passed 20 of 20 runs each, in parallel batches of 10, under the same load.

  • tsc and eslint are clean.

Pinned, not changed: a frontmatter line that ends in a carriage return (a CRLF file) reads as no value, because . stops at \r before $. A test pins it; whether CRLF frontmatter should be read is a follow-up.

Slice: #473

🤖 Generated with Claude Code


Summary by cubic

Brings doc-identifiers.ts, doc-links.ts, doc-paths.ts, and doc-references-config.ts (all in packages/pariksha/src/) to zero surviving or uncovered mutants under pariksha.

Adds regression tests in each file's suite for edge cases (spans, Prisma models, routes, lockfiles, paths, and config shapes) and simplifies code where a mutant could not be observed: dropped checks that decided nothing, restructured [] seeds, and manifestObject now returning {} instead of undefined (its callers read the same either way). No // Stryker disable comments or changes to config files. The full pariksha test suite (4640 tests) passes, with the four files at 100% lines, functions, and branches.