Repository navigation
Ariadne shell SH1: mounts:, app-open/app-close, budgets per mount, shell.ari - #1566
Merged
Merged
Conversation
This was referenced Nov 26, 2026
Merged
…ell.ari
docs/roadmap/ARIADNE_SHELL.md 4.1, 4.2, 4.11 and the SH1 row; ARIADNE.md 6.7.
- mounts: <key>: one isolated mount per child of the key (uri, args), loaded through
load_mount (expand_load in a fresh context, stateless) with the loader AppRuntime gives the
Runtime (Runtime::set_mount_loader). Its init: runs and its on_tick: starts as it opens; it
is an application (its bar one menu of the outer bar; one without a bar gets Restart, Quit,
Close). Closing quits it, kills every process under its scope and frees its slot; its state
stays, so reopening resumes it. Parsed again only when its uri, args or a file changes; hot
reload keeps its resident when its program is the same. allow: (a list or { bind }) narrows
what may be mounted, a refusal posted to the feed; catalog: names the documents that run as
the local principal. The requires: check at mount refuses what the static scan would fail or
warn on (a required entry, an unprovided call, gl.scene for a scene: on a host without one).
- (app-open URI [AS [ARGS]]) and (app-close AS) on the calling document's first slot; a mounted
document gets a PermissionError.
- A budget per mount: cvc::state_exec::frame_account (execute_options::account, kept by spawn and
fork). The async scheduler charges steps and seconds, ends a run at the limit, and parks a
spent account's processes until the next frame (never killed); wake_awaiting starts each
account's new frame. Memory is the processes' measured heap shares (process::measures_heap),
summed by the Runtime. Defaults by principal (local 100000 steps, 0.025 s, 256 MB a frame;
file: and remote: 20000, 0.005 s, 64 MB), settled against every shipped example (busiest:
108 steps, under 0.4 ms a frame). Held for 3 s: a notice whose click offers Allow more, Quit
and Restart. The apps mirror carries principal and budget.*; processes.ari shows each share.
- data: uri: { arg: NAME }; a menu_item: label that is an expression.
- components/shell.ari (--catalog in gallery.json format, --open), an Apps menu, a Launcher,
processes.ari, a mounts: slot; examples/ariadne/documents/shell_apps.json (tray_demo,
json_feed, apps/counter).
- The .ari schema learns mounts:, allow:, catalog: and uri: { arg }.
Tests: AriadneMounts.* (open, close with its memory freed, reopen with state kept, the verbs,
a refused URI, unmet requires:, hot reload, a busy mount held while another runs, a mount past
its memory, the shipped examples within the local budget), AriadneComponents.ShellOpensIts-
CatalogOnDemand, AriadneLoader.MountsSlotAndADataUriFromAnArgument and LoadMountParsesAn-
EntrysDocument, AsyncSchedulerTest.AFrameAccountHoldsItsProcessesToTheirFrame, and
ari_run_shell_{ftxui,tvision} (tmux, Linux).
…l form On the Windows CI runner the temp directory is spelled with an 8.3 short name (C:\Users\RUNNER~1\...). The slot's base comes from the resolver, which uses weakly_canonical, so it holds the long name. The entry's path was only made lexically normal, so the two never matched, and AriadneMounts.ARefusedUriIsPostedToTheFeed saw its allowed file refused. mount_norm now makes a local path canonical the way the resolver does (links followed, short names spelled out), and keeps a trailing slash so an allow: prefix still matches only under its directory. Reproduced and verified locally by running ariadne_runtime_test with TMP set to a short path: all 377 pass.
…a small stack Rebased onto the iterative walk (#1577): - emit_mounts pushes a frame per open mount (its id and emit_path entry, the wrapper on the walk, then a Then that pops them) instead of emitting each in a nested walk. - plan_windows_menu's Mounts case pushes each open mount's tree, then a marker visit that makes it an application if it brought no bar (ARIADNE_SHELL.md 4.9), keeping tree order. - app_menu ends every application's menu through app_commands (Restart, Quit, and Close for a mounts: entry's); one without a bar gets those alone. - drop_mount_ticks seeds its loop with the slots' wrappers. Runtime::set_root's search for the document's own first mounts: slot recursed once a level: it overflowed ariadne_deep_nesting_test's 256 KiB stack on PlainGroups, MenusAndTrayMenus and the FTXUI and tvision plain-group tests. It is a loop now. AriadneDeepNesting.AMountsSlotsEntriesDraw: three entries opened and drawn on the small stack, a window nesting 3000 groups, a bar whose menu nests 3000 submenus, and one without a bar, each with its Close item, every begin_* and push_id balanced.
transfix
force-pushed
the
tfx/shell-sh1-mounts-fb75fd
branch
from
November 27, 2026 04:54
9d8125b to
124a59c
Compare
…shell-sh1-mounts-fb75fd # Conflicts: # inc/cvc/ariadne/widget.h
#1563 added a document's state: block. A load:ed module's seeds are written at its sub-prefix just before its init:, once, and again on a Restart. A mounts: entry's wrapper carries the same seeds (load_mount goes through expand_load), but open_mount ran only its init:. That marked the mount done in ran_inits, so the seeds were never written. open_mount now writes them just before the init:, under the same once-only check. Reopening resumes without writing them, and a Restart writes them again (emit_container, as for a load: module). AriadneMounts.AMountsStateBlockIsWrittenAsItOpens checks that init: reads the seeds, a reopen keeps a changed value, and a Restart writes the seeds again. It fails without the fix: the mount opens but count is empty. ARIADNE.md 5.3 and 6.7 and the ARIADNE_SHELL.md 4.2 note say so.
This was referenced Nov 27, 2026
mount_principal and open_mount each kept a `static const MountsSpec kNoSpec` to stand for a slot without a spec. A function-local static of a non-trivial type is a bss object and a guard variable, so the writable-data scan on package-linux / libcvc-release-grpc failed on four symbols that are not on the allowlist. Each is now a local MountsSpec: an empty one costs no allocation, and nothing is left process-wide.
…ounts-fb75fd #1586 builds each widget in place and splits expand_load into read_fragment, open_mount and finish_mount. SH1's LoadOutcome (why a fragment was not mounted, its canonical path, whether it has a scene, and the min_libcvc gate a run-time mount keeps) moves into read_fragment, and expand_load passes it through. parse_mounts builds its slot in place like the other widgets. load_mount gives its context a Nesting, as load_node does, and refuses a document nested past kMaxNesting with that error rather than mounting it cut short: a mounts: entry's document nests as a document of its own does. New AriadneLoader.LoadMountRefusesADocumentNestedPastTheLimit. ARIADNE.md: #1586's "How deep a document nests" keeps 6.7, which its error message cites, and mounts: is now 6.8; SH1's references to it follow. The deep nesting tests keep both sides.
This was referenced Nov 27, 2026
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.
Ariadne shell phase SH1 (docs/roadmap/ARIADNE_SHELL.md 4.1, 4.2 and 4.11, the SH1 row, the decisions of 2026-11-23). Documented in docs/ARIADNE.md §6.8, with an "As built in SH1" note in ARIADNE_SHELL.md 4.2 and 4.11.
What it builds
mounts: <state key>: one isolated mount per child of the key (uri,args.*,budget.*).load_mount(loader.h):expand_loadin a fresh context, stateless, using the same resolver, component paths and guards as a staticload:, plus themin_libcvcgate.AppRuntimegives the Runtime that loader (Runtime::set_mount_loader), with therequires:check against its host.includes.<id>under the slot's scope). It reconciles the slots at the top of each frame (open, close, parse again) and plans the Windows menu over them.init:runs and itson_tick:starts as it opens.status,error,principalandnameback.includes.<id>, so reopening resumes it without runninginit:again.uri,argsor one of its files changes.AppRuntime::reload_if_changedalso polls the mounts' files. A mount parsed again keeps itson_tick:resident when the program is the same.allow:, a literal list or{ bind: <key> }. A refused URI is posted to the feed.requires:at mount time. What the static scan would fail or warn on refuses the mount, named: a required entry, a function a program calls that the host lacks, orgl.scenefor ascene:on a host without one. An optional entry the host lacks stays a warning.(app-open URI [AS [ARGS]])and(app-close AS)act on the calling document's first slot. Without an id,app-opentakes the URI's file name and returns an entry already open on that URI. A mounted document gets aPermissionError.cvc::state_exec::frame_account(process.h) is a share of each frame that several processes draw on (execute_options::account; spawn and fork keep the parent's).The async scheduler charges each step's steps and seconds and ends a run at the limit.
It parks a spent account's processes as
(await)does, until the next frame, and never kills them.wake_awaitingstarts every account's new frame.Memory is the processes' measured heap shares. The scheduler now measures them under a memory-capped account without a limit of its own (
process::measures_heap). The Runtime sums them four times a second.Defaults by principal, local /
file:andremote:(per frame):localfile:,remote:After 3 s held, a notice is posted. Its click opens a Budgets window with Allow more (doubles the entry's
budget.*), Quit and Restart, because a feed entry has a single action.The apps mirror carries
principalandbudget.*, andprocesses.arishows each application's share.data:entryuri: { arg: NAME }, filled in from the parsed command line. A relative path is taken from the working directory.menu_item:label that is an expression is worked out each frame. The Apps menu needs it to list the catalog by title.components/shell.ari(cvc://components/shell.ari):--catalogin gallery.json format, plus--open SLUG,...;processes.ariand amounts: shell.appsslot.examples/ariadne/documents/shell_apps.jsonlists tray_demo, json_feed and apps/counter..arischema getsmounts:(mounts_site, withallow:/catalog:asuri_list) and the datauri: { arg }.ari validatefollows from the schema. INDEX.ari listsshellas a document component.A decision for Joe
catalog:on the slot. Principals come from where the bytes came from (4.12). A local file can't say on its own whether it is the shell's catalog app (local) or a file the user opened (file:<dir>), so the slot names its catalog:catalog: { bind: shell.catalog_uris }, whichshell.arifills from--catalog.The alternative is a flag the shell writes on each entry (
shell.apps.<id>.catalog). It's an easy swap if you prefer it.view,background,grantsandargvaren't read yet; they belong to SH3, SH6 and SH7. A staticload:still shares its document's budget.Verified
On Windows (MSVC 19.44, Release, cvcGL off; this
arihas FTXUI and tvision), at 189d397 (this branch with master 104bca2 merged in), withTMPset to a short path:The new tests:
AriadneMounts.AMountsStateBlockIsWrittenAsItOpens: a mounted document'sstate:(Ariadne: a state: block, the document's starting values without init: calls #1563) is written as it opens, before itsinit:reads it; a reopen keeps a changed value, and Restart writes the seeds again. It fails without the fix.AriadneMounts.OpenCloseAndReopenKeepItsState: after close, no process is left under the mount, its sources and slot are gone, the scheduler holds no account, no widgets are drawn, and it is no longer an application.AppOpenAndAppCloseActOnTheCallingDocument.ARefusedUriIsPostedToTheFeed.AnUnmetRequiresRefusesTheMount.HotReloadKeepsTheResidentWhenItsProgramIsTheSame.ABusyMountIsHeldToItsBudgetWhileTheOthersRun: the busy mount never exceeds 5064 steps a frame, isn't killed, gets the notice, and Allow more doubles its budget.AMountPastItsMemoryIsHeld.TheShippedExamplesKeepWithinTheLocalBudget: every example mounted as a catalog application with a stub scene adapter. The busiest uses 108 steps and under 0.4 ms in a frame; none is held. The 8 the host refuses (net, oidc, stream_view, quit, a custom verb) are listed.AriadneComponents.ShellOpensItsCatalogOnDemand: the AppRuntime stand-in for the tmux run. It opens with--open, checks the menus and windows, runs a menu item in the mount's scope, closes, and reopens with state kept.AriadneLoader.MountsSlotAndADataUriFromAnArgument.AriadneLoader.LoadMountParsesAnEntrysDocument.AriadneLoader.LoadMountRefusesADocumentNestedPastTheLimit: a mounted document at Ariadne loader: about 1 KB of stack a level, and a document nests at most 256 levels #1586's 256-level limit mounts, and one a level deeper is refused with the nesting error.AsyncSchedulerTest.AFrameAccountHoldsItsProcessesToTheirFrame, at slice 1 and slice 256.The first CI run failed
ARefusedUriIsPostedToTheFeedon Windows. The runner's temp path uses an 8.3 short name (RUNNER~1), and the slot compared it with the resolver's long-name base. Since eaa7b11 (originally 9d8125b, before the rebase),allow:andcatalog:paths are compared in canonical form. The failure reproduces locally withTMPset to a short path, and with the fix all 377 runtime tests pass that way.ari validatepassesshell.ari.ari snapshot --backend ftxuiofshell.ari --catalog shell_apps.json --open counter,json_feeddraws the bar asApps Counter JSON feed Windows, with the Counter's tray star and the feed's window.Not run here:
ari_run_shell_{ftxui,tvision}, the tmux run (Linux CI only, no tmux on this box). The cvcGL build wasn't built locally; the ImGui backend and arigl are left to CI.Merged with #1563 (
state:)#1563 landed on master after the rebase. It is merged in (36d8db4); the one conflict was two declarations added at the same place in widget.h, and both are kept.
With #1563, a
load:module'sstate:seeds are written just before itsinit:. Amounts:entry's wrapper carries them too, butopen_mountran only theinit:. That marked the mount done, so the seeds were never written.f9f6a94 writes them just before the
init:, as aload:module's are: once as it opens, not again on a reopen, and again on Restart. ARIADNE.md 5.3 and 6.8 say so.Merged with #1586 (the loader's nesting limit)
#1586 landed next and conflicted in loader.cpp, ARIADNE.md and the deep nesting tests. Master is merged in (189d397):
expand_loadintoread_fragment,open_mountandfinish_mount. SH1'sLoadOutcome(why a fragment was not mounted, its canonical path, whether it has a scene, themin_libcvcgate) moves intoread_fragment, andparse_mountsbuilds its slot in place.load_mountgives its context aNesting, asload_nodedoes, and refuses a document nested pastkMaxNestingrather than mounting it cut short. A mounted document nests as a document of its own does.mounts:is now §6.8, and SH1's references to it in the code, the schema, the components and ARIADNE_SHELL.md follow.The writable-data scan
CI at f9f6a94 failed package-linux / libcvc-release-grpc in its writable-data scan; all its tests passed.
mount_principalandopen_mounteach kept astatic const MountsSpec kNoSpecfor a slot without a spec, a bss object and a guard variable each. Since aac42a3 each is a local, so nothing is left process-wide and the allowlist is unchanged. The scan reads ELF objects, so it can't run on this box; CI checks it again.On top of #1577 (the walk on the heap)
As Joe asked, #1577 merged first, and this branch was replayed onto it. The SH1 parts of the walk now follow #1577's rules: nothing in them recurses, so a mounts: slot draws on #1577's 256 KiB test stack.
emit_mountspushes one walk frame per open mount (its id, then the wrapper's walk) rather than callingemit(), which nests a walk.plan_windows_menu'sKind::Mountscase puts each open mount's wrapper on the plan'sVisitstack. After it comes a marker visit that records the mount as an application when it has no bar of its own.app_commandsends each application's menu: Restart, Quit, and Close for a mounts: entry's. An application without a bar gets that menu alone.drop_mount_tickswalks each kept mount's wrapper on its heap list.set_root's search for the document's own slot is a loop over a heap list. It used to recurse, which overflowed four of Ariadne: the per-frame walk keeps its place on the heap, so any depth draws on a small stack #1577's deep tests.AriadneDeepNesting.AMountsSlotsEntriesDraw:Before #1577, this branch had to keep
emit_node's frame small, so the slot's data sits behind one pointer (Widget::mounts) and its emit work is in helpers that are never inlined. Both stay: they cost nothing, and they keep each walk step small.