Make main the lean product a site receives
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.
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
"""Shared Alembic env.py logic for bundled plugins.
|
||||
|
||||
Every bundled plugin that owns tables (computers, employees, knowledgebase,
|
||||
machines, network, notifications, printers, slides, usb, warranty) has a
|
||||
`migrations/env.py` that does the minimum:
|
||||
Every bundled plugin that owns tables (backups, computers, endpoints, guides,
|
||||
knowledgebase, machines, network, notifications, printers, slides, tools,
|
||||
warranty) has a `migrations/env.py` that does the minimum:
|
||||
|
||||
import os
|
||||
os.environ['PLUGIN_NAME'] = 'computers'
|
||||
@@ -23,6 +23,13 @@ the core chain.
|
||||
Plugin tables must be importable via `plugins.<name>.models`. Plugins
|
||||
register their `__tablename__` set in PLUGIN_TABLE_OWNERS below so the
|
||||
filter is explicit (avoids depending on import-side-effect global state).
|
||||
|
||||
ORPHAN_TABLE_OWNERS below is the other half of that map, and it exists because
|
||||
the core chain creates tables that no bundled plugin owns any more. Those rows
|
||||
are not a plugin's, so they must not be in PLUGIN_TABLE_OWNERS - nothing can
|
||||
import their models and no chain owns them - but they still land on every site,
|
||||
and `flask plugin prune-schema` only knows how to drop a table it can attribute
|
||||
to an owner. Drop the entry and the table becomes undroppable.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -51,35 +58,48 @@ PLUGIN_TABLE_OWNERS: dict[str, Iterable[str]] = {
|
||||
'computers': ('computertypes', 'computers', 'computerinstalledapps',
|
||||
'accessprotocols', 'computeraccess',
|
||||
'configurationpolicies', 'configurationpolicyactions',
|
||||
'businesspolicies', 'businesspolicyitems'),
|
||||
'employees': ('directoryemployees',),
|
||||
'endpoints': ('endpointstates', 'endpointevents', 'endpointcommands', 'endpointapplications', 'endpointmonitors', 'operatorreports'),
|
||||
'geenforce': ('manifestscopes', 'manifestentries', 'manifestentrypctypes',
|
||||
'manifestentryhostnames', 'manifestentrymachinenumbers',
|
||||
'manifestinusechecks', 'manifestinusecheckprocesses',
|
||||
'manifestpublishedversions', 'manifestpayloads',
|
||||
'manifestblobs',
|
||||
'manifestenforcementreports', 'manifestenforcementresults',
|
||||
'pctypealiases'),
|
||||
'businesspolicies', 'businesspolicyitems',
|
||||
'policyactionholds'),
|
||||
'endpoints': ('endpointstates', 'endpointevents', 'endpointcommands',
|
||||
'endpointapplications', 'endpointmonitors',
|
||||
'operatorreports', 'endpointhealthstates',
|
||||
'endpointhealthtransitions', 'endpointmonitorimpacts',
|
||||
'endpointlocks', 'endpointlogcollections',
|
||||
'endpointcredentials', 'endpointenrollrequests',
|
||||
'endpointmigrationwaves', 'endpointbootstraptokens'),
|
||||
'guides': ('guides', 'guiderevisions', 'guideimages'),
|
||||
'knowledgebase': ('knowledgebase',),
|
||||
'machines': ('machinetypes', 'machines'),
|
||||
'measuringtools': ('measuringtooltypes', 'measuringtools'),
|
||||
'network': ('networkdevicetypes', 'networkdevices', 'vlans', 'subnets'),
|
||||
'notifications': ('notificationtypes', 'notifications'),
|
||||
'printedparts': ('printeditems', 'printeditemtransactions',
|
||||
'printeditemfiles'),
|
||||
'notifications': ('notificationtypes', 'notifications', 'notificationacknowledgements'),
|
||||
'printers': ('printertypes', 'printers', 'modelsupplies', 'printerdrivers',
|
||||
'printersupplyalerts', 'printerobservedqueues'),
|
||||
'slides': ('tvslides',),
|
||||
# Tech Tools was schemaless until secure send: every other tool in it
|
||||
# runs in the browser and owns nothing.
|
||||
'tools': ('securesendsecrets',),
|
||||
'usb': ('usbdevicetypes', 'usbdevices', 'usbcheckouts'),
|
||||
'warranty': ('warranties', 'warrantyassets'),
|
||||
}
|
||||
|
||||
|
||||
# Tables the CORE Alembic chain creates that NO bundled plugin owns.
|
||||
#
|
||||
# They are not dead weight by accident: the core baseline (68b3947ae14f) creates
|
||||
# usbdevicetypes/usbdevices/usbcheckouts and 7d16_directoryemployees creates
|
||||
# directoryemployees, and neither migration can be removed - the whole plugin
|
||||
# chain set anchors on that head, so editing it breaks `flask db upgrade` on a
|
||||
# fresh database. The tables therefore arrive at every site whether or not
|
||||
# anything reads them.
|
||||
#
|
||||
# Keyed by the name of the plugin that used to own them, because that is the
|
||||
# name an operator recognises in prune-schema output. A key here is NOT a plugin
|
||||
# this build ships, and nothing imports models for it.
|
||||
ORPHAN_TABLE_OWNERS: dict[str, Iterable[str]] = {
|
||||
'employees': ('directoryemployees',),
|
||||
'usb': ('usbdevicetypes', 'usbdevices', 'usbcheckouts'),
|
||||
}
|
||||
|
||||
|
||||
def _get_plugin_metadata(plugin_name: str) -> MetaData:
|
||||
"""Import the plugin's models and return a MetaData containing only its
|
||||
declared tables (filtered via PLUGIN_TABLE_OWNERS)."""
|
||||
|
||||
Reference in New Issue
Block a user