feat(scheduler-core): implement REPL execution control (task 12.1)
Adds the interactive simulation REPL's execution-control slice (Req 5 AC 22): a single-threaded input loop (readline-based) supporting step [N], continue, quit, and help, pausing before the first replay event and blocking the driver loop while active. Review round 1 raised two findings, both resolved here: - GNU readline (GPL) was linked directly into xce_scheduler, a shipped production daemon. Switched the whole project to libedit (BSD) for line editing -- scheduler and controller (xce_test) both now use editline/readline.h, API-compatible (readline()/add_history()). - Getting a clean regression run after the libedit swap required a full clean rebuild, which exposed a genuine pre-existing SIGSEGV (bug-1504): SnapshotData.internalState was a capnp Data field, and this codebase's capnpc-c backend silently no-ops Data-field encoding without zero-initializing the caller's stack struct, leaving an uninitialized capn_ptr written onto the wire. Fixed by switching internalState to List(UInt8) (with a new internalStateLen wire field), matching the working FetchFileReply.content/bytesRead precedent -- no hand-written accessor code needed. A second, unrelated instance of the same bug class was found in the controller's WAL-catchup path (WalCatchupEntry.payload) and deliberately left unfixed as bug-1505, out of scheduler-core's boundary; needs its own project-wide Data-field audit. Scheduler suite: 34/34 clean. RED-phase reproduction recorded in tasks.md (repl_should_pause() step-budget check disabled -> 2/4 tests fail as expected -> reverted -> 34/34 green). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JPPXeKSUXUqcqvzNXY1rzJ
This commit is contained in:
parent
de00ccff37
commit
02f7f48ff9
17 changed files with 1491 additions and 81 deletions
|
|
@ -65,17 +65,34 @@
|
|||
* write the output header/snapshot, so a re-derived value would drift from
|
||||
* "the same SnapshotEntry that was loaded" (AC 19's own wording -- same ts,
|
||||
* not merely a same-shaped one taken moments later).
|
||||
*
|
||||
* `repl_state` below is a SECOND field beyond design.md's literal sketch
|
||||
* (scheduler-core spec, task 12.1, Req 5 AC 22) -- the interactive REPL's
|
||||
* own execution-control state (current step-N/continue mode, remaining step
|
||||
* budget; task 12.2/12.3 grow the same struct with breakpoints/param
|
||||
* overrides). Declared here only as an opaque forward-declared pointer
|
||||
* (xce_sched_repl_state_t, just below) -- the full struct body lives in
|
||||
* repl.c, never in this header, matching plugin.h's own
|
||||
* `xce_sched_core_t` forward-declare precedent for the identical "opaque
|
||||
* pointer, defined in the consuming file" reason. NULL until
|
||||
* xce_repl_start() lazily allocates it (repl.c) -- guaranteed NULL after a
|
||||
* successful sched_sim_driver_start() the same way every other field here
|
||||
* is, via that function's own `memset(sim, 0, sizeof(*sim))` (sim.c); no
|
||||
* sim.c change was needed for this task.
|
||||
*/
|
||||
typedef struct xce_sched_repl_state_s xce_sched_repl_state_t;
|
||||
|
||||
typedef struct {
|
||||
xce_sched_core_t core;
|
||||
FILE* replay_file;
|
||||
FILE* alt_events_file;
|
||||
FILE* record_file;
|
||||
uint64_t sim_speed_num;
|
||||
uint64_t sim_speed_den;
|
||||
bool verify;
|
||||
bool interactive;
|
||||
uint64_t snapshot_ts;
|
||||
xce_sched_core_t core;
|
||||
FILE* replay_file;
|
||||
FILE* alt_events_file;
|
||||
FILE* record_file;
|
||||
uint64_t sim_speed_num;
|
||||
uint64_t sim_speed_den;
|
||||
bool verify;
|
||||
bool interactive;
|
||||
uint64_t snapshot_ts;
|
||||
xce_sched_repl_state_t* repl_state;
|
||||
} xce_sched_sim_driver_t;
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue