You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(netbox_audit): correct the policy config schema and pin it with a test
CONFIG.md documented five top-level sections — `wan`, `vrf`, `wireless`,
`rack_placement`, `poe` — that the loader has never accepted. The real schema
nests every knob under `rules`, keyed by check ID, as `auditConfig` in config.go
and the committed netbox_audit.config.json both show.
encoding/json drops unknown keys silently, so a config written from the old doc
parsed clean, ran green, and left every knob at its default. `wan.device_roles`
was doubly wrong: the field is `wan_device_roles`, under `rules.interface-vrf`.
CHECKS.md carried the same paths in its thirteen "Configuration knobs" bullets.
Rather than prefix each with `rules.<check-id>.`, which runs to 79 characters on
the wireless suppression knob, the section is named once in the lead-in and the
bullets keep bare field names.
The docs are prose that hand-copies a schema, and nothing failed while they
drifted — the same shape as the couplings //meta/scripts:test_precommit_docs and
:test_codeql_toolchain already guard. config_docs_test.go closes it by decoding
the docs' own JSON blocks into the real auditConfig with DisallowUnknownFields,
turning that silent drop into a build failure; it also runs CONFIG.md's example
through loadAuditConfig to prove the documented values land, resolves every
CHECKS.md knob against the schema, and fails if a check grows rules with no
CONFIG.md section. Each assertion was negative-controlled — reinstating the
original bug fails with `unknown field "wan"`.
Also corrected while rewriting the sections they live in: private-ip-vrf covers
IPv6 ULA as well as RFC1918 (netip.Addr.IsPrivate), an unrecognized check ID is
fatal rather than ignored, and exempt_device_tags replaces the default list
rather than extending it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@@ -107,14 +125,16 @@ Controls the `wireless-normalization` check.
107
125
108
126
---
109
127
110
-
## `rack_placement`
128
+
## `rules.rack-placement`
111
129
112
130
Controls the `rack-placement` check.
113
131
114
132
```json
115
-
"rack_placement": {
116
-
"exempt_child_devices": true,
117
-
"exempt_device_tags": ["0u-rack-device"]
133
+
"rules": {
134
+
"rack-placement": {
135
+
"exempt_child_devices": true,
136
+
"exempt_device_tags": ["0u-rack-device"]
137
+
}
118
138
}
119
139
```
120
140
@@ -123,17 +143,23 @@ Controls the `rack-placement` check.
123
143
|`exempt_child_devices`|`bool`|`true`| Skip the check for devices that are installed inside a parent device. Child devices do not occupy their own rack unit. |
124
144
|`exempt_device_tags`|`string[]`|`["0u-rack-device"]`| Devices carrying any of these tags are exempt from U position and face requirements. Use this for zero-U items such as PDUs, patch panels, or cable managers. |
125
145
146
+
`exempt_device_tags`**replaces** the default rather than extending it, so keep `0u-rack-device` in
147
+
the list when adding a tag. Entries are matched against tag slugs, trimmed of surrounding
148
+
whitespace.
149
+
126
150
---
127
151
128
-
## `poe`
152
+
## `rules.poe-power`
129
153
130
154
Controls the `poe-power` check.
131
155
132
156
```json
133
-
"poe": {
134
-
"check_powered_device_supply": true,
135
-
"require_pse_mode_on_peer": true,
136
-
"unknown_type_policy": "fail"
157
+
"rules": {
158
+
"poe-power": {
159
+
"check_powered_device_supply": true,
160
+
"require_pse_mode_on_peer": true,
161
+
"unknown_type_policy": "fail"
162
+
}
137
163
}
138
164
```
139
165
@@ -143,6 +169,10 @@ Controls the `poe-power` check.
143
169
|`require_pse_mode_on_peer`|`bool`|`true`| Flag a finding when a PD interface is connected to a peer that is not marked as PSE mode. |
144
170
|`unknown_type_policy`|`string`|`"fail"`| How to handle a PD or PSE with no PoE type set. `"fail"` flags it as a finding; `"ignore"` skips silently. |
145
171
172
+
`unknown_type_policy` is the one value validated on load: anything other than `"fail"`, `"ignore"`,
173
+
or the empty string aborts the run rather than falling back to a default. Case and surrounding
174
+
whitespace are normalized.
175
+
146
176
### PoE type hierarchy
147
177
148
178
The check uses this ordering to determine whether a supply is sufficient for a demand:
@@ -165,28 +195,33 @@ A supply of type N satisfies any demand of type ≤ N.
0 commit comments