Prepare isolated parsed-model Scene layout experiment
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
# Actual Scene anchor experiment — pending execution
|
||||
|
||||
2026-09-12. Prepared by delegated reviewer `/root/diagram_usage_workflows` in branch `codex/diagram-coverage-fixes-ytr83r-20260912`, inspected base `f23615ffebdc3ca6872f98b6889ec49bb4e8abda` plus root's ongoing correction work. Only this experiment directory was authored. **Root applied the test-only wiring on isolated branch `codex/behavior-layout-scene-ytr83r-20260912`, based on `46b4f3c0d0f04050ad6d705051ee0199138e47a2`. Not compiled or executed.** Root owns the build checkpoint. No production schema choice, native acceptance or fix is claimed.
|
||||
|
||||
## Question and candidates
|
||||
|
||||
Can a minimal presentation input feed the actual current desktop Scene before it constructs rows, message polylines, nested frames and lifecycle geometry, while preserving the semantic Project and occurrence identities? Does explicit pointer intent preserve latent authored values on zero motion?
|
||||
|
||||
The candidate is an occurrence-ID-to-desired-row map. A tiny test-only hook raises the current Scene cursor to a requested row before recording an occurrence. This deliberately retains the existing renderer's next-row floor: it is a **downward spacing adapter**, not a general absolute-coordinate projector. The competing gap policy remains meaningful but is not implemented here: this experiment first tests the proposed real-Scene integration boundary. It cannot select a production storage schema.
|
||||
|
||||
Rejected experimental shortcuts: a standalone rectangle model would not test Scene; translating final polylines after rendering would bypass dependent frames/lifecycle; extracting the whole renderer would exceed the uncertainty being tested. This adapter uses the existing code that actually generates all those representations.
|
||||
|
||||
## Files and exact root wiring
|
||||
|
||||
- `fixture.arcadia`: hand-authored current source with explicit UUIDs, two occurrences sharing one communication mean, a fragment containing an operand/action box, and a self-call/reply. The self messages intentionally have unassigned global exchanges: current global relation validation rejects a self edge. Their explicit lifelines permit rendering; incomplete-exchange warnings are expected, semantic errors are not.
|
||||
- `mod.rs`: private child tests of `behavior`, a scoped thread-local anchor adapter, pointer-delta candidate operation, and independent numerical checks against actual Scene outputs.
|
||||
- `wiring.patch`: proposed two-site test-only wiring in `crates/oa-desktop/src/behavior.rs`. It adds the child module and calls `resolve_row_anchor(*id, y)` immediately before the `if ordered` block that records rows/slots in `Scene::occurrences`, **after** any self lifecycle clearance. The relative module path is from `crates/oa-desktop/src`. The line numbers are informational; verify the context against the exact integration version.
|
||||
|
||||
On the isolated wired branch, run:
|
||||
|
||||
```powershell
|
||||
cargo test -p oa-desktop behavior_layout_scene_experiment -- --nocapture
|
||||
```
|
||||
|
||||
Use the project's configured Windows compiler/linker environment. No dependency, Cargo target or main-function changes are needed. The hook is compiled only under cfg(test), inactive unless the current thread installs an AnchorScope, and restored by Drop after normal return or unwind. A test checks that another thread does not inherit the anchor map and that an intentional panic restores the baseline. Do not catch or reinterpret that expected panic output as a product crash; its test must still pass.
|
||||
|
||||
The isolated branch already contains this wiring; `wiring.patch` records its reviewable delta and must not be applied twice. If a compiler/parser assertion fails, preserve the failure, identify the exact reviewed source version, and correct the fixture or adapter at this boundary. Do not weaken independent geometric assertions solely to make the test green. Never claim a passing test from the existence of these files.
|
||||
|
||||
## Independent evaluators
|
||||
|
||||
The baseline is the actual `Scene::sequence` with no installed anchors. The hand-derived expected row coordinates are first148, second240, fragment332, nested action477, self-call636 and self-reply728. These follow the current seed metrics (message92, fragment header55, operand90, action95, trailing fragment64) and are observable implementation oracles, not proposed permanent UX rules. The nested box top is457; fragment height240; self-call endpoint y values are636 and660. Line identities and endpoints are asserted independently, not just compared between two calls to the same projector.
|
||||
|
||||
Tests cover:
|
||||
|
||||
1. Actual `oa_core::language::parse` and canonical format/reparse Project equality; baseline actual Scene equality after semantic source round trip; repeated exchange references retain distinct line UUIDs.
|
||||
2. Move only second delivery by40: its row becomes280, first stays148, nested action becomes517, fragment translates with unchanged height240, and self-call/reply geometry moves by40 with unchanged x and identity. Whole Project and canonical semantic source remain equal.
|
||||
3. Move the nested action by30: actual fragment grows from240 to270 while its top remains332; later self-call shifts. Move that self-call by18 and assert actual send/receive y684/708 and reply776; the nested box remains unchanged.
|
||||
4. Move first by200: second is visibly displaced to440 while its authored desired value stays240. Zero pointer delta returns the exact original candidate. Moving first back restores second240. Explicitly assigning second.desired=440 before moving first back deliberately preserves440 instead, exposing the distinction between pointer no-op and explicit latent-intent change.
|
||||
5. Reorder the repeated occurrences in actual source and parse it; the override stays attached to the second occurrence UUID. Its row is280 and the first follows at372. Projection does not write back any semantic model change.
|
||||
6. Scope restoration on panic and isolation from other test threads.
|
||||
7. Explicit upward-drag counterexample: the requested y200 remains rendered at240 under the current floor.
|
||||
|
||||
Model equality compares the entire Project. Scene equality checks rows, scopes, size, lanes, lifecycle, open calls, lines/labels, boxes and insertion slots; it does not invoke GPU painting. Explicit UUIDs are necessary because parsing declarations without IDs allocates new identities, which would make separate source parses unsuitable for occurrence-address comparison.
|
||||
|
||||
## Limits and next decision
|
||||
|
||||
This is real parser/Scene construction evidence **only after it runs**. Layout maps remain external experimental data; source round trips cover the semantic Project, not persisted layout. No new parser syntax, Document transaction, REST operation, undo stack, dirty-source workflow, route bend, text measurement, native gesture, inspector, resize, or performance result is established.
|
||||
|
||||
The current floor retains automatic whitespace and cannot establish all feasible free positions, upward drag, independent frame resize, gap-policy superiority or minimal displacement. Its limitation is useful evidence: if feeding requested anchors into the existing cursor still feels rigid, a real constraint/inverse policy is required, not more seed spacing. The next bounded choice is a declared anchor/constraint policy, then one typed layout record through source/Document/REST; broad renderer extraction is not justified by this probe.
|
||||
|
||||
Self-call send/receive assertions intentionally follow the actual current polyline contract. They do **not** assert activation correctness or substitute for peer #21's work. Activation boxes are generated by the real existing Scene/lifecycle path, and source roundtrip equality includes them, but that is not an independent oracle for nested activation start/depth/paint order. The fixture does not cover delayed creation/deletion, parallel operands, nested calls, cross-operand semantic moves, hidden views, copy/delete/reidentify lifecycle, or large models. Coordinate any later anchor contract with #16/#21 owners and retain these gaps in published evidence.
|
||||
|
||||
Root should publish this directory and the exact wired code/test result together for remote peer review. Independent machines cannot consume workspace-local links.
|
||||
|
||||
## Root source review before execution
|
||||
|
||||
The panic-restoration evaluator originally accepted any panic inside its scope, so an earlier failed geometry/thread assertion could have looked like successful deliberate unwinding. Root corrected it to require the exact deliberate panic payload. Moved message polylines now also require equal point counts before zipped endpoint comparisons. These are evaluator corrections; execution remains pending.
|
||||
|
||||
Independent bounded review confirmed hook placement, fixture assumptions and the hand-derived coordinates without executing them. Its coverage caveat prompted adding box marker metadata and insertion-slot labels to equality comparisons. Transient selection, camera and interaction state are not part of this geometry comparison. No material source finding remains from that review; compiler/runtime evidence is still required.
|
||||
@@ -0,0 +1,60 @@
|
||||
arcadia 7;
|
||||
project layout_probe "Behavior layout Scene probe" id "10000000-0000-4000-8000-000000000001" {
|
||||
oa_entity sender "Sender" id "10000000-0000-4000-8000-000000000002" {}
|
||||
oa_entity receiver "Receiver" id "10000000-0000-4000-8000-000000000003" {}
|
||||
oa_activity inspect "Inspect" id "10000000-0000-4000-8000-000000000004" {}
|
||||
allocation inspect_assignment "Receiver performs inspection" id "10000000-0000-4000-8000-000000000005" {
|
||||
source @receiver; target @inspect;
|
||||
}
|
||||
communication_mean channel "Shared channel" id "10000000-0000-4000-8000-000000000006" {
|
||||
source @sender; target @receiver; oriented false;
|
||||
}
|
||||
oa_scenario conversation "Conversation" id "10000000-0000-4000-8000-000000000007" {
|
||||
viewpoint ParticipantInteraction;
|
||||
steps [@first, @second, @fragment, @self_call, @self_reply];
|
||||
}
|
||||
oa_lifeline left "Sender role" id "10000000-0000-4000-8000-000000000008" { parent @conversation; represented @sender; }
|
||||
oa_lifeline right "Receiver role" id "10000000-0000-4000-8000-000000000009" { parent @conversation; represented @receiver; }
|
||||
oa_occurrence first "First delivery" id "10000000-0000-4000-8000-00000000000a" {
|
||||
parent @conversation;
|
||||
body { Exchange {
|
||||
exchange @channel; sender @left; receiver @right;
|
||||
message_kind Asynchronous;
|
||||
}; };
|
||||
}
|
||||
oa_occurrence second "Second delivery" id "10000000-0000-4000-8000-00000000000b" {
|
||||
parent @conversation;
|
||||
body { Exchange {
|
||||
exchange @channel; sender @left; receiver @right;
|
||||
message_kind Asynchronous;
|
||||
}; };
|
||||
}
|
||||
oa_occurrence fragment "Optional inspection" id "10000000-0000-4000-8000-00000000000c" {
|
||||
parent @conversation;
|
||||
body { Fragment { operator Optional; branches [@operand]; }; };
|
||||
}
|
||||
oa_occurrence operand "When requested" id "10000000-0000-4000-8000-00000000000d" {
|
||||
parent @fragment;
|
||||
body { Branch { guard "requested"; occurrences [@nested]; }; };
|
||||
}
|
||||
oa_occurrence nested "Inspection occurrence" id "10000000-0000-4000-8000-00000000000e" {
|
||||
parent @operand;
|
||||
body { Action { action @inspect; lifeline @right; }; };
|
||||
}
|
||||
// Self calls intentionally have no global self-edge: such a relation is
|
||||
// invalid in the current metamodel. Their unassigned exchange is a known
|
||||
// incomplete-model warning, while explicit lifelines make Scene drawable.
|
||||
oa_occurrence self_call "Local call" id "10000000-0000-4000-8000-00000000000f" {
|
||||
parent @conversation;
|
||||
body { Exchange {
|
||||
exchange none; sender @right; receiver @right; message_kind Call;
|
||||
}; };
|
||||
}
|
||||
oa_occurrence self_reply "Local reply" id "10000000-0000-4000-8000-000000000010" {
|
||||
parent @conversation;
|
||||
body { Exchange {
|
||||
exchange none; sender @right; receiver @right;
|
||||
message_kind Reply; reply_to @self_call;
|
||||
}; };
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,343 @@
|
||||
//! Isolated test-only adapter. See README.md and wiring.patch before running.
|
||||
//! It drives the actual parent Scene; it contains no replacement geometry model.
|
||||
use super::*;
|
||||
use oa_core::{language, validation};
|
||||
use std::cell::RefCell;
|
||||
|
||||
type Layout = BTreeMap<Id, f32>;
|
||||
|
||||
thread_local! {
|
||||
static ANCHORS: RefCell<Option<Layout>> = const { RefCell::new(None) };
|
||||
}
|
||||
|
||||
struct AnchorScope(Option<Layout>);
|
||||
impl AnchorScope {
|
||||
fn install(layout: &Layout) -> Self {
|
||||
Self(ANCHORS.with(|slot| slot.replace(Some(layout.clone()))))
|
||||
}
|
||||
}
|
||||
impl Drop for AnchorScope {
|
||||
fn drop(&mut self) {
|
||||
ANCHORS.with(|slot| {
|
||||
slot.replace(self.0.take());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// Called only by the proposed cfg(test) row hook, before Scene records rows.
|
||||
/// Retains the CURRENT renderer's next-row floor; this is not general free y.
|
||||
pub(super) fn resolve_row_anchor(id: Id, y: &mut f32) {
|
||||
ANCHORS.with(|slot| {
|
||||
if let Some(desired) = slot.borrow().as_ref().and_then(|map| map.get(&id)) {
|
||||
assert!(desired.is_finite());
|
||||
*y = (*y).max(*desired);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
fn render(project: &Project, owner: Id, layout: &Layout) -> Scene {
|
||||
let _scope = AnchorScope::install(layout);
|
||||
Scene::sequence(project, owner, owner)
|
||||
}
|
||||
|
||||
/// Pointer intent differs from explicit SetDesiredY: zero displacement preserves
|
||||
/// the complete original authored candidate even when desired != displayed.
|
||||
fn drag(original: &Layout, frame: &Scene, target: Id, delta_y: f32) -> Layout {
|
||||
assert!(delta_y.is_finite());
|
||||
if delta_y == 0. {
|
||||
return original.clone();
|
||||
}
|
||||
let mut next = original.clone();
|
||||
next.insert(target, frame.rows[&target].1 + delta_y);
|
||||
next
|
||||
}
|
||||
|
||||
fn id(p: &Project, alias: &str) -> Id {
|
||||
p.identities()
|
||||
.into_iter()
|
||||
.find(|(_, name)| *name == alias)
|
||||
.unwrap()
|
||||
.0
|
||||
}
|
||||
|
||||
fn fixture() -> (Project, Id) {
|
||||
let p = language::parse(include_str!("fixture.arcadia")).expect("real Arcadia fixture parses");
|
||||
let errors: Vec<_> = validation::validate(&p)
|
||||
.into_iter()
|
||||
.filter(|issue| issue.severity == validation::Severity::Error)
|
||||
.collect();
|
||||
assert!(errors.is_empty(), "fixture semantic errors: {errors:?}");
|
||||
let owner = id(&p, "conversation");
|
||||
(p, owner)
|
||||
}
|
||||
|
||||
fn row(scene: &Scene, id: Id) -> f32 {
|
||||
scene.rows[&id].1
|
||||
}
|
||||
fn line(scene: &Scene, id: Id) -> &Line {
|
||||
assert_eq!(scene.lines.iter().filter(|line| line.id == id).count(), 1);
|
||||
scene.lines.iter().find(|line| line.id == id).unwrap()
|
||||
}
|
||||
fn named_box(scene: &Scene, id: Id) -> &BoxItem {
|
||||
scene
|
||||
.boxes
|
||||
.iter()
|
||||
.find(|item| item.id == id && !item.title.is_empty())
|
||||
.unwrap()
|
||||
}
|
||||
fn same_geometry(a: &Scene, b: &Scene) {
|
||||
assert_eq!(a.rows, b.rows);
|
||||
assert_eq!(a.sequence_bounds, b.sequence_bounds);
|
||||
assert_eq!(a.size, b.size);
|
||||
assert_eq!(a.lanes, b.lanes);
|
||||
assert_eq!(a.lifecycle, b.lifecycle);
|
||||
assert_eq!(a.open_calls, b.open_calls);
|
||||
let lines = |s: &Scene| {
|
||||
s.lines
|
||||
.iter()
|
||||
.map(|l| {
|
||||
(
|
||||
l.id,
|
||||
l.points.clone(),
|
||||
l.label_at,
|
||||
l.label.clone(),
|
||||
l.dashed,
|
||||
)
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
};
|
||||
let boxes = |s: &Scene| {
|
||||
s.boxes
|
||||
.iter()
|
||||
.map(|b| (b.id, b.rect, b.title.clone(), b.detail.clone(), b.marker))
|
||||
.collect::<Vec<_>>()
|
||||
};
|
||||
assert_eq!(lines(a), lines(b));
|
||||
assert_eq!(boxes(a), boxes(b));
|
||||
let slots = |s: &Scene| {
|
||||
s.slots
|
||||
.iter()
|
||||
.map(|s| (s.slot.parent, s.slot.before, s.y, s.label.clone()))
|
||||
.collect::<Vec<_>>()
|
||||
};
|
||||
assert_eq!(slots(a), slots(b));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn real_parser_roundtrip_and_baseline_scene_have_independent_expected_anchors() {
|
||||
let (p, owner) = fixture();
|
||||
let before = p.clone();
|
||||
let source = language::format(&p);
|
||||
let reparsed = language::parse(&source).unwrap();
|
||||
assert_eq!(reparsed, p);
|
||||
let baseline = Scene::sequence(&p, owner, owner);
|
||||
same_geometry(&baseline, &render(&p, owner, &Layout::new()));
|
||||
same_geometry(&baseline, &Scene::sequence(&reparsed, owner, owner));
|
||||
let first = id(&p, "first");
|
||||
let second = id(&p, "second");
|
||||
assert_ne!(first, second);
|
||||
for occurrence in [first, second] {
|
||||
assert!(matches!(p.elements[&occurrence].shared(),
|
||||
Some(SharedBody::Occurrence { body: OccurrenceBody::Exchange { exchange: Some(edge), .. }, .. })
|
||||
if *edge == id(&p, "channel")));
|
||||
}
|
||||
// Hand-derived current metrics: start148, each message92, fragment55,
|
||||
// operand90, action95, fragment trailing64. These are regression oracles,
|
||||
// NOT a claim that those fixed spacings should remain product constraints.
|
||||
for (alias, expected) in [
|
||||
("first", 148.),
|
||||
("second", 240.),
|
||||
("fragment", 332.),
|
||||
("nested", 477.),
|
||||
("self_call", 636.),
|
||||
("self_reply", 728.),
|
||||
] {
|
||||
assert_eq!(row(&baseline, id(&p, alias)), expected, "{alias}");
|
||||
}
|
||||
assert_eq!(baseline.rows[&id(&p, "nested")].0, id(&p, "operand"));
|
||||
assert_eq!(named_box(&baseline, id(&p, "nested")).rect.y, 457.);
|
||||
let frame = named_box(&baseline, id(&p, "fragment")).rect;
|
||||
assert_eq!((frame.y, frame.height), (332., 240.));
|
||||
let left = baseline.lanes[&id(&p, "left")];
|
||||
let right = baseline.lanes[&id(&p, "right")];
|
||||
assert_eq!(
|
||||
line(&baseline, first).points,
|
||||
vec![Point::new(left, 148.), Point::new(right, 148.)]
|
||||
);
|
||||
assert_eq!(
|
||||
line(&baseline, second).points,
|
||||
vec![Point::new(left, 240.), Point::new(right, 240.)]
|
||||
);
|
||||
let local = line(&baseline, id(&p, "self_call"));
|
||||
assert_eq!(
|
||||
local.points,
|
||||
vec![
|
||||
Point::new(right, 636.),
|
||||
Point::new(right + 75., 636.),
|
||||
Point::new(right + 75., 660.),
|
||||
Point::new(right, 660.)
|
||||
]
|
||||
);
|
||||
assert_eq!(p, before);
|
||||
assert_eq!(language::format(&p), source);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn moved_repeat_drives_actual_scene_followers_frames_and_self_message_without_semantic_edits() {
|
||||
let (p, owner) = fixture();
|
||||
let before = p.clone();
|
||||
let source = language::format(&p);
|
||||
let baseline = Scene::sequence(&p, owner, owner);
|
||||
let second = id(&p, "second");
|
||||
let candidate = drag(&Layout::new(), &baseline, second, 40.);
|
||||
assert_eq!(candidate, Layout::from([(second, 280.)]));
|
||||
let moved = render(&p, owner, &candidate);
|
||||
assert_eq!(row(&moved, id(&p, "first")), 148.);
|
||||
assert_eq!(row(&moved, second), 280.);
|
||||
assert_eq!(row(&moved, id(&p, "nested")), 517.);
|
||||
assert_eq!(row(&moved, id(&p, "self_call")), 676.);
|
||||
assert_eq!(row(&moved, id(&p, "self_reply")), 768.);
|
||||
assert_eq!(
|
||||
line(&moved, id(&p, "first")).points,
|
||||
line(&baseline, id(&p, "first")).points
|
||||
);
|
||||
for alias in ["second", "self_call", "self_reply"] {
|
||||
assert_eq!(
|
||||
line(&moved, id(&p, alias)).points.len(),
|
||||
line(&baseline, id(&p, alias)).points.len()
|
||||
);
|
||||
for (old, new) in line(&baseline, id(&p, alias))
|
||||
.points
|
||||
.iter()
|
||||
.zip(&line(&moved, id(&p, alias)).points)
|
||||
{
|
||||
assert_eq!(new.x, old.x);
|
||||
assert_eq!(new.y - old.y, 40.);
|
||||
}
|
||||
}
|
||||
let frame = named_box(&moved, id(&p, "fragment")).rect;
|
||||
assert_eq!((frame.y, frame.height), (372., 240.));
|
||||
assert_eq!(named_box(&moved, id(&p, "nested")).rect.y, 497.);
|
||||
same_geometry(&moved, &render(&p, owner, &candidate));
|
||||
same_geometry(
|
||||
&moved,
|
||||
&render(&language::parse(&source).unwrap(), owner, &candidate),
|
||||
);
|
||||
assert_eq!(p, before); // Entire Project, not only the steps vector.
|
||||
assert_eq!(language::format(&p), source);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nested_anchor_grows_actual_fragment_and_self_call_keeps_its_receive_offset() {
|
||||
let (p, owner) = fixture();
|
||||
let before = p.clone();
|
||||
let baseline = Scene::sequence(&p, owner, owner);
|
||||
let nested = id(&p, "nested");
|
||||
let candidate = drag(&Layout::new(), &baseline, nested, 30.);
|
||||
let moved = render(&p, owner, &candidate);
|
||||
let frame = named_box(&moved, id(&p, "fragment")).rect;
|
||||
assert_eq!((frame.y, frame.height), (332., 270.));
|
||||
assert_eq!(named_box(&moved, nested).rect.y, 487.);
|
||||
assert_eq!(row(&moved, id(&p, "self_call")), 666.);
|
||||
let call = id(&p, "self_call");
|
||||
let next = drag(&candidate, &moved, call, 18.);
|
||||
let local = render(&p, owner, &next);
|
||||
assert_eq!(row(&local, call), 684.);
|
||||
assert_eq!(line(&local, call).points.first().unwrap().y, 684.);
|
||||
assert_eq!(line(&local, call).points.last().unwrap().y, 708.);
|
||||
assert_eq!(row(&local, id(&p, "self_reply")), 776.);
|
||||
assert_eq!(
|
||||
named_box(&local, nested).rect,
|
||||
named_box(&moved, nested).rect
|
||||
);
|
||||
assert_eq!(p, before);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn zero_pointer_delta_preserves_latent_authored_intent_but_explicit_assignment_can_change_it() {
|
||||
let (p, owner) = fixture();
|
||||
let baseline = Scene::sequence(&p, owner, owner);
|
||||
let first = id(&p, "first");
|
||||
let second = id(&p, "second");
|
||||
let original = Layout::from([(first, 148.), (second, 240.)]);
|
||||
let displaced = drag(&original, &baseline, first, 200.);
|
||||
let frame = render(&p, owner, &displaced);
|
||||
assert_eq!(row(&frame, second), 440.);
|
||||
assert_eq!(displaced[&second], 240.);
|
||||
let untouched = drag(&displaced, &frame, second, 0.);
|
||||
assert_eq!(untouched, displaced);
|
||||
let back = drag(&untouched, &frame, first, -200.);
|
||||
assert_eq!(back, original);
|
||||
assert_eq!(row(&render(&p, owner, &back), second), 240.);
|
||||
let mut explicit = displaced.clone();
|
||||
explicit.insert(second, 440.); // Explicit SetDesiredY, not a pointer gesture.
|
||||
let explicit_back = drag(&explicit, &frame, first, -200.);
|
||||
assert_eq!(row(&render(&p, owner, &explicit_back), second), 440.);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn source_reorder_keeps_override_bound_to_occurrence_identity_and_does_not_write_back_projection() {
|
||||
let (p, owner) = fixture();
|
||||
let input = include_str!("fixture.arcadia");
|
||||
let reordered_source =
|
||||
input.replace("[@first, @second, @fragment", "[@second, @first, @fragment");
|
||||
assert_ne!(input, reordered_source);
|
||||
let reordered = language::parse(&reordered_source).unwrap();
|
||||
let before = reordered.clone();
|
||||
let second = id(&p, "second");
|
||||
let first = id(&p, "first");
|
||||
assert_eq!(id(&reordered, "second"), second);
|
||||
let scene = render(&reordered, owner, &Layout::from([(second, 280.)]));
|
||||
assert_eq!(row(&scene, second), 280.);
|
||||
assert_eq!(row(&scene, first), 372.);
|
||||
assert_eq!(
|
||||
&reordered.elements[&owner].steps().unwrap()[..2],
|
||||
&[second, first]
|
||||
);
|
||||
assert_eq!(reordered, before);
|
||||
assert_eq!(
|
||||
language::parse(&language::format(&reordered)).unwrap(),
|
||||
before
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn current_floor_is_an_explicit_counterexample_to_general_free_positioning() {
|
||||
let (p, owner) = fixture();
|
||||
let baseline = Scene::sequence(&p, owner, owner);
|
||||
let second = id(&p, "second");
|
||||
let requested = drag(&Layout::new(), &baseline, second, -40.);
|
||||
assert_eq!(requested[&second], 200.);
|
||||
assert_eq!(row(&render(&p, owner, &requested), second), 240.);
|
||||
// This expected mismatch records a limitation; it is not acceptance of
|
||||
// silently clamped product gestures or proof that y200 is semantically bad.
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn scoped_hook_is_inactive_by_default_thread_local_and_restored_after_panic() {
|
||||
let (p, owner) = fixture();
|
||||
let first = id(&p, "first");
|
||||
let baseline = Scene::sequence(&p, owner, owner);
|
||||
let caught = std::panic::catch_unwind(|| {
|
||||
let _scope = AnchorScope::install(&Layout::from([(first, 900.)]));
|
||||
assert_eq!(row(&Scene::sequence(&p, owner, owner), first), 900.);
|
||||
// Another test thread has no access to this thread's temporary anchors.
|
||||
std::thread::spawn(|| {
|
||||
let (p, owner) = fixture();
|
||||
assert_eq!(
|
||||
row(&Scene::sequence(&p, owner, owner), id(&p, "first")),
|
||||
148.
|
||||
);
|
||||
})
|
||||
.join()
|
||||
.unwrap();
|
||||
panic!("exercise scoped restoration");
|
||||
});
|
||||
let payload = caught.expect_err("the deliberate scope-restoration panic must occur");
|
||||
assert_eq!(
|
||||
payload.downcast_ref::<&str>().copied(),
|
||||
Some("exercise scoped restoration"),
|
||||
"an earlier failed assertion must not masquerade as the expected panic"
|
||||
);
|
||||
same_geometry(&baseline, &Scene::sequence(&p, owner, owner));
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
diff --git a/crates/oa-desktop/src/behavior.rs b/crates/oa-desktop/src/behavior.rs
|
||||
--- a/crates/oa-desktop/src/behavior.rs
|
||||
+++ b/crates/oa-desktop/src/behavior.rs
|
||||
@@ -1120,1 +1120,5 @@
|
||||
+#[cfg(test)]
|
||||
+#[path = "../../../harness/experiments/behavior-layout-scene-20260912/mod.rs"]
|
||||
+mod behavior_layout_scene_experiment;
|
||||
+
|
||||
struct BoxItem {
|
||||
@@ -1446,2 +1450,4 @@
|
||||
+ #[cfg(test)]
|
||||
+ behavior_layout_scene_experiment::resolve_row_anchor(*id, y);
|
||||
if ordered {
|
||||
let slot = scenario::Slot {
|
||||
Reference in New Issue
Block a user