# Adding a fleet config backup kind The recipe for adding a kind to the `backups` plugin - the per-PC CONFIG backups the collector takes off shopfloor machines (NTLARS settings, part-marker configs). Backing up the ShopDB database itself is [BACKUP-RESTORE.md](BACKUP-RESTORE.md); why a Backup badge reads green or red is [BACKUP-STALENESS.md](BACKUP-STALENESS.md), and you do not need it here. --- A kind is one class in `plugins/backups/services/registry.py`, added to `REGISTRY` at the bottom of that file: ```python REGISTRY = {k.key: k for k in (NtlarsKind(), PartMarkerKind())} ``` Subclass `BackupKind` and override what applies. `NtlarsKind` is the fullest example (parseable, renderable, has an info panel); `PartMarkerKind` is the lean one. | Member | What it is | |--------|------------| | `key` | Wire value. This is what lands in `backuprevisions.backupkind` and what the fleet table shows on the badge. Keep it short and lowercase. | | `displayname` | Human label for the UI. | | `storagebackend` | `'shopdb'` (bytes live in the DB, deduped on a semantic hash) or `'share'` (file lives on the SMB share, deduped on a raw byte hash). | | `assettypes` | Which core asset types this kind can attach to; `['*']` for any. | | `emptytext` | Text when an asset has no revisions of this kind. `None` HIDES the panel, which is the right default - a kind applies to an asset TYPE, but whether a given machine ever has that backup is per-machine. A part-marker panel on all 144 machines is noise. | | `parse(raw)` | Opaque kinds return `None`; parseable kinds return a projection dict. | | `formats()` / `render(...)` | Download formats, for `shopdb` kinds. | | `resolveassetid(payload)` | Map a collector payload to the asset the backup belongs to. | | `infopanel()` / `buildinfo(...)` | Optional at-a-glance card (ADR-010). Declared by the KIND, not hardcoded in the plugin, so a successor technology ships its own card by adding a class. | | `sharedir(...)` | Conventional UNC directory for a `share` kind. Advisory - the authoritative path is whatever the collector reported, because the PC is what actually wrote the file. | ### What you do NOT have to touch The **Backups stopped** dashboard card needs no change. It reads `backuprevisions` generically: newest revision per chain, whatever the kind, and shows `backupkind` as the detail line. A new kind inherits the card with no work. The staleness rule needs no change either - it is time-based and kind-agnostic ([BACKUP-STALENESS.md](BACKUP-STALENESS.md)). Making a kind file against the DEVICE rather than the parent asset it hangs under is [ASSET-COMPOSITION.md](ASSET-COMPOSITION.md).