From 05403e6996bd466d2449c4f672b797f17855634f Mon Sep 17 00:00:00 2001 From: Codex Bot Date: Fri, 23 Oct 2026 11:42:23 +0800 Subject: [PATCH] test: preserve stable frames after collecting lazy driver helpers --- README.md | 3 +++ src/api.rs | 2 ++ src/endor_host.rs | 21 +++++++++++++++++++++ 3 files changed, 26 insertions(+) diff --git a/README.md b/README.md index 8050969..e4daa68 100644 --- a/README.md +++ b/README.md @@ -548,3 +548,6 @@ Source paint now uses a resumable read-only VM call with the same 256-instructio Layout and paint drivers now prepare one occurrence at a time. Their fixed-size outer bytecode repeats on the same VM frame; a short-lived helper retains only the current call, its bounds/arguments and collector. The helper is released before the next occurrence. Layout keeps bottom-up measure, top-down arrange and the same settling loop. Paint advances even intrinsic method classification through VM quanta. The weak occurrence list and native scratch/output data remain proportional to the actual tree, but preparation no longer allocates managed callables/Bounds for the whole tree before the first slice. All helpers share the original read-only scope and cumulative instruction/frame limits. Weak-list copying, structural extraction, settling and final projection remain bounded atomic native work. + + +ui.stats().dependencyInvalidations counts observed layout/paint dependency version mismatches. lastInvalidDependency records the phase, object kind/identity and old/current versions without rendering its fields or retaining it. An input changing its globals is an expected invalidation; compare idle document versions before diagnosing a refresh loop. diff --git a/src/api.rs b/src/api.rs index 5efb1a6..2ae5b3a 100644 --- a/src/api.rs +++ b/src/api.rs @@ -1505,6 +1505,8 @@ Source paint now uses a resumable read-only VM call with the same 256-instructio Layout and paint drivers now prepare one occurrence at a time. Their fixed-size outer bytecode repeats on the same VM frame; a short-lived helper retains only the current call, its bounds/arguments and collector. The helper is released before the next occurrence. Layout keeps bottom-up measure, top-down arrange and the same settling loop. Paint advances even intrinsic method classification through VM quanta. The weak occurrence list and native scratch/output data remain proportional to the actual tree, but preparation no longer allocates managed callables/Bounds for the whole tree before the first slice. All helpers share the original read-only scope and cumulative instruction/frame limits. Weak-list copying, structural extraction, settling and final projection remain bounded atomic native work. +ui.stats().dependencyInvalidations counts observed layout/paint dependency version mismatches. lastInvalidDependency records the phase, object kind/identity and old/current versions without rendering its fields or retaining it. An input changing its globals is an expected invalidation; compare idle document versions before diagnosing a refresh loop. + ## UI host object Positional arguments only: diff --git a/src/endor_host.rs b/src/endor_host.rs index fed786c..6755254 100644 --- a/src/endor_host.rs +++ b/src/endor_host.rs @@ -3221,6 +3221,27 @@ page.render(block) ) } + #[test] + fn collecting_lazy_helpers_does_not_invalidate_stable_layout_or_paint() { + for source in [ + include_str!("../examples/flex-constraints.endor"), + include_str!("../examples/source-paint.endor"), + ] { + let (mut session, initial) = ReplSession::load(source, "app.main", 281, 1).unwrap(); + session + .bridge + .reclaim(&mut session.candidate.vm, &mut session.candidate.roots) + .unwrap(); + assert!(session.refresh_document().unwrap().is_none()); + assert_eq!( + session.documents[&crate::window::MAIN_WINDOW] + .frame + .layout_version, + initial.frame.layout_version + ); + } + } + #[test] fn layout_and_paint_prepare_keep_only_current_occurrence_managed_helpers() { for copies in [160, 640] {