Repository navigation
feat(engine): mcVersion 2 compilers in the Rust engine (D-0020) - #263
Merged
Merged
Conversation
…y beside v1 (D-0020) Mirrors the TS v2 surface: schema_v2 (JSON Schema 2020-12 subset — properties/ required/additionalProperties with optional-by-default, minLength/maximum/items/ integer, [T,"null"] unions, composable format on a widened Schema::Format, validated const, closed per-node keys with the three rejection classes) and body_v2 (additionalSections, minContains/maxContains onto the repeatable machinery, hoisted sections, list items). Finding gains hint (serde-skipped when absent); descriptions thread through structure/content/frontmatter walks with nearest-enclosing resolution and a contract-root fallback. v1 documents compile unchanged; shared-corpus goldens untouched. 180 unit tests + corpus harness green; clippy/fmt clean.
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.
What
PR 3 of the D-0020 series (#261, #262): the Rust engine mirrors the mcVersion 2 declarative surface, keeping the two engines semantics-identical ahead of the shared-fixture v2 twins (PR 4).
declarative/schema_v2.rs— the JSON Schema 2020-12 subset:properties/required(optional-by-default;requiredentries must name declared properties)/additionalProperties,minLength/maxLength/pattern+ composableformat(the runtimeSchema::Formatwidened to{format, min, max, pattern}, issues emitted in Zod's chained order),minimum/maximum,type: integer,items/minItems/maxItems,[T,"null"]unions, validatedconst; per-node closed keys with the same three rejection classes as the TS side (v1-spelling migration hints, the 34-keyword outside-subset list, unknown key).declarative/body_v2.rs—additionalSections, the fullminContains/maxContainsoccurrence recipe onto the repeatable machinery, hoisted nestedsections, listitems(checkbox | schema); v1 keys rejected with migration hints.Finding.hint—Option<String>, serde-skipped when absent so existing consumers and goldens see byte-identical output; nearest-enclosingdescriptionresolution threaded through the structure/content/frontmatter walks with contract-root fallback.mcVersion; inline config contracts compile with their config's version.Example (same document + contract as #262's demo, Rust side)
Gates
cargo test -p markdown-contract-engine: 180 unit tests + corpus harness green (up from 149; shared-corpus goldens untouched — 51 fixtures / 8 ts-only skips unchanged).cargo clippy --all-targets -- -D warningsclean;cargo fmt --checkclean;cargo check --workspace --all-targetsclean (one test-literalhint: Nonetouch in apps/desktop's engine map to keep the workspace compiling).Notes: this crate has no text renderer (the runner returns
Findings), so the humanhint:line lives on the TS side only; JSON serialization carries the field here. v2 parity fixtures for the shared corpus land in PR 4 with the corpus migration.