Files
shopdb-flask/docs/adr/ADR-003-plugin-distribution.md
cproudlock f9d6b57f0f Move the documentation to the line that ships, and correct it against the code
The docs lived on one lineage and the fleet code on another. That is why six
pages described a shared fleet key as how an agent authenticates, why
COLLECTOR-AUTH had to warn that the per-PC credential code was not in the
repository it sat in, and why ADR-019 recorded a decision whose implementation
was somewhere else. Documentation that cannot see the code it documents goes
stale by construction, and no amount of editing fixes that.

So the corpus moves here: 84 files, 56 pages, 20 ADRs, the proposals, INDEX.md,
llms.txt and both gates. Filenames are unchanged, because a wiki page name is
derived from the filename and a rename breaks every link anybody saved.

THE POINT OF THE MOVE IS THE CORRECTION IT ENABLES. Every caveat that said "not
in this tree" was false the moment the files landed beside the code, so each was
rewritten from what is actually here:

- COLLECTOR-AUTH gained the real enroll request body, the two bounds on the
  unauthenticated route (per-IP rate limit, pending cap with stale rows dropped
  before a real PC is refused), and the rejected pending reason that binds to
  the endpoint identity rather than the nonce.
- ADR-019 now describes an implementation that is present, including its tests,
  and says plainly that what remains is the FLEET migration, not the code.
- proposals/device-identity claimed phase 1 was unbuilt. plugins/computers
  declares deviceid on the collector schema and prefers it over the older
  fallbacks. Corrected in the page, its summary and the index.

WINDOWS/IIS IS NOW DOCUMENTED AS THE LEGACY PATH, per the product decision, and
carefully: it is what production runs today. Every Windows page opens by saying
it is supported, not for a new site, and where a new site should go instead. No
procedure was cut - an operator on an IIS box at 2am needs these pages to work
exactly as well tomorrow. MIGRATE-TOPOLOGY stops being a footnote and becomes
the off-ramp, which is why it nearly doubled: what was there did not match how
the Docker stack really works here.

The Docker material that already lived on this line was kept and given
ownership rather than buried under the ported Windows-centric prose: DEPLOY now
describes the four services, the migrate service that runs the upgrade chain
before api starts, TLS terminated by nginx, and the plugin count corrected from
thirteen to seventeen - a number both lineages had wrong.

ROADMAP is rewritten from evidence rather than memory: what has shipped, read
out of the changelog, the ADRs and the manifests, and ahead of it exactly two
items - finalize a distributed release and polish the setup wizard.

PROJECT-MAP is generated and was stale; the GENERATOR was what was wrong.
--check passes now.

API-REFERENCE is retired to a pointer. /api/docs serves 573 operations with
derived auth, query parameters and harvested examples, and a hand-written page
competing with that is a liability. The file stays so its wiki page and its
inbound links survive.

AND THE MOVE TURNED ON A SCRUB THAT HAD NEVER RUN HERE. test_docs_publishable
keys on docs/*.md, which this line did not have, so it skipped - its own comment
predicted what would surface. Porting the corpus activated it and it found 48
lines that must not reach a published wiki: branch names abbreviating the site,
assistant-tooling paths, the site name in two deployment pages, and an employee
ID in a Windows path that the scrub does not even look for.
2026-09-19 09:10:15 -04:00

4.0 KiB

ADR-003: Plugin distribution model

  • Status: ACCEPTED
  • Date: 2026-05-08
  • Deciders: ShopDB maintainers

Context

Sister sites adopting shopdb-flask need a way to:

  1. Install the framework
  2. Pick which plugins they want
  3. Build their own plugins for site-specific equipment
  4. Receive updates to both framework and plugins

Today, every plugin lives in the plugins/ directory of the framework repo. There is no separation between framework code and plugin code, no install / uninstall, and no way for a site to develop a plugin without forking the whole repo.

Three viable distribution models:

Model How a site installs a plugin
In-tree only Fork the framework repo, add plugin under plugins/, run their own deploy. No separation.
Pip-installable plugins Each plugin published as a Python package. Site does pip install shopdb-printers shopdb-network etc. Discovery via Python entry points. Framework loads any installed plugin that registers itself.
Git-based plugins Each plugin lives in its own git repo. Site clones / submodules into plugins/<name>/. Loader picks them up from the directory.

Decision

Use a hybrid model with two clearly-labeled paths.

  1. Bundled plugins: a small set of plugins ships with the framework, in-tree at plugins/. These are the reference implementations and the default install (printers, computers, network, equipment, usb, notifications). A site that wants only what's bundled needs no extra work.
  2. External plugins: sister sites or third parties build plugins in their own git repos. The site running the framework drops the plugin into plugins/<name>/ (clone, submodule, or symlink) and runs flask plugin install <name>. No pip packaging required for v1.

Pip-installable plugins (Python entry-point discovery) are deferred to v2. The complexity is not justified until at least two sites are running their own plugins.

Consequences

Positive

  • v1 is simple: filesystem-based discovery (already implemented in shopdb/plugins/loader.py), works for both bundled and external plugins.
  • Sites can develop plugins without changing the framework repo.
  • The plugins/ directory is already the canonical location, so no architectural change is needed.

Negative / cost

  • No automatic update path for external plugins. Sites must git pull in each plugin directory manually. Acceptable for v1; revisit when plugin count grows.
  • Multiple plugin authors writing in parallel can collide on namespace (e.g., two plugins both registering an AssetType named "Equipment"). Need a naming policy: plugin names and asset-type names should be prefixed with the site or org if not in the bundled set.

Neutral

  • The existing in-tree pattern keeps working. This decision just formalizes it and clarifies the path for outside-the-tree plugins.

Alternatives considered

  1. Pip-installable from day one. Cleaner for the long term but adds packaging, entry-point registration, and CI steps. Premature for current scale (one site running, no sister-site plugins yet).
  2. In-tree only forever. Forces every site to fork. Doesn't scale beyond two or three sites.
  3. Submodules only. Forces git-submodule discipline on every adopting site. Submodules are notoriously fiddly. Rejected.

Open questions

  • For external plugins, should there be a manifest field (source_url) declaring where the plugin can be cloned from, so flask plugin install could pull it for the site? Defer; manual clone is fine for v1.
  • Naming convention for non-bundled plugin directory names: prefix with site? (gea-wjsf-shipping)? Adopt if and when we hit a name collision.

References

  • shopdb/plugins/loader.py (filesystem discovery)
  • shopdb/plugins/cli.py (plugin install / uninstall command)
  • ADR-001 (defines what plugins target)
  • ADR-002 (defines plugin version compatibility)