Repository navigation
test(core): share session fixtures and replace test-only hooks with three seams - #528
Merged
Merged
Conversation
…ne nextest profile Tests use one thread per CPU; real-process tests share a two-thread group so their exit confirmation is not starved, and only the ~15 slowest tests get priority. Soak tests form a group the pull-request gate leaves out and `cargo xtask check --full` runs. The hand-picked test-exact steps become a nextest `platform` profile whose selection CI diffs against .config/platform-tests/<os>.txt; the two Windows jobs merge into one. `cargo xtask lint` requires every Windows- or macOS-only test to be listed. Adds a 14-day quarantine list with a lint, a gate exclusion and a non-blocking stress job, starting empty. The devcontainer job runs only when its inputs change or off pull requests; the minimal core profile runs as its own job.
…p instead of doc comments
…he always-None harness parameter
…harness test and the ignored R4 diagnostic
…he novel-read runtime run
…l compaction test
…stead of migrating them Schema 25 shipped in v0.0.1. Steps 1-24 only served unreleased builds, so they go together with their tests, and opening an older store now fails with SessionRuntimeError::UnsupportedStoreSchema.
Seeds at unreleased schemas (27, 29-31, 40-42, 45-49, 51-57, 60-63) move to the nearest released schema below them (26, 28, 39, 43, 50, 58). Tests whose seeded state never existed in a released store (goal rows before 58, the experimental 48 notice build) are deleted.
With an active goal the scheduler queues a goal-origin run as soon as the goal is set. Under load it was claimed before the fixture's prompt, so the report counted the prompt's tool events (zero) while the goal run did the work. The fixture now follows the queued goal run, with a per-run turn cap that fits the scripted workload.
One checked goal now covers the real kills, waits, outages, interleaved prompts, achievement through the check, and then a replacement goal that runs out its deadline, which the unchecked soak used to prove.
The perf run keeps its 560 paced 1 KiB chunks. The test streams 8 KiB chunks with no pause, which still commits over 512 events, the gate it checks. The captured-output timeout test waits 100 ms instead of 1 s.
The in-run compaction scripts spawned about 640 shells only to produce 6 KB results. A test tool now returns the same stored bytes (the bounded 2,051-byte shell result), so every test compacts exactly as many times as before. The verbatim-goal test runs 30 turns instead of 72, which still compacts five times per row.
A 5 s limit made each case wait 5 s. On one loaded core the run needs about 520 ms to reach the hung summarizer (22 ms unloaded), so 500 ms failed under stress while 2 s passed 40 of 40.
Each run reads three 90 KiB notes instead of one, so the window-less session crosses the point where stale reads must be shed after about 40 runs instead of 140. The assertions are unchanged.
Collaborator
Author
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #525 (now merged, so this targets
main).Change
This is a test refactor with no behavior change. It covers findings E1, E2 and E5 from the test audit. The tests are the same and assert the same things, in about 4,800 fewer lines. Production behavior does not change.
E1: three seams instead of 16 ad-hoc statics
sessions/probe.rsadds oneRuntimeProbe, aCheckpointenum withhold/observe/hold_reporting_run. It replaces the 11 hold/observe registries plushold_result: cancellation read, outcome read, child creation, failing reserved start, child delivery, child receipt, parent wait, execution stop, buffered tool output, drop settlement, summary admission ack, and goal-check result.StoreFaultsreplacesfail_cancellation_reads,fail_reserved_settlements,fail_reserved_reloadsandfail_child_cancellation.#[cfg(test)].SessionRuntime::stats()returnsStoreStats { catch_up_reads, retained_feeds }.hold_control_capacityand the other test-onlyStoremethods move tostore/test_api.rs.SessionRuntime::hold_scheduling()replaces 22 hand-rolledinner.permitsacquisitions. Alongside it areidle_run_permits(),has_failed()andstore(), insessions/runtime/test_api.rs.RunResources::for_runreplaces the#[cfg(test)]run_idfield and thefor_test_runbuilder.#[cfg(test)]blocks in non-test sessions files went from 116 to 36. The remaining ones aremod testsblocks, test-onlyuses, the paused-clock hook instore/worker.rs,codec::TEST_EPOCH, andwaiting_for_test, which is part of theSubagentSpawnertrait outside sessions. Hook-registryMutexstatics went from 16 to 0.E2: shared builders in
sessions/tests/fixtures.rs, which the file-split PR can import as is.SessionFixture:open,open_with,open_atandopen_in. Each one opens the runtime, resolves the workspace, creates the session and subscribes.ProviderLoader, with pricing, route, max-output and context-window options, plusload_provider,load_errorandtest_pricing.provider_script,text_reply,text_delta,completed,tool_callandprovider_usage.Promptwithsubmit,try_submitandstore_command.set_goal,goal_command,goal_controlandidentity_of.TurnCommitbuilder forModelTurnCommit.new_session,store_session,subscribe_afterandcancel_run.ScriptedRunsHarness,ApprovalHarness,SessionManagementHarness,AutoCompactHarness,SpawnHarness,OutputContractHarnessandBudgetHarness) plusDeadlineSessionare nowSessionFixture.ApprovalHarnessandSessionManagementHarnesskeep their one extra field throughDeref.tools.rstests,run_shell_tooland a newshell_toolreplace nine 9-argument shellexecutecalls.StaticPolicyGate::fixed(mode)replaces 28 struct literals inlib.rs,tests/progress.rsandsessions/tests/goals.rs.crate::test_support::run_workerreplaces 6 hand-rolled self-re-exec workers. The orphan-server worker inshell.rsspawns rather than waits, and the soak worker is async, so both stay.E5:
.inner.reach-ins in sessions tests went from 384 to 65. Most now go throughruntime.store(),store_id(),request_schedule()and the seams above. The remaining ones reach side-question permits,failed/shutdownwatches,cancel/notify, child permit pools andArc::clone(&runtime.inner)for compactor construction. None of those was cheap to move.Measured literal counts in the sessions tests, base → head:
SubmitPrompt {: 158 → 23"set_goal": 87 → 5CommandOutcome::SessionCreated: 174 → 68SessionRuntime::open(: 170 → 121map_err(|error| RuntimeLoadError: 51 → 0ModelTurnCommit {: 31 → 4SnapshotRequest {: 68 → 5.inner: 384 → 65Hooks left in place, with reasons:
worker::hold_paused_clock. It changes job settlement under a paused current-thread runtime rather than pausing at a checkpoint.codec::TEST_EPOCH. It is the clock seam from test(core): drive session wall time and deadlines from one clock #521.waiting_for_test. It is aSubagentSpawnertrait method inruntime/, which is outside sessions.crate::tools/crate::workspacehooks (hold_shell_receipt,hold_tool_apply,pause_blocking_preparationand the others). They are outside sessions production code and out of scope.No findings were skipped. No tests were deleted or renamed.
Verification
cargo nextest run -p qq-core: 1357 run and 2 skipped on the base (origin/maincf07b60). The same 1357 run and 2 skipped on the head. Thecargo nextest listname sets are identical (1359 names).cargo xtask checkpassed on 0adbc12: fmt, lint (11/11 test sleeps), clippy-D warnings, and 2362/2362 tests across qq, qq-client, qq-core, qq-host, qq-server, qq-tui and xtask.PROBE,FAULTS,hold_outcome_readorhold_scheduling. That is 53 tests. Each ran 50 iterations with the taskset loaded-core recipe (three spinners and nextest on core 0,--profile ci --retries 0): 50/50 and 50/50 in two halves.hold_schedulingtook every available permit. Under load, a run that had already been admitted could still hold one, soside_answer_bypasses_the_main_permit…anddetached_child_refreshes_ancestor_budget…failed 5 of 50. The base passes those 50/50 under the same load.hold_schedulingnow waits for exactlymax_active_runs, which is what the original single-permitacquire()waited for. After the fix both tests pass 50/50, and so does the full set of 53.xtask/src/legacy-sleeps.txtonly moves the same 11 sleeps to their new line numbers.Known impact
None for users. In test builds,
RuntimeProbeandStoreFaultsare process-global, as the old statics were. They are keyed by run, session or tool-call id, so tests running in parallel do not interfere.