Skip to content

feat: optional netbox-dlm integration + provision table preflight (2.5.0)#47

Merged
captainpacket merged 2 commits into
mainfrom
feat/dlm-support-provision-preflight
Jul 9, 2026
Merged

feat: optional netbox-dlm integration + provision table preflight (2.5.0)#47
captainpacket merged 2 commits into
mainfrom
feat/dlm-support-provision-preflight

Conversation

@captainpacket

Copy link
Copy Markdown
Collaborator

Field report (design partner)

Sync crashed mid-provision with ProgrammingError: relation "public.netbox_dlm_contract" does not exist — the netbox-dlm plugin was installed without its migrations applied (it ships none), and branch provisioning clones every registered model's table.

1. Provision table preflight (fixes the crash class permanently)

  • missing_branch_table_report() diffs netbox_branching's get_tables_to_replicate() (the exact list provision clones) against the database's real tables and maps gaps to app labels.
  • The single-branch executor fails in seconds with the app + remedy (apply migrations or remove the plugin) instead of dying mid-CREATE TABLE.
  • New Database tables Health check (fail severity) surfaces the gap before anyone syncs; diagnostics failures degrade to no check, never a broken page.

2. Optional netbox-dlm integration (3 opt-in maps, disabled by default)

Map Source Target
Forward DLM Software Versions device.platform.osSupport SoftwareVersion (platform, version, EOL date, announcement URL)
Forward DLM Hardware Notices chassis components[].support HardwareNotice per DeviceType (EoS / security patches / SW releases)
Forward DLM Device Software device.platform.osVersion DeviceSoftware (one per device; ensures its SoftwareVersion without overwriting announced dates)

Wired end-to-end via the optional-plugin pattern (registry + adapter contract on sync_dlm, choices + migration 0032, query registry, decision/budget/contract/identity tables, runner dispatch, delete ordering children-before-PROTECTed-parent). Degrades cleanly when the plugin is absent.

Also fixes a latent import-order bug the new models exposed (branch_budget._fallback_bucket_key_family defined after its module-scope caller).

Verification

  • Live on ADP: 35 software versions, 48 hardware notices, 4960 device-software rows; all 3 queries NQE-lint clean and run raw.
  • Adversarial (codex) review: 1 red (missing delete ranks → ProtectedError risk) + 2 yellows (date-string churn, reporting-filter mismatch) — all fixed.
  • Full suite 1012 OK, lint, harness green. Preflight covered by 6 dedicated tests, DLM wiring by 12.

…5.0)

Preflight: Django registers ContentTypes for every installed app even when its
migrations never ran, so netbox_branching's provision runs CREATE TABLE
branch.T (LIKE public.T) for a missing table and the sync dies mid-provision
with an opaque ProgrammingError (field report: netbox_dlm_contract).
missing_branch_table_report() diffs get_tables_to_replicate() against the
database's real tables; the single-branch executor now fails in seconds with
the app labels and remedy, and a new Database tables Health check surfaces the
gap before anyone syncs.

netbox-dlm integration: three opt-in NQE maps (disabled by default) sync
Forward's end-of-life analysis into the optional netbox-dlm plugin —
SoftwareVersion from device.platform.osSupport per (platform, osVersion),
HardwareNotice from chassis part support per device type, and DeviceSoftware
one row per device (the adapter ensures the referenced SoftwareVersion without
overwriting announced dates). Wired end to end through the optional-plugin
pattern: registry integration + adapter contract, choices (+migration 0032),
query registry, decision/budget/contract/identity tables, runner dispatch,
and delete ordering (children before the PROTECTed SoftwareVersion). Dates are
parsed to date objects so unchanged rows do not churn.

Also fixes a latent import-order bug the new models exposed: branch_budget's
_fallback_bucket_key_family was defined after the module-level shard-contract
build and NameError'd for any supported model without a structured contract.

Live against ADP: 35 software versions, 48 hardware notices, 4960 device-
software rows; queries lint clean. Full suite (1012) + lint + harness green;
adversarial review findings (delete ranks, date churn, reporting filter)
fixed.
@captainpacket captainpacket merged commit c6e1872 into main Jul 9, 2026
2 checks passed
@captainpacket captainpacket deleted the feat/dlm-support-provision-preflight branch July 9, 2026 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant