feat(scheduler-sim-diagnostics): implement info limit name/all resolution

repl_info_limit() (repl_info.c, not yet wired into repl_cmd_info() -- that's
task 4) resolves "all" vs a specific name against limit_get_configured_limits():
a NULL/empty handle on the all path reports "no limits configured" (Req 1.7);
a NULL handle or key_find() miss on the named path reports "no such limit
'<name>'" (Req 1.3) and never collapses into the all-only message. New
white-box test_repl_limit_table.c exercises both paths directly, including a
dedicated regression guard for the NULL-scoping rule.

Making repl_info.c genuinely call limit_get_configured_limits() broke the link
for ~24 other white-box test files that #include repl_info.c without also
linking plugins/limit.c -- fixed with the same link-satisfying-stub idiom this
file family already uses elsewhere (all return NULL, verified behavior-
preserving since none of these fixtures register the limit plugin).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RLSNJhNoULvVcUhXEFafQC
This commit is contained in:
Rongsong Shen 2026-09-17 09:53:59 +00:00
parent b79a547a1e
commit d3df8fb29f
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
28 changed files with 1098 additions and 1 deletions

View file

@ -1103,6 +1103,40 @@ sched_repl_resource_table_test = executable(
dependencies: [scheduler_test_deps, libedit_dep],
install: false)
# Contract test for the interactive simulation REPL's `info limit <name|all>`
# name/all resolution and absence messaging (scheduler-sim-diagnostics spec,
# Requirement Set 1, task 2.1, Requirements 1.3, 1.7, 4.1, 4.2). Split into
# its own file rather than added to test_repl_resource_table.c, per
# design.md's own explicit build-wiring risk note: that file's white-box
# #include set deliberately does NOT link plugins/limit.c or resource.c
# ("resource.c, not linked here"), and this task needs the REAL
# plugins/limit.c (for the real limit_get_configured_limits()/limit_init()/
# limit_update_config() its own fixtures and repl_info_limit() call) --
# not stubbed, the same bug-1762 precedent design.md cites for a different
# scheduler-sim-repl-verbosity command that hit the identical undefined-
# reference link-failure class. Same white-box #include pattern as
# sched_repl_resource_table_test above (core.c, core_clock.c, core_events.c,
# core_session.c, decision.c, plugin.c, plugins/builtin_fcfs.c, recording.c,
# recording_session.c, sim.c, sim_loop.c, sim_picker.c, sim_record.c,
# sim_verify.c, snapshot.c/snapshot_wire.c/snapshot_load.c, repl.c,
# repl_fmt.c, repl_rollup.c, repl_break.c, repl_info.c, repl_params.c) PLUS
# the new ../src/plugins/limit.c under test. task 2.1's own scope never
# reads live usage/resource accounting (that's task 3), so resource.c is
# NOT linked here -- the same minimal link-satisfying stubs
# test_limit_plugin.c already establishes for limit.c's unused
# limit_job_election()/limit_prepare_allocation() hook bodies
# (reset_sched_obj()/get_resvals()/put_resvals()) are reused verbatim,
# confirmed sufficient by actually attempting the build and reading the
# resulting undefined-reference errors rather than guessing blindly.
# `repl_info_limit()` is not yet wired into repl_cmd_info() (task 4) -- every
# test in this file calls it directly, not through repl_dispatch().
sched_repl_limit_table_test = executable(
'sched_repl_limit_table_test',
['test_repl_limit_table.c'],
include_directories:[incdir],
dependencies: [scheduler_test_deps, libedit_dep],
install: false)
# Contract test for the interactive simulation REPL's Help & Breakpoint
# Discoverability component (scheduler-sim-repl-verbosity spec, task 9.1,
# Requirements 7.1-7.4): `help`'s listing groups commands into four labeled
@ -1828,6 +1862,9 @@ test('scheduler repl breakpoints inspection test',
test('scheduler repl resource table test',
sched_repl_resource_table_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])
test('scheduler repl limit table test',
sched_repl_limit_table_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])
test('scheduler repl help test',
sched_repl_help_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])