Repository navigation
unison: refpulse, a Unison service behind the site's Live button - #66
Merged
Merged
Conversation
A static page on GitHub Pages calls a Unison HTTP service and draws its answer: the Live section's button sends GET /check?doi=... to refpulse (unison/refpulse/refpulse.u), which asks doi.org about each of the book's DOIs and answers JSON with CORS *. The site works when it is down. just unison-install / unison-serve / unison-deploy, with ucm from a new .#unison dev shell. The browser half was proven in headless Chrome against a stand-in with the same contract; refpulse.u is not compiled yet (the libraries could not be downloaded here). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
h0ffmann
marked this pull request as ready for review
October 15, 2026 15:35
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.
Draft: one step left before it's proven, the Unison compile (see below).
A button on the static GitHub Pages site starts a remote computation in Unison and draws the answer back on the page. The Live section's "Check the DOIs now" button calls refpulse, a Unison HTTP service (
unison/refpulse/refpulse.u). refpulse asks doi.org about each of the book's DOIs and answers JSON.The result (last iteration)
The real site build, driven in headless Chrome over the DevTools protocol. The button was clicked and the answer drawn. The service URL was given with
?refpulse=, on a different origin from the page:When the service is down, the page says so and nothing breaks:
Is it proven?
fetch→ JSON → drawn on the pagesite/dist(port 8765) against a stand-in with refpulse's exact contract (port 8081). The stand-in asked doi.org for real: the book's DOI came back 302 and a made-up DOI 404. The page drew "1 of 1 DOIs resolve · 302". In an earlier run, with Zenodo reachable at build time, it drew all 5 version DOIs.Access-Control-Allow-Origin: *. Chrome accepted it across origins.refpulse.ucompiles and serves@unison/cloud27.3.1,routes7.0.2,http16.1.0,json1.4.2,base7.20.0). It is not compiled:lib.installfailed in the agent's sandbox withIncompleteHeaders. Runjust unison-install, thenjust unison-serve, and the same Chrome test will be repeated against the real Unison service.auth.login(see below).Tests: 20 site tests pass, two of them new (
parse_pulse, and the Live section is prerendered).just checkandjust md-qualitypass.Unison Cloud: how to deploy
The full text is in
unison/refpulse/README.md.nix develop .#unisongivesucm, pinned byflake.lock(1.5.0).just unison-install: a UCM transcript makes therefpulseproject inunison/.codebase/(git-ignored), installs@unison/cloudand@unison/routesfrom Share, and addsrefpulse.u.just unison-serve: runs it on this machine (Cloud.main.local.serve). It prints the URL. Then open the site with?refpulse=<that URL>#live.ucm -c unison/.codebase→auth.login.just unison-deploy:Cloud.main+deployHttp+ServiceName.assign. It prints a stable public URL; a new deploy moves the name to the new code.refpulse_urlinsite/src/closed_source_site/app.gleam. The button then works for every reader.The free tier (pricing page, 15 Oct 2026) allows 5 services, which "deactivate every 3 weeks", 50 MB and 5k requests a month. So the button is built to survive a service that is down.
Can I run the Unison server on my own machine?
Yes, three ways:
just unison-serve). The same code and the samedeployHttp, on your computer. Pages you open in your own browser can call it. Readers can't, because it isn't on the internet. Chrome is adding a "local network access" permission prompt for a public page that callslocalhost.Design
content.gleamand the book never read it.fetch. The Lustre model hasIdle | Running | Done | Failed, and the result region isaria-live.Remote.fork/await(orparMap) can run them on many machines, if the forked task may callHttp. That comes after the first compile.Not checked
refpulse.ucompiling (above). Expect small fixes onceucmsees it./etc/ssl/certshas a Bitdefender network monitor CA. TLS inspection like that may be what brokeucm's streaming download (IncompleteHeaders). Ifjust unison-installfails the same way in your terminal, letapi.unison-lang.orgpast it.localhost.🤖 Generated with Claude Code