Skip to content

Turn on coverage, CRAP and mutation in every crate - #56

Merged
VirtualMachinist merged 18 commits into
mainfrom
feat/w13-tops
Nov 15, 2026
Merged

VirtualMachinist merged 18 commits into
mainfrom
feat/w13-tops

Conversation

@VirtualMachinist

Copy link
Copy Markdown
Member

Turns on coverage, CRAP and mutation in every crate's rust-tops.yaml, keeping each crate's own thresholds, and lifts every crate to them. Product behavior does not move: every index row and every CLI and MCP reply is byte-identical to the base.

What changes

  • Quality layers. coverage, crap and mutation are on in every crate. phantom-fractal-git gets its first rust-tops.yaml, as a library-core crate. No threshold moves.
  • Tests. New and extended tests in every crate, written from behavior. The store adds a #[cfg(test)] fault-injection seam so the real error paths are exercised. The seam does not exist in non-test builds.
  • Complexity. CRAP applies to new and changed functions, and no existing function's score rises. A few functions are lowered by extracting named jobs. There are no exemptions.
  • A resolver fix with no output change. lookup is memoized on its full input key, which removes an exponential re-entry on self-referential use bindings. Results are identical by construction, and a differential run over the fixtures and fuzz cases is byte-identical.
  • Test hygiene.
    • Every git a test spawns gets an explicit identity and isolated config, so the suite makes no name-service lookups.
    • Test temp dirs get a per-process counter.
    • The fuzz smoke is sharded so it fits the CI time limit under load.
    • The scorer's member scope treats nested non-member packages as out of scope.
  • RUST-TOPS.md. A new root file pointing to the rust-tops protocol. It records the class and thresholds of each crate, how to run the gate, the CRAP baseline rule, and known deviations.

Checks

fmt, clippy (--workspace --all-targets --all-features --locked -D warnings), cargo deny check and nextest all pass. No new package, no new crate, no .github change.

🤖 Generated with Claude Code

VirtualMachinist and others added 18 commits November 14, 2026 14:47
- turn coverage, CRAP and mutation on for the store crate, thresholds unchanged, and add the git crate its first instance
- scope a document by the longest covering directory boundary, so a nested package that is not a member puts it out of scope
- keep the coverage of the reads: one populated store read back through the resolver input, the rank and map rows, the detail and impact reads, the scorer reads and the edge neighbours
- answer every read and writer over a store missing one table each, and name the dump escapes and dangling references
- fail each row statement in turn through a test-only seam, and assert the call answers the store error a real fault makes
- pass the raw profile path through the sandbox re-spawn, and give the test git identity explicit variables
- split the manifest directory out of the package directory read
A lookup through use bindings is a pure function of the index, the
module, the name and the depth, so its answer is kept under exactly that
key for the life of the index. A name whose use bindings name it again
now costs one walk per depth level instead of one per path, which was
about k^8 walks for k such bindings. Every result is unchanged.

The local-item check and the use-binding walk move out of lookup into
two named helpers. New tests cover a use that names itself, two aliases
that name each other, two modules that re-export from each other, and a
cycle beside a real binding, each at counts that used to take minutes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The lang crate gets its own tests for every store text and conversion of
the resolve types. The extract crate gets tests for an unreadable source
file, a repository whose HEAD cannot be read, a missing root, an unknown
base and the error texts they give, for an unreadable directory in the
walk, and for a target directory beside a nested manifest in a diff.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The git helpers of the extract and analyze tests now set the author and
committer name and email, and point XDG_CONFIG_HOME at the test home
beside HOME and the cleared system and global config. Without an
identity, git looks one up from the user and host databases, which on a
box whose hostname is not in its hosts file costs a DNS lookup and so an
inet socket.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The temp dirs of the map, map_git, rank_store and fixture tests were
named by process id and time alone, so two tests in one process, as
libtest runs them, could share a path at the clock resolution and
collide on one store. Each name now also carries a per-process count,
so the tests pass under libtest, plain cargo llvm-cov included, as they
do under nextest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Under load a 32-shard run came near the CI test time limit, since a
shard could hold several large random-byte inputs. With ten cases per
shard the slowest takes under half the limit even with twice as many
tests as cores. Every one of the 2000 cases still runs, and the smoke
still asserts no panic only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The lang, lang-rust, extract and analyze instances turn on their
coverage, CRAP and mutation layers with every threshold unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Whole items only: the two hand-built bucket cases move from the scorer test file into a module under its test directory, leaving a same-named test that calls each one. No logic, name or output changes; the scorer file is back under the line cap.
Both crates' rust-tops.yaml enable the coverage, crap and mutation layers,
with every threshold unchanged, and RUST-TOPS.md at the root says how the
gate runs and which figures govern.

The MCP tool parsers read their arguments as one list and report the
first bad one, as each read did before. The JSON-RPC handling, the line
framing, the server loop, show and status are split into named steps.
Every reply is byte-identical.

New tests cover a data directory others can write, an open repos
directory, a database that is not SQLite or has an older schema, an index
path that is not a directory, a watch whose stdout is closed, a status
with no stored root, an interrupted read, and the server loop's exits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
map refuses a budget outside 1 to 100000 as usage before any index is
read. show keeps exactly 100 members untruncated and sets truncated at
101.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The synthetic repositories and the version test's rev-parse each run git
with a fixed author and committer, no system or global config, and HOME
and XDG_CONFIG_HOME in the test's temp dir. With no identity, git derives
one from the host name, which costs a DNS lookup, so the suite opened
inet sockets through its own git children.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…refused

A message with a result or an error and no method is a client's
response and gets no reply. One with no method and neither is refused
with "method must be a string".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With any one page of graph.db zeroed, map either answers in full or
fails with one error envelope, never a panic or a partial reply, and a
page it reads past the store's own checks fails as the store's error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each read_line and answer call in their unit tests runs in a thread and
must return within 10 s: every input ends in a line, the end of input,
or an error. A read that loops forever now fails its test at once
instead of running until it is stopped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The second swap writes its replacement first and renames it over the lock, so the new file cannot land on the freed inode number; the unreadable-directory case probes the mode-000 directory after closing it and stands down with a printed reason where the process still reads it, which uid 0 does.
Each read is a reader that prepares, queries and passes every row through
collect_rows, and a mapper that owns the row body. A column the struct
does not carry, or the placement mark, is read by the reader and passed
in. No logic or SQL change.
@VirtualMachinist
VirtualMachinist merged commit f123309 into main Nov 15, 2026
6 checks passed
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.

1 participant