YmerNode.Notebook.VecLoadCheck (Ymer Node v0.2.1)

Copy Markdown View Source

One-shot boot probe that aborts application start when the sqlite-vec vec0 extension did not load into YmerNode.Notebook.Repo.

exqlite loads extensions best-effort — its extension loader runs SELECT load_extension(...) and DISCARDS the result, so a missing, corrupt, or wrong-arch binary boots a healthy-looking repo with vec0 silently absent. The failure would otherwise surface much later as no such module: vec0 at the MCP boundary, with the SQL loader already disabled and no way to recover. This child runs SELECT vec_version() once: on success it logs the version and returns :ignore, so the supervisor keeps no process; on failure it raises, which aborts Supervisor.start_link and fails the boot.

Refusing to boot is the right trade for a node whose vector layer is a headline capability. An install that silently cannot do KNN search is worse than one that says why it stopped — and what it says has to be true, because this is the last answer the node gives about a notebook it cannot use, and the one the operator reads after a not-serving answer sends them to the log. The one query here fails the same way for a store that will not open as for an extension that did not load, so the two are told apart before the message is written: see refusal/1.

Disabling is a configuration decision, not an environment sniff, because the reason to skip the probe is a property of the test setup rather than of the host: the Ecto.Adapters.SQL.Sandbox holds no checked-out connection at boot, so the probe would fail against a perfectly healthy build. The disabled branch lives inside init/1 and returns the same :ignore the success path does, which is what lets the supervision tree list this child unconditionally.

Summary

Functions

Returns a specification to start this module under a supervisor.

Whether the probe runs at boot. Defaults to enabled — a skipped check is opt-in.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

enabled?()

Whether the probe runs at boot. Defaults to enabled — a skipped check is opt-in.

start_link(opts)