Architecture Decision Records
ADR 0070: Extension Tiers and the Edition Boundary: Open-Source Code Speaks Only of Availability, and a Separately Built Server Composes Through One Set of Interfaces
On this page
Date: 2026-11-16 · Status: Accepted, partly superseded by ADR 0071 (adds the edition scope to ADR 0040 and the requirements of ADR 0067 for extension codes)
2026-11-17: ADR 0071 moves to "a general core plus signed plugin packages". Decision 1 (four tiers) is superseded by its tier model, in which T1 is core-internal composition only; decision 10 (edition-scoped release and upgrade) is withdrawn for the official release path. The other decisions are kept and extended by 0071 (it lists where each one goes). Extension routes are now mounted under
/api/v1/x/<name>/. The original text is kept below.
Context
Another Go module should be able to use gpuworks as a library and build a server with more capabilities: organizations and permissions, audit, billing, capabilities enabled per feature, and vendor customization. Each touches different places: management routes, the node insert transaction, every status report, the console menu, database tables, installation and upgrade.
If each capability changed the open-source code on its own, the open-source repository would grow edition branches, product-specific vocabulary and code paths that exist for one build only. If extensions got the Store or a database handle directly, deadlocks on the single writer connection, core tables rewritten by extension migrations and table-name clashes would all follow, and once extensions depend on those internals the open-source code can no longer be refactored freely.
A few things cannot change once released: the key reserved for extensions in server.yaml, the table that records extension migrations, the shape of the console manifest, and the availability vocabulary. They need to be decided now.
Decision
- Four tiers; a capability goes in the lowest tier that can carry it. T0 core (open source); T1 modules compiled into the server; T2 server child-process plugins; T3 apps on nodes. Only what must decide on every management request, inside an insert or status transaction, or work before any node exists goes in T1. This ADR settles only the interfaces T0 leaves for T1.
- One entry point; the zero value is the community edition. A separately built server passes everything (edition name, extension modules, console build, distribution channel, install hooks, extra commands) through
cli.Options, whichclihands toapp.Config. Noinit()registration and no new package globals.cli.Options{}iscmd/gpuworks. - Open-source code speaks only of availability. The vocabulary is feature keys (opaque; open-source code interprets none) and four availabilities: full, read-only, locked and hidden, plus opaque limits, a link and a prebuilt
ProductError. Commercial or site-specific rules and their states, and who decides and why, exist only on the feature source's side. Community paths never consult the feature gate; only extension routes, extension menu entries and guards an extension registers name a feature key. Open-source code never branches on the edition name, which is for display only (theedition_branchesbudget is 0). - The server decides; the UI renders. Every gate is enforced at a server choke point: the extension route wrapper, the node insert transaction, scheduling holds. The console renders
GET /api/v1/console/manifest(edition name, each declared feature's availability, extension menu entries, banners) and derives nothing itself. An extension route must either name a feature or be marked as a community route, or router construction panics; extension GET routes are not readable by the AI assistant and MCP by default. - Extensions do not get the Store. A module reaches the server only through
app.Host: the tables of its own namespace (store.ExtensionTables, two closures: a transaction on the writer and a read transaction on the read pool), a logger, the bus, the data directory, the installation ID, keys derived from the master key and bound to the module name, its own section ofserver.yaml, and methods that register routes, features, banners, node insert guards and scheduling holders. Registrations are accepted only duringInit. What a holder needs to know of the fleet comes through theHostas well:NodeFleet, every node's hold facts in one read on the read pool, and a topic of node inserts, deletes and hold-fact changes keyed by node ID, defined and read by the open-source code (store.NodeFleetChangeOf); modules never parse event reason text. - Extension migrations are recorded apart from core migrations. Extension steps are recorded in
namespace_migrations(created only when sets are passed), one namespace and one table prefix starting withee_per module; core tables never use theee_prefix. A step that creates an object without the prefix is rolled back and refused; a namespace this build does not know only logs a warning; a known namespace newer than the binary, or a recorded step that is missing or renamed, stops startup. server.yamlreserves oneextensions:key. The top level is still decoded strictly;extensions.<module name>is kept raw and each module decodes its own section strictly. A section no module claims only logs a warning, so the server still starts after a change of build.- Hooks inside writer transactions must be pure. Insert guards and scheduling holders are called inside transactions on the single writer connection and may only answer from a snapshot: one atomic load plus one map lookup, no Store calls, no I/O, and a prebuilt error when they refuse. Holders cordon and never drain; an operator cannot make a held node schedulable, but can still cordon or drain it; holds no module claims are released at startup. A module whose answers changed asks for the holds to be reapplied (
Host.ReapplySchedulingHolds): requests never block and are coalesced, fleet-wide writer transactions have a minimum interval between them, and the pass runs in the server's background loop, never on the caller or inside a hook. - Running workloads are never interrupted. A change of availability acts only on new requests and writes.
- Edition-scoped distribution and upgrades. A signed distribution index names its edition, and a build's channel accepts only indexes of the same edition; an upgrade compares the edition of the old and new binaries and needs explicit confirmation when they differ (an addition to ADR 0040).
- Every extension point has a contract test against fake modules in the open-source repository (
internal/testenv/extmodule), and a build without modules has a route inventory identical to the community edition's, route by route.
Trade-offs
- Compiled modules vs out-of-process plugins: an out-of-process plugin cannot decide synchronously inside an insert transaction, on every status report or on every management request. The cost is that modules depend on internal packages of the open-source repository; contract tests and this page constrain that, and the separately built side has to keep building against open-source master.
- Namespaced tables only vs the Store: with tables only, an extension must reach core data through Store methods, the API or hooks, which is more roundabout, but types rule out writer deadlocks, rewritten core schema and a frozen open-source refactoring surface.
- Availability only vs commercial rules in open source: open-source code thus knows no commercial rule, and the community edition is untouched by any such logic; the cost is that the feature source must map its own state onto the four availabilities and coded notices itself.
- Hidden answers 404, locked answers 403: a hidden feature does not exist for this server, and 404 matches a route that is not there; a locked feature is visible in the UI, and 403 carries a code saying why it cannot be used.
Consequences
- A new extension need is first expressed with the existing interfaces; when a new interface is really needed, it is defined in the package that calls it, exposed through
Host, given a contract test against a fake module, and documented indocs/dev/extensions.md. api.Depsgained exactly one field for extensions (Extensions); later API-side hooks are added inside that struct.- The contract and operational details are in Extension Points.
Was this page helpful?