Files
zeekayandGitHub bdb590a9c6 feat(base): cloud.Mount entry point per HIP-0106 (#4)
* feat(base): cloud.Mount entry point per HIP-0106

Adds pkg/base/mount.go exposing the canonical
Mount(app *zip.App, deps cloud.Deps) error contract. cmd/cloud imports
this package via the blank-import side-effect; init() registers base
with cloud.Registry at order 60 — after iam (50) and kms (10) so the
per-tenant SQLite substrate is up before subsystems that need it.

The mount strategy is "wrap, don't rewrite": Mount constructs a Base
instance with the per-deployment data dir, runs the existing Bootstrap
(data + aux DB, migrations, cached collections, settings reload),
builds the http.Handler from apis.NewRouter(app).BuildMux(), and
attaches it under /v1/base/* + /healthz via zip's net/http adaptor.
/v1/base/health and /v1/base/readyz are native zip handlers so probes
work even when Bootstrap refuses to boot.

DATA_DIR and BASE_API_PREFIX env vars are set inside Mount so Base's
NewWithConfig path picks up the cloud-scoped data directory and the
/v1/base prefix without any flag wiring.

go.mod gains require + replace stanzas for hanzoai/cloud and
hanzoai/zip; matches the kms / vfs convention. The standalone base
binary is unchanged.

schema/base.zap declares the minimum ZAP-typed surface (Health) needed
by the Mount contract; richer ZAP handlers will land alongside the
in-process BaseClient interface from cloud/pkg/cloud/deps.go.

* refactor: collapse pkg/base/ → root for clean import path

Subsystem code lives in package base at repo root. Importers now use
`github.com/hanzoai/base` (no /pkg/base/ nesting). Standalone shim moved
to cmd/base/ where applicable.

Per Hanzo Go-stdlib pattern: repo IS the package.

* refactor: flatten import path — github.com/hanzoai/cloud (drop /pkg/cloud)
2026-05-18 23:40:06 -07:00
..

wazero-rust fixture

Pure-Rust validate(email, age) compiled to wasm32-unknown-unknown, loaded by the Base wasmvm runtime. Implements the shared HIP-0105 pointer/length ABI directly (no zip-rs / no Hanzo-internal deps):

__base_alloc(size: i32) -> i32
__base_free(ptr: i32, size: i32)
validate(ptr: i32, len: i32) -> i64   // high32=resultPtr, low32=resultLen

Build

./build.sh

The committed validate.wasm is the release artifact. Re-build only if you change src/lib.rs.

Requires the wasm32-unknown-unknown Rust target — install with rustup target add wasm32-unknown-unknown if missing (homebrew rust does not ship the wasm32 std crates).

Why not wasm32-wasip1?

This fixture imports zero WASI symbols. Building against wasm32-unknown-unknown produces a smaller artifact (no WASI imports to satisfy) and avoids accidentally pulling in std features that need a real OS. The Base wasmvm host still instantiates WASI globally, so modules that do import WASI work too — the existing wazero-as fixture is one example.

Verify exports

wasm-objdump -x validate.wasm | grep -E 'validate|__base_alloc|__base_free'