How it works
One engine, in your browser, on files that stay where they are. What runs where, what is kept, what is checked.
One engine
diff-ref-struct is a Rietveld refinement project for the Mac: a core in Rust (the engine, with the command line drs), an app around it, and modules. The page runs the core's plotting part compiled to WebAssembly with wasm-bindgen, and the app's Plots module unchanged. The module asks the core with the same commands, names and data as in the Mac app; in the page a dispatcher answers them from the WebAssembly package instead of the app's process. So there is no second implementation of anything: a map, a step, a temperature read from a name is what the Mac app and drs give.
The browser does two things besides drawing: it reads files and saves downloads. Every calculation is the core's, including the ones that look small (a colour range, a stack's step, the rows' edges on a map).
Checked, not assumed
- The same numbers as the command line. A test runs the WebAssembly core under Node on the Tb2Pd2Sn files, given by name and text as the browser gives them, and requires its map to equal
drs plots map --json's to the bit. - The same commands as the app. A test requires the package to serve the commands the app's Plots module uses, by name.
- Real runs. The ESRF in-situ run of 101 scans (112 MB) is the test of the series detector: its three sets found scan for scan as they had been built by hand, the exposure classes told apart.
- The page's own parts (the file tree, the address, live mode's reading, the offline list) are tested under Node on every publication; the publication stops if a test fails.
Your files
- Read where they are. Open Folder… gives the page a handle to read the folder (Chrome, Edge, Arc) or a list of its files (Firefox, Safari). A file's text is read when the core needs it, then handed to the core inside the page. Files over 64 MB are not read.
- Never sent. The page has no server to send to: it is a set of static files. It loads its own files from its own address and nothing from elsewhere (no web fonts, no scripts from other sites, no counters).
- Never written. The page asks only to read. What you save (a
.drv, a viewer page) is downloaded to your Downloads folder. - Kept in your browser. The page's address keeps the view (names and numbers on screen, never content); local storage keeps your choices of theme, inspector width, tree order and live mode. Clear the site's data in the browser to forget them.
Offline
A service worker keeps the page's own files: the list of every file the page loads (36 files, 4.4 MB with the core) is written by a tool that walks the page's links and imports, and a test fails when it is not the page's. It never keeps a data file and never fetches one. A new version installs beside the old and replaces it; a tab open on the old one keeps it until reloaded.
Published
The page and this site are built by one GitHub Action from the project's repository on every change: the core compiled to WebAssembly, the tests run, the files staged, this site rendered with Quarto, a guard run against any trace of a team's unpublished data, all pushed to the public repository diff-ref-struct-web (branch gh-pages), served by GitHub Pages. The page is at the root, this site at /guide/. The source the page is built from goes to the same repository's main at each release, by a second Action, under the Apache License 2.0; the documents under CC BY 4.0.
See also: the file formats, the releases, the conventions.