Skip to content

Make service-request scheduler tests deterministic - #1170

Draft
thehobbit85 wants to merge 1 commit into
seedds:mainfrom
thehobbit85:codex/deterministic-service-request-test
Draft

thehobbit85 wants to merge 1 commit into
seedds:mainfrom
thehobbit85:codex/deterministic-service-request-test

Conversation

@thehobbit85

@thehobbit85 thehobbit85 commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Main still uses wall-clock dispatch to assert flag ordering in the service-request fixture. This patch models fixture time/completion while retaining real scheduler handoff/native-wait assertions and the separate bounded-deadline exception. Production timing and retries remain unchanged.

Current rebase — 2026-11-05

Rebased 7229bff97db66ebc4dbb2bc16cc153932769cba8 onto fixed current main f8a5618d5f505a4c0a0bcac7c413872d3a53c009, producing 9424e5bbabcb3ee37c1556a92ee0d386e006de1a on the same existing canonical and PR branches. Main is an ancestor. This replays the existing feature commit; no new squash or unrelated prerequisite is included.

Rebase was clean and patch-equivalent. The fixture and production scheduler source blobs match the prior tested feature. This PR remains a draft.

Fresh validation and limits

Fresh normal and TSan preemption targets passed both scheduler modes, including delayed starters and the separate deadline case. All 21 documentation/current-ABI tests passed. Scoped LLVM 23.1.4 C lint matches the current baseline with zero new or stale file/check pairs. No assertions, deadlines or timeouts were weakened.

The workflow-pinned Python ratchet (Ruff 0.17.2 / Pyright 1.1.414) passes: 389 findings against 389 recorded, zero new or stale findings. The former shared-main B023 issue is fixed on this base; references to it below are historical. No baseline was loosened. Generated documentation and git diff --check were reviewed. New remote CI is pending publication and is not claimed green.

This is synthetic fixture/reference coverage only; no production scheduler behavior, gameplay, devices or performance claim is made. Historical negative-control and repeated-run evidence below retains its original tested revisions.

Historical proposal, validation and original commit context

The description below predates this rebase. Its commit identities, timing tables, tool environments and validation limits remain historical; they are not a current all-pass or fresh gameplay claim.

Main still asserts flag ordering using wall-clock dispatch in the service-request fixture, although production’s bounded deadline explicitly permits the opposite ordering after a long host deschedule. This PR models only fixture time/request completion, retains the real scheduler and handoff/native-wait assertions, checks 20 ms delayed starters in both modes, and separately tests the 5 ms deadline. No production timing, timeout or retry policy changes.

Current refresh — 2026-11-04

Candidate 7229bff97db66ebc4dbb2bc16cc153932769cba8 is exactly one commit directly atop fresh main 975bb4c14456d145eb3d969814534eecdd996ce9. The canonical branch and existing PR destination are unchanged. The published head was 3b4fcabb29a610ffc14cc9ea8ebb1626a2cc9433; preserved local pre-pass candidate was 3b4fcabb29a610ffc14cc9ea8ebb1626a2cc9433. Rebase range-diff is patch-equivalent, and the pre-squash tree c4caf023c29a59fc0a30bc5f5dfbbceaaf427dcc equals final tree c4caf023c29a59fc0a30bc5f5dfbbceaaf427dcc. No unrelated prerequisite or feature was dropped. Original author credit is preserved.

Validation and limits

Fresh native and ThreadSanitizer preempt targets pass both modes on this exact candidate, including delayed starters and the separate deadline case. 21 documentation/current-ABI tests pass. LLVM 23.1.4 focused clang-tidy matches the fixture baseline with zero new or stale file/check pairs. This is not a full current lint pass. The first sandbox test attempt stopped on ignored-header generation; the completed run used normal authorized worktree access.

This remains a draft. The remaining diff changes only the scheduler fixture and its reference entry. Gameplay, devices and production scheduler behavior are outside this test-only change. Historical four negative controls and prior full lint results below retain their original tested revisions; they are not newly repeated.

Shared Python lint is blocked by unchanged main dm/games/settings.py:115 Ruff B023 (390 findings versus 389 baseline), confirmed on the pinned base. No unrelated repair or baseline alteration is included. Generated documentation, final main diff and git diff --check were reviewed for PR #895 placement/artifact rules; no planning journals or run-specific evidence were added to repository documentation. Remote CI for this new unpublished SHA has not run; previous CI results are historical.

Historical context and evidence

