chore: update coverage stats and badges - #34
Merged
Conversation
matthewevans
enabled auto-merge (squash)
April 8, 2026 20:24
matthewevans
added a commit
to lgray/phase
that referenced
this pull request
Jul 13, 2026
* fix(census): lex a Rust lifetime as a lifetime, not as a char literal
strip_noncode's char-literal alternative was permissive -- `'(?:\\.|[^'\\])*'`
-- so it could not tell a char literal from a LIFETIME (`&'a str`, `Foo<'_>`) or
a loop LABEL (`'outer:`), neither of which any second quote ever closes. Given an
odd number of ticks on a line, the tick pairs with the opening quote of the next
char literal and everything between them is eaten as literal content:
fn drain(&'a mut self) { self.hand.push_back(c); assert!(c != 'x'); }
-> fn drain(&x'); } <- the hit AND the brace, gone
That is the raw-string ceiling again (phase-rs#34), with the same two failure modes: a
SWALLOWED HIT, which reads like migration progress rather than a mis-scan, and a
LEAKED BRACE, which desyncs brace tracking for the rest of the file. The tree has
a live instance of the second, in census scope:
engine/src/parser/oracle_replacement.rs:9560
char::<_, OracleError<'_>>('{'), -> char::<_, OracleError<{'),
which invents a `{` and drifts depth for ~9,600 lines. It has been harmless only
because the drift is a constant offset that no #[cfg(test)] skip region straddles
-- luck, of exactly the kind phase-rs#34 removed.
Encode Rust's own rule instead: a char literal is ONE char or ONE escape ('x',
'\n', '\x41', '\u{1F600}') followed by the closing quote. A quote that does not
close that way opens a lifetime, and its tick is emitted as the ordinary code it
is. The CANDIDATE prefilter is untouched, so no per-character scanning returns.
Evidence (population stated, computed this session):
* whole-tree sweep, 1,713 .rs files / 1,512,084 lines under crates/: old vs new
diverge on 746 lines. Adjudicated: 1 changes brace balance (the fix above),
0 change census hit count anywhere. The rest is inert text -- an apostrophe
the old lexer ate and the new one leaves alone.
* both frozen baselines stay byte-identical: zone 87 hits / 64 rows, draw
producers 8 hits / 7 rows, unchanged. Both gates exit 0.
* throughput, time.process_time() best-of-5 over the 5 largest engine/src files
(6.78 MB): 35.2 MB/s before, 35.1 MB/s after -- noise, and 7x the 5 MB/s floor.
Five new seam tests, each observed RED against the pre-fix scanner (four assertion
failures and one CensusError from the #[cfg(test)] desync), plus one preservation
guard pinning that every char-literal escape form is still consumed whole.
* ci(census): gate the census scanner's own seam suite, and un-stale the draw-census scope note
Gates (B) and (C) of check-engine-authorities.sh both stand on strip_noncode,
but the 30-case suite that pins that lexer was not run by ANY CI job -- a lexer
regression would not fail the gates, it would silently mis-scope them (a
swallowed hit reads as migration progress, not as a mis-scan). Run the suite in
the same job, ahead of the gates it protects. Cost: 1ms.
Also correct the (C) scope comment: the raw-string blocker it cites was fixed
in phase-rs#5704, so "cannot yet read the whole workspace" is no longer true. The
3-crate scope itself is unchanged -- widening it moves the frozen producer
population and is deliberately left to its own unit.
---------
Co-authored-by: matthewevans <matthewevans@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Automated update of README coverage badges from latest card data.