feat(component-failover-adoption): validate scheduler backpressure, fix candidate-name diagnostics

Adds a worst-case-occupancy test proving the scheduler's picker/allocator
pipeline buffers briefly past a stalled publish (decisions cbuf cap 5,
jbuf cap 1) then genuinely blocks until connectivity recovers, with zero
job loss (Req 3 AC2). Adds a source-scan regression guard confirming the
scheduler makes no periodic heartbeat call of its own (Req 3 AC3).

Also fixes a real gap found along the way: sched_init()'s
all-candidates-unreachable and join-failure log lines named only a
candidate count, never which candidates were attempted (same class of
bug worker's task 2.3 fixed). Added sched_format_candidate_list(),
covered by a real dup2()-based stdout capture around a live sched_init()
failure path (round-1 review caught this diagnostic shipping with zero
test coverage; fixed in round 2).

Multi-candidate join and kill-primary/reconnect were validated manually
against a live 3-node cluster rather than committed as an automated
test, following worker's task 2.3 precedent -- no automated live-deploy
E2E harness exists for any C daemon in this repo.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NNB4zGPCsHyDUCDJyMbiQN
This commit is contained in:
Rongsong Shen 2026-08-11 14:00:02 +00:00
parent 7c260e0c97
commit b7df8d602c
Signed by: rshen
SSH key fingerprint: SHA256:8Vf2pZ3h6rJa7EhGK+WaAQ9Mta/apZvteW6g9U/WKKk
5 changed files with 811 additions and 9 deletions

View file

@ -829,6 +829,31 @@ sched_scheduler_decision_publish_retry_test = executable(
'-Wl,--wrap=xcecli_set_reconnect_handler'],
install: false)
# Worst-case decision/allocation backpressure test (component-failover-
# adoption, task 3.3, boundary: SchedulerControllerClient, Req 3 AC2 / Req
# 7). Same real-scheduler_srcs link technique as the two targets above, PLUS
# `-Wl,--wrap=` on xcecli_start/xcecli_join (forced to succeed with no I/O,
# so this file's one real sched_init() call actually starts the picker/
# allocator threads) and xcecli_set_pend_reason (blocks on a test-controlled
# condvar, standing in for a stuck outage retry) -- see the test file's own
# header comment for the full design and worst-case derivation.
scheduler_backpressure_test_srcs = ['test_scheduler_backpressure.c']
foreach f : scheduler_srcs
if f != 'src/main.c'
scheduler_backpressure_test_srcs += ['../' + f]
endif
endforeach
sched_scheduler_backpressure_test = executable(
'sched_scheduler_backpressure_test',
scheduler_backpressure_test_srcs,
include_directories:[incdir],
dependencies: [scheduler_deps, unity_dep],
link_args: ['-Wl,--wrap=xcecli_start',
'-Wl,--wrap=xcecli_join',
'-Wl,--wrap=xcecli_set_pend_reason'],
install: false)
# Register as meson tests so `meson test --suite scheduler` runs them all.
# detect_leaks=0 matches the suite convention (fixtures are not torn down).
test('scheduler test', scheduler_test, suite: 'scheduler',
@ -937,3 +962,6 @@ test('scheduler connect pipeline test',
test('scheduler decision publish retry test',
sched_scheduler_decision_publish_retry_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])
test('scheduler backpressure test',
sched_scheduler_backpressure_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])