Merge CB-602: guard against a config key that never reaches the example
bridged.yaml is gitignored, so bridged.example.yaml is the only committed description of the config schema. Two tests already covered example -> code; nothing covered code -> example, so a brand-new key could ship undocumented and no test would notice. A new test compares BridgedConfig.KNOWN_TOP_LEVEL_KEYS against the example scanned as TEXT, so a key documented only as a comment counts as documented. That is what makes the guard correct rather than annoying: most of the example is commented on purpose. Verified here: added an undocumented key and watched the test fail with an actionable message naming it; then documented that key as a comment only and watched it pass. Probe reverted, tree clean. Closes #96
This commit is contained in:
@@ -967,8 +967,12 @@ public record BridgedConfig(
|
||||
/**
|
||||
* Top-level keys this version understands. Used only to warn about the rest — see
|
||||
* {@link #warnUnknownTopLevelKeys}. Keep in step with the record components.
|
||||
*
|
||||
* <p>Package-private (not {@code private}) so a test can assert every key here is documented in
|
||||
* {@code bridged.example.yaml} — the only committed description of the config schema, since
|
||||
* {@code bridged.yaml} itself is gitignored.
|
||||
*/
|
||||
private static final Set<String> KNOWN_TOP_LEVEL_KEYS = Set.of(
|
||||
static final Set<String> KNOWN_TOP_LEVEL_KEYS = Set.of(
|
||||
"bind", "herdrSocket", "profiles", "guard", "worktreeRoot",
|
||||
"lifecycle", "spawnReadyTimeoutMs", "spawnReadyPollMs", "broker", "primary", "fleet",
|
||||
"leadHeartbeat", "health", "placement", "auth", "configReload", "quarantineCooldownSeconds");
|
||||
|
||||
Reference in New Issue
Block a user