Repository navigation
psi: delete test-only syntax-trees JSON snapshot mirror - #6309
Merged
Merged
Conversation
`syntax-trees` maintained a 2,823-line hand-written `inspection/` mirror of every AST struct solely to serialize `SyntaxTrees` to JSON for a handful of tests and two benchmarks, with zero production callers. This change deletes `representations/syntax-trees/inspection/` and rewrites those tests and benchmarks to inspect `SyntaxTrees` and its `record_storage` bytes directly, cutting 2,972 lines net and dropping `serde`, `serde_json`, and `artifacts` from `syntax-trees` (plus `serde_json` from `source-parser` dev-dependencies).
Comparing the real syntax tables directly in `tests/lexical_handoff.rs` also uncovered a trailing-trivia arena leak in `transitions/guards.rs:170`: a tuple wildcard `_` followed by whitespace or a comment failed `component.tokens.len() == 1`, fell into `parse_destructure_pattern_arm`, and allocated an unreachable `Identifier` in `expressions.identifier_path_members` before returning `None`. Checking `component.take_contextual("_").is_ok_and(|rest| rest.tokens.is_empty())` fixes the leak.
- **`representations/syntax-trees`:** Deleted `inspection/` (`snapshot.rs`, `items.rs`, `expressions_and_types.rs`, `statements.rs`, `mathematical.rs`) and its self-test `tests/unit/snapshot_tests.rs`. Removed `artifacts`, `serde`, and `serde_json` dependencies and updated `README.md`. Rewrote `tests/page_roots.rs` and `tests/unit/forest.rs` to assert directly on `SyntaxTrees` rows.
- **Stage 01 (`source-parser`) and driver:** Replaced `SourceSyntax::snapshot_json` (gated under `test-support`) with `SourceSyntax::record_bytes` backed by `record_storage::encode`, updated `benchmarks/parser_timing.rs` and `benchmarks/streaming.rs` to hash `record_storage` bytes, updated `driver/parse_source_batch/tests.rs` to compare `SyntaxTrees` with `assert_eq!`, and rewrote the snapshot-using parser tests (`lexical_handoff.rs`, `positional_patterns.rs`, `operator_grouping.rs`, `items_and_selections.rs`, `bindings_and_conformances.rs`, `mathematical_definitions.rs`) to assert directly on `SyntaxTrees`.
- **Parser bugfix:** Fixed wildcard trailing-trivia check in `pipeline/01_tokens-to-syntax-trees/src/transitions/guards.rs`.
Validation:
- `mbx test -p syntax-trees -p source-parser -p source-syntax` (pass)
- `mbx test -p source-compiler --lib parse_source_batch` (pass)
- `mbx check -p source-compiler --features test-support --benches` (pass)
- `mbx clippy -p syntax-trees -p source-parser --all-targets -- -D warnings` (pass)
- `mbx clippy -p source-compiler --no-deps --lib --tests --benches --features test-support -- -D warnings` (pass; `--no-deps` because unrelated `psi-provider-selections` on `main` has a pre-existing `clippy::needless_lifetimes` warning)
- `mbx xtask check-boundary` (pass)
- `mbx xtask fmt --check --base origin/main` (pass)
Gate: RC-REPOSITORY | removes 2.9k lines of test-only syntax-tree JSON snapshot mirror, drops serde/serde_json/artifacts from syntax-trees, and fixes a trailing-trivia wildcard arena leak in stage 01
Spec: wiki/spec/language/patterns.md, wiki/spec/language/data_and_literals.md, wiki/spec/language/expressions.md
Proof: mbx test -p syntax-trees -p source-parser -p source-syntax; mbx test -p source-compiler --lib parse_source_batch; mbx check -p source-compiler --features test-support --benches; mbx clippy -p syntax-trees -p source-parser --all-targets -- -D warnings; mbx clippy -p source-compiler --no-deps --lib --tests --benches --features test-support -- -D warnings; mbx xtask check-boundary; mbx xtask fmt --check --base origin/main | clean; deleted representations/syntax-trees/tests/unit/snapshot_tests.rs (self-test of deleted SyntaxTreesSnapshot) and rewrote snapshot-based assertions in lexical_handoff.rs, positional_patterns.rs, operator_grouping.rs, items_and_selections.rs, bindings_and_conformances.rs, mathematical_definitions.rs, page_roots.rs, forest.rs, and parse_source_batch/tests.rs to assert directly on SyntaxTrees
Agent: Antigravity | Model: Gemini 4 Neon | Effort: high | Tokens: 13.70M in (12.39M cached), 40.0k out | Steps: 40 | Time: 29m39s | Steers: 0
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.
syntax-treesmaintained a 2,823-line hand-writteninspection/mirror of every AST struct solely to serializeSyntaxTreesto JSON for a handful of tests and two benchmarks, with zero production callers. This change deletesrepresentations/syntax-trees/inspection/and rewrites those tests and benchmarks to inspectSyntaxTreesand itsrecord_storagebytes directly, cutting 2,972 lines net and droppingserde,serde_json, andartifactsfromsyntax-trees(plusserde_jsonfromsource-parserdev-dependencies).Comparing the real syntax tables directly in
tests/lexical_handoff.rsalso uncovered a trailing-trivia arena leak intransitions/guards.rs:170: a tuple wildcard_followed by whitespace or a comment failedcomponent.tokens.len() == 1, fell intoparse_destructure_pattern_arm, and allocated an unreachableIdentifierinexpressions.identifier_path_membersbefore returningNone. Checkingcomponent.take_contextual("_").is_ok_and(|rest| rest.tokens.is_empty())fixes the leak.representations/syntax-trees: Deletedinspection/(snapshot.rs,items.rs,expressions_and_types.rs,statements.rs,mathematical.rs) and its self-testtests/unit/snapshot_tests.rs. Removedartifacts,serde, andserde_jsondependencies and updatedREADME.md. Rewrotetests/page_roots.rsandtests/unit/forest.rsto assert directly onSyntaxTreesrows.source-parser) and driver: ReplacedSourceSyntax::snapshot_json(gated undertest-support) withSourceSyntax::record_bytesbacked byrecord_storage::encode, updatedbenchmarks/parser_timing.rsandbenchmarks/streaming.rsto hashrecord_storagebytes, updateddriver/parse_source_batch/tests.rsto compareSyntaxTreeswithassert_eq!, and rewrote the snapshot-using parser tests (lexical_handoff.rs,positional_patterns.rs,operator_grouping.rs,items_and_selections.rs,bindings_and_conformances.rs,mathematical_definitions.rs) to assert directly onSyntaxTrees.pipeline/01_tokens-to-syntax-trees/src/transitions/guards.rs.Validation:
mbx test -p syntax-trees -p source-parser -p source-syntax(pass)mbx test -p source-compiler --lib parse_source_batch(pass)mbx check -p source-compiler --features test-support --benches(pass)mbx clippy -p syntax-trees -p source-parser --all-targets -- -D warnings(pass)mbx clippy -p source-compiler --no-deps --lib --tests --benches --features test-support -- -D warnings(pass;--no-depsbecause unrelatedpsi-provider-selectionsonmainhas a pre-existingclippy::needless_lifetimeswarning)mbx xtask check-boundary(pass)mbx xtask fmt --check --base origin/main(pass)Gate: RC-REPOSITORY | removes 2.9k lines of test-only syntax-tree JSON snapshot mirror, drops serde/serde_json/artifacts from syntax-trees, and fixes a trailing-trivia wildcard arena leak in stage 01
Spec: wiki/spec/language/patterns.md, wiki/spec/language/data_and_literals.md, wiki/spec/language/expressions.md
Proof: mbx test -p syntax-trees -p source-parser -p source-syntax; mbx test -p source-compiler --lib parse_source_batch; mbx check -p source-compiler --features test-support --benches; mbx clippy -p syntax-trees -p source-parser --all-targets -- -D warnings; mbx clippy -p source-compiler --no-deps --lib --tests --benches --features test-support -- -D warnings; mbx xtask check-boundary; mbx xtask fmt --check --base origin/main | clean; deleted representations/syntax-trees/tests/unit/snapshot_tests.rs (self-test of deleted SyntaxTreesSnapshot) and rewrote snapshot-based assertions in lexical_handoff.rs, positional_patterns.rs, operator_grouping.rs, items_and_selections.rs, bindings_and_conformances.rs, mathematical_definitions.rs, page_roots.rs, forest.rs, and parse_source_batch/tests.rs to assert directly on SyntaxTrees
Agent: Antigravity | Model: Gemini 4 Neon | Effort: high | Tokens: 13.70M in (12.39M cached), 40.0k out | Steps: 40 | Time: 29m39s | Steers: 0