Repository navigation
Own the Linux runtime layout discovery; ship the GTK main-thread bridge - #274
Merged
Merged
Conversation
…ridge The staged-vs-packaged runtime layout is Rivet's contract, but its discovery code was hand-copied per product (autarx AppModel.swift, taskly HostResources.swift, syncpilot discover_runtime_layout, and the Linux host template's main.cpp). rivet::linux_runtime now owns it (issue #246): discover_layout() locates runtime/*.boot + res/core.zo beside the running executable, an explicit-root overload serves tests and unusual staging, layout_error_hint() is the remediation message hosts display verbatim, and RuntimeLayout exposes stage_root, resources, and the four artifact paths. The template main.cpp consumes the library instead of carrying its own copy. GTK hosts also share one completion-marshaling shape: completions arrive on the backend reader thread and nothing there may touch GTK objects. The host template ships rpc_bridge.hpp (issue #247): unpack flattens the generated Result<T> — including the Result<void> specialization Void RPCs produce — into an Unpacked<T> decided on the reader thread (no exception flow across the hop), and post_to_main runs the closure on the GTK main loop, heap-allocated on the reader thread and freed there. The template main.cpp drops its private IntResult/g_idle_add plumbing for the bridge, so a new GTK host starts with the correct pattern instead of rediscovering thread affinity the hard way.
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.
Closes #246. Closes #247.
Runtime layout discovery (#246)
The staged-vs-packaged layout is Rivet's contract, but its discovery was hand-copied per product (autarx
AppModel.swift:255— an admitted third Swift copy, tasklyHostResources.swift, syncpilotdiscover_runtime_layout, and the Linux host template's ownmain.cpp).rivet::linux_runtimenow owns it (layout.hpp/layout.cpp, part ofrivet::platform):discover_layout()locatesruntime/*.boot+res/core.zobeside the running executable (/proc/self/exe)discover_layout(stage_root)explicit-root overload for tests and unusual stagingRuntimeLayoutexposesstage_root,resources, and the four artifact pathslayout_error_hint()is the remediation message hosts display verbatimmain.cppconsumes the library instead of carrying a private copymacOS parity note:
RivetEmbeddingalready exposesEmbeddedRacketConfiguration.resolvedDefaultwith the same stage-root logic;docs/embedding.mdis the cross-platform pointer. Products migrate by rebasing on the next release and deleting their private copies.GTK main-thread bridge (#247)
The host template ships
src/rpc_bridge.hpp:unpackflattens the generatedResult<T>— including theResult<void>specialization Void RPCs produce — intoUnpacked<T>(value or error, decided on the reader thread, no exception flow across the hop);post_to_mainruns the closure on the GTK main loop, heap-allocated on the reader thread and freed there. The templatemain.cppdrops its privateIntResult/g_idle_addplumbing and shows the pattern end to end.platform/linux/host/README.mddocuments both under "Runtime layout discovery" and "Completions belong on the main loop".Verification
RivetLayoutTestjoins the Linux integration CTest suite (complete/truncated/empty layouts, hint content, executable-path resolution)layout_test.cppcompiled and run locally (non-GTK paths);rpc_bridge.hpptemplate instantiations (unpack<int>success/error,unpack<void>against the generator's ownResult<void>shape) compiled and run locally with glib;main.cpp's GTK link compiles in the Linux CI legsrivet_linux_sources.cmakeaddslayout.cppto therivet::platformlibrary target; downstream hosts link the target and never compile Rivet sources themselves (issue Host integrations must consume released rivet packages, never compile rivet sources into downstream executables #238 contract)