test(component-failover-adoption): add scheduler decision-redelivery queue coverage

Proves task 3.2's retry-until-success-or-shutdown wrapper's guarantees
hold across multiple queued decisions drained through the real
xce_sched_driver_on_decision(), not just a single isolated call:
decisions queued behind a stuck one publish afterward in original
order (Req 7 AC3), and shutdown mid-retry costs at most one retry
cycle regardless of queue depth -- decisions behind the stuck one see
core.stop already true and are never attempted (Req 7 AC2). Also adds
a source-scan confirming this stays scoped to the scheduler's own
publish direction (Req 7 AC5) and a fresh-instance test confirming a
restart still loses in-flight queued decisions, unchanged by this work
(Req 7 AC6).

Pure test-coverage task -- zero production changes, matching the
review's independently-reproduced RED->GREEN evidence that the
existing task-3.2 implementation already satisfies these guarantees.

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 23:50:20 +00:00
parent b7df8d602c
commit d383d04311
Signed by: rshen
SSH key fingerprint: SHA256:8Vf2pZ3h6rJa7EhGK+WaAQ9Mta/apZvteW6g9U/WKKk
3 changed files with 566 additions and 1 deletions

View file

@ -854,6 +854,41 @@ sched_scheduler_backpressure_test = executable(
'-Wl,--wrap=xcecli_set_pend_reason'],
install: false)
# Queue-level decision-redelivery test coverage (component-failover-adoption,
# task 3.4, boundary: SchedulerControllerClient, Req 7). Proves task 3.2's
# retry-until-success-or-shutdown wrapper's guarantees hold across MULTIPLE
# queued decisions drained through the real xce_sched_driver_on_decision()
# (driver.c), not just a single isolated call (already covered by
# test_scheduler_decision_publish_retry.c). Same real-scheduler_srcs link
# technique as the targets above, but only xcecli_jobdispatch() needs
# wrapping here -- these fixtures use xce_sched_core_init() directly (not
# sched_init()), so sched_needs_rejoin is never set and
# sched_publish_check_rejoin() never reaches xcecli_join(). Also needs
# driver.c's absolute path (XCE_DRIVER_C_PATH) alongside scheduler.c's
# (XCE_SCHEDULER_C_PATH, same pattern as sched_scheduler_connect_test) for
# its Req 7 AC5 source-text scan.
scheduler_decision_redelivery_test_srcs = [
'test_scheduler_decision_redelivery.c']
foreach f : scheduler_srcs
if f != 'src/main.c'
scheduler_decision_redelivery_test_srcs += ['../' + f]
endif
endforeach
sched_scheduler_decision_redelivery_test = executable(
'sched_scheduler_decision_redelivery_test',
scheduler_decision_redelivery_test_srcs,
include_directories:[incdir],
dependencies: [scheduler_deps, unity_dep],
c_args: ['-DXCE_SCHEDULER_C_PATH="'
+ (meson.current_source_dir() / '..' / 'src' / 'scheduler.c')
+ '"',
'-DXCE_DRIVER_C_PATH="'
+ (meson.current_source_dir() / '..' / 'src' / 'driver.c')
+ '"'],
link_args: ['-Wl,--wrap=xcecli_jobdispatch'],
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',
@ -965,3 +1000,6 @@ test('scheduler decision publish retry test',
test('scheduler backpressure test',
sched_scheduler_backpressure_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])
test('scheduler decision redelivery test',
sched_scheduler_decision_redelivery_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])