Skip to main content

Module default_scope

Module default_scope 

Source
Expand description

Substrate-complete default-scope readiness detectors (v0.31.0 Finding 8): observe whether the default project’s BLOB + LIBSQL data is still un-re-homed, so the serve guard + boatramp migrate --finalize reach the same bar as the KV version-guard. Substrate-complete default-scope readiness (v0.31.0 Finding 8).

The KV re-home + the serve version-guard that boatramp_core::migrate owns are KV-only. A default project’s data also lives in BLOB (hblob/, mqp/, mqgp/) and LIBSQL ({dir}/{site}.db), which the KV version cannot observe — so a blob-only or SQL-only default project could pass the KV guard as Ready while its data strands (HIGH-1/2/3 of the security review). These node-level detectors make the re-home observable across those substrates so the serve guard and boatramp migrate --finalize can refuse/warn/sequence until ALL substrates are re-homed.

The critical asymmetry: BLOB has a runtime read-fallback during the KV dual soak (a cold object is bridged), so an outstanding blob is a WARN while the soak is live. LIBSQL has no runtime fallback — database("default", site) would open the non-existent {dir}/default/{site}.db and auto-create an EMPTY database — so an un-re-homed default libsql database is a hard REFUSE.

Constants§

BLOB_RETIRED_MARKER
Control-plane KV marker set by boatramp blob rehome --finalize once the blob substrate is verified retired (no bare default-scoped object remains), and REQUIRED by boatramp migrate --finalize before it clears the KV dual soak (which disengages the runtime blob read-fallback). The explicit “I retired the blob substrate” signal — set by the command that holds the blob backend (and resolves its credentials), read by the KV finalize that does not. A node with no blob data still sets it by running blob rehome --finalize once (a 0-object no-op).

Functions§

blob_default_outstanding
Whether any BARE default-scoped blob object remains under hblob//mqp//mqgp/ on storage — i.e. a key whose scope segment is neither the reserved default (already re-homed) nor a KNOWN project (projects, that project’s own object). Short-circuits on the first such key. Used by boatramp migrate --finalize to REFUSE clearing the KV dual soak (which disengages the runtime blob read-fallback) until the blob substrate is drained — otherwise a cold default object would 404 after finalize.
known_projects
Read the projectmeta/ project-name set (including the reserved default) from the control-plane KV — the set both detectors use to tell a bare default scope from a named project.
libsql_bare_default_idents
Un-re-homed default-project libsql identities still at the bare (pre-default/) on-disk layout under libsql_dir. A default site’s data moves from {dir}/{site}.db (and named DBs from {dir}/{site}/{name}.db, functions from {dir}/fn/{name}.db) to under {dir}/default/…; so:
libsql_dir_for
The libsql data directory for a node config’s handlers.bindings.sql (single-node), mirroring handlers::build_sql_backends: handlers.bindings.sql.dir, else {data_dir}/handlers-sql. Only meaningful for a LOCAL (non-url) libsql binding — a remote sqld has no local directory.