test(relay): rename misnamed precedence test; document the flat-key fallback nuance

test_flat_key_wins_over_subblock asserted the OPPOSITE of its name (the
sub-block wins, matching _relay_slack_extra). Rename to what it proves.
Also note in _resolve_cron_surface_mode why its fallback differs from
_relay_slack_extra's all-or-nothing sub-dict: the flat key is the legacy
staging shape, and a flat knob applies to every fronted platform, gated
only by the per-platform D6 capability check.
This commit is contained in:
Ben Barclay
2026-08-20 20:13:29 +10:00
parent a78af23cca
commit 6cd1ed2e78
2 changed files with 13 additions and 3 deletions
+9
View File
@@ -1510,6 +1510,15 @@ def _resolve_cron_surface_mode(pconfig, logical_platform_name: str) -> str:
scoped to its logical platform so a ``slack:`` block cannot leak onto
another fronted platform.
Precedence nuance vs _relay_slack_extra: that helper is all-or-nothing
(a sub-dict REPLACES the flat extra entirely), while this one falls back
to the flat key when the sub-block exists but omits the knob. The
difference is deliberate — the flat key is the legacy staging shape and
must keep working — but note a flat ``cron_continuable_surface`` then
applies to EVERY platform this relay fronts; only the per-platform D6
capability gate contains it. Scope the knob under the sub-block on
multi-platform relays.
Field gap (2026-08-18): the scheduler read only the flat key, so on the
relay lane — where pconfig is platforms.relay — operators had NO working
location for the knob and briefs always threaded.
@@ -169,9 +169,10 @@ class TestSurfaceKnobResolution:
pconfig = SimpleNamespace(extra={})
assert _resolve_cron_surface_mode(pconfig, "slack") == "thread"
def test_flat_key_wins_over_subblock(self):
"""Legacy-fallback precedence mirrors _relay_slack_extra: an explicit
flat key keeps working when both are present."""
def test_subblock_wins_over_flat_key(self):
"""Sub-block precedence: the per-logical-platform sub-block is the
documented relay shape and wins when both are present — matches
_relay_slack_extra (sub-dict preferred over flat extra)."""
pconfig = SimpleNamespace(
extra={
"cron_continuable_surface": "thread",