feat(scheduler-core): enforce simulation isolation (task 11.3)

Three-layer regression guard (test_sim_isolation.c) proving sim.h/sim.c/
sim_loop.c hold no controller-facing client/cluster-config/capnp-socket
state: source-text scan, struct-body field scan, and nm(1) link-time
undefined-symbol audit of a new isolated sched_sim_isolation_lib target.
This commit is contained in:
Rongsong Shen 2026-08-07 00:19:45 +00:00
parent 7e1e861e4f
commit b8d2f5f48d
Signed by: rshen
SSH key fingerprint: SHA256:8Vf2pZ3h6rJa7EhGK+WaAQ9Mta/apZvteW6g9U/WKKk
4 changed files with 604 additions and 1 deletions

View file

@ -501,6 +501,40 @@ sched_sim_event_loop_test = executable(
dependencies: [scheduler_test_deps],
install: false)
# Regression guard for task 11.3's Observable (scheduler-core spec, Req 5 AC
# 17, "Simulation isolation"): "a build-time or structural check confirms no
# controller-facing symbol is reachable from the simulation driver's compiled
# object", plus the AC's own "confirmed by the struct definition itself, not
# runtime checks alone" clause. Same source-text-scan + nm(1) link-time-proof
# genre as sched_core_isolation_test above, PLUS a third, narrower structural
# layer scanning ONLY xce_sched_sim_driver_t's own struct body text for
# forbidden field types -- see the test's own header comment for why a
# comment-stripping pass is required first (sim.h's own boundary doc comment
# legitimately names xcecli_ctx_t/xce_cluster_config_t in prose). link_with
# establishes the build-order dependency on sched_sim_isolation_lib (parent
# meson.build -- sim.c AND sim_loop.c compiled together, isolated from the
# rest of the scheduler); XCE_SIM_*_PATH bake in absolute paths the same way
# XCE_CORE_*_PATH does above.
sched_sim_isolation_test = executable(
'sched_sim_isolation_test',
['test_sim_isolation.c'],
include_directories:[incdir],
dependencies: [scheduler_test_deps],
link_with: [sched_sim_isolation_lib],
c_args: ['-DXCE_SIM_H_PATH="'
+ (meson.current_source_dir() / '..' / 'include' / 'sim.h')
+ '"',
'-DXCE_SIM_C_PATH="'
+ (meson.current_source_dir() / '..' / 'src' / 'sim.c')
+ '"',
'-DXCE_SIM_LOOP_C_PATH="'
+ (meson.current_source_dir() / '..' / 'src' / 'sim_loop.c')
+ '"',
'-DXCE_SIM_LIB_PATH="'
+ sched_sim_isolation_lib.full_path()
+ '"'],
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',
@ -576,3 +610,6 @@ test('scheduler sim startup test',
test('scheduler sim event loop test',
sched_sim_event_loop_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])
test('scheduler sim isolation test',
sched_sim_isolation_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])