Skip to content

Browser path: cypkg on ari's wasm page, tested in Chrome, deployed to GitHub Pages - #2

Merged
transfix merged 5 commits into
mainfrom
m0-browser
Oct 30, 2026
Merged

transfix merged 5 commits into
mainfrom
m0-browser

Conversation

@transfix

@transfix transfix commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

cypkg's browser path. The same documents run in ari's xterm.js page, the FTXUI backend built for wasm (transfix/libcvc#887), served from the registry's own origin.

What's here

  • tools/site.sh ARI_WEB OUT assembles OUT/apps/cypkg/ from ari's page files (ari.html, ari.js, ari.wasm, ari-web.*, xterm/) and share/cypkg/*.ari. index.html is a copy of ari.html, so /apps/cypkg/ opens the terminal.
  • web/ariadne.config.json:
    • pins the document (src_param: false);
    • turns the network on for the page's own origin only (--net);
    • passes --server {origin}, so cypkg browses the registry that serves it.
      Host flags come only from this file, never from the URL.
  • The fixture registry takes --site DIR. It serves the site and the API from one origin with a strict Content-Security-Policy, as a registry should serve /apps/cypkg/ (C1).
  • tests/browser.mjs runs the page in headless Chrome over DevTools (Node 22, no other dependency). It sends real keys and reads the terminal's text through window.ariadneWeb.text(). Its 7 steps mirror the tmux test:
    • start-up search;
    • typing a query and Enter;
    • Open, which starts the package module;
    • Next, then Back.
      It fails on a page failure, a document warning or a CSP violation.
  • CI gets a browser job. It builds ari's single-threaded wasm page from libcvc with #887 too, using cvcpkg's emsdk and wasm deps as libcvc's ari-wasm job does, caches it by source tree, assembles the site and runs the test.
  • tools/libcvc.sh now does both jobs' fetching and merging.
  • tools/libcvc-resolve.py resolves the one known conflict: #887 and #896 in src/ari/main.cpp, where both sides of both hunks are wanted. Any other conflict fails. Delete it once either PR is rebased onto the other or merged.

Checked locally

  • tests/run.sh with every layer passes, including 3c (the browser).
  • By hand in a browser: mouse clicks on Open, Next and Back, and typing a query, with no console errors.
  • Removing --net from the config fails the browser test at its first step, with the reason in the log.
  • Size: ari.wasm is 8.8 MB raw, 3.1 MB gzipped; ari.js is 26 KB gzipped; xterm/ is 0.4 MB.
  • Speed: the first search results show 3.7 s after navigation (headless Chrome, localhost, cold).

GitHub Pages (55a9be0)

  • Where: until a registry serves it, CI publishes main's tested page to https://cy-pca.github.io/cypkg/. Pages is enabled for this repo with GitHub Actions as its source.
  • How: the browser job assembles the site from the page it just tested, with web/ariadne.config.pages.json (--net-allow https://cvcpkg.org, --server https://cvcpkg.org). A pages job deploys it on pushes to main only.
  • What it needs from cvcpkg.org: that's another origin, so cvcpkg.org must allow https://cy-pca.github.io with CORS (CVCPKG_CORS_ORIGINS). Today it doesn't: the preflight is a 400, and GETs carry no Access-Control-Allow-Origin.
    • Served locally from a plain static server, the page loads and runs. Its search is blocked only by "No 'Access-Control-Allow-Origin' header", and the terminal shows "search failed: ... (network or CORS)".
    • This is roadmap item C5.

Not in this PR

  • Serving it from a registry (C1). Deferred: GitHub Pages hosts it for now.
  • cvcpkg.org's CORS for the Pages origin (C5).
  • #887 merging. Until it does, CI builds the page from its branch.

tools/site.sh assembles /apps/cypkg/ from ari's xterm.js page
(transfix/libcvc#887) and share/cypkg/. web/ariadne.config.json pins
main.ari, turns the network on for the page's own origin and passes
--server {origin}, so cypkg browses the registry that serves it. The
fixture registry serves a site too (--site), with a strict CSP.

tests/browser.mjs drives the page in headless Chrome over DevTools with
real keys and checks the terminal's text: 7 steps, passing locally. The
first results show 3.7 s after navigation; ari.wasm is 3.1 MB gzipped.

CI gains a browser job that builds ari's single-threaded wasm page from
libcvc with #887 too and runs the test. tools/libcvc.sh does both jobs'
fetching and merging; tools/libcvc-resolve.py resolves the one known
conflict (#887 and #896 in src/ari/main.cpp) and fails on any other.
Until a registry serves /apps/cypkg/, CI publishes the browser build to
https://cy-pca.github.io/cypkg/. The browser job assembles it from the
page it just tested, with web/ariadne.config.pages.json
(--net-allow https://cvcpkg.org, --server https://cvcpkg.org), and a
pages job deploys it on pushes to main. tools/site.sh takes the config
as an optional third argument.

That origin needs cvcpkg.org's CORS to allow it. Served locally from a
plain static server, the page loads and runs, and its search is blocked
only by the missing Access-Control-Allow-Origin (roadmap C5).
@transfix transfix changed the title Browser path: cypkg on ari's wasm page, tested in headless Chrome Browser path: cypkg on ari's wasm page, tested in Chrome, deployed to GitHub Pages Oct 30, 2026
libcvc master (#889) added #include <cstdlib> at the top of
state_exec_builtins_test.cpp, where #883 adds #include <cmath>, so #883
stopped merging and both CI jobs failed at their checkout. A conflict
whose two sides only add #include lines now keeps both, sorted, in any
file. With it, all seven PRs merge onto master again, and tests/run.sh
passes on the ari built from them.
In CI every step passed, then rmSync failed with ENOTEMPTY on the
profile Chrome was still writing as it shut down, and the job failed.
Wait for Chrome's exit (at most 5 s), retry the removal, and never let
cleanup change the result.
cy-pca/llm-gate@v1 fails a pull request (and a push to main) whose
commits, title or description carry AI-assistant attribution: co-author
trailers naming an AI, "generated with" footers, AI session links, AI
bot authors. The same workflow as cy-pca/cvcpkg's, on main.
@transfix
transfix enabled auto-merge (squash) October 30, 2026 19:29
@transfix
transfix merged commit acbcd51 into main Oct 30, 2026
5 checks passed
@transfix
transfix deleted the m0-browser branch October 30, 2026 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant