Skip to main content

Module deploy

Module deploy 

Source

StructsΒ§

DeployManifest πŸ”’
PackageEntry πŸ”’
PackageSpawnEnv πŸ”’
ResolvedPackage πŸ”’
One package as it was actually found on disk when the deployment ran.
Spawned πŸ”’

ConstantsΒ§

CMD_ACTIVATE πŸ”’
CMD_DEACTIVATE πŸ”’
CMD_INIT πŸ”’
CMD_SHUTDOWN πŸ”’
DEFAULT_DRIVER_INIT_TIMEOUT πŸ”’
DEPLOY_CONSUMER_ID πŸ”’
DRIVER_REGISTER_TIMEOUT πŸ”’
SOMA_STAGE_FD πŸ”’
Fixed fd number rbnx exports as ROBONIX_SOMA_STAGE_FD in soma’s environment. Any fd β‰₯ 3 works β€” we pick 3 because it’s the first non-stdio slot, which keeps ls /proc/<soma>/fd readable at a glance. Soma reads the trigger line, then closes it.
SYSTEM_BUILTINS πŸ”’
Single source of truth for which system: keys are shipped binaries rather than packages under <robonix_source>/system/<key>/.

FunctionsΒ§

call_driver_cmd πŸ”’
Issue one Driver(cmd) RPC against a freshly-connected channel, then release the channel. Returns the response’s state string on success; bail-errors when ok=false or the RPC itself fails. Used by the boot path for both CMD_INIT and CMD_ACTIVATE, with identical timeout / channel hygiene.
check_prerequisites πŸ”’
Boot-time prerequisites check:
close πŸ”’ ⚠
component_records πŸ”’
driver_init_timeout πŸ”’
dup2 πŸ”’ ⚠
ensure_soma_defaults πŸ”’
Make sure system.soma exists in the manifest map as a mapping, and resolve any relative file paths inside it against manifest_dir.
execute
git_state πŸ”’
git rev-parse HEAD, and a digest of the uncommitted changes if any.
is_builtin_system πŸ”’
libc_close πŸ”’
libc_dup2 πŸ”’
lifecycle_state_label πŸ”’
log_path πŸ”’
persist_state πŸ”’
port_is_free πŸ”’
Probe a host:port. Returns Ok(()) when nothing is listening (we can safely bind), Err describing the live owner otherwise. This is a race-prone pre-check (someone else can grab the port between probe and spawn) but in practice the failure mode it catches β€” a stale previous-boot daemon β€” has been alive for minutes, not seconds, so a single connect attempt is enough.
prepare_manifest πŸ”’
Apply top-level deployment variables, then expand every scalar in the manifest. Build and boot share this preparation path so package locations, target-manifest selectors, system settings, and package config all resolve against the same environment.
read_log_tail πŸ”’
Read the last max_lines lines of a file for embedding into an error message. Best-effort: an unreadable/missing file returns an empty string rather than an error β€” the caller already reports the path, we just enrich when we can. We read the whole file (soma.log is scribe-managed and stays small during boot), split, and take the tail β€” no seek-from-end acrobatics needed for the boot-time use case.
read_provider_exit_summary πŸ”’
Summarize a package that exited before Atlas registration. Providers often forward Python tracebacks through Scribe at info level, so the lifecycle- specific parser above may intentionally return None. In that case the last structured message is the most useful single-line cause for boot output.
read_provider_failure πŸ”’
Return the provider’s actual lifecycle failure rather than whichever shutdown record happened to be written last. Scribe records are JSONL; providers commonly report lifecycle transitions at info level, so prefer -> ERROR (...) messages before falling back to an error-level record.
repo_dir_name πŸ”’
Compute a PackageEntry’s expected on-disk path. PURE β€” no I/O, no logging, no cloning. path: entries land at manifest_dir/path; url: entries land at cache_root/<name> (whether or not it’s been cloned yet). Use entry_path_exists_on_disk to check presence; use the public cmd::fetch::clone_remote_packages (called from rbnx build) to actually populate the cache. Cache directory name for a url-remote package: the git REPO name (last path segment of the url, minus .git), NOT the per-instance provider id.
require_system_args πŸ”’
Render a one-line β€œwhat is this binary doing” string for the boot log. Pulls out the high-signal flags (port, vlm model+host) and drops noisy ones (–capabilities, –log, raw API keys). Per-binary required-arg sanity check, run before spawning.
resolve_entry_path πŸ”’
short_label πŸ”’
Strip the leading <component>_ from the boot-log pkg_label. system_memory β†’ memory; primitive_tiago_chassis β†’ tiago_chassis. Keeps boot-output columns narrow (the section header above already said which class the entry belongs to).
soma_grpc_ready πŸ”’
spawn_and_init πŸ”’
Spawn one package and wait for its provider to register with Atlas.
spawn_package πŸ”’
spawn_soma_binary πŸ”’
Spawn soma with an inherited pipe on SOMA_STAGE_FD. The parent keeps the write end and later writes stage2\n to it (see write_stage2_trigger below). Layered on spawn_system_binary’s stdio+scribe pattern but adds:
spawn_system_binary πŸ”’
system_boot_detail πŸ”’
system_cli_args πŸ”’
Translate supported system: manifest fields into CLI args for built-in binaries.
system_listen πŸ”’
Translate a system.<name>: block into CLI args for the corresponding Rust binary. Per-binary mapping kept narrow β€” adding a new flag means touching exactly this function plus the binary’s clap struct.
wait_for_registration πŸ”’
Poll atlas until a provider NOT in before appears. Returns the new provider_id plus every distinct lifecycle Driver observed after the declaration settle window. The caller verifies this list before sending config or lifecycle commands.
wait_for_soma_skills πŸ”’
wait_for_soma_stage1 πŸ”’
with_spinner πŸ”’
Run fut while animating the boot spinner so the user sees the [ β ™ ] name msg_prefix N.Ns line update steadily even when the underlying RPC takes a while (Driver(CMD_INIT) for sensor-warm-up packages routinely sits at 30+ seconds). Without this the line goes silent right after wait_for_registration finishes and rbnx looks hung between OK lines.
write_lockfile πŸ”’
Write rbnx-boot/deployment.lock: what this run actually used.
write_stage2_trigger πŸ”’
Write the stage2\n trigger into the pipe rbnx and soma share (see spawn_soma_binary). This is a one-shot: soma reads the line, unblocks its skill-package launcher, and closes its read end. rbnx-side we drop the writer here β€” no reason to hold it open, and closing gives soma an immediate EOF on the (very unlikely) chance it re-reads.