acdream/tests/AcDream.App.Tests/UI
Erik 1d73ce524c test(app): measure the warmed path, not the path being warmed (#250)
The zero-allocation family failed about one full-suite run in three, on
unchanged trees, and had been dismissed as inherent noise in
`GC.GetAllocatedBytesForCurrentThread` three separate times. It is not noise.
Reading the four members side by side, they share one root: **the measured
window was never the warmed path.**

  UiDatFontTests            1 warm call, then a 10,000-iteration loop inline
  RenderFrameProductTests   8 warm calls, then a 1,000-iteration loop inline
  OracleTests               1 warm call, 1 measured call
  ArchRenderSceneTests      warms Apply(registrations), measures Apply(updates)

Two mechanisms come out of that table. A test method is JIT-compiled at tier 0
like anything else, and a long-running loop in tier-0 code gets replaced
mid-flight by on-stack replacement — which compiles on the thread running the
loop, so its bookkeeping is charged to the window being measured. That is the
first two. And `ArchRenderSceneTests` warmed one arm of a switch and measured
the other, so the measured call was the first ever into `ApplyUpdate` and paid
that arm's JIT, type loads and static initialisation inside the window;
`RenderFrameProductTests` warmed 8 times, below the tier-0 call-counting
threshold of 30, so promotion was still pending when measurement began.

That also explains the signature nobody could account for. Alone, the process is
quiet and the runtime has finished before the assertion arrives. Alongside eight
other test assemblies, tier-0 compilation never stops, the call-counting delay is
re-armed continually, and the work slides into the window. Clean in isolation,
failing under load, on a tree that changed nothing.

`ZeroAllocationProbe` invokes the step many times before measuring anything, then
measures windows that run the same already-warmed loop over the same
already-taken path. Each window is a batch of 32 invocations and it reports the
minimum across 4 of them. Both halves are load-bearing: the minimum is what
excludes a one-time cost, and the batch is what keeps the assertion as strong as
the loops it replaces — minimising over *single* invocations would report zero
for a path that allocates every tenth call, which is a real regression made
invisible. I had written it that way first and the apparatus test caught it.

**The bound is untouched: exactly zero, no tolerance, no retry, no assertion
relaxed.** `ZeroAllocationProbeTests` proves the apparatus can still fail — a
step allocating every call reads above zero and does throw, a first-invocation
cost reads as zero, a cost every tenth call is caught, and the one stated limit
(the batch must cover the period) is pinned as a test rather than left as prose.
Without those, a later edit could quietly make the whole family unfailable.

Twelve further sites in this assembly still use the hand-rolled shape. None has
been observed failing, and each needs its own repeatability analysis — several
mutate state or consume monotonic sequences — so they are listed in the issue
for adoption when next touched rather than converted blind at scale.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-29 03:42:08 +02:00
..
Layout feat(render): Campaign V slice V11 commit 1 - delete ImGui, Studio, and the DevTools frontend 2026-07-28 23:56:04 +02:00
AutoWieldGenerationTests.cs feat(net): port retail physics spawn and event timestamps 2026-07-14 00:22:17 +02:00
ClientCommandControllerTests.cs feat(chat): port retail client command families 2026-07-13 14:50:15 +02:00
ControlsIniTests.cs feat(D.2b): controls.ini stylesheet loader + apply title color 2026-06-14 17:31:55 +02:00
CursorFeedbackControllerTests.cs Revert "Campaign V slice V4a" - it lost world multisampling 2026-07-27 18:29:28 +02:00
DatWidgetFactoryZOrderTests.cs Revert "Campaign V slice V4a" - it lost world multisampling 2026-07-27 18:29:28 +02:00
DragDropSpineTests.cs Revert "Campaign V slice V4a" - it lost world multisampling 2026-07-27 18:29:28 +02:00
GameplayConfirmationControllerTests.cs refactor(net): converge live session state reset 2026-07-21 12:00:48 +02:00
IconComposerTests.cs fix(D.5.2): effect tint = per-pixel tile copy (surface ReplaceColor overload) 2026-06-18 10:21:33 +02:00
ItemInteractionControllerTests.cs Revert "Campaign V slice V4a" - it lost world multisampling 2026-07-27 18:29:28 +02:00
LayoutImporterMountTests.cs feat(ui): D.2b-B — sub-window mount (inheritor attaches base subtree) 2026-06-20 22:36:20 +02:00
MarkupDocumentTests.cs Revert "Campaign V slice V4a" - it lost world multisampling 2026-07-27 18:29:28 +02:00
PortalWaitNoticeControllerTests.cs perf(streaming): reserve destination reveal capacity 2026-07-24 19:39:23 +02:00
RetailCursorCatalogTests.cs fix(ui): port retail window control feedback 2026-07-17 09:40:08 +02:00
RetailCursorManagerTests.cs feat(ui): complete retail cursor state machine 2026-07-11 08:31:40 +02:00
RetailItemConfirmationControllerTests.cs refactor(runtime): own interaction transactions 2026-07-26 11:13:09 +02:00
RetailSkillTrainingConfirmationControllerTests.cs fix(ui): restore retail skill training confirmation 2026-07-13 17:57:29 +02:00
RetailUiAutomationProbeTests.cs Revert "Campaign V slice V4a" - it lost world multisampling 2026-07-27 18:29:28 +02:00
RetailUiInteractionFlowTests.cs Revert "Campaign V slice V4a" - it lost world multisampling 2026-07-27 18:29:28 +02:00
RetailUiRuntimeLeaseTests.cs refactor(lifetime): own render resource prefixes 2026-07-22 14:42:14 +02:00
RetailWindowLayoutPersistenceTests.cs fix(ui): restore modern spell formula presentation 2026-07-24 07:08:47 +02:00
RetailWindowManagerTests.cs fix(ui): port retail window control feedback 2026-07-17 09:40:08 +02:00
RetainedPanelControllerGroupTests.cs refactor(ui): own retained controller lifetimes 2026-07-10 23:35:26 +02:00
RetainedUiInputBindingTests.cs refactor(input): own pointer and callback lifetime 2026-07-22 11:59:33 +02:00
UiButtonStateMachineTests.cs feat(ui): port retained widget foundations 2026-07-10 17:55:41 +02:00
UiButtonTests.cs Revert "Campaign V slice V4a" - it lost world multisampling 2026-07-27 18:29:28 +02:00
UiClipRectTests.cs fix(ui): complete retail inventory scroll polish 2026-07-11 10:56:33 +02:00
UiCollapsibleFrameTests.cs Revert "Campaign V slice V4a" - it lost world multisampling 2026-07-27 18:29:28 +02:00
UiCompositeShutdownTests.cs test(runtime): add unattended connected R6 soak 2026-07-20 12:12:08 +02:00
UiDatFontTests.cs test(app): measure the warmed path, not the path being warmed (#250) 2026-07-29 03:42:08 +02:00
UiElementChildOrderTests.cs fix(rendering): bound portal resource lifetime 2026-07-18 21:35:16 +02:00
UiFieldTests.cs fix #234: port retail appraisal floaty and inscriptions 2026-07-23 12:12:57 +02:00
UiItemListGridTests.cs feat(ui): D.2b item interaction + retail cursors + live character sheet 2026-07-03 09:18:43 +02:00
UiItemListScrollTests.cs fix(ui): complete retail inventory scroll polish 2026-07-11 10:56:33 +02:00
UiItemListTests.cs feat(items): port retail shared cooldown overlays 2026-07-23 10:41:16 +02:00
UiItemSlotTests.cs Revert "Campaign V slice V4a" - it lost world multisampling 2026-07-27 18:29:28 +02:00
UiLayoutPolicyTests.cs fix(ui): preserve cropped chat and button faces 2026-07-10 18:11:14 +02:00
UiMenuTests.cs fix(D.2b): UiMenu — controller owns Selected (review fix for Task 4) 2026-06-16 17:27:30 +02:00
UiMeterTests.cs feat(D.2b): UiMeter vital bar + fill-geometry tests 2026-06-14 16:38:07 +02:00
UiMeterVerticalTests.cs feat(ui): D.2b-B — UiMeter vertical fill (burden bar, retail m_eDirection 2/4) 2026-06-21 08:58:37 +02:00
UiNineSlicePanelTests.cs feat(D.2b): UiNineSlicePanel — 8-piece retail window frame + geometry test 2026-06-14 16:36:11 +02:00
UiRadarTests.cs feat(ui): port retail radar and compass 2026-07-10 16:14:37 +02:00
UiRootInputTests.cs Revert "Campaign V slice V4a" - it lost world multisampling 2026-07-27 18:29:28 +02:00
UiScrollablePanelTests.cs feat(ui): D.2b item interaction + retail cursors + live character sheet 2026-07-03 09:18:43 +02:00
UiScrollableTests.cs feat(ui): unify retained window mounts 2026-07-10 22:22:25 +02:00
UiScrollbarTests.cs fix(ui): match retail spell bar controls 2026-07-23 07:49:09 +02:00
UiTextDatFontTests.cs feat(D.2b): UiText (Type 12) -- generic text + Type-12 flip; transcript factory-built (widget-generalization Task 5) 2026-06-16 17:39:02 +02:00
UiTextTests.cs fix(ui): render live component counts 2026-07-15 18:11:02 +02:00