Files
shopdb-flask/docs/adr/ADR-011-machines-rename.md
cproudlock 4995456136 docs: take one site's name, hosts and paths off the public wiki
The publishability gate caught internal tooling names and developer paths but
nothing site-specific, so roughly sixty leaks reached the wiki: the site name in
ten documents, real fleet hostnames in the collector and GE-Enforce examples, an
internal database name through the whole import guide, imaging-share paths, and
a maintainer's username as the Deciders line of every ADR and inside a generated
curl example.

None of it is a security matter on an air-gapped fleet. It matters because these
pages are read by engineers at other plants, and a document that names one site
throughout reads as that site's notes rather than a product's documentation -
which is exactly what it then gets treated as.

Examples now use neutral hostnames, the site is "the reference site" where the
distinction carries meaning, and ADRs are decided by "ShopDB maintainers". The
gate carries all of these patterns, so the next one fails a build.

Two documents leave docs/ because they were never written for an outside reader.
PROJECT-REVIEW.md is an internal health memo pinned to a commit from July, whose
headline finding (an untracked playbook) has since been fixed - it is history,
and git holds it. PILOT-DEPLOY.md is one site's own cutover runbook, complete
with a "re-measure before publishing" placeholder; it moves next to the loader
it belongs to, in scripts/site_imports/wjf/.

ADR-015 is AMENDED rather than rewritten. Its enforcement section still said
report-only and its backlog still listed hardcodes that are now cleared, which
left the record contradicting itself. The amendment says what changed and why
the report-only period ended; the original text stays, because what the decision
looked like when it was taken is the part worth keeping.

Also corrects llms.txt's response envelope, which had errors at the top level
and pagination at meta.total. Both are nested one deeper, so anything written
against that description read undefined on every error it tried to handle.
2026-08-14 15:38:27 -04:00

3.7 KiB

ADR-011: Rename the equipment domain to machines; retype the models catalog with modeltypes

  • Status: ACCEPTED
  • Date: 2026-07-11
  • Deciders: ShopDB maintainers
  • Relates to: ADR-005 (equipment vs measuringtools scope), ADR-008 (plugin migration ownership)

Context

ADR-005 split the old "equipment" concept: gage-lab instruments moved to the measuringtools plugin, leaving the equipment plugin holding exactly one thing - shop-floor machines (lathes, mills, CMMs, grinders, furnaces). The UI, the routes (/machines), the frontend view folder (views/machines/), and even the data vocabulary (asset numbers headed "MACHINE #") already said machines. Only the code identity still said equipment: the plugin name, the API prefix, the equipment/equipmenttypes tables, and the assettype='equipment' data value. Every future contributor would pay a small permanent translation tax.

A display-label-only swap was shipped first (2026-07-11) and immediately showed the dissonance: UI Machines over code equipment forever.

Separately, the legacy machinetypes table survived the Machine-model retirement for one real reason: it types the vendor models catalog (models.machinetypeid, 95 of 127 models) with fine-grained, cross-category types (Lathe, Switch, Laser Printer). Its name was a misnomer - it never typed machines specifically - and it squatted on the name the machines plugin's subtype table wants.

The economics favor doing this now and never again: the plugin contract is pre-1.0 (breaking changes are cheap per ADR-002), no sister site has adopted yet, there is no production instance, and the test suite plus CI give the strongest safety net the project has had.

Decision

Rename the domain in one coordinated pass:

Current New Rationale
plugins/equipment/, /api/equipment, equipment.* perms plugins/machines/, /api/machines, machines.* plugin identity matches the domain
equipment table, equipmentid machines, machineid main entity
equipmenttypes, equipmenttypeid, equipmenttype machinetypes, machinetypeid, machinetype subtypes take the freed name
legacy machinetypes, models.machinetypeid modeltypes, models.modeltypeid role-accurate: it types the models catalog, losslessly (no collapse to the 4 asset types)
assettypes.assettype = 'equipment' (data) 'machine' the string compare sites flip with it

Migration placement follows ADR-008: the modeltypes rename and the data flips land in the core chain (core tables, core data); the plugin table renames land in the machines plugin's own chain, idempotently guarded so fresh installs (whose core chain still creates the old names at 7c04) rename on first flask plugin upgrade-all. The alembic_version_equipment version table is renamed to alembic_version_machines by the core migration so the plugin chain resumes seamlessly on existing installs. The plugin registry auto-migrates an equipment key to machines on load.

Historical migrations and accepted ADRs are not rewritten; old ids and ADR-005 wording remain as history.

Consequences

  • Upgrading instances run flask db upgrade then flask plugin upgrade-all, same as every deploy; both migrations are idempotent.
  • /api/equipment and equipmentApi cease to exist - a breaking change made while there is nobody to break. After contract 1.0 this class of rename would be a major-version event; this is the last cheap moment.
  • The "Machine Types" settings card becomes "Model Types" and finally says what it does; the machines plugin's subtype card owns the machine-types name.
  • Contributors stop translating between UI vocabulary and code vocabulary.