Skip to content

Menu bar and windows: builders, builds, activity, account; sign in with a token or a browser - #6

Merged
transfix merged 6 commits into
mainfrom
windows
Oct 30, 2026
Merged

transfix merged 6 commits into
mainfrom
windows

Conversation

@transfix

@transfix transfix commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

A menu bar whose View menu opens a window for each page cvcpkg.org's site has: Builders, Builds, Activity and Account, beside Search.

Windows

  • Builders: the fleet's platform, status, load, version and last heartbeat, with a count of how many are online.
  • Builds: jobs newest first, filtered by status, a page at a time.
  • Activity: publishes and yanks.
  • Account: whoami (name, role, orgs), and Sign out.

How they behave:

  • Each window is a module (share/cypkg/{builders,builds,activity,account}.ari), with its view in views.ari. A closed window's module doesn't start until the window is first opened.
  • Each refreshes about every 10 s while open. idle-wait waits in 0.1 s slices and answers Refresh at once.
  • Each draws a progress bar at its bottom while a request is in flight.
  • --open builders,activity opens windows at start.

Sign-in

  • API token: bin/cypkg --token-env VAR (default CYPKG_TOKEN) hands a cvctok_ token to ari with --credential-env. A policy file written for the run binds it to the registry's origin (Ariadne credentials: several per reply, form and header values, --credential-env (cypkg) transfix/libcvc#895). The documents never see the token.
  • Where auth lives: main.ari asks the host whether it holds the credential and hands auth.* to the modules through a hole. It has to, because has? doesn't exist inside a module (L18). Every request then carries the token, so private orgs' packages show in search.
  • Refused tokens: a 401 from whoami drops the token, and the windows go back to anonymous requests.
  • Browser sign-in (OIDC), added in 7d64b4b: device pairing.
    • Account > Sign in with a browser shows a code and the approval URL.
    • It polls /v1/auth/device/token at the server's interval, honouring slow_down. capture_auth takes the access and refresh tokens into the host, so the documents never see them.
    • Cancel, denial and expiry each say so.
    • Sign out revokes a paired session on the server, then forgets it.
    • bin/cypkg remembers the sign-in in ari's credential store (~/.config/cvc/credentials/cypkg, 0600), unless --no-remember.
    • It pairs as cvcpkg-cli, the only client cvcpkg.org registers, with device_label "cypkg".
    • It needs sha256-hex and random-token from state_exec: sha256, sha256-hex and random-token builtins transfix/libcvc#911.

Under the hood

  • share/cypkg/net.ari now holds fetch, shared by every module, so lib.ari stays pure.
  • lib.ari gains idle-wait, closed, int-or and table formatters.
  • The search window's progress code moved into fetch, and its requests send the token when signed in.
  • --progress off makes plain blocking requests, for a browser ari without Ariadne L4: requests in single-threaded wasm don't stall the frame loop transfix/libcvc#914.
  • CI's browser build now merges #914, and both builds merge #911 and #912.
  • tools/libcvc-resolve.py keeps both sides of a conflict in docs or tests between open PRs (#911 against #896).
  • tools/libcvc-resolve.py's two main.cpp rules work in either merge order, now that #887 has merged and #896 meets it from the other side.

Tests

tests/run.sh passes locally (94 checks, on an ari from master plus every listed PR), including the integration layer against a real cvcpkg-server:

  • Fixture: serves builders, builds and activity captured from cvcpkg.org (fleet.json), and whoami for a test token.
  • Module tests:
    • pairing_test.ari: approved (signed in as a session), sign-out revokes on the server, denied, Cancel. The fixture plays the pairing endpoints, and /_approve stands in for a person at /link.
    • fleet_test.ari: the online count, Refresh answered at once, paging, the status filter, activity;
    • account_test.ari: signed in with the test token through --credential-env, whoami, sign-out.
  • Snapshots: one per window, and every frame gains the menu bar's row.
  • tmux: View > Builders opens the window, in FTXUI and tvision (their menu keys differ).

Known

  • Browser test flakiness: in about 1 run of 3, a request in the single-threaded browser ari never resumes, before and after #914, with main's documents too. It's reported to the L4 session (L19).
  • A tvision quirk: it reads an unset tree.<id>.open that a menu item binds as closed, so main.ari sets the search window's open state explicitly.

…gress bar

Next was slow because every page asked cvcpkg.org for facets, which
makes it count every match: 1.2 s for page 2 of everything and 2.4 s
for page 2 of zlib, against 0.2 s and 0.4 s without. Now only a new
query or filter asks for facets (the honest package count); paging
reuses that count. After showing a page the search module prefetches
the next one in the background and keeps the page it left, so Next and
Prev are answered with no request.

Requests wait in 50 ms slices (http-get-async and await with a
timeout), and between slices the module draws an indeterminate progress
bar at the bottom of its view; the package module does too. lib.ari
gains search-key, body-text and progress-bar, and search-query takes
facets.

The fixture logs its requests (/_requests) and answers a slow: name
after a second. Module tests show a new query asks for facets and
paging doesn't, Next and Prev make no request, and the bar draws during
a slow request and clears after; with prefetch disabled they fail.
# Conflicts:
#	share/cypkg/package.ari
#	share/cypkg/search.ari
#	share/cypkg/views.ari
…sign-in

A View menu opens a window per page the registry's site has: Builders,
Builds (by status, paged), Activity and Account, beside Search. Each is a
module in share/cypkg/, started when its window first opens, refreshing
about every 10 s while open (idle-wait answers a click at once), with a
progress bar at its bottom.

Signing in: bin/cypkg --token-env VAR hands a cvctok_ token to ari
(--credential-env, bound to the registry by a policy file for the run).
main.ari asks the host (has? works only at the top level) and hands
auth.* to the modules through a hole; every request then sends the token.
Account shows whoami and signs out; a refused token is dropped. Browser
sign-in (device pairing) waits on sha256-hex and random-token in libcvc.

net.ari holds fetch, now shared by every module, so lib.ari stays pure.
--progress off makes plain blocking requests, for a browser ari without
transfix/libcvc#914, which CI's browser build now merges. The fixture
serves builders, builds, activity and whoami; tests cover each module,
the account signed in and out, each window's frame, and opening Builders
from the View menu in FTXUI and tvision.
Account > Sign in with a browser runs cvcpkg's device pairing, its OIDC
route for a terminal: a random verifier (random-token), its SHA-256 sent
to /v1/auth/device, the code and an absolute approval URL shown, and a
poll of /v1/auth/device/token at the server's interval (slow_down
honoured) with capture_auth taking the access and refresh tokens into
the host. Cancel stops it; a denied or expired code says so. main.ari
re-asks the host once a token is captured. Sign out revokes a paired
session on the server before forgetting it.

bin/cypkg keeps the sign-in in ari's credential store (--credential-store
cypkg, 0600) unless --no-remember. Pairing needs sha256-hex and
random-token (transfix/libcvc#911); CI now merges #911 and #912, and the
resolver keeps both sides of docs and test conflicts between open PRs.

The fixture plays the pairing endpoints, with /_approve standing in for
a person at /link; pairing_test.ari covers approve, revoke, deny, cancel.
@transfix transfix changed the title Menu bar and windows: builders, builds, activity, account; API-token sign-in Menu bar and windows: builders, builds, activity, account; sign in with a token or a browser Oct 30, 2026
@transfix
transfix enabled auto-merge (squash) October 30, 2026 23:13
@transfix
transfix merged commit 4dcf016 into main Oct 30, 2026
6 checks passed
@transfix
transfix deleted the windows branch October 30, 2026 23: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