We recently shipped a web-based file tree navigator so that you can see the files from a task's output. Seeing the file tree is helpful for configuring output filters. We currently do not display the contents of the files, but we will add that in the future.
To make browsing the file tree as fast as possible, we implemented it in WebAssembly.
#Background on RWX's Architecture
Tasks run on RWX with content-based caching. This means that before running a task, a cache key is generated based on the exact contents of all of the files on the filesystem.
We generate a manifest of the entire filesystem using a proprietary binary format. Before running tasks, we merge all of the manifests for the dependencies together, apply filters, and then produce a cache key.
The algorithm is performance-intensive, and we want it to run as fast as possible, so we wrote it in Go.
#Using WebAssembly
When building the web-based file tree browser, we wanted to reuse the code we had already written for parsing our proprietary binary format. We also wanted it to be as fast as possible.
Fortunately, Go makes it easy to compile to WebAssembly.
go build -o build/manifests.wasm ./wasm
The Go code:
1package main23import (4"bytes"5"encoding/json"6"os"7"syscall/js"89"github.com/rwx-cloud/manifests/parsing"10)1112func main() {13rwxManifestsJs := js.Global().Get("Object").New()14rwxManifestsJs.Set("parseManifest", js.FuncOf(parseManifest))15rwxManifestsJs.Set("quit", js.FuncOf(quit))1617js.Global().Set("RwxManifests", rwxManifestsJs)18js.Global().Get("document").Call("dispatchEvent", js.Global().Get("CustomEvent").New("rwx-manifests:ready"))1920select {}21}
We use this approach to ship the entire manifest to the browser, parse it client-side, and provide fast tree navigation.
#Demo
Related posts

What would GitHub Actions look like if you designed it today?
GHA was designed in ~2018. What would it look like if you designed it today, with all we know now?

Truly continuous integration: ensuring pull requests from agents have passing builds
RWX CLI v3.0.0 introduces new tools for developers and coding agents to iterate on changes until CI passes - without a single commit or push.

