Repository navigation
startup: check that refused storage requests leave the destination and later requests intact - #1664
Conversation
…d later requests intact
tedin7
left a comment
There was a problem hiding this comment.
Independent technical peer review of PR #1664 at head commit a19dc4a3aaf4c8171427643c4c82a3c70976763a.
Summary
- Scope & title-neutrality: clean (
CMakeLists.txt,docs/startup-runtime.md,tests/startup_storage_refusal_order.cpp). Zero production code is modified. - No defects found in the test or documentation.
Findings
- Nit (
tests/startup_storage_refusal_order.cpp):plan[4]andplan[7]share the exact same(zlib=true, offset=zlib_offset, size=stream.size())tuple, sooutcome_of(which scanslog_textfrom offset0) returns the log line fromplan[4]for bothi=4andi=7.outcome_ofsearches for'\r'as the line terminator, assuming CRLF output fromX2W_TRAP_LOG.
Verification Executed Locally
- Linux:
git diff --check origin/main...HEAD— passed./root/.local/share/x2w-rev-venv/bin/python -B tests/docs_links_check.py— passed (16 Markdown files, 350 links)./root/.local/share/x2w-rev-venv/bin/python -B tests/bidi_controls_check.py— passed (1278 files).
- Windows Server 2025 (Build 26100, MSVC 14.44.35207):
x2w_pipe.py win2025 --batch 1667 1664:- Debug (
--preset dev):startup_storage_refusal_order1/1 passed (0.03s). - Release
/O2(--preset release):startup_storage_refusal_order1/1 passed (0.03s).
- Debug (
- Local mutation check:
- Temporarily injected a broken relative link into the new
DirectStorage refusal orderentry indocs/startup-runtime.mdand rantests/docs_links_check.py— failed as expected withdocs/startup-runtime.md:513: nonexistent_target.md(exit=1), then restored viagit checkout -- .. (The C++ test itself is Win32-only and was verified on Windows Server 2025 Debug and Release/O2.)
- Temporarily injected a broken relative link into the new
AI-assisted; commands listed were executed locally.
|
Built and ran this at cmake --preset dev
cmake --build --preset dev
ctest --preset dev --no-tests=error -R '^startup_storage_refusal_order$' -VEnvironment: Windows 11 build 26300.9974, MSVC 14.44.35207, SDK 10.0.26100. Independent check on the boundary it leans onThe refusals here come from
So the "offset == end of file" case in the new fixture is doing real work, and the short-read case is guarded too. What I think is still openThe fixture covers the ordering within one Submit on one queue. Two things it does not appear to touch, and both are the kind that a later refactor could break silently:
Neither is a defect in this change; they are the cases I would add next if you want this fixture to be the one that guards the ordering contract. I can write either against your branch or as a follow-up with One wording pointThe header comment says the check covers "the whole poisoned buffer of each refused destination". Reading the test, the poisoned region checked is the destination buffer of each refused request, which is what matters — if the intent is the whole capacity including the bytes past the declared size, that is not asserted. Worth a half-sentence either way, because "whole buffer" is the kind of phrase someone will later trust without reading the code. VerdictReviewed |
Change
Adds
startup_storage_refusal_order, a device-free test of the DirectStorage stand-in (src/startup_stubs/xcrdapi.cpp), registered likestartup_storage_alloc_failure. Test-only: no change insrc/.It writes its own file (patterned raw bytes, then one stored-deflate zlib stream) and submits one batch of 8 requests, each followed by its status entry and an
EnqueueSignalfence:Every destination (4096 bytes) is poisoned with 0xA5 and compared over its whole length. The test also checks that each fence runs after its own status entry and before the next, in queue order, and that the stand-in's log names
read failedfor each refusal.docs/startup-runtime.mdgets one bullet.No per-file offset and no compressed-size fallback is added (as asked on #1586).
Verification
Commit under test: this commit on top of origin/main c864f13. Windows 11 26300, MSVC 14.51.
cmake --preset dev; cmake --build --preset dev --target startup_storage_refusal_order startup_storage_file_range startup_storage_alloc_failure startup_storage_worker_start startup_storage_root_check startup_dstorage_file_read_check startup_inflate_statusctest --preset dev -R "startup_storage|startup_dstorage|startup_inflate" --no-tests=error: 9/9 passed, 0 skipped (77), includingstartup_storage_refusal_order.--preset release: 9/9 passed, 0 skipped.Negative controls (run on the earlier base 734217e; single-point edits of
xcrdapi.cpp, rebuilt, reverted, not committed):if (failed && self && strcmp(outcome, "read failed"))): fails, "request 1 status is E_FAIL, got 0x00000000" (also requests 2, 5, 6, and the fence checks).result = self->pending): fails, "request 3 status is S_OK, got 0x80004005" (the valid request after a refusal), likewise 4 and 7.Evidence and follow-up
Refs #1586. Relates to #1198 (the same request shapes: offset at EOF, implausible size). Existing coverage left as is:
startup_storage_file_range(helper level), the file-source negatives instartup_stub_consumer.cpp, the failure-order tests instartup_storage_alloc_failure.cpp. Open PRs #1429, #1390, #1616, #1622 and #1523 do not add a test of this shape.Not shown: that the title proceeds correctly after a refusal, and anything about the offset shift itself. A refusal happens in two layers (the bound check in
read_storage_fileand the read), so the test pins the observable behaviour, not which layer refuses.AI-assisted.