The description below predates this refresh. Its revision names, validation runs, measurements and limitations are retained as historical evidence rather than current all-pass claims.

The sanitizer job on #1155 failed in t_preempt's service-request case, outside that PR's NARC changes. The fixture required the starter to publish a flag before a real service timing window expired. Production explicitly allows the worker to finish first after a sufficiently long host deschedule, so the test was asserting a scheduling guarantee the host does not make.

Drive the service clock and request completion explicitly inside the fixture while retaining the real thread SVCs, handoff/native-wait state and existing flag-order assertions. Cover 20 ms starter delays in both preemption modes, and separately advance the clock to the 5 ms start deadline to verify the bounded exception. Production scheduler code and timing constants are unchanged.

Current head 3b4fcabb29a610ffc14cc9ea8ebb1626a2cc9433 contains only the test and its existing reference documentation, on main a41b80545c82c5fff3dfeaba41bd5e2e6dcb4290. Main's a27d684b supplies the shared allocation/filesystem lint repair, so the earlier carried #1164 prerequisite has been removed. The scheduler patch is unchanged by the rebase. This also resolves the old head's lint failure when its 261-finding baseline was compared against main's newly tightened 241-finding baseline.

Validation on Apple Silicon, macOS 26.6 (25G5028f), Xcode 27.2 (27B52), Apple clang 21.0.0 from the Swift 6.4.1 toolchain:

  • Fresh normal and ThreadSanitizer make -C dm/host/tests GAME=010015100B514000 preempt runs pass both modes, including delayed starters and the explicit deadline case. TSan uses SAN='-g -fsanitize=thread -fno-inline' and a separate build directory.
  • Before the fixture change, a controlled 20 ms starter delay failed all 20 service-request cases. Ten additional fresh-process TSan runs passed on the pre-rebase patch. Four temporary negative controls failed at their intended assertions: missing handoff release, missing native-wait state, removed start deadline and removed service round trip. These results remain applicable after verifying identical test, scheduler, stub, header, Makefile and game inputs. No mutations are included.
  • Fresh full LLVM 23.1.4 clang-tidy ratchet: 230 sources, 241 findings against 241 recorded, zero file/check pairs above or below baseline, and no baseline growth over current main.
  • Full pinned Python ratchet: 391 existing findings, zero new or stale. All 11 documentation tests pass; git diff --check passes.

The final diff changes only a synthetic scheduler fixture and its reference entry. No production scheduler, game-profile or renderer change remains, so gameplay is outside this change's validation scope. No agent plans or execution journals are included. Fresh remote CI is pending.

Historical original commit context and preserved corrective messages

These are the original published and preserved local messages before this squash. They explain historical intent and limitations; any validation named in them belongs to the original commit, not the new candidate. Repeated equivalent messages are shown once with their original identities.

seedds seedds@gmail.com — 3b4fcabb29a610ffc14cc9ea8ebb1626a2cc9433 (published), 3b4fcabb29a610ffc14cc9ea8ebb1626a2cc9433 (preserved unpublished/local)

Make service-request regression independent of host dispatch timing
Published commit context before this rebase

Historical message from 7229bff97db66ebc4dbb2bc16cc153932769cba8; any validation statements belong to that revision.

Make service-request regression independent of host dispatch timing

Model only the fixture clock and request completion while preserving real scheduler handoff assertions and a separate bounded-deadline case. Production scheduling and deadlines remain unchanged.

@github-actions github-actions Bot added host The Horizon host: SVCs, services, threads, memory (dm/host) nvn NVN on Metal and its tests (dm/gfx/nvn, dm/gfx/tests) tools Tools and scripts (dm/tools, scripts) docs Documentation labels Nov 4, 2026
@thehobbit85
thehobbit85 force-pushed the codex/deterministic-service-request-test branch from 5e7e409 to 3b4fcab Compare November 4, 2026 06:26
@thehobbit85
thehobbit85 force-pushed the codex/deterministic-service-request-test branch from 3b4fcab to 7229bff Compare November 4, 2026 17:48
Model only the fixture clock and request completion while preserving real scheduler handoff assertions and a separate bounded-deadline case. Production scheduling and deadlines remain unchanged.
@thehobbit85
thehobbit85 force-pushed the codex/deterministic-service-request-test branch from 7229bff to 9424e5b Compare November 5, 2026 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation host The Horizon host: SVCs, services, threads, memory (dm/host) nvn NVN on Metal and its tests (dm/gfx/nvn, dm/gfx/tests) tools Tools and scripts (dm/tools, scripts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants