Notes/CodeInstances

CodeInstances Launches, Keeping Program Runs as Files and Replaying Them Offline

CodeInstances, the studio’s fourteenth project, treats each run of a program as something you can keep. Code is versioned and reviewed; its runs are thrown away, so a CI test that fails once and passes on the rerun takes the bug with it. Version 0.1 came out on 18 October with the first two verbs, keep and replay, and binaries for Linux, macOS and Windows. It’s pure Go with no dependencies outside the standard library, open source under Apache 2.0.

codeinstances record runs any program behind a local proxy with a certificate authority made for that run alone, and keeps the arguments, the output, the exit code and every HTTP and HTTPS exchange. Go programs can also hand over their clock and random values through a small hook package. The result is an instance, one JSON file in an open format whose SHA-256 id shows any later edit. codeinstances replay runs the program again with every request answered from the file, never dialling out, and lists each way the run differed.

The test write-up counts 59 Go tests with a clean race detector run. In the recorded demo, a program made 23 requests to two local servers and took 5 clock and random values; with both servers stopped, all 10 offline replays matched, in 26 to 45 ms each, and a changed program and an edited file were both caught. Five use scenarios on the site, from a flaky CI test to a runnable bug report, show where it fits.

The limits are listed plainly: HTTP only, so WebSocket and raw TCP aren’t kept, and clock and random values only for Go programs that use the hook. Comparing two runs, shrinking a failing run, grouping repeated failures and signed instances are on the plan, each as its own release.