Repository navigation
v5.13.0
Nuthatch 5.13.0 is the shared runtime: GraphOps's feature requests for hosting many organisations'
nests in one runtime, taken one by one in RFC-0073. Everything in it is operator configuration or
operability. Nuthatch still knows nothing about who a caller is; keys, accounts, billing and identity
stay in the operator's gateway. There is no storage migration, and no nest's NID, registry hash or
sealed segment changes. A few behaviours change, mostly for a runtime with more than one tenant, and
they are listed at the end.
Bundles over the admin API (FR10)
A host can now check, publish, read and prune bundles without shelling out to the binary (#2442):
POST /_admin/bundles?dry_run=truechecks a bundle exactly asnest loaddoes and prices its
mount.POST /_admin/bundles?as=<name>@<version>publishes it to--registry.GET /_admin/bundles/<nid>reads what the registry holds for a NID.POST /_admin/bundles/prunedeletes what nothing reaches, keeping any NID listed inkeepand any
NID a mount of this runtime still names.?dry_run=truelists only.
Prune deletes refs before blobs, re-lists refs before each blob delete and skips blobs younger than
15 minutes, and publish re-checks its blob after writing its refs, so within one runtime a ref never
names a missing blob. The one window left between two processes is described in docs/admin-api.md.
nuthatch nest inspect <bundle|dir> [--json] prints a versioned description of a nest
(nuthatch.nest-inspect/1) with no runtime and no network: NID, data identity, chain, contracts,
templates, factories, entities, feature-gated declarations, archive or trace extraction, and every
egress. Keyed RPC URLs show as scheme and host. nest load's egress warning now lists IPFS gateways
and offchain sources too, which it missed before (#2434).
S3 registries and mount failure codes (FR15)
S3 registries take credentials from the standard AWS chain (environment, web identity, container
credentials, instance metadata), never from mounts.toml or the command line. Named profiles are not
supported. A mount or move job now carries a code, one of not_found, access_denied,
verification_failed or other, set from typed errors rather than message text, shown by
GET /_admin/mounts and cleared on retry. Publish to a private bucket, mount by NID, a missing NID,
a tampered bundle and a wrong secret now run in CI against versitygw (#2436).
Seeding a mount from a mirror (FR16)
Rebuilding a lost runtime used to mean re-indexing every nest over RPC. POST /_admin/nests now
takes "seed": true and an optional "publish" table, and [runtime.publish] in mounts.toml sets
one mirror for the whole runtime (#2446). A seeded mount fills its dataset from the mirror through the
same code as nuthatch seed, checking every file's hash, then indexes from there. The job shows a
seeding phase with progress. A corrupt segment fails the job with verification_failed, and a retry
fetches only what is missing. A dataset that has already indexed, or that another mount serves, is not
seeded again.
Seeding from an S3 mirror now runs end to end in CI (#2459), and it found two defects, both fixed
here: a refused S3 or HTTP read was coded other and is now access_denied for 401 and 403, and
seeding wrote a missing schema.json into a runtime dataset, so seeding from another runtime's mirror
failed not_found or left a dataset that no longer hashed to its NID. A runtime dataset is no longer
written to.
Fair share between tenants (FR2)
Each cursor's SQL permits and the process's response-byte budget were first come, first served, so
one tenant's burst answered 503 to every other tenant on the chain. Both are now divided by tenant
label (#2445). Every tenant with a mount on a cursor reserves one permit and a weighted slice of
response bytes, and may borrow a free permit only while every other seated tenant's reservation stays
free, so a tenant under its reservation is admitted within the 250 ms admission wait however busy
another is. A tenant at its own share is answered 429 with "reason": "tenant_share"; a saturated
process still answers 503 busy.
PUT /_admin/tenants/<tenant> sets weight, max_permits and max_response_mib live and persists
them under [tenants.<tenant>] in mounts.toml. GET /_admin/tenants shows each tenant's share and
use. A runtime with one tenant, and a solo nest, behave as before.
Per-mount limits (FR3)
Every query guard was a constant shared by every mount. A mount record now carries optional limits
(statement timeout, rows, result bytes, hot rows and bytes, named-query scan, analytics memory and
queue), set on POST /_admin/nests or changed live with PATCH /_admin/mounts/<name>, and kept in
mounts.toml outside the NID and data identity (#2440). A value above the process limit is a 400
naming the ceiling. A PATCH lets queries already running finish under the old limits.
The memory limit is approximate: Burrmill accounts memory per dataset pool, so a mount's cap is
checked against the pool its NID shares and can refuse a query while a co-tenant of the same NID is
busy. It never raises the pool.
The memory ceiling, live (FR5)
PUT /_admin/runtime {"max_rss_mb": N} sets the per-cursor ceiling on a running runtime and persists
it in mounts.toml; GET /_admin/runtime reads it with what each cursor holds (#2444). It refuses a
value below what a cursor's mounts are admitted at. The authored-entity cap scales with the ceiling,
32 per 2,048 MB. At boot, each cursor's mounts are admitted in mounts.toml order and one that does
not fit is booted quarantined with the refusal a live mount would get, rather than refusing the whole
runtime.
An operator may now set the ceiling above 2,048 MB (#2461), up to 1 TiB, and the response says when
it is above the default. The analytics budget check at boot now uses the cursor's ceiling rather than
assuming 2 GiB, so a raise lets more fit. nuthatch watch reads the ceiling from the roster. The
default stays 2,048 MB, and the CI footprint gates still hold nuthatch's own design to it.
Non-negotiable 2 in CLAUDE.md carries the amendment.
Each /sql copies the unsealed tip into memory for the life of the query, and nothing counted those
copies. Each cursor's gate now carries a hot-copy budget of 128 MiB, paid from the ingestion
reservation and divided between tenants as response bytes are (#2449). The copy is measured from
stored lengths before a row is parsed, so a tenant over its share is refused 429 tenant_share
without copying, and a full gate answers 503 busy. The charge is released when the query ends,
errors or panics.
Strict isolation between tenants (FR8)
[runtime] isolation = "strict" gives each tenant label its own Burrmill sessions, engine memory
pools and memo entries, on every SQL route, even when two tenants mount the same dataset (#2455). It
admits only an allow-list of functions, every one the engine registers except version,
arrow_metadata and arrow_field, in the statement and in any authored view it reaches, and a test
fails the build when Burrmill or DataFusion registers a function the list does not name. Authored
views must be CREATE VIEW; CREATE TABLE ... AS is not run. The boot budget charges one engine
pool per permit, which the shipped split of two permits at 512 MB already fits. The default,
shared, is unchanged. A fuzz/sql target runs in CI.
A statement's computed values are now charged to its memory budget (#2469, burrmill#122). The engine
did not count scalar function results against a statement's pool, so one /sql statement, strict
mode included, could hold several GB in values it built. Every scalar function is now bounded at
16 MiB a value, checked from the arguments before allocating where an argument sets the size
(repeat, lpad, array_repeat, range, replace and their relatives); outputs over 256 KiB are
charged to the pool while they live; and ||, folded constants, string_agg and range or
generate_series in FROM are bounded the same way. A refusal reads as out_of_memory, as before.
An error naming an authored view is now explained from what defining the views recorded, where it used
to replay every authored statement in a fresh engine outside the request's limits, and an authored
view file starting with a multibyte character no longer panics its definition (#2472).
The isolation guarantee is not claimed. docs/security/shared-runtime.md is the threat
model, including what it does not defend: timing, shared CPU, and memory safety in the engine. It
describes what the code does and is meant to stop, and it is not a guarantee until an independent
review has run against it.
Fault containment (FR6)
A panic in one nest's ingest killed its chain's cursor, quarantining every co-tenant until a
restart, and one nest's build failure aborted the runtime's boot. Now a panic in a nest's window,
prepare, reorg rollback, rejoin or view-health check quarantines that nest alone, terminally, with
the panic message as its reason; the cursor and its co-tenants carry on, and the nest keeps answering
from its last committed window. A nest that fails to build at boot is booted quarantined, answering
503 with the reason, and the rest boot. Boot still fails when every nest does, and --fail-fast
keeps the strict behaviour (#2439). docs/admin-api.md has a table of each fault and what it takes
out. A slow nest still slows its chain: there is no per-nest window deadline.
Read replicas (FR1)
nuthatch serve --runtime <dir> --follow <writer-url> starts a follower on the same box as the
writer. It serves every mount's routes read-only, from the sealed segments in the runtime directory
and an in-memory copy of each hot tip, fed by the writer's GET /_admin/feed with the admin token
(#2448). A seal reaches it as one delta, so it never sees a block twice or not at all. Until a mount's
snapshot arrives, that mount answers 503 catching_up. /<tenant>/<alias>/ready reports the
writer as connected or absent and the follower's lag in generations, and a follower keeps serving
through a writer restart. Adding one needs no writer restart and re-indexes nothing.
Followers also derive balances, exposure, velocity, flags and RFC-0041 entities themselves, with the
writer's code, from the sealed history and their copy of the tip, and nothing answers
writer_only any more (#2457). Derived state torn part-way, or built over a segment missing from
disk, is never served; its routes answer catching_up until rebuilt. A rebuild took 100 ms over 50
segments, 861 ms over 500 and 3.8 s over 2,000 on the measurement in
docs/bench/rfc-0073-fr1-follower-derive.md, which also says why real nests will take longer.
A follower's request sees each delta's rows and derived state together or not at all (#2468): applying
a delta holds a per-dataset lock across the rows, the derived feed and a flush, and requests read
under it. One delta holds it for 0.25 to 0.43 ms, and derived routes' p99 rose by about 0.1 ms in the
measurement on that PR. The writer still has this window between its views and its commit (#2467).
Restarts and upgrades (FR7)
docs/bench/rfc-0073-fr7-restart-to-ready.md measures a writer's restart by mount count, for small
test nests: 9 ms to serving with 1 mount, 95 ms with 10, 992 ms with 100 and 10,238 ms with 500. It
is not a bound for real nests, and the page says why. scripts/rolling-upgrade.sh takes a runtime
from one binary to another, followers first and the writer last, with a query answered at every
step (#2448).
Each release is now gated on a rolling upgrade from the one before it (#2458). Given only the
candidate, the script finds the newest full release older than it, downloads and checksums it, and
runs the real upgrade when that release can follow; otherwise it runs the candidate in both roles and
says so on a MODE line. The release gate posts release-gate/rolling-upgrade on the candidate, and
it does not block the tag. 5.12 cannot follow, so this release is gated in that fallback; from 5.14.0
every run is across two releases.
Per-nest metrics and the cost report (FR4)
The request and SQL counters now have a per-nest series beside the process totals:
nuthatch_nest_http_requests_total{nest}, nuthatch_nest_sql_queries_total{nest},
nuthatch_nest_sql_rejections_total{nest,reason} and a nuthatch_nest_sql_duration_seconds{nest}
histogram from 1 ms to 30 s. The label is the mount's name, so an alias of a shared dataset is counted
under its own, and unmounting drops its series (#2435).
A request that sends Nuthatch-Cost: 1 gets a Nuthatch-Cost response header with eight fields:
sealed_bytes; hot_rows; engine_us; peak_mem_bytes; queue_us; result_bytes; sealed_bytes_read; scan_cpu_us, on /sql, /q/{name}, GraphQL, /table, /entities, /entity, /derived, balances,
exposure and flags (#2451, #2462). sealed_bytes is worked out from segment footers before the plan
runs, so the same statement over the same segments always reports the same figure; sealed_bytes_read
is what was fetched and can vary. engine_us is wall time. scan_cpu_us is the thread CPU spent in
segment scans, where Parquet decode and pushed-down filters run, and not in joins, aggregates or sorts
above them; on the scan-heavy test it was 54% of process CPU. It reads 0 where there is no per-thread
clock. The header is a report, not a price, and a request that does not ask runs exactly the old path.
Smaller requests
- Chains at runtime (FR9).
POST /_admin/chainsdeclares a chain on a running runtime, dormant
until a nest mounts on it, andPUT /_admin/chains/<chain>/rpcreplaces its RPC pool; a call in
flight finishes on the old pool. Both ask every endpoint foreth_chainIdfirst and refuse a wrong
or silent one, and persist to[[chains]]inmounts.tomlbefore taking effect. A runtime started
with--rpcor--rpc-fallbackrefuses both with409(#2447). POST /sql(FR11)./sql,/explainand/q/{name}also answer POST with a JSON body, so SQL
need not sit in proxy and CDN logs. The answer is byte for byte the GET answer (#2432).- A token from the MCP bridge (FR13).
nuthatch mcp --urlsends a bearer token from the variable
--token-envnames, orNUTHATCH_MCP_TOKEN. The token never reaches output, and a response that
echoes it is redacted before the model sees it (#2431). - Undecoded logs (FR14). Logs that matched a nest's topics but did not decode were dropped at
debug level, and a factory child's without even that. They are now counted in
nuthatch_nest_logs_undecoded_total{nest,contract,topic0}, capped at 256 pairs per nest, and
/readyand/nestshowundecoded: {total, top}. The per-log debug line is now one warning per
window (#2433). - A security window (FR12).
SECURITY.mdnow backports security fixes to the previous minor for
30 days after the next minor ships, so 5.12 receives them until 30 days after this release. A
hosting operator may ask for private advance notice of a security release (#2443).
Fixes
- A factory nest fetches wide per template (#2409). Past 500 discovered children, a factory
nest's seal-direct backfill and solo tip fetch switched to one address-lessgetLogscarrying every
topic0 in the nest, static contracts' included. For ENS that asked for every token transfer on
mainnet: the window fell from 25,000 blocks to 25. Static contracts are now always fetched by
address. A template with more than 500 children of its own is fetched by its own topic0s alone;
when only the total crosses 500, every template that has a child goes wide. - Two prunes on one registry no longer fail with 500 (#2456) when one deletes an entry the other
has just listed. - An offchain manifest names only its own files, shipped in 5.12.1 (GHSA-w9wm-2c89-4cxw, #2450,
#2453). - A bundle installs only its own regular files, shipped in 5.12.2 (GHSA-mqw2-cc6q-mpw6, #2463).
Compatibility and upgrade
Replace the binary and restart. A 5.12 store is used as it is: the hot store's tables and keys, the
sealed segment format and the segment manifest are unchanged. New settings live in mounts.toml
([tenants.<tenant>], [runtime.publish], [[chains]], a mount's limits, max_rss_mb). A writer
holding replaced segments back for its followers lists them in .retained.json beside the shared
segments, for at most an hour. Before upgrading a runtime that hosts more than one tenant:
- Two tenants on one chain share its two default SQL permits, one each, even when the other is
idle, because a reservation is held by having a mount. A tenant at its share gets429
tenant_share, not503.NUTHATCH_SQL_MAX_CONCURRENCYraises the permits. - A
/qnamed query whose tip copy exceeds 128 MiB is refused. The 512 MiB named-scan bound
allowed it before. A solo nest otherwise meets the hot-copy budget only when concurrent copies
together pass 128 MiB. - Boot now counts the 120 MB runtime base against each cursor, as live admission always did. A
runtime packed within 120 MB of its ceiling starts its last mount quarantined rather than starting
everything. A mount that does not fit, or does not build, is quarantined where the whole boot used
to fail;--fail-fastrestores that. - The follower feed is new, at feed version 1, and a follower refuses a writer speaking another.
5.12 has no feed, so the upgrade to 5.13 cannot be a rolling one; the first is from 5.13. string_aggresults are capped at 16 MiB, andrangeinFROMcounts against a statement's
memory budget. A statement whose sort or join keeps large computed values may be refused somewhat
earlier than before, never later.scan_cpu_uscounts scans only, not the operators above them.- Undecoded logs warn once per window where they were silent at debug level.