main was 16 days and 259 commits behind the line the product is actually built on, at contract 0.30.0 against 0.35.0, with no per-PC credential code at all. It was neither current nor curated - just stale. This brings it forward and, at the same time, makes it mean something: main is what a receiving site installs, and nothing else. WHAT IT CARRIES. Twelve plugins - backups, computers, endpoints, guides, knowledgebase, machines, network, notifications, printers, slides, tools, warranty - plus applications, which is manifest-less core and always ships. The only manifest dependency inside that set is endpoints on computers, and both are in it, so the closure is self-contained. WHAT IT DOES NOT. employees, geenforce, measuringtools, printedparts and usb stay on the site line. So do the Windows installer tree, the VM rehearsal helpers, the agent tooling config, one site's data loader, the internal audit and findings records, and the planner spreadsheet. 1,135 tracked files against 1,438. A REMOVAL THAT BREAKS THE APP IS NOT A REMOVAL, and two nearly shipped: deploy/site-profile-universal.json still named all seventeen plugins. It is the file docs/DEPLOY.md tells a site to provision from, so a fresh install would have failed at `flask plugin apply-profile` with PluginError - the first thing a receiving site does, broken by the branch meant to serve them. It now names the twelve that exist, and its comment says the two must agree. agent/ was never refreshed. Whoever populated this branch copied shopdb/, plugins/, frontend/ and tests/ from the site line and left the agent tree at its September state: 22 C# and PowerShell sources missing, including AgentCredentials, EnrollmentService, AgentHttpFactory and the fleet-alert client, plus one file the site line had deleted still present. The old tree is internally consistent, so it compiles, and nothing in CI builds it - every gate was green over a server that speaks enrollment and per-PC credentials to a bundled agent source that cannot. Resynced whole. DECISIONS THIS ENCODES, rather than defers: - The plugin-authoring lab builds printedparts, whose manifest depends on employees, so it could not stay. The lab remains on the site line and main ships no build-along tutorial. That is a real loss for an adopting developer and is recorded here rather than discovered later. - Recognition, Training and Recertification notifications are no longer seeded. Each splits one notification into a card per employee and renders a photo, which needs a plugin this branch does not bundle. Seeding them would offer an author a type that cannot resolve anybody. A site that installs employees gets them from that plugin's own seed. - Windows/IIS is documented as the legacy path throughout, and the README leads with Docker, because that is what a receiving site gets. The API description is regenerated for THIS branch - 347 paths and 483 operations, down from 415 and 573 - so the published contract describes what is here rather than what the site line serves. docs/CONFIG.md lost the two measuring-tool label keys the code no longer declares, which two lanes had decided opposite ways. Suite: 3124 passed, 6 skipped. Naming and style gates pass. The docs gates run rather than skip, and every index line count is derived from the file it names.
6.5 KiB
Composition: several devices under one parent
When more than one physical device answers to a single identifier, model each
device as its own asset and file it under a parent. This page is the pattern:
when to reach for it, what you get for free, and how to make the collector do it
without writing code. The mechanism itself is not new - partof and its
propagation rails are the ADR-001 platform contract; the recipe is.
The problem it solves
A machine number is supposed to identify one thing. Sometimes it does not.
At the reference site, several Telesis part markers serve one operation number: 0613, 0615 and PRTMK01 each have more than one. Their configurations differ, most often by COM port. Treating the operation as the device collapsed them into a single record, and the damage was quiet:
- Their backups overwrote each other, so the history read as one device flip-flopping between configurations that were really two devices.
- No question about an individual device could be asked at all - how many there are, which port one is on, which one failed.
- Every PC driving one contested the single
controlslink to the operation, so whichever reported last appeared to own it.
None of that announced itself. It surfaced as duplicate backup rows, weeks later.
When to use it
Reach for composition when ALL of these hold:
- Several physical devices share one identifier, and that is CORRECT - not a
numbering mistake. Two PCs carrying the same machine number by accident is a
fault to fix on the PC, not a model to build.
flask relationships check-shared-machinestells the two apart. - The devices are individually interesting: they fail, get replaced, carry their own configuration or calibration.
- Something already identifies each device. One device per PC is the easy case, because the PC names it.
Do NOT reach for it when the parent is simply a location. A room holding six printers wants a Location, not a parent asset.
What you get
Filing a device partof a parent buys behaviour already built:
- Control propagates.
controlspropagates throughpartof(ADR-001, and seeded byflask seed reference-data). A PC controlling a device therefore controls its parent by inheritance, so the PC does NOT need - and must not have - a direct link to the parent. That is what stops several devices contesting a link only one can hold. - Position inherits. Map-position resolution walks
partoffirst, so a device with no coordinates of its own shows at its parent's position. - History separates. Anything keyed on the asset - backup revisions, relationships, notes, audit - is per device instead of merged.
Making the collector do it
A PC that drives a subordinate device declares it in
plugins/computers/pctypemap.py:
SUBORDINATE_DEVICE_MAP = {
'gea-shopfloor-partmarker': {
'assettype': 'machine', # core AssetType for the device
'typename': 'Part Marker', # type within that vocabulary
'description': 'Telesis part marker',
'suffix': 'PARTMARKER', # device asset number = <PC>-<suffix>
'partof': True, # file under the reported machine number
'label': 'collector:partmarker',
},
}
partof: True is the switch that matters. It files the device under the
operation the PC reports AND stops that PC claiming the operation directly.
Leave it False for a device that does not share an identifier - a CMM is a
subordinate device too, but no two CMMs answer to one number, so it links to
its PC and nothing more.
label is the relationship origin marker. Only rows carrying it are archived
by a collector push, so links made by hand are never touched. Do not change
an existing label: those exact strings are in production databases.
A site adds or retargets an entry without a code change, per ADR-015:
Setting: subordinatedevice_<pctype> category: pctypemapping
Value: {"assettype": "machine", "typename": "Marking Laser",
"suffix": "LASER", "partof": true, "label": "collector:partmarker"}
A malformed override falls back to the built-in default rather than failing the collector push - a bad setting must not stop a bay reporting its inventory.
Making a backup kind follow the device
A backup posted by a PC that drives a device belongs to the DEVICE, not the
parent. plugins/backups/services/registry.py resolves this through
markerforsource: it finds the PC by the reported sourcehostname, follows the
PC's active device link, and files against what it finds. It falls back to the
machine number whenever the device cannot be resolved - no hostname on the
payload, a lean build without the computers plugin, or a PC that has not
reported yet - because filing under the parent beats rejecting a backup.
Two things that matter if you add a kind:
sourcehostnameis load-bearing, not informational. Without it a backup files against the parent and merges two devices' histories.- A revision chain is (asset, kind, source hostname), so two devices on one parent keep separate chains even before they become separate assets.
Finding the next one
flask relationships check-shared-machines
Read-only. Lists every machine number claimed by more than one PC and separates the two cases by whether child assets exist:
0615 11 PCs, 11 child asset(s) - modelled
2026 2 PCs, NO child assets - PCONE, PCTWO
The first is composition working. The second is two PCs carrying one number - fix that on the PC.
The parent is not disposable
Once devices are filed under it, the parent is doing a real job even though it
may look empty: it is the thing that says those devices belong together.
Deactivating it (isactive = 0, which is what "delete" does in the UI) breaks
filing, because the resolver requires an ACTIVE parent - every subsequent
report warns and files nothing.
A hard SQL DELETE is worse: backuprevisions.assetid is ON DELETE CASCADE,
so it destroys history still attached to the parent.
If the parent looks wrong in a list - an operation number appearing among machines - that is a CLASSIFICATION question, not a deletion one.
See also
- ADR-001 - relationship types, propagation rails, position inheritance
- ADR-015 - why the device map is settings-overridable
- COLLECTOR-INTEGRATION.md - the collector contract and the part-marker case end to end