feat(worker-rejoin-resync): wire config fields into xceadmin build (task 1.5)

Add workerResyncWindowMs/workerResyncTimeoutMs to xce.schema.json
(minimum:0, matching the optional-scalar-field precedent -- these
aren't `required` with a floor like heartbeatInterval, so minimum:1
would be wrong) and to mapping.py's YAML->capnp field table. Regenerate
both golden config-build fixtures (task 1.1 grew ClusterConfig's wire
layout by 2 fields; full/expected.bin and minimal/expected.bin each
grew by exactly 8 bytes). full's fixture YAML now sets real values
(900000ms/15000ms); minimal deliberately left untouched (no xce.yaml)
per its own locked-down "hosts+queues only" boundary test -- its
expected.bin still regenerates to reflect the new default-0 fields.
Two new tests assert specific decoded values, not just "build succeeds".

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y4M5MJM2zK6nU43da267Ku
This commit is contained in:
Rongsong Shen 2026-09-01 09:47:02 +00:00
parent 9f3dfe7903
commit ce3d391e5e
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
8 changed files with 81 additions and 9 deletions

View file

@ -60,11 +60,12 @@ def test_section_map_hosts_yaml_feeds_two_distinct_capnp_fields():
assert yaml_keys == {"hostgroups", "hosts"}
def test_section_map_covers_all_13_clusterconfig_fields_or_documents_exclusion():
# 5 scalar (xce.yaml) + 7 list capnp_fields covers 12 of the 13
# ClusterConfig fields; configGeneration (@12) is the one deliberately
# excluded field (Requirement 1.9), documented in the module docstring,
# not present in SECTION_MAP at all.
def test_section_map_covers_all_14_clusterconfig_fields_or_documents_exclusion():
# 7 scalar (xce.yaml, including worker-rejoin-resync's workerResyncWindowMs/
# workerResyncTimeoutMs, task 1.5) + 7 list capnp_fields covers 14 of the
# 15 ClusterConfig fields (@0-@14); configGeneration (@12) is the one
# deliberately excluded field (Requirement 1.9), documented in the
# module docstring, not present in SECTION_MAP at all.
list_fields = {s["capnp_field"] for s in mapping.SECTION_MAP if s["kind"] == "list"}
assert list_fields == {
"resources",
@ -83,6 +84,8 @@ def test_section_map_covers_all_13_clusterconfig_fields_or_documents_exclusion()
"inactiveHeartbeatCount",
"fetchJobInterval",
"netioTimeout",
"workerResyncWindowMs",
"workerResyncTimeoutMs",
}
@ -91,7 +94,7 @@ def test_section_map_covers_all_13_clusterconfig_fields_or_documents_exclusion()
# ---------------------------------------------------------------------------
def test_map_scalar_section_sets_all_5_fields(cluster_config):
def test_map_scalar_section_sets_all_7_fields(cluster_config):
spec = mapping.SECTION_MAP[0]
values = {
"cluster_name": "eda1",
@ -99,6 +102,8 @@ def test_map_scalar_section_sets_all_5_fields(cluster_config):
"inactive_heartbeat_count": 3,
"fetch_job_interval": 10,
"netio_timeout": 30,
"worker_resync_window_ms": 900000,
"worker_resync_timeout_ms": 15000,
}
mapping.map_scalar_section(spec, values, cluster_config)
@ -107,6 +112,8 @@ def test_map_scalar_section_sets_all_5_fields(cluster_config):
assert cluster_config.inactiveHeartbeatCount == 3
assert cluster_config.fetchJobInterval == 10
assert cluster_config.netioTimeout == 30
assert cluster_config.workerResyncWindowMs == 900000
assert cluster_config.workerResyncTimeoutMs == 15000
def test_map_scalar_section_leaves_missing_optional_keys_at_default(cluster_config):
@ -117,6 +124,8 @@ def test_map_scalar_section_leaves_missing_optional_keys_at_default(cluster_conf
assert cluster_config.clusterName == "eda1"
assert cluster_config.fetchJobInterval == 0
assert cluster_config.netioTimeout == 0
assert cluster_config.workerResyncWindowMs == 0
assert cluster_config.workerResyncTimeoutMs == 0
@pytest.mark.parametrize("empty", [None, {}])