Add default safe snapshot processing - #6
Merged
Conversation
magiccodingman
marked this pull request as ready for review
July 27, 2026 00:34
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 changed
Snapshot.Processinglibrary built on the protocol processor contract<style>contentSnapshotindex.html, aliases, prefix gateways, assets, and hosting artifacts unchangedDefault behavior
snapshot buildnow performs processing automatically. Canonical mismatch and invalid inline JSON are route failures and build errors by default.Simple escape hatches remain available:
--no-minifykeeps validation and preserves each snapshot HTML string exactly--no-processingdisables the complete layer--canonical-policy warning|offrelaxes canonical enforcementJavaScript is never minified, renamed, bundled, tree-shaken, or rewritten by this processing layer.
Architecture
Snapshot.Protocolowns onlyISnapshotProcessorand invokes it as successful render results flow into the archive.Snapshot.Processingowns the concrete DOM parsing, validation, conservative minification, semantic verification, and standalone archive processing implementation. Playwright remains only an executor.This keeps the processor reusable by future executors, including the planned Blazor WebAssembly/browser implementation, without depending on SQLite, Playwright, or a desktop-only storage model. The normal CLI remains a one-pass build; existing archives can use the same processor through
snapshot process.Scope and isolation
Processing applies only to generated route snapshots, including
/index/index.htmlfor the rendered root route. It never processes the original/index.htmlloader, case aliases, prefix gateways, source assets, or hosting artifacts.The standalone archive processor streams unchanged entries into a new ZIP, rewrites only manifested
Snapshotentries, regenerates lengths and hashes, rewrites the manifest, validates the destination, and publishes it atomically.Memory behavior
Rendered page bodies and ZIP bytes do not accumulate across the build. Each route is processed as it arrives, encoded directly into its ZIP entry, and released. Memory therefore scales primarily with browser concurrency and the largest simultaneously rendered pages rather than total site HTML size.
Route plans, route results, and manifest records still scale linearly with the number of real output entries; they do not retain entry contents. There is no separate large-site pipeline or scale flag.
Validation
GitHub Actions CI run 87 is fully green:
--no-minifyvalidation-only behavior preserves the exact HTML stringThe PR remains draft for a final TruthGate build and artifact-size review.