Repository navigation
test(streaming): restore a native checkpoint in a wasm32 kernel and the reverse - #301
Merged
Merged
Conversation
…he reverse tools/streaming/wasm_resume.rs is a #![no_std] module built from the identical grammar files for wasm32-unknown-unknown. A host copies the source bytes, a checkpoint and the caller's cursors into its scratch memory and calls resume_maps (a DWGM checkpoint), resume_section (a DWGS checkpoint, given the section's rows of the caller's page index) or run_maps (walk some steps, leave a DWGM checkpoint), and reads back the JSON lines the native examples print. wasm_resume.mjs drives it under node with a fresh instance per job; verify_wasm.py is the acceptance run. On the canonical R2018 fixture and three real files: every native map-walk checkpoint (every step of the fixture, about 40 sampled per real file) restored in the kernel, reading at 1, 7, 64 or 256 bytes at a time, finishes with the lines the native resume prints; the kernel's own checkpoint at the same step is byte-identical to the native one and the native build resumes it to the uninterrupted run's output. About 90 native data-page checkpoints per file, around every page, hole and section end, restored in the kernel finish their section with the native resume's lines and a CRC-32 equal to the independent assembly. Sampled bit flips and a wrong identity are refused by the kernel as by the native build. It runs in the Streaming E2E job. R2004SectionWalker gains section_id(), which the kernel prints. Refs #207
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d56966c347
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
… in the kernel, and split its scratch memory verify_wasm.py let a kernel that returned empty output pass for a section checkpoint: an empty list equals the zero-length native prefix and the completion and CRC assertions were skipped. It now records each saved checkpoint's stage and requires every one that is not already finished to run through its section_done, equal to the independent assembly's, and a finished one to produce nothing; the count of sections the kernel finished must equal the number of unfinished checkpoints. wasm_resume.rs made a mutable reference to the whole scratch array on every helper call while the table and label slices still borrowed it, which violates Rust's aliasing rules. Each export now splits the scratch memory once into disjoint source, checkpoint, digest, table and output slices and passes them to the helpers; the output writer owns its slice. Reported by the review on #301.
This was referenced Oct 27, 2026
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.
Summary
A
no_stdwasm32 kernel built from the identical grammar files restores a checkpoint made by a native build and finishes the walk, and makes a map-walk checkpoint a native build restores; node drives it,verify_wasm.pyis the acceptance run and it joins the Streaming E2E job. Refs #207.Spec reference
ODA v5.4.1 §4.3–§4.6 walks only (no new format feature). Adds
R2004SectionWalker::section_id(), which the kernel prints.Test plan
tools/streaming/verify_wasm.pyon the canonical R2018 fixture andline_2004,line_2010,line_2013(plus a built file for the section walk): every nativeDWGMcheckpoint (every step of the fixture, about 40 sampled per real file) restored in the kernel, reading at 1, 7, 64 or 256 bytes, finishes with the lines the native resume prints; the kernel's own checkpoint at the same step is byte-identical to the native one (173, 43, 44, 43 of 173, 43, 44, 43) and the native build resumes it to the uninterrupted run's output; about 90 nativeDWGScheckpoints per file restored in the kernel finish their section with the native resume's lines and a CRC-32 equal toverify_sections.py's independent assembly; 63 sampled bit flips and a wrong identity per walk are refused by the kernel (code -1).rustc --target wasm32-unknown-unknowninside the verifier, under node (V8), not a browser; the section walk crosses runtimes in one direction only.cargo +1.85 check,check_invariants.py,no_std.rsnative and wasm32 unchanged.Source-provenance declaration
By submitting this PR I certify that my contribution does not incorporate executable code from any source whose license is incompatible with Apache-2.0. Specifically:
CLEANROOM.md).dwg-rsis Apache-2.0 and must remain compatible.My contribution is based on: