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

@ -83,6 +83,50 @@ def test_build_same_input_twice_is_byte_identical(tmp_path):
assert first == second
# ---------------------------------------------------------------------------
# worker-rejoin-resync (Requirements 3.7, 5.3): workerResyncWindowMs/
# workerResyncTimeoutMs are operator-settable through xce.yaml's scalar
# section, following the heartbeat_interval/inactive_heartbeat_count
# pattern exactly (task 1.5). These prove the VALUE round-trips
# (YAML -> binary -> decode) with a specific, checkable pair of numbers --
# not just that some golden blob happens to match.
# ---------------------------------------------------------------------------
def test_build_maps_worker_resync_window_and_timeout_fields(tmp_path):
_write_yaml(
tmp_path / "xce.yaml",
{
"cluster_name": "eda1",
"heartbeat_interval": 30,
"inactive_heartbeat_count": 3,
"worker_resync_window_ms": 900000,
"worker_resync_timeout_ms": 15000,
},
)
data = build.build_cluster_config(str(tmp_path))
mod = load_schema()
with mod.ClusterConfig.from_bytes(data) as reader:
assert reader.workerResyncWindowMs == 900000
assert reader.workerResyncTimeoutMs == 15000
def test_build_leaves_worker_resync_fields_at_default_when_absent(tmp_path):
_write_yaml(
tmp_path / "xce.yaml",
{"cluster_name": "eda1", "heartbeat_interval": 30, "inactive_heartbeat_count": 3},
)
data = build.build_cluster_config(str(tmp_path))
mod = load_schema()
with mod.ClusterConfig.from_bytes(data) as reader:
assert reader.workerResyncWindowMs == 0
assert reader.workerResyncTimeoutMs == 0
# ---------------------------------------------------------------------------
# Hard failures propagate (schema violation, reserved name, duplicates)
# ---------------------------------------------------------------------------