diff --git a/.github/workflows/portable-contracts.yml b/.github/workflows/portable-contracts.yml index 616651d..caf6e8d 100644 --- a/.github/workflows/portable-contracts.yml +++ b/.github/workflows/portable-contracts.yml @@ -8,6 +8,11 @@ on: pull_request: workflow_dispatch: +concurrency: + # A newer push or PR update replaces the older run on the same ref; workflow_dispatch runs are never cancelled. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name != 'workflow_dispatch' }} + jobs: contracts-and-browser: name: ${{ matrix.os }} ${{ matrix.package }} @@ -16,7 +21,10 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-latest, ubuntu-latest] + # No Windows runner exists: the windows-latest leg runs on workflow_dispatch only (GitHub or a + # Windows runner), the ubuntu-latest leg gates push and PR. Windows push/PR triggers return in the PR + # that registers a Windows runner. + os: ${{ fromJSON(github.event_name == 'workflow_dispatch' && '["windows-latest", "ubuntu-latest"]' || '["ubuntu-latest"]') }} package: [eve-contracts, eve-browser-lowering] steps: @@ -30,6 +38,14 @@ jobs: cache: npm cache-dependency-path: packages/${{ matrix.package }}/package-lock.json + # eve-browser-lowering links eve-contracts as file:../eve-contracts; npm installs none of the + # linked package's dependencies, and tsc resolves its declarations from the real path, so + # ajv must be installed in eve-contracts itself. + - name: Install eve-contracts dependencies + if: matrix.package != 'eve-contracts' + working-directory: packages/eve-contracts + run: npm ci + - name: Install package dependencies working-directory: packages/${{ matrix.package }} run: npm ci @@ -38,6 +54,23 @@ jobs: working-directory: packages/${{ matrix.package }} run: npm test + # The forge runner images carry no pwsh; GitHub's Windows and hosted images do. + - name: Install PowerShell + if: runner.os == 'Linux' + shell: bash + run: | + set -euo pipefail + if command -v pwsh >/dev/null; then pwsh -Version; exit 0; fi + SUDO=""; [ "$(id -u)" -eq 0 ] || SUDO="sudo" + PWSH_VERSION=7.4.6 + curl -fsSL "https://github.com/PowerShell/PowerShell/releases/download/v${PWSH_VERSION}/powershell-${PWSH_VERSION}-linux-x64.tar.gz" -o "${RUNNER_TEMP:-/tmp}/powershell.tar.gz" + $SUDO mkdir -p /opt/microsoft/powershell/7 + $SUDO tar -xzf "${RUNNER_TEMP:-/tmp}/powershell.tar.gz" -C /opt/microsoft/powershell/7 + $SUDO chmod +x /opt/microsoft/powershell/7/pwsh + $SUDO ln -sf /opt/microsoft/powershell/7/pwsh /usr/local/bin/pwsh + echo "DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1" >> "$GITHUB_ENV" + DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 pwsh -Version + - name: Reject stale generated output shell: pwsh run: | diff --git a/.gitignore b/.gitignore index 816f622..37111ad 100644 --- a/.gitignore +++ b/.gitignore @@ -8,12 +8,19 @@ packages/eve-browser-lowering/node_modules/ !packages/eve-contracts/** packages/eve-contracts/node_modules/ packages/eve-contracts/*.tgz +!packages/thing-contract/ +!packages/thing-contract/** +packages/thing-contract/node_modules/ +packages/thing-contract/dist/ +packages/thing-contract/dist-test/ !packages/org.gamecult.eve.surface/ !packages/org.gamecult.eve.surface/** packages/org.gamecult.eve.surface/bin~/ packages/org.gamecult.eve.surface/obj~/ !packages/org.gamecult.eve.unity-uitoolkit/ !packages/org.gamecult.eve.unity-uitoolkit/** +!packages/GameCult.Thing.Contract/ +!packages/GameCult.Thing.Contract/** obj/ artifacts/ tools/deps/ diff --git a/Cargo.lock b/Cargo.lock index 3898b9a..9cba10e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,12 +17,30 @@ version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" +[[package]] +name = "ar_archive_writer" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "523e5e187fff36fcb8d1d19ccf0ca4ca43ec3d158316057f66dc6f72716bc5ec" +dependencies = [ + "object", +] + [[package]] name = "autocfg" version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + [[package]] name = "bumpalo" version = "3.20.3" @@ -65,10 +83,29 @@ version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + [[package]] name = "cultcache-rs" -version = "0.2.0" -source = "git+https://github.com/GameCult/CultLib.git?rev=b3bd8dd5e5b208b2012392e9c5d6dfee2441aaa7#b3bd8dd5e5b208b2012392e9c5d6dfee2441aaa7" +version = "0.3.1" +source = "git+https://github.com/GameCult/CultLib.git?rev=4c9af401ae33812d862dde4ff3131433fc73c7dc#4c9af401ae33812d862dde4ff3131433fc73c7dc" dependencies = [ "anyhow", "chrono", @@ -79,20 +116,33 @@ dependencies = [ "serde", "serde_bytes", "serde_json", + "serde_stacker", + "sha2", + "stacker", "uuid", - "windows-sys", + "windows-sys 0.59.0", ] [[package]] name = "cultcache-rs-derive" -version = "0.1.0" -source = "git+https://github.com/GameCult/CultLib.git?rev=b3bd8dd5e5b208b2012392e9c5d6dfee2441aaa7#b3bd8dd5e5b208b2012392e9c5d6dfee2441aaa7" +version = "0.2.0" +source = "git+https://github.com/GameCult/CultLib.git?rev=4c9af401ae33812d862dde4ff3131433fc73c7dc#4c9af401ae33812d862dde4ff3131433fc73c7dc" dependencies = [ "proc-macro2", "quote", "syn 2.0.119", ] +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + [[package]] name = "find-msvc-tools" version = "0.1.14" @@ -133,6 +183,16 @@ dependencies = [ "slab", ] +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + [[package]] name = "getrandom" version = "0.4.3" @@ -212,6 +272,15 @@ dependencies = [ "autocfg", ] +[[package]] +name = "object" +version = "0.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e5a6c098c7a3b6547378093f5cc30bc54fd361ce711e05293a5cc589562739b" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.21.4" @@ -233,6 +302,16 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "psm" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dcd034599e63b970727f70d79e02d62390a4a84f7c6b827c27c46d5ac3fa622" +dependencies = [ + "ar_archive_writer", + "cc", +] + [[package]] name = "quote" version = "1.0.47" @@ -335,6 +414,28 @@ dependencies = [ "zmij", ] +[[package]] +name = "serde_stacker" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4936375d50c4be7eff22293a9344f8e46f323ed2b3c243e52f89138d9bb0f4a" +dependencies = [ + "serde", + "serde_core", + "stacker", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "shlex" version = "2.0.1" @@ -347,6 +448,19 @@ version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" +[[package]] +name = "stacker" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "707f49d46706bacf8a2b00d51dace3f9de527c13eec3778f570c411f89e69967" +dependencies = [ + "cc", + "cfg-if", + "libc", + "psm", + "windows-sys 0.61.2", +] + [[package]] name = "syn" version = "2.0.119" @@ -378,8 +492,47 @@ dependencies = [ "rmp-serde", "serde", "serde_bytes", + "thing-testkit", ] +[[package]] +name = "thing-core" +version = "0.1.0" +dependencies = [ + "stacker", + "thing-contract", + "thing-testkit", +] + +[[package]] +name = "thing-state" +version = "0.1.0" +dependencies = [ + "cultcache-rs", + "rmp-serde", + "serde", + "thing-core", +] + +[[package]] +name = "thing-testkit" +version = "0.1.0" +dependencies = [ + "anyhow", + "cultcache-rs", + "rmp-serde", + "serde", + "thing-contract", + "thing-core", + "thing-state", +] + +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + [[package]] name = "unicode-ident" version = "1.0.26" @@ -397,6 +550,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + [[package]] name = "wasm-bindgen" version = "0.2.129" @@ -532,6 +691,15 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + [[package]] name = "windows-targets" version = "0.52.6" diff --git a/Cargo.toml b/Cargo.toml index d4018b6..4902143 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,6 @@ resolver = "2" [workspace.dependencies] anyhow = "1" -cultcache-rs = { git = "https://github.com/GameCult/CultLib.git", rev = "b3bd8dd5e5b208b2012392e9c5d6dfee2441aaa7", package = "cultcache-rs" } +cultcache-rs = { git = "https://github.com/GameCult/CultLib.git", rev = "4c9af401ae33812d862dde4ff3131433fc73c7dc", package = "cultcache-rs" } serde = { version = "1", features = ["derive"] } rmp-serde = "1.3" diff --git a/README.md b/README.md index 33eff9e..8956984 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,41 @@ # Thing -This repository is Thing. Its present tree is Thing 1, kept running for live -consumers until each ports; Thing 2.0 is built here (`docs/thing2-target.md`). -The Thing 1 renderer repos are archived under their Eve names: EveUnity, -EveFlutter, EveElectron, EveTui, EvePlugins and EveConformance. +This repository is Thing (the Eve display, control and sensor edge for GameCult +apps). Its present tree is Thing 1, kept running for live consumers until each +ports; Thing 2.0 is built here (`docs/thing2-target.md`). The Thing 1 renderer +repos are archived under their Eve names: EveUnity, EveFlutter, EveElectron, +EveTui, EvePlugins and EveConformance. + +## Start Here + +Value: services publish a surface once, as a typed retained document +(`gamecult.eve.surface.v1`), and every runtime lowers it locally. Providers keep +authority over state and commands; Eve owns projection, input capture and +timestamped sensor publication. + +Problem: without a shared surface contract, each service hand-builds its own +dashboard and each renderer re-implements layout, binding and commands. + +Live (Thing 1): + +- `packages/org.gamecult.eve.surface`: renderer-neutral C# surface contract and + composition builders; tests in `tests/GameCult.Eve.Surface.Serialization.Tests`. +- `packages/eve-contracts`: TypeScript types and validators generated from + `schemas/` (`npm run generate`, `npm test`). +- `packages/eve-browser-lowering`: browser DOM/CSS lowering of surface documents + (`npm test`). +- `web/`: browser reference oracle (`web/index.html`, `web/eve-dsl.js`; tests + with `node --test web/eve-dsl.test.mjs`). +- `docs/surface-contract-v1.md`: the contract. `docs/repo-strategy.md`: repo + ownership. `docs/parity-testing-harness.md` with + `scripts/run-parity-harness.ps1`: parity runs. +- `android/` and `Sources/` (iOS Theos app, `make package`): native proof + clients; build steps under Build Shape below. + +Planned (Thing 2.0, in progress): `crates/thing-contract` is the first Rust +piece. The layout solver, text, accessibility tree, closed render-command list +and thin backends described in `docs/thing2-target.md` and `docs/thing2-map.md` +are not built yet; `docs/thing-campaign.md` holds the rename plan. CultMesh-based surface web, portable control layer, and timestamped sensor edge. @@ -214,11 +246,8 @@ render: ## VoidBot CEF Stream -Start the Starfire relay from `E:\Projects\VoidBot`: - -```powershell -npm run swarm:eve-cef-relay -- --width 1620 --height 2160 --scale 2 --port 8792 -``` +The CEF relay that produced these frames is not in VoidBot's default branch, so +no relay command is documented here until one exists. EveCanvas displays binary JPEG frames and returns touch events only when a stream lowering is configured through `EVE_STREAM_URLS`. The native app no @@ -226,12 +255,11 @@ longer guesses a Starfire relay address. ## Mimir Sensor Uplink -Start Mimir with `config/mimir-runtime.raven-eve.example.json` or run the -receiver processes directly: +Run the receiver processes from a Mimir checkout (a sibling `..\Mimir` here): ```powershell -dotnet run --project E:\Projects\Mimir\src\Mimir.EveSensorReceiver\Mimir.EveSensorReceiver.csproj -- --port 8793 --path /eve/camera --source-id eve-camera --type video-frame -dotnet run --project E:\Projects\Mimir\src\Mimir.EveSensorReceiver\Mimir.EveSensorReceiver.csproj -- --port 8794 --path /eve/mic --source-id eve-mic --type audio-block +dotnet run --project ..\Mimir\src\Mimir.EveSensorReceiver\Mimir.EveSensorReceiver.csproj -- --port 8793 --path /eve/camera --source-id eve-camera --type video-frame +dotnet run --project ..\Mimir\src\Mimir.EveSensorReceiver\Mimir.EveSensorReceiver.csproj -- --port 8794 --path /eve/mic --source-id eve-mic --type audio-block ``` EveCanvas sends binary `mimir.eve_media_observation.v1` camera and microphone @@ -245,7 +273,7 @@ guess receiver URLs. Start the dashboard authority on Starfire: ```powershell -dotnet run --project E:\Projects\Mimir\src\Mimir.EveDashboard\Mimir.EveDashboard.csproj -- --port 8795 +dotnet run --project ..\Mimir\src\Mimir.EveDashboard\Mimir.EveDashboard.csproj -- --port 8795 ``` EveCanvas connects to the Mimir dashboard WebSocket lowering for native retained diff --git a/crates/thing-contract/Cargo.toml b/crates/thing-contract/Cargo.toml index f3ffd0f..b799adc 100644 --- a/crates/thing-contract/Cargo.toml +++ b/crates/thing-contract/Cargo.toml @@ -12,4 +12,5 @@ serde = { workspace = true } serde_bytes = "0.11" [dev-dependencies] +thing-testkit = { path = "../thing-testkit" } rmp-serde = { workspace = true } diff --git a/crates/thing-contract/src/asset.rs b/crates/thing-contract/src/asset.rs index 9e97d7e..0827521 100644 --- a/crates/thing-contract/src/asset.rs +++ b/crates/thing-contract/src/asset.rs @@ -28,7 +28,7 @@ pub struct AssetCatalog { pub catalog_id: Segment, #[cultcache(key = 2)] pub version: Version, - #[cultcache(key = 3)] + #[cultcache(key = 3, type_name = "System.Collections.Immutable.ImmutableArray")] pub assets: Vec, } diff --git a/crates/thing-contract/src/command.rs b/crates/thing-contract/src/command.rs index 6db6a88..9daf1c3 100644 --- a/crates/thing-contract/src/command.rs +++ b/crates/thing-contract/src/command.rs @@ -37,6 +37,7 @@ pub enum CommandRef { /// A typed record of the declared `payload_schema`, as its MessagePack bytes. #[derive(Clone, Debug, PartialEq, CultSlots)] +#[cultcache(type_name = "GameCult.Thing.Contract.RecordPayload")] pub struct RecordPayload { #[cultcache(key = 0)] pub schema: SchemaId, @@ -105,7 +106,7 @@ pub struct CommandInvocation { pub command: CommandId, #[cultcache(key = 4)] pub payload: RecordPayload, - #[cultcache(key = 5)] + #[cultcache(key = 5, type_name = "System.Collections.Immutable.ImmutableArray")] pub captured: Vec, #[cultcache(key = 6)] pub client: String, diff --git a/crates/thing-contract/src/domain.rs b/crates/thing-contract/src/domain.rs index 59e26b0..09a5d45 100644 --- a/crates/thing-contract/src/domain.rs +++ b/crates/thing-contract/src/domain.rs @@ -9,6 +9,7 @@ use std::fmt; +use cultcache_rs::CultTypeName; use serde::{Deserialize, Deserializer, Serialize, Serializer, de}; /// A value was outside its domain. Names the domain and its bound, never the value. @@ -72,6 +73,13 @@ impl std::error::Error for DomainError {} #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] pub struct Seq(i32); +impl CultTypeName for Seq { + fn cult_type_name() -> String { + "System.Int32".to_string() + } + const VALUE_TYPE: bool = true; +} + impl Seq { pub const FIRST: Seq = Seq(1); @@ -108,6 +116,13 @@ impl Seq { #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] pub struct Version(i64); +impl CultTypeName for Version { + fn cult_type_name() -> String { + "System.Int64".to_string() + } + const VALUE_TYPE: bool = true; +} + impl Version { pub fn new(value: i64) -> Result { if value >= 0 { Ok(Self(value)) } else { Err(DomainError::new("Version", "at least 0")) } @@ -166,6 +181,12 @@ impl Count { #[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] pub struct Segment(String); +impl CultTypeName for Segment { + fn cult_type_name() -> String { + "System.String".to_string() + } +} + impl Segment { pub fn new(value: impl Into) -> Result { let value = value.into(); diff --git a/crates/thing-contract/src/keys.rs b/crates/thing-contract/src/keys.rs index f6de211..32b603e 100644 --- a/crates/thing-contract/src/keys.rs +++ b/crates/thing-contract/src/keys.rs @@ -1,5 +1,6 @@ //! Identifier newtypes and the record key of each kind. No caller spells a key as a free string. +use cultcache_rs::CultTypeName; use serde::{Deserialize, Serialize}; use crate::domain::{Segment, Seq, Version}; @@ -20,6 +21,12 @@ macro_rules! id_type { &self.0 } } + + impl CultTypeName for $name { + fn cult_type_name() -> String { + "System.String".to_string() + } + } }; } diff --git a/crates/thing-contract/src/lib.rs b/crates/thing-contract/src/lib.rs index 9f9d544..602e81a 100644 --- a/crates/thing-contract/src/lib.rs +++ b/crates/thing-contract/src/lib.rs @@ -9,10 +9,11 @@ //! field types (`Seq`, `Version`, `Count`, `Segment`), whose `Deserialize` calls the same //! `new` the constructors call, so no door skips a check. //! -//! Hazard: decoding these kinds from untrusted bytes on a default-size thread can abort the -//! process inside CultCache's nesting bound before the bound refuses (the stack is not -//! bounded by nesting depth). The owner is `cultlib-gaps:follow_up:decode-stack-safety`; the -//! tests decode on a 16 MiB thread until it lands. +//! Stack hazard: `Node` nests without a bound of its own, and serde's `Deserialize` recurses +//! once per level, so a hostile payload nested deep enough overflows the stack of a caller that +//! decodes it directly. CultCache refuses such a payload on read and on write +//! (`cultcache_rs::check_payload_depth`, 256 containers); a caller that decodes bytes outside a +//! CultCache must run that check first. mod asset; mod command; @@ -32,6 +33,7 @@ pub use result::*; pub use source::*; pub use style::*; +pub use cultcache_rs::DatabaseEntry; use cultcache_rs::{CultCache, CultCacheRegistry}; /// Registers the five kinds with a cache. diff --git a/crates/thing-contract/src/node.rs b/crates/thing-contract/src/node.rs index 603950b..8be831c 100644 --- a/crates/thing-contract/src/node.rs +++ b/crates/thing-contract/src/node.rs @@ -1,12 +1,14 @@ //! Thing Script: the closed node union, the surface document that holds a tree of nodes, and the -//! composition document that names a reusable subtree. Arm keys are fixed for v1. +//! composition document that names a reusable subtree. Arm keys are fixed: Slot (13) is the arm +//! added after the first twelve, and a decoder from before it refuses a record holding one +//! (CultCache's unknown-arm rule). use cultcache_rs::{CultSlots, CultUnion, DatabaseEntry}; use crate::domain::{Count, Segment, Version}; use crate::command::{CommandDecl, CommandRef}; use crate::keys::{NodeId, ProviderId, composition_key, surface_key}; -use crate::source::{Bind, BoolSource, CollectionSource, MemberPath, NumberSource, TextSource}; +use crate::source::{Bind, BoolSource, CollectionSource, MemberPath, NumberSource, ParamName, TextSource}; use crate::style::{BoxStyle, Paint, Role}; /// What every node carries. @@ -21,6 +23,7 @@ pub struct NodeCommon { } #[derive(Clone, Debug, PartialEq, CultUnion)] +#[cultcache(type_name = "GameCult.Thing.Contract.Node")] pub enum Node { #[cultcache(key = 0)] Box(BoxNode), @@ -48,6 +51,8 @@ pub enum Node { Embed(EmbedNode), #[cultcache(key = 12)] Use(UseNode), + #[cultcache(key = 13)] + Slot(SlotNode), } #[derive(Clone, Debug, PartialEq, CultSlots)] @@ -159,8 +164,10 @@ pub struct TextInputNode { pub common: NodeCommon, #[cultcache(key = 1)] pub multiline: bool, + /// Named `input_kind` in every runtime (Rust `input_kind`, C# `InputKind`, TypeScript `inputKind`): a field + /// named `kind` collides with the union tag in TypeScript. The wire is the slot key, 2. #[cultcache(key = 2)] - pub kind: InputKind, + pub input_kind: InputKind, #[cultcache(key = 3)] pub placeholder: TextSource, #[cultcache(key = 4)] @@ -309,6 +316,13 @@ pub struct CompositionRef { pub version: Version, } +impl CompositionRef { + /// The record key of the composition this names, from the one key function. + pub fn record_key(&self) -> String { + composition_key(&self.publisher, &self.name, self.version) + } +} + #[derive(Clone, Debug, PartialEq, CultSlots)] pub struct UseNode { #[cultcache(key = 0)] @@ -319,6 +333,15 @@ pub struct UseNode { pub args: Vec, } +/// Where a composition body places the nodes passed for its Slot parameter `param`. Only a child +/// list of a composition body holds one, and resolve refuses it elsewhere. It carries no +/// `NodeCommon`: the argument's nodes, keeping their caller-scope ids, replace it. +#[derive(Clone, Debug, PartialEq, CultSlots)] +pub struct SlotNode { + #[cultcache(key = 0)] + pub param: ParamName, +} + #[derive(Clone, Debug, PartialEq, CultSlots)] pub struct Arg { #[cultcache(key = 0)] @@ -422,7 +445,7 @@ pub struct SurfaceDocument { pub title: String, #[cultcache(key = 4)] pub root: Node, - #[cultcache(key = 5)] + #[cultcache(key = 5, type_name = "System.Collections.Immutable.ImmutableArray")] pub commands: Vec, } @@ -442,7 +465,7 @@ pub struct CompositionDocument { pub name: Segment, #[cultcache(key = 2)] pub version: Version, - #[cultcache(key = 3)] + #[cultcache(key = 3, type_name = "System.Collections.Immutable.ImmutableArray")] pub params: Vec, #[cultcache(key = 4)] pub body: Node, diff --git a/crates/thing-contract/src/result.rs b/crates/thing-contract/src/result.rs index d2a1bb9..99cd0f4 100644 --- a/crates/thing-contract/src/result.rs +++ b/crates/thing-contract/src/result.rs @@ -41,6 +41,7 @@ pub struct FailedOutcome { } #[derive(Clone, Debug, PartialEq, CultUnion)] +#[cultcache(type_name = "GameCult.Thing.Contract.Outcome")] pub enum Outcome { #[cultcache(key = 0)] Pending(PendingOutcome), diff --git a/crates/thing-contract/src/source.rs b/crates/thing-contract/src/source.rs index c304068..0a3cad0 100644 --- a/crates/thing-contract/src/source.rs +++ b/crates/thing-contract/src/source.rs @@ -81,7 +81,9 @@ pub enum StateSource { Item, } -/// A state record. An absent provider is the publisher of the document. +/// A state record. An absent provider is the publisher of the document. `schema` is the id the +/// provider's record type is registered under in its store: a provider's state type must have its +/// entry type equal to that schema id, because a store names a record's schema by its entry type. #[derive(Clone, Debug, PartialEq, CultSlots)] pub struct StateRef { #[cultcache(key = 0)] diff --git a/crates/thing-contract/tests/catalog_members.rs b/crates/thing-contract/tests/catalog_members.rs new file mode 100644 index 0000000..1148b35 --- /dev/null +++ b/crates/thing-contract/tests/catalog_members.rs @@ -0,0 +1,60 @@ +//! The catalog rows the five document kinds publish are the rows the C# package declares: +//! `tests/thing-contract-parity/catalog-members.tsv`, which NameSetTests (C#) and parity.test.ts +//! (TypeScript) are held to as well. Schema ids differ by writer, so the comparison is by group, +//! as `catalogGroups` in parity.test.ts makes it. + +use std::path::PathBuf; + +use cultcache_rs::{DatabaseEntry, SchemaCatalogMember, SingleFileMessagePackBackingStore}; +use thing_contract::*; + +fn tsv_groups() -> Vec { + let path = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../../tests/thing-contract-parity/catalog-members.tsv"); + let text = std::fs::read_to_string(path).unwrap(); + let mut groups: Vec<(String, Vec)> = Vec::new(); + for row in text.lines().filter(|line| !line.trim().is_empty()) { + let (schema, rest) = row.split_once('\t').unwrap(); + match groups.iter_mut().find(|(id, _)| id == schema) { + Some((_, rows)) => rows.push(rest.to_string()), + None => groups.push((schema.to_string(), vec![rest.to_string()])), + } + } + sorted(groups.into_iter().map(|(_, rows)| rows.join("\n")).collect()) +} + +fn group(members: &[SchemaCatalogMember]) -> String { + members.iter().map(|m| format!("{}\t{}\t{}", m.slot, m.member_name, m.type_name)).collect::>().join("\n") +} + +fn sorted(mut groups: Vec) -> Vec { + groups.sort(); + groups +} + +#[test] +fn rows_equal_the_csharp_file() { + let mine = sorted(vec![ + group(&SurfaceDocument::schema_members()), + group(&CompositionDocument::schema_members()), + group(&CommandInvocation::schema_members()), + group(&CommandResult::schema_members()), + group(&AssetCatalog::schema_members()), + ]); + assert_eq!(mine, tsv_groups()); +} + +#[test] +fn the_written_store_carries_the_rows() { + // goldens.rs writes a store of one record per kind and compares it byte for byte with the + // committed surface.cc, so the committed file's catalog is the catalog the crate writes. It is + // copied first: reading a store creates a lock file beside it. + let committed = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/goldens/surface.cc"); + let work = PathBuf::from(env!("CARGO_TARGET_TMPDIR")).join("catalog-members"); + std::fs::create_dir_all(&work).unwrap(); + let copy = work.join("surface.cc"); + std::fs::copy(committed, ©).unwrap(); + let catalog = SingleFileMessagePackBackingStore::new(©).pull_schema_catalog().unwrap(); + let from_store = sorted(catalog.iter().map(|entry| group(&entry.members)).collect()); + assert_eq!(from_store, tsv_groups()); + let _ = std::fs::remove_dir_all(&work); +} diff --git a/crates/thing-contract/tests/goldens.rs b/crates/thing-contract/tests/goldens.rs index 71a5c23..8a74b28 100644 --- a/crates/thing-contract/tests/goldens.rs +++ b/crates/thing-contract/tests/goldens.rs @@ -2,42 +2,24 @@ //! byte. The TypeScript and C# packages and core are held to these files; none of them writes //! one. `THING_BLESS=1` rewrites them; any other run compares. -mod common; - use std::collections::BTreeSet; use std::fmt::Debug; use std::path::PathBuf; -use common::*; -use cultcache_rs::{CultCache, CultCacheEnvelope, CultCacheRegistry, DatabaseEntry, SingleFileMessagePackBackingStore}; +use thing_testkit::{build::*, golden, store}; +use cultcache_rs::{CultCache, CultCacheEnvelope, CultCacheRegistry, DatabaseEntry}; use thing_contract::*; -const PINNED_CLOCK: &str = "2026-01-01T00:00:00Z"; -// A value that must never appear in a refusal. -const CANARY: &str = "CANARY-7f3a91c2"; - fn goldens_dir() -> PathBuf { PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/goldens") } -fn blessing() -> bool { - std::env::var("THING_BLESS").as_deref() == Ok("1") -} - -/// Bless the file or compare against it. Returns the committed bytes. -fn golden_bytes(file: &str, produced: &[u8]) -> Vec { - let path = goldens_dir().join(file); - if blessing() { - std::fs::write(&path, produced).unwrap_or_else(|error| panic!("{file}: {error}")); - } - let committed = std::fs::read(&path).unwrap_or_else(|error| panic!("{file}: {error}")); - assert_eq!(committed, produced, "{file}: the committed golden differs from what the crate writes"); - committed -} +// A value that must never appear in a refusal. +const CANARY: &str = "CANARY-7f3a91c2"; fn golden(name: &str, value: &T) -> String { let produced = rmp_serde::to_vec(value).unwrap(); - let committed = golden_bytes(&format!("{name}.bin"), &produced); + let committed = golden::check(&goldens_dir(), &format!("{name}.bin"), &produced); let decoded: T = rmp_serde::from_slice(&committed).unwrap_or_else(|error| panic!("{name}: {error}")); assert_eq!(&decoded, value, "{name}: the golden does not decode to the constructed value"); assert_eq!(rmp_serde::to_vec(&decoded).unwrap(), committed, "{name}: re-encoding changed the bytes"); @@ -150,7 +132,7 @@ fn full_surface() -> SurfaceDocument { Node::TextInput(TextInputNode { common: common("name-input"), multiline: true, - kind: InputKind::Number, + input_kind: InputKind::Number, placeholder: lit_text("name"), initial: TextSource::Param(param("initial")), submit: command("rename"), @@ -158,7 +140,7 @@ fn full_surface() -> SurfaceDocument { Node::TextInput(TextInputNode { common: common("title-input"), multiline: false, - kind: InputKind::Text, + input_kind: InputKind::Text, placeholder: lit_text("title"), initial: TextSource::Param(param("initial")), submit: command("retitle"), @@ -384,7 +366,10 @@ fn full_composition() -> CompositionDocument { .into_iter() .map(|(name, kind)| ParamDecl { name: name.into(), kind }) .collect(), - body: boxed("panel-root", vec![text("panel-title", "t"), inner_use]), + body: boxed( + "panel-root", + vec![text("panel-title", "t"), inner_use, Node::Slot(SlotNode { param: param("body") })], + ), } } @@ -435,26 +420,17 @@ fn asset_catalog() -> AssetCatalog { /// A store with one record of each kind, written by cultcache-rs under a pinned clock. fn write_store(path: &std::path::Path) { - let _ = std::fs::remove_file(path); - let mut cache = CultCache::new(); - ThingContract.register_entries(&mut cache).unwrap(); - cache.add_generic_backing_store(SingleFileMessagePackBackingStore::new(path)).unwrap(); + let mut cache = store::create(path); let surface = full_surface(); let composition = full_composition(); let invocation = invocation(); let result = CommandResult::pending(&invocation, seq(1), "working"); let catalog = asset_catalog(); - put(&mut cache, &surface.record_key(), &surface); - put(&mut cache, &composition.record_key(), &composition); - put(&mut cache, &invocation.record_key(), &invocation); - put(&mut cache, &result.record_key(), &result); - put(&mut cache, &catalog.record_key(), &catalog); -} - -fn put(cache: &mut CultCache, key: &str, value: &T) { - let (mut envelope, _) = cache.prepare_entry(key, value).unwrap(); - envelope.stored_at = PINNED_CLOCK.into(); - cache.put_envelope::(envelope).unwrap(); + store::put_pinned(&mut cache, &surface.record_key(), &surface); + store::put_pinned(&mut cache, &composition.record_key(), &composition); + store::put_pinned(&mut cache, &invocation.record_key(), &invocation); + store::put_pinned(&mut cache, &result.record_key(), &result); + store::put_pinned(&mut cache, &catalog.record_key(), &catalog); } fn envelope(key: &str, payload: Vec) -> CultCacheEnvelope { @@ -462,17 +438,17 @@ fn envelope(key: &str, payload: Vec) -> CultCacheEnvelope key: key.into(), r#type: T::TYPE.into(), payload, - stored_at: PINNED_CLOCK.into(), + stored_at: store::PINNED_CLOCK.into(), schema_id: Some(T::TYPE.into()), } } -fn open_store(path: &std::path::Path) -> CultCache { - let mut cache = CultCache::new(); - ThingContract.register_entries(&mut cache).unwrap(); - cache.add_generic_backing_store(SingleFileMessagePackBackingStore::new(path)).unwrap(); - cache.pull_all_backing_stores().unwrap(); - cache +#[test] +fn slot_arm_bytes() { + let slot = Node::Slot(SlotNode { param: param("body") }); + let bytes = rmp_serde::to_vec(&slot).unwrap(); + assert_eq!(bytes, [0x92, 0x0D, 0x91, 0x91, 0xA4, 0x62, 0x6F, 0x64, 0x79]); + assert_eq!(rmp_serde::from_slice::(&bytes).unwrap(), slot); } #[test] @@ -491,7 +467,7 @@ fn goldens_match() { // that no case names is an orphan. let refusals = refusal_payloads(); for (name, bytes) in &refusals { - golden_bytes(&format!("{name}.bin"), bytes); + golden::check(&goldens_dir(), &format!("{name}.bin"), bytes); names.insert((*name).to_string()); } let on_disk: BTreeSet = std::fs::read_dir(goldens_dir()) @@ -504,10 +480,10 @@ fn goldens_match() { // The store: one record of each kind, written under a pinned clock, byte for byte. let scratch = PathBuf::from(env!("CARGO_TARGET_TMPDIR")).join("goldens-surface.cc"); write_store(&scratch); - let committed = golden_bytes("surface.cc", &std::fs::read(&scratch).unwrap()); + let committed = golden::check(&goldens_dir(), "surface.cc", &std::fs::read(&scratch).unwrap()); let reopened = goldens_dir().join("surface.cc"); assert_eq!(std::fs::read(&reopened).unwrap(), committed); - let cache = open_store(&scratch); + let cache = store::open(&scratch); let surface = full_surface(); assert_eq!(cache.get::(&surface.record_key()).unwrap(), Some(surface)); let composition = full_composition(); @@ -553,10 +529,11 @@ fn refusal_payloads() -> Vec<(&'static str, Vec)> { let root = text("root", "x"); vec![ ("result-thing1-flat", rmp_serde::to_vec_named(&flat).unwrap()), - // A surface whose root is an arm key the Node union does not declare. + // A surface whose root is an arm key the Node union does not declare: 14 is the first key + // Node does not declare (Slot is 13). ( "node-unknown-arm", - rmp_serde::to_vec(&("provider.a", "main", 1i64, CANARY, (13i32, (CANARY,)), unit)).unwrap(), + rmp_serde::to_vec(&("provider.a", "main", 1i64, CANARY, (14i32, (CANARY,)), unit)).unwrap(), ), // A result whose outcome is an arm key the Outcome union does not declare. ("outcome-unknown-arm", rmp_serde::to_vec(&("inv-1", 1i32, (4i32, (CANARY,)))).unwrap()), @@ -591,7 +568,7 @@ fn refusal_payloads() -> Vec<(&'static str, Vec)> { #[test] fn refusal_cases() { let payloads: std::collections::BTreeMap<_, _> = refusal_payloads().into_iter().collect(); - let committed = |name: &str| golden_bytes(&format!("{name}.bin"), &payloads[name]); + let committed = |name: &str| golden::check(&goldens_dir(), &format!("{name}.bin"), &payloads[name]); // Stored under their key, each is refused naming the kind and the key, never a value. let cases: [(&str, &str, &str); 7] = [ @@ -623,7 +600,7 @@ fn refusal_cases() { } // Decoded directly, the refusal names the union and the arm key, and never the payload. - for (name, union, key) in [("node-unknown-arm", "Node", "13"), ("outcome-unknown-arm", "Outcome", "4")] { + for (name, union, key) in [("node-unknown-arm", "Node", "14"), ("outcome-unknown-arm", "Outcome", "4")] { let bytes = committed(name); let message = if union == "Node" { rmp_serde::from_slice::(&bytes).unwrap_err().to_string() @@ -665,13 +642,6 @@ fn refusal_cases() { #[test] fn deep_tree() { - // Decoding a Node costs tens of KiB of debug stack per nesting level, so the chain runs on a - // thread that has the room; the 2 MiB default does not. The hazard is CultCache's, owned by - // cultlib-gaps:follow_up:decode-stack-safety; the test stays on the big thread until it lands. - std::thread::Builder::new().stack_size(16 * 1024 * 1024).spawn(deep_tree_body).unwrap().join().unwrap(); -} - -fn deep_tree_body() { // A 64-deep Box chain. let mut chain = text("leaf", "bottom"); for depth in (0..64).rev() { @@ -698,15 +668,12 @@ fn deep_tree_body() { }; let path = PathBuf::from(env!("CARGO_TARGET_TMPDIR")).join("deep-tree.cc"); - let _ = std::fs::remove_file(&path); { - let mut cache = CultCache::new(); - ThingContract.register_entries(&mut cache).unwrap(); - cache.add_generic_backing_store(SingleFileMessagePackBackingStore::new(&path)).unwrap(); - put(&mut cache, &deep.record_key(), &deep); - put(&mut cache, &wide.record_key(), &wide); + let mut cache = store::create(&path); + store::put_pinned(&mut cache, &deep.record_key(), &deep); + store::put_pinned(&mut cache, &wide.record_key(), &wide); } - let cache = open_store(&path); + let cache = store::open(&path); assert_eq!(cache.get::(&deep.record_key()).unwrap(), Some(deep)); assert_eq!(cache.get::(&wide.record_key()).unwrap(), Some(wide)); } diff --git a/crates/thing-contract/tests/goldens/README.md b/crates/thing-contract/tests/goldens/README.md index 0e7f7d9..f9e9f74 100644 --- a/crates/thing-contract/tests/goldens/README.md +++ b/crates/thing-contract/tests/goldens/README.md @@ -12,8 +12,8 @@ when absent. Arm keys are fixed for v1. | File | Kind | Decodes to | |---|---|---| -| `surface-all-arms.bin` | `gamecult.thing.surface.v1` | One surface with all 13 node arms (Box 0, Text 1, Image 2, Button 3, Toggle 4, Slider 5, TextInput 6 as both input kinds, Text 0 and Number 1, Select 7, Repeat 8, Overlay 9, Plot 10, Embed 11, Use 12), a Box chain four levels deep, every text, number and bool source arm, every Format arm, both state sources, both member steps, every dimension and colour arm, and two declared commands | -| `composition-all-params.bin` | `gamecult.thing.composition.v1` | A composition with one parameter of each of the 7 kinds, whose body uses a composition with one argument of each of the 7 argument arms | +| `surface-all-arms.bin` | `gamecult.thing.surface.v1` | One surface with 13 of the 14 node arms (Box 0, Text 1, Image 2, Button 3, Toggle 4, Slider 5, TextInput 6 as both input kinds, Text 0 and Number 1, Select 7, Repeat 8, Overlay 9, Plot 10, Embed 11, Use 12; Slot 13 is in `composition-all-params`, a body being where a slot stands), a Box chain four levels deep, every text, number and bool source arm, every Format arm, both state sources, both member steps, every dimension and colour arm, and two declared commands | +| `composition-all-params.bin` | `gamecult.thing.composition.v1` | A composition with one parameter of each of the 7 kinds, whose body uses a composition with one argument of each of the 7 argument arms and places the body slot (Slot 13) last in its root's children | | `invocation-all-inputs.bin` | `gamecult.thing.command_invocation.v1` | An invocation with a payload record of bin bytes and one captured input of each of the 4 input arms | | `result-pending.bin` | `gamecult.thing.command_result.v1` | Outcome Pending, seq 1 | | `result-completed.bin` | same | Outcome Completed with source version 8, drafts cleared, no effect | @@ -30,7 +30,7 @@ when absent. Arm keys are fixed for v1. | File | Payload | Expected | |---|---|---| | `result-thing1-flat.bin` | a MessagePack map with named members, the shape a Thing 1 provider wrote for a command result | refused when stored as a command result; the error names the kind and the record key and never a value | -| `node-unknown-arm.bin` | a surface whose root node has arm key 13, which Node does not declare | refused; the error names the kind and the record key, and decoded directly it names the union Node and the key 13, and never a value | +| `node-unknown-arm.bin` | a surface whose root node has arm key 14, which Node does not declare | refused; the error names the kind and the record key, and decoded directly it names the union Node and the key 14, and never a value | | `outcome-unknown-arm.bin` | a result whose outcome has arm key 4, which Outcome does not declare | refused in the same way, naming the union Outcome and the key 4 | | `result-extra-slot.bin` | a Pending result with a fourth slot past the last one declared | read: it decodes to the Pending result with seq 1 (CultLib's extra-trailing-slots ruling: read, never written back) | | `result-seq-zero.bin` | a result whose seq slot is 0 | refused; the error names the kind and the record key, decoded directly it names Seq, and never a value | @@ -40,3 +40,9 @@ when absent. Arm keys are fixed for v1. | `rgba-channel-out-of-range.bin` | the Rgba slot array `[256, 0, 0, 255]` | refused when decoded as an Rgba: a channel is a byte, 0 to 255 | Domain refusals are the contract's rule, which the TypeScript and C# packages mirror: each is held to refuse these files, without the leaf set a Rust `u8` or a checked newtype has. + +## The nil vector + +`nil-positions.tsv` is written only by `crates/thing-contract/tests/nil_positions.rs` (`THING_BLESS=1`). For every element inside an array, at every depth, of each value golden above except `surface.cc` (the eleven `.bin` files from `surface-all-arms` to `asset-catalog`), the test replaces that element with nil (`0xC0`) and decodes the whole payload with the Rust decode door, `rmp_serde::from_slice` into the golden's kind. A row is `golden`, `path` (dotted array indices from the root, e.g. `3.0.1`), the element's byte `start` and `end` in the golden, and `ACCEPT` or `REFUSE`. An accepted variant re-encodes to the spliced bytes. Maps are not walked. + +A slot is required exactly when its Rust type is not optional, so `REFUSE` rows are the required slots and `ACCEPT` rows the optional ones. The Rust decode door decides every row; the TypeScript and C# packages keep no list of required slots and are held to every row. diff --git a/crates/thing-contract/tests/goldens/composition-all-params.bin b/crates/thing-contract/tests/goldens/composition-all-params.bin index a93e57a..aeea9ed 100644 Binary files a/crates/thing-contract/tests/goldens/composition-all-params.bin and b/crates/thing-contract/tests/goldens/composition-all-params.bin differ diff --git a/crates/thing-contract/tests/goldens/nil-positions.tsv b/crates/thing-contract/tests/goldens/nil-positions.tsv new file mode 100644 index 0000000..6796323 --- /dev/null +++ b/crates/thing-contract/tests/goldens/nil-positions.tsv @@ -0,0 +1,2871 @@ +surface-all-arms 0 1 12 REFUSE +surface-all-arms 1 12 17 REFUSE +surface-all-arms 2 17 18 REFUSE +surface-all-arms 3 18 27 REFUSE +surface-all-arms 4 27 4638 REFUSE +surface-all-arms 4.0 28 29 REFUSE +surface-all-arms 4.1 29 4638 REFUSE +surface-all-arms 4.1.0 30 41 REFUSE +surface-all-arms 4.1.0.0 31 36 REFUSE +surface-all-arms 4.1.0.1 36 40 REFUSE +surface-all-arms 4.1.0.1.0 37 38 REFUSE +surface-all-arms 4.1.0.1.1 38 40 REFUSE +surface-all-arms 4.1.0.1.1.0 39 40 REFUSE +surface-all-arms 4.1.0.2 40 41 ACCEPT +surface-all-arms 4.1.1 41 242 REFUSE +surface-all-arms 4.1.1.0 44 47 REFUSE +surface-all-arms 4.1.1.0.0 45 46 REFUSE +surface-all-arms 4.1.1.0.1 46 47 REFUSE +surface-all-arms 4.1.1.1 47 50 REFUSE +surface-all-arms 4.1.1.1.0 48 49 REFUSE +surface-all-arms 4.1.1.1.1 49 50 REFUSE +surface-all-arms 4.1.1.2 50 53 REFUSE +surface-all-arms 4.1.1.2.0 51 52 REFUSE +surface-all-arms 4.1.1.2.1 52 53 REFUSE +surface-all-arms 4.1.1.3 53 78 REFUSE +surface-all-arms 4.1.1.3.0 54 66 REFUSE +surface-all-arms 4.1.1.3.0.0 55 56 REFUSE +surface-all-arms 4.1.1.3.0.1 56 66 REFUSE +surface-all-arms 4.1.1.3.0.1.0 57 66 REFUSE +surface-all-arms 4.1.1.3.1 66 78 REFUSE +surface-all-arms 4.1.1.3.1.0 67 68 REFUSE +surface-all-arms 4.1.1.3.1.1 68 78 REFUSE +surface-all-arms 4.1.1.3.1.1.0 69 78 REFUSE +surface-all-arms 4.1.1.4 78 127 REFUSE +surface-all-arms 4.1.1.4.0 79 91 REFUSE +surface-all-arms 4.1.1.4.0.0 80 81 REFUSE +surface-all-arms 4.1.1.4.0.1 81 91 REFUSE +surface-all-arms 4.1.1.4.0.1.0 82 91 REFUSE +surface-all-arms 4.1.1.4.1 91 103 REFUSE +surface-all-arms 4.1.1.4.1.0 92 93 REFUSE +surface-all-arms 4.1.1.4.1.1 93 103 REFUSE +surface-all-arms 4.1.1.4.1.1.0 94 103 REFUSE +surface-all-arms 4.1.1.4.2 103 115 REFUSE +surface-all-arms 4.1.1.4.2.0 104 105 REFUSE +surface-all-arms 4.1.1.4.2.1 105 115 REFUSE +surface-all-arms 4.1.1.4.2.1.0 106 115 REFUSE +surface-all-arms 4.1.1.4.3 115 127 REFUSE +surface-all-arms 4.1.1.4.3.0 116 117 REFUSE +surface-all-arms 4.1.1.4.3.1 117 127 REFUSE +surface-all-arms 4.1.1.4.3.1.0 118 127 REFUSE +surface-all-arms 4.1.1.5 127 140 REFUSE +surface-all-arms 4.1.1.5.0 128 131 REFUSE +surface-all-arms 4.1.1.5.0.0 129 130 REFUSE +surface-all-arms 4.1.1.5.0.1 130 131 REFUSE +surface-all-arms 4.1.1.5.1 131 134 REFUSE +surface-all-arms 4.1.1.5.1.0 132 133 REFUSE +surface-all-arms 4.1.1.5.1.1 133 134 REFUSE +surface-all-arms 4.1.1.5.2 134 137 REFUSE +surface-all-arms 4.1.1.5.2.0 135 136 REFUSE +surface-all-arms 4.1.1.5.2.1 136 137 REFUSE +surface-all-arms 4.1.1.5.3 137 140 REFUSE +surface-all-arms 4.1.1.5.3.0 138 139 REFUSE +surface-all-arms 4.1.1.5.3.1 139 140 REFUSE +surface-all-arms 4.1.1.6 140 156 REFUSE +surface-all-arms 4.1.1.6.0 141 153 REFUSE +surface-all-arms 4.1.1.6.0.0 142 143 REFUSE +surface-all-arms 4.1.1.6.0.1 143 153 REFUSE +surface-all-arms 4.1.1.6.0.1.0 144 153 REFUSE +surface-all-arms 4.1.1.6.1 153 156 REFUSE +surface-all-arms 4.1.1.6.1.0 154 155 REFUSE +surface-all-arms 4.1.1.6.1.1 155 156 REFUSE +surface-all-arms 4.1.1.7 156 181 REFUSE +surface-all-arms 4.1.1.7.0 157 169 REFUSE +surface-all-arms 4.1.1.7.0.0 158 159 REFUSE +surface-all-arms 4.1.1.7.0.1 159 169 REFUSE +surface-all-arms 4.1.1.7.0.1.0 160 169 REFUSE +surface-all-arms 4.1.1.7.1 169 181 REFUSE +surface-all-arms 4.1.1.7.1.0 170 171 REFUSE +surface-all-arms 4.1.1.7.1.1 171 181 REFUSE +surface-all-arms 4.1.1.7.1.1.0 172 181 REFUSE +surface-all-arms 4.1.1.8 181 188 REFUSE +surface-all-arms 4.1.1.8.0 182 185 REFUSE +surface-all-arms 4.1.1.8.0.0 183 184 REFUSE +surface-all-arms 4.1.1.8.0.1 184 185 REFUSE +surface-all-arms 4.1.1.8.1 185 188 REFUSE +surface-all-arms 4.1.1.8.1.0 186 187 REFUSE +surface-all-arms 4.1.1.8.1.1 187 188 REFUSE +surface-all-arms 4.1.1.9 188 191 REFUSE +surface-all-arms 4.1.1.9.0 189 190 REFUSE +surface-all-arms 4.1.1.9.1 190 191 REFUSE +surface-all-arms 4.1.1.10 191 204 REFUSE +surface-all-arms 4.1.1.10.0 192 195 REFUSE +surface-all-arms 4.1.1.10.0.0 193 194 REFUSE +surface-all-arms 4.1.1.10.0.1 194 195 REFUSE +surface-all-arms 4.1.1.10.1 195 198 REFUSE +surface-all-arms 4.1.1.10.1.0 196 197 REFUSE +surface-all-arms 4.1.1.10.1.1 197 198 REFUSE +surface-all-arms 4.1.1.10.2 198 201 REFUSE +surface-all-arms 4.1.1.10.2.0 199 200 REFUSE +surface-all-arms 4.1.1.10.2.1 200 201 REFUSE +surface-all-arms 4.1.1.10.3 201 204 REFUSE +surface-all-arms 4.1.1.10.3.0 202 203 REFUSE +surface-all-arms 4.1.1.10.3.1 203 204 REFUSE +surface-all-arms 4.1.1.11 204 207 REFUSE +surface-all-arms 4.1.1.11.0 205 206 REFUSE +surface-all-arms 4.1.1.11.1 206 207 REFUSE +surface-all-arms 4.1.1.12 207 210 REFUSE +surface-all-arms 4.1.1.12.0 208 209 REFUSE +surface-all-arms 4.1.1.12.1 209 210 REFUSE +surface-all-arms 4.1.1.13 210 213 REFUSE +surface-all-arms 4.1.1.13.0 211 212 REFUSE +surface-all-arms 4.1.1.13.1 212 213 REFUSE +surface-all-arms 4.1.1.14 213 216 REFUSE +surface-all-arms 4.1.1.14.0 214 215 REFUSE +surface-all-arms 4.1.1.14.1 215 216 REFUSE +surface-all-arms 4.1.1.15 216 219 REFUSE +surface-all-arms 4.1.1.15.0 217 218 REFUSE +surface-all-arms 4.1.1.15.1 218 219 REFUSE +surface-all-arms 4.1.1.16 219 228 REFUSE +surface-all-arms 4.1.1.17 228 237 REFUSE +surface-all-arms 4.1.1.18 237 240 REFUSE +surface-all-arms 4.1.1.18.0 238 239 REFUSE +surface-all-arms 4.1.1.18.1 239 240 REFUSE +surface-all-arms 4.1.1.19 240 241 REFUSE +surface-all-arms 4.1.1.20 241 242 REFUSE +surface-all-arms 4.1.2 242 254 REFUSE +surface-all-arms 4.1.2.0 243 244 ACCEPT +surface-all-arms 4.1.2.1 244 245 ACCEPT +surface-all-arms 4.1.2.2 245 254 REFUSE +surface-all-arms 4.1.3 254 257 REFUSE +surface-all-arms 4.1.3.0 255 256 REFUSE +surface-all-arms 4.1.3.1 256 257 REFUSE +surface-all-arms 4.1.4 257 4638 REFUSE +surface-all-arms 4.1.4.0 260 1518 REFUSE +surface-all-arms 4.1.4.0.0 261 262 REFUSE +surface-all-arms 4.1.4.0.1 262 1518 REFUSE +surface-all-arms 4.1.4.0.1.0 263 272 REFUSE +surface-all-arms 4.1.4.0.1.0.0 264 267 REFUSE +surface-all-arms 4.1.4.0.1.0.1 267 271 REFUSE +surface-all-arms 4.1.4.0.1.0.1.0 268 269 REFUSE +surface-all-arms 4.1.4.0.1.0.1.1 269 271 REFUSE +surface-all-arms 4.1.4.0.1.0.1.1.0 270 271 REFUSE +surface-all-arms 4.1.4.0.1.0.2 271 272 ACCEPT +surface-all-arms 4.1.4.0.1.1 272 473 REFUSE +surface-all-arms 4.1.4.0.1.1.0 275 278 REFUSE +surface-all-arms 4.1.4.0.1.1.0.0 276 277 REFUSE +surface-all-arms 4.1.4.0.1.1.0.1 277 278 REFUSE +surface-all-arms 4.1.4.0.1.1.1 278 281 REFUSE +surface-all-arms 4.1.4.0.1.1.1.0 279 280 REFUSE +surface-all-arms 4.1.4.0.1.1.1.1 280 281 REFUSE +surface-all-arms 4.1.4.0.1.1.2 281 284 REFUSE +surface-all-arms 4.1.4.0.1.1.2.0 282 283 REFUSE +surface-all-arms 4.1.4.0.1.1.2.1 283 284 REFUSE +surface-all-arms 4.1.4.0.1.1.3 284 309 REFUSE +surface-all-arms 4.1.4.0.1.1.3.0 285 297 REFUSE +surface-all-arms 4.1.4.0.1.1.3.0.0 286 287 REFUSE +surface-all-arms 4.1.4.0.1.1.3.0.1 287 297 REFUSE +surface-all-arms 4.1.4.0.1.1.3.0.1.0 288 297 REFUSE +surface-all-arms 4.1.4.0.1.1.3.1 297 309 REFUSE +surface-all-arms 4.1.4.0.1.1.3.1.0 298 299 REFUSE +surface-all-arms 4.1.4.0.1.1.3.1.1 299 309 REFUSE +surface-all-arms 4.1.4.0.1.1.3.1.1.0 300 309 REFUSE +surface-all-arms 4.1.4.0.1.1.4 309 358 REFUSE +surface-all-arms 4.1.4.0.1.1.4.0 310 322 REFUSE +surface-all-arms 4.1.4.0.1.1.4.0.0 311 312 REFUSE +surface-all-arms 4.1.4.0.1.1.4.0.1 312 322 REFUSE +surface-all-arms 4.1.4.0.1.1.4.0.1.0 313 322 REFUSE +surface-all-arms 4.1.4.0.1.1.4.1 322 334 REFUSE +surface-all-arms 4.1.4.0.1.1.4.1.0 323 324 REFUSE +surface-all-arms 4.1.4.0.1.1.4.1.1 324 334 REFUSE +surface-all-arms 4.1.4.0.1.1.4.1.1.0 325 334 REFUSE +surface-all-arms 4.1.4.0.1.1.4.2 334 346 REFUSE +surface-all-arms 4.1.4.0.1.1.4.2.0 335 336 REFUSE +surface-all-arms 4.1.4.0.1.1.4.2.1 336 346 REFUSE +surface-all-arms 4.1.4.0.1.1.4.2.1.0 337 346 REFUSE +surface-all-arms 4.1.4.0.1.1.4.3 346 358 REFUSE +surface-all-arms 4.1.4.0.1.1.4.3.0 347 348 REFUSE +surface-all-arms 4.1.4.0.1.1.4.3.1 348 358 REFUSE +surface-all-arms 4.1.4.0.1.1.4.3.1.0 349 358 REFUSE +surface-all-arms 4.1.4.0.1.1.5 358 371 REFUSE +surface-all-arms 4.1.4.0.1.1.5.0 359 362 REFUSE +surface-all-arms 4.1.4.0.1.1.5.0.0 360 361 REFUSE +surface-all-arms 4.1.4.0.1.1.5.0.1 361 362 REFUSE +surface-all-arms 4.1.4.0.1.1.5.1 362 365 REFUSE +surface-all-arms 4.1.4.0.1.1.5.1.0 363 364 REFUSE +surface-all-arms 4.1.4.0.1.1.5.1.1 364 365 REFUSE +surface-all-arms 4.1.4.0.1.1.5.2 365 368 REFUSE +surface-all-arms 4.1.4.0.1.1.5.2.0 366 367 REFUSE +surface-all-arms 4.1.4.0.1.1.5.2.1 367 368 REFUSE +surface-all-arms 4.1.4.0.1.1.5.3 368 371 REFUSE +surface-all-arms 4.1.4.0.1.1.5.3.0 369 370 REFUSE +surface-all-arms 4.1.4.0.1.1.5.3.1 370 371 REFUSE +surface-all-arms 4.1.4.0.1.1.6 371 387 REFUSE +surface-all-arms 4.1.4.0.1.1.6.0 372 384 REFUSE +surface-all-arms 4.1.4.0.1.1.6.0.0 373 374 REFUSE +surface-all-arms 4.1.4.0.1.1.6.0.1 374 384 REFUSE +surface-all-arms 4.1.4.0.1.1.6.0.1.0 375 384 REFUSE +surface-all-arms 4.1.4.0.1.1.6.1 384 387 REFUSE +surface-all-arms 4.1.4.0.1.1.6.1.0 385 386 REFUSE +surface-all-arms 4.1.4.0.1.1.6.1.1 386 387 REFUSE +surface-all-arms 4.1.4.0.1.1.7 387 412 REFUSE +surface-all-arms 4.1.4.0.1.1.7.0 388 400 REFUSE +surface-all-arms 4.1.4.0.1.1.7.0.0 389 390 REFUSE +surface-all-arms 4.1.4.0.1.1.7.0.1 390 400 REFUSE +surface-all-arms 4.1.4.0.1.1.7.0.1.0 391 400 REFUSE +surface-all-arms 4.1.4.0.1.1.7.1 400 412 REFUSE +surface-all-arms 4.1.4.0.1.1.7.1.0 401 402 REFUSE +surface-all-arms 4.1.4.0.1.1.7.1.1 402 412 REFUSE +surface-all-arms 4.1.4.0.1.1.7.1.1.0 403 412 REFUSE +surface-all-arms 4.1.4.0.1.1.8 412 419 REFUSE +surface-all-arms 4.1.4.0.1.1.8.0 413 416 REFUSE +surface-all-arms 4.1.4.0.1.1.8.0.0 414 415 REFUSE +surface-all-arms 4.1.4.0.1.1.8.0.1 415 416 REFUSE +surface-all-arms 4.1.4.0.1.1.8.1 416 419 REFUSE +surface-all-arms 4.1.4.0.1.1.8.1.0 417 418 REFUSE +surface-all-arms 4.1.4.0.1.1.8.1.1 418 419 REFUSE +surface-all-arms 4.1.4.0.1.1.9 419 422 REFUSE +surface-all-arms 4.1.4.0.1.1.9.0 420 421 REFUSE +surface-all-arms 4.1.4.0.1.1.9.1 421 422 REFUSE +surface-all-arms 4.1.4.0.1.1.10 422 435 REFUSE +surface-all-arms 4.1.4.0.1.1.10.0 423 426 REFUSE +surface-all-arms 4.1.4.0.1.1.10.0.0 424 425 REFUSE +surface-all-arms 4.1.4.0.1.1.10.0.1 425 426 REFUSE +surface-all-arms 4.1.4.0.1.1.10.1 426 429 REFUSE +surface-all-arms 4.1.4.0.1.1.10.1.0 427 428 REFUSE +surface-all-arms 4.1.4.0.1.1.10.1.1 428 429 REFUSE +surface-all-arms 4.1.4.0.1.1.10.2 429 432 REFUSE +surface-all-arms 4.1.4.0.1.1.10.2.0 430 431 REFUSE +surface-all-arms 4.1.4.0.1.1.10.2.1 431 432 REFUSE +surface-all-arms 4.1.4.0.1.1.10.3 432 435 REFUSE +surface-all-arms 4.1.4.0.1.1.10.3.0 433 434 REFUSE +surface-all-arms 4.1.4.0.1.1.10.3.1 434 435 REFUSE +surface-all-arms 4.1.4.0.1.1.11 435 438 REFUSE +surface-all-arms 4.1.4.0.1.1.11.0 436 437 REFUSE +surface-all-arms 4.1.4.0.1.1.11.1 437 438 REFUSE +surface-all-arms 4.1.4.0.1.1.12 438 441 REFUSE +surface-all-arms 4.1.4.0.1.1.12.0 439 440 REFUSE +surface-all-arms 4.1.4.0.1.1.12.1 440 441 REFUSE +surface-all-arms 4.1.4.0.1.1.13 441 444 REFUSE +surface-all-arms 4.1.4.0.1.1.13.0 442 443 REFUSE +surface-all-arms 4.1.4.0.1.1.13.1 443 444 REFUSE +surface-all-arms 4.1.4.0.1.1.14 444 447 REFUSE +surface-all-arms 4.1.4.0.1.1.14.0 445 446 REFUSE +surface-all-arms 4.1.4.0.1.1.14.1 446 447 REFUSE +surface-all-arms 4.1.4.0.1.1.15 447 450 REFUSE +surface-all-arms 4.1.4.0.1.1.15.0 448 449 REFUSE +surface-all-arms 4.1.4.0.1.1.15.1 449 450 REFUSE +surface-all-arms 4.1.4.0.1.1.16 450 459 REFUSE +surface-all-arms 4.1.4.0.1.1.17 459 468 REFUSE +surface-all-arms 4.1.4.0.1.1.18 468 471 REFUSE +surface-all-arms 4.1.4.0.1.1.18.0 469 470 REFUSE +surface-all-arms 4.1.4.0.1.1.18.1 470 471 REFUSE +surface-all-arms 4.1.4.0.1.1.19 471 472 REFUSE +surface-all-arms 4.1.4.0.1.1.20 472 473 REFUSE +surface-all-arms 4.1.4.0.1.2 473 485 REFUSE +surface-all-arms 4.1.4.0.1.2.0 474 475 ACCEPT +surface-all-arms 4.1.4.0.1.2.1 475 476 ACCEPT +surface-all-arms 4.1.4.0.1.2.2 476 485 REFUSE +surface-all-arms 4.1.4.0.1.3 485 488 REFUSE +surface-all-arms 4.1.4.0.1.3.0 486 487 REFUSE +surface-all-arms 4.1.4.0.1.3.1 487 488 REFUSE +surface-all-arms 4.1.4.0.1.4 488 1518 REFUSE +surface-all-arms 4.1.4.0.1.4.0 489 1518 REFUSE +surface-all-arms 4.1.4.0.1.4.0.0 490 491 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1 491 1518 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.0 492 501 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.0.0 493 496 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.0.1 496 500 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.0.1.0 497 498 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.0.1.1 498 500 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.0.1.1.0 499 500 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.0.2 500 501 ACCEPT +surface-all-arms 4.1.4.0.1.4.0.1.1 501 702 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.0 504 507 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.0.0 505 506 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.0.1 506 507 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.1 507 510 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.1.0 508 509 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.1.1 509 510 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.2 510 513 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.2.0 511 512 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.2.1 512 513 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.3 513 538 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.3.0 514 526 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.3.0.0 515 516 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.3.0.1 516 526 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.3.0.1.0 517 526 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.3.1 526 538 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.3.1.0 527 528 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.3.1.1 528 538 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.3.1.1.0 529 538 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.4 538 587 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.4.0 539 551 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.4.0.0 540 541 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.4.0.1 541 551 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.4.0.1.0 542 551 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.4.1 551 563 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.4.1.0 552 553 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.4.1.1 553 563 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.4.1.1.0 554 563 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.4.2 563 575 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.4.2.0 564 565 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.4.2.1 565 575 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.4.2.1.0 566 575 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.4.3 575 587 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.4.3.0 576 577 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.4.3.1 577 587 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.4.3.1.0 578 587 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.5 587 600 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.5.0 588 591 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.5.0.0 589 590 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.5.0.1 590 591 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.5.1 591 594 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.5.1.0 592 593 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.5.1.1 593 594 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.5.2 594 597 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.5.2.0 595 596 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.5.2.1 596 597 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.5.3 597 600 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.5.3.0 598 599 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.5.3.1 599 600 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.6 600 616 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.6.0 601 613 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.6.0.0 602 603 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.6.0.1 603 613 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.6.0.1.0 604 613 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.6.1 613 616 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.6.1.0 614 615 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.6.1.1 615 616 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.7 616 641 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.7.0 617 629 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.7.0.0 618 619 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.7.0.1 619 629 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.7.0.1.0 620 629 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.7.1 629 641 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.7.1.0 630 631 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.7.1.1 631 641 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.7.1.1.0 632 641 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.8 641 648 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.8.0 642 645 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.8.0.0 643 644 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.8.0.1 644 645 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.8.1 645 648 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.8.1.0 646 647 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.8.1.1 647 648 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.9 648 651 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.9.0 649 650 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.9.1 650 651 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.10 651 664 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.10.0 652 655 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.10.0.0 653 654 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.10.0.1 654 655 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.10.1 655 658 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.10.1.0 656 657 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.10.1.1 657 658 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.10.2 658 661 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.10.2.0 659 660 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.10.2.1 660 661 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.10.3 661 664 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.10.3.0 662 663 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.10.3.1 663 664 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.11 664 667 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.11.0 665 666 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.11.1 666 667 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.12 667 670 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.12.0 668 669 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.12.1 669 670 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.13 670 673 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.13.0 671 672 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.13.1 672 673 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.14 673 676 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.14.0 674 675 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.14.1 675 676 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.15 676 679 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.15.0 677 678 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.15.1 678 679 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.16 679 688 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.17 688 697 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.18 697 700 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.18.0 698 699 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.18.1 699 700 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.19 700 701 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.1.20 701 702 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.2 702 714 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.2.0 703 704 ACCEPT +surface-all-arms 4.1.4.0.1.4.0.1.2.1 704 705 ACCEPT +surface-all-arms 4.1.4.0.1.4.0.1.2.2 705 714 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.3 714 717 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.3.0 715 716 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.3.1 716 717 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4 717 1518 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0 718 1518 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.0 719 720 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1 720 1518 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.0 721 730 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.0.0 722 725 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.0.1 725 729 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.0.1.0 726 727 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.0.1.1 727 729 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.0.1.1.0 728 729 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.0.2 729 730 ACCEPT +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1 730 931 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.0 733 736 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.0.0 734 735 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.0.1 735 736 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.1 736 739 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.1.0 737 738 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.1.1 738 739 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.2 739 742 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.2.0 740 741 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.2.1 741 742 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.3 742 767 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.3.0 743 755 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.3.0.0 744 745 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.3.0.1 745 755 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.3.0.1.0 746 755 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.3.1 755 767 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.3.1.0 756 757 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.3.1.1 757 767 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.3.1.1.0 758 767 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.4 767 816 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.4.0 768 780 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.4.0.0 769 770 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.4.0.1 770 780 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.4.0.1.0 771 780 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.4.1 780 792 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.4.1.0 781 782 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.4.1.1 782 792 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.4.1.1.0 783 792 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.4.2 792 804 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.4.2.0 793 794 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.4.2.1 794 804 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.4.2.1.0 795 804 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.4.3 804 816 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.4.3.0 805 806 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.4.3.1 806 816 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.4.3.1.0 807 816 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.5 816 829 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.5.0 817 820 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.5.0.0 818 819 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.5.0.1 819 820 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.5.1 820 823 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.5.1.0 821 822 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.5.1.1 822 823 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.5.2 823 826 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.5.2.0 824 825 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.5.2.1 825 826 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.5.3 826 829 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.5.3.0 827 828 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.5.3.1 828 829 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.6 829 845 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.6.0 830 842 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.6.0.0 831 832 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.6.0.1 832 842 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.6.0.1.0 833 842 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.6.1 842 845 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.6.1.0 843 844 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.6.1.1 844 845 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.7 845 870 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.7.0 846 858 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.7.0.0 847 848 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.7.0.1 848 858 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.7.0.1.0 849 858 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.7.1 858 870 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.7.1.0 859 860 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.7.1.1 860 870 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.7.1.1.0 861 870 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.8 870 877 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.8.0 871 874 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.8.0.0 872 873 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.8.0.1 873 874 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.8.1 874 877 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.8.1.0 875 876 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.8.1.1 876 877 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.9 877 880 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.9.0 878 879 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.9.1 879 880 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.10 880 893 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.10.0 881 884 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.10.0.0 882 883 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.10.0.1 883 884 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.10.1 884 887 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.10.1.0 885 886 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.10.1.1 886 887 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.10.2 887 890 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.10.2.0 888 889 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.10.2.1 889 890 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.10.3 890 893 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.10.3.0 891 892 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.10.3.1 892 893 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.11 893 896 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.11.0 894 895 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.11.1 895 896 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.12 896 899 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.12.0 897 898 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.12.1 898 899 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.13 899 902 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.13.0 900 901 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.13.1 901 902 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.14 902 905 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.14.0 903 904 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.14.1 904 905 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.15 905 908 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.15.0 906 907 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.15.1 907 908 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.16 908 917 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.17 917 926 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.18 926 929 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.18.0 927 928 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.18.1 928 929 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.19 929 930 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.1.20 930 931 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.2 931 943 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.2.0 932 933 ACCEPT +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.2.1 933 934 ACCEPT +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.2.2 934 943 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.3 943 946 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.3.0 944 945 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.3.1 945 946 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4 946 1518 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0 947 1518 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.0 948 949 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1 949 1518 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.0 950 959 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.0.0 951 954 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.0.1 954 958 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.0.1.0 955 956 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.0.1.1 956 958 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.0.1.1.0 957 958 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.0.2 958 959 ACCEPT +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1 959 1160 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.0 962 965 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.0.0 963 964 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.0.1 964 965 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.1 965 968 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.1.0 966 967 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.1.1 967 968 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.2 968 971 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.2.0 969 970 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.2.1 970 971 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.3 971 996 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.3.0 972 984 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.3.0.0 973 974 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.3.0.1 974 984 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.3.0.1.0 975 984 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.3.1 984 996 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.3.1.0 985 986 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.3.1.1 986 996 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.3.1.1.0 987 996 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.4 996 1045 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.4.0 997 1009 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.4.0.0 998 999 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.4.0.1 999 1009 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.4.0.1.0 1000 1009 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.4.1 1009 1021 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.4.1.0 1010 1011 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.4.1.1 1011 1021 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.4.1.1.0 1012 1021 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.4.2 1021 1033 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.4.2.0 1022 1023 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.4.2.1 1023 1033 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.4.2.1.0 1024 1033 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.4.3 1033 1045 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.4.3.0 1034 1035 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.4.3.1 1035 1045 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.4.3.1.0 1036 1045 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.5 1045 1058 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.5.0 1046 1049 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.5.0.0 1047 1048 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.5.0.1 1048 1049 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.5.1 1049 1052 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.5.1.0 1050 1051 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.5.1.1 1051 1052 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.5.2 1052 1055 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.5.2.0 1053 1054 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.5.2.1 1054 1055 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.5.3 1055 1058 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.5.3.0 1056 1057 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.5.3.1 1057 1058 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.6 1058 1074 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.6.0 1059 1071 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.6.0.0 1060 1061 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.6.0.1 1061 1071 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.6.0.1.0 1062 1071 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.6.1 1071 1074 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.6.1.0 1072 1073 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.6.1.1 1073 1074 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.7 1074 1099 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.7.0 1075 1087 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.7.0.0 1076 1077 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.7.0.1 1077 1087 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.7.0.1.0 1078 1087 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.7.1 1087 1099 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.7.1.0 1088 1089 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.7.1.1 1089 1099 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.7.1.1.0 1090 1099 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.8 1099 1106 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.8.0 1100 1103 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.8.0.0 1101 1102 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.8.0.1 1102 1103 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.8.1 1103 1106 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.8.1.0 1104 1105 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.8.1.1 1105 1106 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.9 1106 1109 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.9.0 1107 1108 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.9.1 1108 1109 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.10 1109 1122 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.10.0 1110 1113 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.10.0.0 1111 1112 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.10.0.1 1112 1113 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.10.1 1113 1116 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.10.1.0 1114 1115 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.10.1.1 1115 1116 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.10.2 1116 1119 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.10.2.0 1117 1118 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.10.2.1 1118 1119 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.10.3 1119 1122 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.10.3.0 1120 1121 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.10.3.1 1121 1122 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.11 1122 1125 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.11.0 1123 1124 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.11.1 1124 1125 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.12 1125 1128 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.12.0 1126 1127 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.12.1 1127 1128 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.13 1128 1131 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.13.0 1129 1130 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.13.1 1130 1131 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.14 1131 1134 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.14.0 1132 1133 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.14.1 1133 1134 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.15 1134 1137 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.15.0 1135 1136 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.15.1 1136 1137 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.16 1137 1146 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.17 1146 1155 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.18 1155 1158 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.18.0 1156 1157 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.18.1 1157 1158 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.19 1158 1159 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.1.20 1159 1160 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.2 1160 1172 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.2.0 1161 1162 ACCEPT +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.2.1 1162 1163 ACCEPT +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.2.2 1163 1172 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.3 1172 1175 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.3.0 1173 1174 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.3.1 1174 1175 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4 1175 1518 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0 1176 1518 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.0 1177 1178 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1 1178 1518 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.0 1179 1205 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.0.0 1180 1188 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.0.1 1188 1196 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.0.1.0 1189 1190 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.0.1.1 1190 1196 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.0.1.1.0 1191 1196 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.0.2 1196 1205 ACCEPT +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.0.2.0 1197 1198 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.0.2.1 1198 1205 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.0.2.1.0 1199 1205 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1 1205 1433 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.0 1208 1211 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.0.0 1209 1210 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.0.1 1210 1211 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.1 1211 1214 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.1.0 1212 1213 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.1.1 1213 1214 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.2 1214 1217 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.2.0 1215 1216 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.2.1 1216 1217 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.3 1217 1242 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.3.0 1218 1230 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.3.0.0 1219 1220 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.3.0.1 1220 1230 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.3.0.1.0 1221 1230 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.3.1 1230 1242 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.3.1.0 1231 1232 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.3.1.1 1232 1242 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.3.1.1.0 1233 1242 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.4 1242 1291 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.4.0 1243 1255 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.4.0.0 1244 1245 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.4.0.1 1245 1255 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.4.0.1.0 1246 1255 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.4.1 1255 1267 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.4.1.0 1256 1257 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.4.1.1 1257 1267 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.4.1.1.0 1258 1267 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.4.2 1267 1279 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.4.2.0 1268 1269 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.4.2.1 1269 1279 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.4.2.1.0 1270 1279 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.4.3 1279 1291 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.4.3.0 1280 1281 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.4.3.1 1281 1291 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.4.3.1.0 1282 1291 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.5 1291 1304 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.5.0 1292 1295 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.5.0.0 1293 1294 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.5.0.1 1294 1295 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.5.1 1295 1298 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.5.1.0 1296 1297 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.5.1.1 1297 1298 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.5.2 1298 1301 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.5.2.0 1299 1300 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.5.2.1 1300 1301 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.5.3 1301 1304 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.5.3.0 1302 1303 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.5.3.1 1303 1304 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.6 1304 1320 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.6.0 1305 1317 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.6.0.0 1306 1307 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.6.0.1 1307 1317 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.6.0.1.0 1308 1317 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.6.1 1317 1320 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.6.1.0 1318 1319 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.6.1.1 1319 1320 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.7 1320 1345 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.7.0 1321 1333 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.7.0.0 1322 1323 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.7.0.1 1323 1333 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.7.0.1.0 1324 1333 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.7.1 1333 1345 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.7.1.0 1334 1335 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.7.1.1 1335 1345 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.7.1.1.0 1336 1345 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.8 1345 1352 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.8.0 1346 1349 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.8.0.0 1347 1348 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.8.0.1 1348 1349 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.8.1 1349 1352 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.8.1.0 1350 1351 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.8.1.1 1351 1352 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.9 1352 1355 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.9.0 1353 1354 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.9.1 1354 1355 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.10 1355 1368 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.10.0 1356 1359 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.10.0.0 1357 1358 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.10.0.1 1358 1359 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.10.1 1359 1362 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.10.1.0 1360 1361 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.10.1.1 1361 1362 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.10.2 1362 1365 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.10.2.0 1363 1364 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.10.2.1 1364 1365 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.10.3 1365 1368 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.10.3.0 1366 1367 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.10.3.1 1367 1368 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.11 1368 1371 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.11.0 1369 1370 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.11.1 1370 1371 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.12 1371 1374 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.12.0 1372 1373 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.12.1 1373 1374 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.13 1374 1377 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.13.0 1375 1376 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.13.1 1376 1377 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.14 1377 1380 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.14.0 1378 1379 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.14.1 1379 1380 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.15 1380 1383 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.15.0 1381 1382 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.15.1 1382 1383 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.16 1383 1392 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.17 1392 1401 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.18 1401 1404 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.18.0 1402 1403 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.18.1 1403 1404 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.19 1404 1429 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.19.0 1405 1417 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.19.0.0 1406 1407 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.19.0.1 1407 1417 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.19.0.1.0 1408 1417 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.19.1 1417 1429 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.19.1.0 1418 1419 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.19.1.1 1419 1429 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.19.1.1.0 1420 1429 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.20 1429 1433 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.20.0 1430 1433 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.20.0.0 1431 1432 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.20.0.1 1432 1433 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.2 1433 1479 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.2.0 1434 1452 ACCEPT +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.2.0.0 1435 1436 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.2.0.1 1436 1452 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.2.0.1.0 1437 1452 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.2.1 1452 1470 ACCEPT +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.2.1.0 1453 1461 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.2.1.0.0 1454 1455 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.2.1.0.1 1455 1461 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.2.1.0.1.0 1456 1457 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.2.1.0.1.1 1457 1458 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.2.1.0.1.2 1458 1459 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.2.1.0.1.3 1459 1461 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.2.1.1 1461 1470 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.2.2 1470 1479 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.3 1479 1482 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.3.0 1480 1481 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.3.1 1481 1482 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.4 1482 1518 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0 1483 1518 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.0 1484 1485 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1 1485 1518 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.0 1486 1502 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.0.0 1487 1497 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.0.1 1497 1501 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.0.1.0 1498 1499 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.0.1.1 1499 1501 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.0.1.1.0 1500 1501 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.0.2 1501 1502 ACCEPT +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1 1502 1510 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.0 1503 1504 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.1 1504 1510 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.1.1.0 1505 1510 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.2 1510 1515 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.3 1515 1516 REFUSE +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.4 1516 1517 ACCEPT +surface-all-arms 4.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.4.0.1.5 1517 1518 REFUSE +surface-all-arms 4.1.4.1 1518 1609 REFUSE +surface-all-arms 4.1.4.1.0 1519 1520 REFUSE +surface-all-arms 4.1.4.1.1 1520 1609 REFUSE +surface-all-arms 4.1.4.1.1.0 1521 1535 REFUSE +surface-all-arms 4.1.4.1.1.0.0 1522 1530 REFUSE +surface-all-arms 4.1.4.1.1.0.1 1530 1534 REFUSE +surface-all-arms 4.1.4.1.1.0.1.0 1531 1532 REFUSE +surface-all-arms 4.1.4.1.1.0.1.1 1532 1534 REFUSE +surface-all-arms 4.1.4.1.1.0.1.1.0 1533 1534 REFUSE +surface-all-arms 4.1.4.1.1.0.2 1534 1535 ACCEPT +surface-all-arms 4.1.4.1.1.1 1535 1600 REFUSE +surface-all-arms 4.1.4.1.1.1.0 1536 1537 REFUSE +surface-all-arms 4.1.4.1.1.1.1 1537 1600 REFUSE +surface-all-arms 4.1.4.1.1.1.1.0 1538 1581 REFUSE +surface-all-arms 4.1.4.1.1.1.1.0.0 1539 1540 REFUSE +surface-all-arms 4.1.4.1.1.1.1.0.1 1540 1581 REFUSE +surface-all-arms 4.1.4.1.1.1.1.0.1.0 1541 1552 ACCEPT +surface-all-arms 4.1.4.1.1.1.1.0.1.1 1552 1575 REFUSE +surface-all-arms 4.1.4.1.1.1.1.0.1.2 1575 1581 REFUSE +surface-all-arms 4.1.4.1.1.1.1.1 1581 1592 REFUSE +surface-all-arms 4.1.4.1.1.1.1.1.0 1582 1592 REFUSE +surface-all-arms 4.1.4.1.1.1.1.1.0.0 1583 1592 REFUSE +surface-all-arms 4.1.4.1.1.1.1.1.0.0.0 1584 1585 REFUSE +surface-all-arms 4.1.4.1.1.1.1.1.0.0.1 1585 1592 REFUSE +surface-all-arms 4.1.4.1.1.1.1.1.0.0.1.0 1586 1592 REFUSE +surface-all-arms 4.1.4.1.1.1.1.2 1592 1600 ACCEPT +surface-all-arms 4.1.4.1.1.1.1.2.0 1593 1594 REFUSE +surface-all-arms 4.1.4.1.1.1.1.2.1 1594 1600 REFUSE +surface-all-arms 4.1.4.1.1.1.1.2.1.0 1595 1597 REFUSE +surface-all-arms 4.1.4.1.1.1.1.2.1.1 1597 1600 REFUSE +surface-all-arms 4.1.4.1.1.2 1600 1606 REFUSE +surface-all-arms 4.1.4.1.1.3 1606 1607 REFUSE +surface-all-arms 4.1.4.1.1.4 1607 1608 ACCEPT +surface-all-arms 4.1.4.1.1.5 1608 1609 REFUSE +surface-all-arms 4.1.4.2 1609 1646 REFUSE +surface-all-arms 4.1.4.2.0 1610 1611 REFUSE +surface-all-arms 4.1.4.2.1 1611 1646 REFUSE +surface-all-arms 4.1.4.2.1.0 1612 1622 REFUSE +surface-all-arms 4.1.4.2.1.0.0 1613 1617 REFUSE +surface-all-arms 4.1.4.2.1.0.1 1617 1621 REFUSE +surface-all-arms 4.1.4.2.1.0.1.0 1618 1619 REFUSE +surface-all-arms 4.1.4.2.1.0.1.1 1619 1621 REFUSE +surface-all-arms 4.1.4.2.1.0.1.1.0 1620 1621 REFUSE +surface-all-arms 4.1.4.2.1.0.2 1621 1622 ACCEPT +surface-all-arms 4.1.4.2.1.1 1622 1628 REFUSE +surface-all-arms 4.1.4.2.1.2 1628 1633 REFUSE +surface-all-arms 4.1.4.2.1.3 1633 1636 REFUSE +surface-all-arms 4.1.4.2.1.3.0 1634 1635 REFUSE +surface-all-arms 4.1.4.2.1.3.1 1635 1636 REFUSE +surface-all-arms 4.1.4.2.1.4 1636 1646 REFUSE +surface-all-arms 4.1.4.2.1.4.0 1637 1638 REFUSE +surface-all-arms 4.1.4.2.1.4.1 1638 1646 REFUSE +surface-all-arms 4.1.4.2.1.4.1.0 1639 1646 REFUSE +surface-all-arms 4.1.4.3 1646 1755 REFUSE +surface-all-arms 4.1.4.3.0 1647 1648 REFUSE +surface-all-arms 4.1.4.3.1 1648 1755 REFUSE +surface-all-arms 4.1.4.3.1.0 1649 1658 REFUSE +surface-all-arms 4.1.4.3.1.0.0 1650 1653 REFUSE +surface-all-arms 4.1.4.3.1.0.1 1653 1657 REFUSE +surface-all-arms 4.1.4.3.1.0.1.0 1654 1655 REFUSE +surface-all-arms 4.1.4.3.1.0.1.1 1655 1657 REFUSE +surface-all-arms 4.1.4.3.1.0.1.1.0 1656 1657 REFUSE +surface-all-arms 4.1.4.3.1.0.2 1657 1658 ACCEPT +surface-all-arms 4.1.4.3.1.1 1658 1691 REFUSE +surface-all-arms 4.1.4.3.1.1.0 1659 1691 REFUSE +surface-all-arms 4.1.4.3.1.1.0.0 1660 1661 REFUSE +surface-all-arms 4.1.4.3.1.1.0.1 1661 1691 REFUSE +surface-all-arms 4.1.4.3.1.1.0.1.0 1662 1677 REFUSE +surface-all-arms 4.1.4.3.1.1.0.1.0.0 1663 1672 REFUSE +surface-all-arms 4.1.4.3.1.1.0.1.0.1 1672 1676 REFUSE +surface-all-arms 4.1.4.3.1.1.0.1.0.1.0 1673 1674 REFUSE +surface-all-arms 4.1.4.3.1.1.0.1.0.1.1 1674 1676 REFUSE +surface-all-arms 4.1.4.3.1.1.0.1.0.1.1.0 1675 1676 REFUSE +surface-all-arms 4.1.4.3.1.1.0.1.0.2 1676 1677 ACCEPT +surface-all-arms 4.1.4.3.1.1.0.1.1 1677 1683 REFUSE +surface-all-arms 4.1.4.3.1.1.0.1.1.0 1678 1679 REFUSE +surface-all-arms 4.1.4.3.1.1.0.1.1.1 1679 1683 REFUSE +surface-all-arms 4.1.4.3.1.1.0.1.1.1.0 1680 1683 REFUSE +surface-all-arms 4.1.4.3.1.1.0.1.2 1683 1688 REFUSE +surface-all-arms 4.1.4.3.1.1.0.1.3 1688 1689 REFUSE +surface-all-arms 4.1.4.3.1.1.0.1.4 1689 1690 ACCEPT +surface-all-arms 4.1.4.3.1.1.0.1.5 1690 1691 REFUSE +surface-all-arms 4.1.4.3.1.2 1691 1697 REFUSE +surface-all-arms 4.1.4.3.1.2.0 1692 1693 REFUSE +surface-all-arms 4.1.4.3.1.2.1 1693 1697 REFUSE +surface-all-arms 4.1.4.3.1.2.1.0 1694 1697 REFUSE +surface-all-arms 4.1.4.3.1.3 1697 1755 REFUSE +surface-all-arms 4.1.4.3.1.3.0 1698 1699 REFUSE +surface-all-arms 4.1.4.3.1.3.1 1699 1755 REFUSE +surface-all-arms 4.1.4.3.1.3.1.0 1700 1743 REFUSE +surface-all-arms 4.1.4.3.1.3.1.0.0 1701 1702 REFUSE +surface-all-arms 4.1.4.3.1.3.1.0.1 1702 1743 REFUSE +surface-all-arms 4.1.4.3.1.3.1.0.1.0 1703 1714 ACCEPT +surface-all-arms 4.1.4.3.1.3.1.0.1.1 1714 1737 REFUSE +surface-all-arms 4.1.4.3.1.3.1.0.1.2 1737 1743 REFUSE +surface-all-arms 4.1.4.3.1.3.1.1 1743 1754 REFUSE +surface-all-arms 4.1.4.3.1.3.1.1.0 1744 1754 REFUSE +surface-all-arms 4.1.4.3.1.3.1.1.0.0 1745 1754 REFUSE +surface-all-arms 4.1.4.3.1.3.1.1.0.0.0 1746 1747 REFUSE +surface-all-arms 4.1.4.3.1.3.1.1.0.0.1 1747 1754 REFUSE +surface-all-arms 4.1.4.3.1.3.1.1.0.0.1.0 1748 1754 REFUSE +surface-all-arms 4.1.4.3.1.3.1.2 1754 1755 ACCEPT +surface-all-arms 4.1.4.4 1755 1837 REFUSE +surface-all-arms 4.1.4.4.0 1756 1757 REFUSE +surface-all-arms 4.1.4.4.1 1757 1837 REFUSE +surface-all-arms 4.1.4.4.1.0 1758 1769 REFUSE +surface-all-arms 4.1.4.4.1.0.0 1759 1764 REFUSE +surface-all-arms 4.1.4.4.1.0.1 1764 1768 REFUSE +surface-all-arms 4.1.4.4.1.0.1.0 1765 1766 REFUSE +surface-all-arms 4.1.4.4.1.0.1.1 1766 1768 REFUSE +surface-all-arms 4.1.4.4.1.0.1.1.0 1767 1768 REFUSE +surface-all-arms 4.1.4.4.1.0.2 1768 1769 ACCEPT +surface-all-arms 4.1.4.4.1.1 1769 1827 REFUSE +surface-all-arms 4.1.4.4.1.1.0 1770 1771 REFUSE +surface-all-arms 4.1.4.4.1.1.1 1771 1827 REFUSE +surface-all-arms 4.1.4.4.1.1.1.0 1772 1815 REFUSE +surface-all-arms 4.1.4.4.1.1.1.0.0 1773 1774 REFUSE +surface-all-arms 4.1.4.4.1.1.1.0.1 1774 1815 REFUSE +surface-all-arms 4.1.4.4.1.1.1.0.1.0 1775 1786 ACCEPT +surface-all-arms 4.1.4.4.1.1.1.0.1.1 1786 1809 REFUSE +surface-all-arms 4.1.4.4.1.1.1.0.1.2 1809 1815 REFUSE +surface-all-arms 4.1.4.4.1.1.1.1 1815 1826 REFUSE +surface-all-arms 4.1.4.4.1.1.1.1.0 1816 1826 REFUSE +surface-all-arms 4.1.4.4.1.1.1.1.0.0 1817 1826 REFUSE +surface-all-arms 4.1.4.4.1.1.1.1.0.0.0 1818 1819 REFUSE +surface-all-arms 4.1.4.4.1.1.1.1.0.0.1 1819 1826 REFUSE +surface-all-arms 4.1.4.4.1.1.1.1.0.0.1.0 1820 1826 REFUSE +surface-all-arms 4.1.4.4.1.1.1.2 1826 1827 ACCEPT +surface-all-arms 4.1.4.4.1.2 1827 1837 REFUSE +surface-all-arms 4.1.4.4.1.2.0 1828 1829 REFUSE +surface-all-arms 4.1.4.4.1.2.1 1829 1837 REFUSE +surface-all-arms 4.1.4.4.1.2.1.0 1830 1837 REFUSE +surface-all-arms 4.1.4.5 1837 1961 REFUSE +surface-all-arms 4.1.4.5.0 1838 1839 REFUSE +surface-all-arms 4.1.4.5.1 1839 1961 REFUSE +surface-all-arms 4.1.4.5.1.0 1840 1852 REFUSE +surface-all-arms 4.1.4.5.1.0.0 1841 1847 REFUSE +surface-all-arms 4.1.4.5.1.0.1 1847 1851 REFUSE +surface-all-arms 4.1.4.5.1.0.1.0 1848 1849 REFUSE +surface-all-arms 4.1.4.5.1.0.1.1 1849 1851 REFUSE +surface-all-arms 4.1.4.5.1.0.1.1.0 1850 1851 REFUSE +surface-all-arms 4.1.4.5.1.0.2 1851 1852 ACCEPT +surface-all-arms 4.1.4.5.1.1 1852 1861 REFUSE +surface-all-arms 4.1.4.5.1.2 1861 1870 REFUSE +surface-all-arms 4.1.4.5.1.3 1870 1879 REFUSE +surface-all-arms 4.1.4.5.1.4 1879 1948 REFUSE +surface-all-arms 4.1.4.5.1.4.0 1880 1881 REFUSE +surface-all-arms 4.1.4.5.1.4.1 1881 1948 REFUSE +surface-all-arms 4.1.4.5.1.4.1.0 1882 1925 REFUSE +surface-all-arms 4.1.4.5.1.4.1.0.0 1883 1884 REFUSE +surface-all-arms 4.1.4.5.1.4.1.0.1 1884 1925 REFUSE +surface-all-arms 4.1.4.5.1.4.1.0.1.0 1885 1896 ACCEPT +surface-all-arms 4.1.4.5.1.4.1.0.1.1 1896 1919 REFUSE +surface-all-arms 4.1.4.5.1.4.1.0.1.2 1919 1925 REFUSE +surface-all-arms 4.1.4.5.1.4.1.1 1925 1940 REFUSE +surface-all-arms 4.1.4.5.1.4.1.1.0 1926 1940 REFUSE +surface-all-arms 4.1.4.5.1.4.1.1.0.0 1927 1936 REFUSE +surface-all-arms 4.1.4.5.1.4.1.1.0.0.0 1928 1929 REFUSE +surface-all-arms 4.1.4.5.1.4.1.1.0.0.1 1929 1936 REFUSE +surface-all-arms 4.1.4.5.1.4.1.1.0.0.1.0 1930 1936 REFUSE +surface-all-arms 4.1.4.5.1.4.1.1.0.1 1936 1940 REFUSE +surface-all-arms 4.1.4.5.1.4.1.1.0.1.0 1937 1938 REFUSE +surface-all-arms 4.1.4.5.1.4.1.1.0.1.1 1938 1940 REFUSE +surface-all-arms 4.1.4.5.1.4.1.1.0.1.1.0 1939 1940 REFUSE +surface-all-arms 4.1.4.5.1.4.1.2 1940 1948 ACCEPT +surface-all-arms 4.1.4.5.1.4.1.2.0 1941 1942 REFUSE +surface-all-arms 4.1.4.5.1.4.1.2.1 1942 1948 REFUSE +surface-all-arms 4.1.4.5.1.4.1.2.1.0 1943 1944 REFUSE +surface-all-arms 4.1.4.5.1.4.1.2.1.1 1944 1945 REFUSE +surface-all-arms 4.1.4.5.1.4.1.2.1.2 1945 1948 ACCEPT +surface-all-arms 4.1.4.5.1.5 1948 1961 REFUSE +surface-all-arms 4.1.4.5.1.5.0 1949 1950 REFUSE +surface-all-arms 4.1.4.5.1.5.1 1950 1961 REFUSE +surface-all-arms 4.1.4.5.1.5.1.0 1951 1961 REFUSE +surface-all-arms 4.1.4.6 1961 2014 REFUSE +surface-all-arms 4.1.4.6.0 1962 1963 REFUSE +surface-all-arms 4.1.4.6.1 1963 2014 REFUSE +surface-all-arms 4.1.4.6.1.0 1964 1981 REFUSE +surface-all-arms 4.1.4.6.1.0.0 1965 1976 REFUSE +surface-all-arms 4.1.4.6.1.0.1 1976 1980 REFUSE +surface-all-arms 4.1.4.6.1.0.1.0 1977 1978 REFUSE +surface-all-arms 4.1.4.6.1.0.1.1 1978 1980 REFUSE +surface-all-arms 4.1.4.6.1.0.1.1.0 1979 1980 REFUSE +surface-all-arms 4.1.4.6.1.0.2 1980 1981 ACCEPT +surface-all-arms 4.1.4.6.1.1 1981 1982 REFUSE +surface-all-arms 4.1.4.6.1.2 1982 1985 REFUSE +surface-all-arms 4.1.4.6.1.2.0 1983 1984 REFUSE +surface-all-arms 4.1.4.6.1.2.1 1984 1985 REFUSE +surface-all-arms 4.1.4.6.1.3 1985 1993 REFUSE +surface-all-arms 4.1.4.6.1.3.0 1986 1987 REFUSE +surface-all-arms 4.1.4.6.1.3.1 1987 1993 REFUSE +surface-all-arms 4.1.4.6.1.3.1.0 1988 1993 REFUSE +surface-all-arms 4.1.4.6.1.4 1993 2004 REFUSE +surface-all-arms 4.1.4.6.1.4.0 1994 1995 REFUSE +surface-all-arms 4.1.4.6.1.4.1 1995 2004 REFUSE +surface-all-arms 4.1.4.6.1.4.1.0 1996 2004 REFUSE +surface-all-arms 4.1.4.6.1.5 2004 2014 REFUSE +surface-all-arms 4.1.4.6.1.5.0 2005 2006 REFUSE +surface-all-arms 4.1.4.6.1.5.1 2006 2014 REFUSE +surface-all-arms 4.1.4.6.1.5.1.0 2007 2014 REFUSE +surface-all-arms 4.1.4.7 2014 2070 REFUSE +surface-all-arms 4.1.4.7.0 2015 2016 REFUSE +surface-all-arms 4.1.4.7.1 2016 2070 REFUSE +surface-all-arms 4.1.4.7.1.0 2017 2035 REFUSE +surface-all-arms 4.1.4.7.1.0.0 2018 2030 REFUSE +surface-all-arms 4.1.4.7.1.0.1 2030 2034 REFUSE +surface-all-arms 4.1.4.7.1.0.1.0 2031 2032 REFUSE +surface-all-arms 4.1.4.7.1.0.1.1 2032 2034 REFUSE +surface-all-arms 4.1.4.7.1.0.1.1.0 2033 2034 REFUSE +surface-all-arms 4.1.4.7.1.0.2 2034 2035 ACCEPT +surface-all-arms 4.1.4.7.1.1 2035 2036 REFUSE +surface-all-arms 4.1.4.7.1.2 2036 2039 REFUSE +surface-all-arms 4.1.4.7.1.2.0 2037 2038 REFUSE +surface-all-arms 4.1.4.7.1.2.1 2038 2039 REFUSE +surface-all-arms 4.1.4.7.1.3 2039 2048 REFUSE +surface-all-arms 4.1.4.7.1.3.0 2040 2041 REFUSE +surface-all-arms 4.1.4.7.1.3.1 2041 2048 REFUSE +surface-all-arms 4.1.4.7.1.3.1.0 2042 2048 REFUSE +surface-all-arms 4.1.4.7.1.4 2048 2059 REFUSE +surface-all-arms 4.1.4.7.1.4.0 2049 2050 REFUSE +surface-all-arms 4.1.4.7.1.4.1 2050 2059 REFUSE +surface-all-arms 4.1.4.7.1.4.1.0 2051 2059 REFUSE +surface-all-arms 4.1.4.7.1.5 2059 2070 REFUSE +surface-all-arms 4.1.4.7.1.5.0 2060 2061 REFUSE +surface-all-arms 4.1.4.7.1.5.1 2061 2070 REFUSE +surface-all-arms 4.1.4.7.1.5.1.0 2062 2070 REFUSE +surface-all-arms 4.1.4.8 2070 2161 REFUSE +surface-all-arms 4.1.4.8.0 2071 2072 REFUSE +surface-all-arms 4.1.4.8.1 2072 2161 REFUSE +surface-all-arms 4.1.4.8.1.0 2073 2084 REFUSE +surface-all-arms 4.1.4.8.1.0.0 2074 2079 REFUSE +surface-all-arms 4.1.4.8.1.0.1 2079 2083 REFUSE +surface-all-arms 4.1.4.8.1.0.1.0 2080 2081 REFUSE +surface-all-arms 4.1.4.8.1.0.1.1 2081 2083 REFUSE +surface-all-arms 4.1.4.8.1.0.1.1.0 2082 2083 REFUSE +surface-all-arms 4.1.4.8.1.0.2 2083 2084 ACCEPT +surface-all-arms 4.1.4.8.1.1 2084 2097 REFUSE +surface-all-arms 4.1.4.8.1.1.0 2085 2086 REFUSE +surface-all-arms 4.1.4.8.1.1.1 2086 2097 REFUSE +surface-all-arms 4.1.4.8.1.1.1.0 2087 2097 REFUSE +surface-all-arms 4.1.4.8.1.1.1.0.0 2088 2097 REFUSE +surface-all-arms 4.1.4.8.1.1.1.0.0.0 2089 2091 REFUSE +surface-all-arms 4.1.4.8.1.1.1.0.0.1 2091 2097 REFUSE +surface-all-arms 4.1.4.8.1.2 2097 2153 REFUSE +surface-all-arms 4.1.4.8.1.2.0 2098 2141 REFUSE +surface-all-arms 4.1.4.8.1.2.0.0 2099 2100 REFUSE +surface-all-arms 4.1.4.8.1.2.0.1 2100 2141 REFUSE +surface-all-arms 4.1.4.8.1.2.0.1.0 2101 2112 ACCEPT +surface-all-arms 4.1.4.8.1.2.0.1.1 2112 2135 REFUSE +surface-all-arms 4.1.4.8.1.2.0.1.2 2135 2141 REFUSE +surface-all-arms 4.1.4.8.1.2.1 2141 2152 REFUSE +surface-all-arms 4.1.4.8.1.2.1.0 2142 2152 REFUSE +surface-all-arms 4.1.4.8.1.2.1.0.0 2143 2152 REFUSE +surface-all-arms 4.1.4.8.1.2.1.0.0.0 2144 2145 REFUSE +surface-all-arms 4.1.4.8.1.2.1.0.0.1 2145 2152 REFUSE +surface-all-arms 4.1.4.8.1.2.1.0.0.1.0 2146 2152 REFUSE +surface-all-arms 4.1.4.8.1.2.2 2152 2153 ACCEPT +surface-all-arms 4.1.4.8.1.3 2153 2161 REFUSE +surface-all-arms 4.1.4.8.1.3.0 2154 2155 REFUSE +surface-all-arms 4.1.4.8.1.3.1 2155 2161 REFUSE +surface-all-arms 4.1.4.8.1.3.1.0 2156 2161 REFUSE +surface-all-arms 4.1.4.9 2161 2294 REFUSE +surface-all-arms 4.1.4.9.0 2162 2163 REFUSE +surface-all-arms 4.1.4.9.1 2163 2294 REFUSE +surface-all-arms 4.1.4.9.1.0 2164 2181 REFUSE +surface-all-arms 4.1.4.9.1.0.0 2165 2176 REFUSE +surface-all-arms 4.1.4.9.1.0.1 2176 2180 REFUSE +surface-all-arms 4.1.4.9.1.0.1.0 2177 2178 REFUSE +surface-all-arms 4.1.4.9.1.0.1.1 2178 2180 REFUSE +surface-all-arms 4.1.4.9.1.0.1.1.0 2179 2180 REFUSE +surface-all-arms 4.1.4.9.1.0.2 2180 2181 ACCEPT +surface-all-arms 4.1.4.9.1.1 2181 2271 REFUSE +surface-all-arms 4.1.4.9.1.1.0 2182 2183 REFUSE +surface-all-arms 4.1.4.9.1.1.1 2183 2271 REFUSE +surface-all-arms 4.1.4.9.1.1.1.0 2184 2253 REFUSE +surface-all-arms 4.1.4.9.1.1.1.0.0 2185 2186 REFUSE +surface-all-arms 4.1.4.9.1.1.1.0.1 2186 2253 REFUSE +surface-all-arms 4.1.4.9.1.1.1.0.1.0 2187 2230 REFUSE +surface-all-arms 4.1.4.9.1.1.1.0.1.0.0 2188 2189 REFUSE +surface-all-arms 4.1.4.9.1.1.1.0.1.0.1 2189 2230 REFUSE +surface-all-arms 4.1.4.9.1.1.1.0.1.0.1.0 2190 2201 ACCEPT +surface-all-arms 4.1.4.9.1.1.1.0.1.0.1.1 2201 2224 REFUSE +surface-all-arms 4.1.4.9.1.1.1.0.1.0.1.2 2224 2230 REFUSE +surface-all-arms 4.1.4.9.1.1.1.0.1.1 2230 2245 REFUSE +surface-all-arms 4.1.4.9.1.1.1.0.1.1.0 2231 2245 REFUSE +surface-all-arms 4.1.4.9.1.1.1.0.1.1.0.0 2232 2241 REFUSE +surface-all-arms 4.1.4.9.1.1.1.0.1.1.0.0.0 2233 2234 REFUSE +surface-all-arms 4.1.4.9.1.1.1.0.1.1.0.0.1 2234 2241 REFUSE +surface-all-arms 4.1.4.9.1.1.1.0.1.1.0.0.1.0 2235 2241 REFUSE +surface-all-arms 4.1.4.9.1.1.1.0.1.1.0.1 2241 2245 REFUSE +surface-all-arms 4.1.4.9.1.1.1.0.1.1.0.1.0 2242 2243 REFUSE +surface-all-arms 4.1.4.9.1.1.1.0.1.1.0.1.1 2243 2245 REFUSE +surface-all-arms 4.1.4.9.1.1.1.0.1.1.0.1.1.0 2244 2245 REFUSE +surface-all-arms 4.1.4.9.1.1.1.0.1.2 2245 2253 ACCEPT +surface-all-arms 4.1.4.9.1.1.1.0.1.2.0 2246 2247 REFUSE +surface-all-arms 4.1.4.9.1.1.1.0.1.2.1 2247 2253 REFUSE +surface-all-arms 4.1.4.9.1.1.1.0.1.2.1.0 2248 2249 REFUSE +surface-all-arms 4.1.4.9.1.1.1.0.1.2.1.1 2249 2250 REFUSE +surface-all-arms 4.1.4.9.1.1.1.0.1.2.1.2 2250 2253 ACCEPT +surface-all-arms 4.1.4.9.1.1.1.1 2253 2261 REFUSE +surface-all-arms 4.1.4.9.1.1.1.1.0 2254 2261 REFUSE +surface-all-arms 4.1.4.9.1.1.1.1.0.0 2255 2261 REFUSE +surface-all-arms 4.1.4.9.1.1.1.1.0.0.0 2256 2257 REFUSE +surface-all-arms 4.1.4.9.1.1.1.1.0.0.1 2257 2261 REFUSE +surface-all-arms 4.1.4.9.1.1.1.1.0.0.1.0 2258 2261 REFUSE +surface-all-arms 4.1.4.9.1.1.1.2 2261 2271 REFUSE +surface-all-arms 4.1.4.9.1.1.1.2.0 2262 2271 REFUSE +surface-all-arms 4.1.4.9.1.1.1.2.0.0 2263 2271 REFUSE +surface-all-arms 4.1.4.9.1.1.1.2.0.0.0 2264 2265 REFUSE +surface-all-arms 4.1.4.9.1.1.1.2.0.0.1 2265 2271 REFUSE +surface-all-arms 4.1.4.9.1.1.1.2.0.0.1.0 2266 2271 REFUSE +surface-all-arms 4.1.4.9.1.2 2271 2286 REFUSE +surface-all-arms 4.1.4.9.1.2.0 2272 2275 REFUSE +surface-all-arms 4.1.4.9.1.2.0.0 2273 2274 REFUSE +surface-all-arms 4.1.4.9.1.2.0.1 2274 2275 REFUSE +surface-all-arms 4.1.4.9.1.2.1 2275 2285 REFUSE +surface-all-arms 4.1.4.9.1.2.1.0 2276 2285 REFUSE +surface-all-arms 4.1.4.9.1.2.1.0.0 2277 2285 REFUSE +surface-all-arms 4.1.4.9.1.2.1.0.0.0 2278 2279 REFUSE +surface-all-arms 4.1.4.9.1.2.1.0.0.1 2279 2285 REFUSE +surface-all-arms 4.1.4.9.1.2.1.0.0.1.0 2280 2285 REFUSE +surface-all-arms 4.1.4.9.1.2.2 2285 2286 ACCEPT +surface-all-arms 4.1.4.9.1.3 2286 2294 REFUSE +surface-all-arms 4.1.4.9.1.3.0 2287 2288 REFUSE +surface-all-arms 4.1.4.9.1.3.1 2288 2294 REFUSE +surface-all-arms 4.1.4.9.1.3.1.0 2289 2294 REFUSE +surface-all-arms 4.1.4.10 2294 2391 REFUSE +surface-all-arms 4.1.4.10.0 2295 2296 REFUSE +surface-all-arms 4.1.4.10.1 2296 2391 REFUSE +surface-all-arms 4.1.4.10.1.0 2297 2308 REFUSE +surface-all-arms 4.1.4.10.1.0.0 2298 2303 REFUSE +surface-all-arms 4.1.4.10.1.0.1 2303 2307 REFUSE +surface-all-arms 4.1.4.10.1.0.1.0 2304 2305 REFUSE +surface-all-arms 4.1.4.10.1.0.1.1 2305 2307 REFUSE +surface-all-arms 4.1.4.10.1.0.1.1.0 2306 2307 REFUSE +surface-all-arms 4.1.4.10.1.0.2 2307 2308 ACCEPT +surface-all-arms 4.1.4.10.1.1 2308 2340 REFUSE +surface-all-arms 4.1.4.10.1.1.0 2309 2310 REFUSE +surface-all-arms 4.1.4.10.1.1.1 2310 2340 REFUSE +surface-all-arms 4.1.4.10.1.1.1.0 2311 2312 ACCEPT +surface-all-arms 4.1.4.10.1.1.1.1 2312 2335 REFUSE +surface-all-arms 4.1.4.10.1.1.1.2 2335 2340 REFUSE +surface-all-arms 4.1.4.10.1.2 2340 2348 REFUSE +surface-all-arms 4.1.4.10.1.2.0 2341 2348 REFUSE +surface-all-arms 4.1.4.10.1.2.0.0 2342 2348 REFUSE +surface-all-arms 4.1.4.10.1.2.0.0.0 2343 2344 REFUSE +surface-all-arms 4.1.4.10.1.2.0.0.1 2344 2348 REFUSE +surface-all-arms 4.1.4.10.1.2.0.0.1.0 2345 2348 REFUSE +surface-all-arms 4.1.4.10.1.3 2348 2391 REFUSE +surface-all-arms 4.1.4.10.1.3.0 2349 2350 REFUSE +surface-all-arms 4.1.4.10.1.3.1 2350 2391 REFUSE +surface-all-arms 4.1.4.10.1.3.1.0 2351 2366 REFUSE +surface-all-arms 4.1.4.10.1.3.1.0.0 2352 2361 REFUSE +surface-all-arms 4.1.4.10.1.3.1.0.1 2361 2365 REFUSE +surface-all-arms 4.1.4.10.1.3.1.0.1.0 2362 2363 REFUSE +surface-all-arms 4.1.4.10.1.3.1.0.1.1 2363 2365 REFUSE +surface-all-arms 4.1.4.10.1.3.1.0.1.1.0 2364 2365 REFUSE +surface-all-arms 4.1.4.10.1.3.1.0.2 2365 2366 ACCEPT +surface-all-arms 4.1.4.10.1.3.1.1 2366 2383 REFUSE +surface-all-arms 4.1.4.10.1.3.1.1.0 2367 2368 REFUSE +surface-all-arms 4.1.4.10.1.3.1.1.1 2368 2383 REFUSE +surface-all-arms 4.1.4.10.1.3.1.1.1.0 2369 2372 REFUSE +surface-all-arms 4.1.4.10.1.3.1.1.1.0.0 2370 2371 REFUSE +surface-all-arms 4.1.4.10.1.3.1.1.1.0.1 2371 2372 REFUSE +surface-all-arms 4.1.4.10.1.3.1.1.1.1 2372 2382 REFUSE +surface-all-arms 4.1.4.10.1.3.1.1.1.1.0 2373 2382 REFUSE +surface-all-arms 4.1.4.10.1.3.1.1.1.1.0.0 2374 2382 REFUSE +surface-all-arms 4.1.4.10.1.3.1.1.1.1.0.0.0 2375 2376 REFUSE +surface-all-arms 4.1.4.10.1.3.1.1.1.1.0.0.1 2376 2382 REFUSE +surface-all-arms 4.1.4.10.1.3.1.1.1.1.0.0.1.0 2377 2382 REFUSE +surface-all-arms 4.1.4.10.1.3.1.1.1.2 2382 2383 ACCEPT +surface-all-arms 4.1.4.10.1.3.1.2 2383 2388 REFUSE +surface-all-arms 4.1.4.10.1.3.1.3 2388 2389 REFUSE +surface-all-arms 4.1.4.10.1.3.1.4 2389 2390 ACCEPT +surface-all-arms 4.1.4.10.1.3.1.5 2390 2391 REFUSE +surface-all-arms 4.1.4.11 2391 2456 REFUSE +surface-all-arms 4.1.4.11.0 2392 2393 REFUSE +surface-all-arms 4.1.4.11.1 2393 2456 REFUSE +surface-all-arms 4.1.4.11.1.0 2394 2405 REFUSE +surface-all-arms 4.1.4.11.1.0.0 2395 2400 REFUSE +surface-all-arms 4.1.4.11.1.0.1 2400 2404 REFUSE +surface-all-arms 4.1.4.11.1.0.1.0 2401 2402 REFUSE +surface-all-arms 4.1.4.11.1.0.1.1 2402 2404 REFUSE +surface-all-arms 4.1.4.11.1.0.1.1.0 2403 2404 REFUSE +surface-all-arms 4.1.4.11.1.0.2 2404 2405 ACCEPT +surface-all-arms 4.1.4.11.1.1 2405 2411 REFUSE +surface-all-arms 4.1.4.11.1.1.0 2406 2407 REFUSE +surface-all-arms 4.1.4.11.1.1.1 2407 2411 REFUSE +surface-all-arms 4.1.4.11.1.1.1.0 2408 2411 REFUSE +surface-all-arms 4.1.4.11.1.2 2411 2412 REFUSE +surface-all-arms 4.1.4.11.1.3 2412 2421 REFUSE +surface-all-arms 4.1.4.11.1.3.0 2413 2414 REFUSE +surface-all-arms 4.1.4.11.1.3.1 2414 2421 REFUSE +surface-all-arms 4.1.4.11.1.3.1.0 2415 2421 REFUSE +surface-all-arms 4.1.4.11.1.4 2421 2456 REFUSE +surface-all-arms 4.1.4.11.1.4.0 2422 2456 REFUSE +surface-all-arms 4.1.4.11.1.4.0.0 2423 2424 REFUSE +surface-all-arms 4.1.4.11.1.4.0.1 2424 2456 REFUSE +surface-all-arms 4.1.4.11.1.4.0.1.0 2425 2441 REFUSE +surface-all-arms 4.1.4.11.1.4.0.1.0.0 2426 2436 REFUSE +surface-all-arms 4.1.4.11.1.4.0.1.0.1 2436 2440 REFUSE +surface-all-arms 4.1.4.11.1.4.0.1.0.1.0 2437 2438 REFUSE +surface-all-arms 4.1.4.11.1.4.0.1.0.1.1 2438 2440 REFUSE +surface-all-arms 4.1.4.11.1.4.0.1.0.1.1.0 2439 2440 REFUSE +surface-all-arms 4.1.4.11.1.4.0.1.0.2 2440 2441 ACCEPT +surface-all-arms 4.1.4.11.1.4.0.1.1 2441 2448 REFUSE +surface-all-arms 4.1.4.11.1.4.0.1.1.0 2442 2443 REFUSE +surface-all-arms 4.1.4.11.1.4.0.1.1.1 2443 2448 REFUSE +surface-all-arms 4.1.4.11.1.4.0.1.1.1.0 2444 2448 REFUSE +surface-all-arms 4.1.4.11.1.4.0.1.2 2448 2453 REFUSE +surface-all-arms 4.1.4.11.1.4.0.1.3 2453 2454 REFUSE +surface-all-arms 4.1.4.11.1.4.0.1.4 2454 2455 ACCEPT +surface-all-arms 4.1.4.11.1.4.0.1.5 2455 2456 REFUSE +surface-all-arms 4.1.4.12 2456 2486 REFUSE +surface-all-arms 4.1.4.12.0 2457 2458 REFUSE +surface-all-arms 4.1.4.12.1 2458 2486 REFUSE +surface-all-arms 4.1.4.12.1.0 2459 2472 REFUSE +surface-all-arms 4.1.4.12.1.0.0 2460 2467 REFUSE +surface-all-arms 4.1.4.12.1.0.1 2467 2471 REFUSE +surface-all-arms 4.1.4.12.1.0.1.0 2468 2469 REFUSE +surface-all-arms 4.1.4.12.1.0.1.1 2469 2471 REFUSE +surface-all-arms 4.1.4.12.1.0.1.1.0 2470 2471 REFUSE +surface-all-arms 4.1.4.12.1.0.2 2471 2472 ACCEPT +surface-all-arms 4.1.4.12.1.1 2472 2475 REFUSE +surface-all-arms 4.1.4.12.1.1.0 2473 2474 REFUSE +surface-all-arms 4.1.4.12.1.1.1 2474 2475 REFUSE +surface-all-arms 4.1.4.12.1.2 2475 2476 REFUSE +surface-all-arms 4.1.4.12.1.3 2476 2485 REFUSE +surface-all-arms 4.1.4.12.1.3.0 2477 2478 REFUSE +surface-all-arms 4.1.4.12.1.3.1 2478 2485 REFUSE +surface-all-arms 4.1.4.12.1.3.1.0 2479 2485 REFUSE +surface-all-arms 4.1.4.12.1.4 2485 2486 REFUSE +surface-all-arms 4.1.4.13 2486 2584 REFUSE +surface-all-arms 4.1.4.13.0 2487 2488 REFUSE +surface-all-arms 4.1.4.13.1 2488 2584 REFUSE +surface-all-arms 4.1.4.13.1.0 2489 2501 REFUSE +surface-all-arms 4.1.4.13.1.0.0 2490 2496 REFUSE +surface-all-arms 4.1.4.13.1.0.1 2496 2500 REFUSE +surface-all-arms 4.1.4.13.1.0.1.0 2497 2498 REFUSE +surface-all-arms 4.1.4.13.1.0.1.1 2498 2500 REFUSE +surface-all-arms 4.1.4.13.1.0.1.1.0 2499 2500 REFUSE +surface-all-arms 4.1.4.13.1.0.2 2500 2501 ACCEPT +surface-all-arms 4.1.4.13.1.1 2501 2561 REFUSE +surface-all-arms 4.1.4.13.1.1.0 2502 2545 REFUSE +surface-all-arms 4.1.4.13.1.1.0.0 2503 2504 REFUSE +surface-all-arms 4.1.4.13.1.1.0.1 2504 2545 REFUSE +surface-all-arms 4.1.4.13.1.1.0.1.0 2505 2516 ACCEPT +surface-all-arms 4.1.4.13.1.1.0.1.1 2516 2539 REFUSE +surface-all-arms 4.1.4.13.1.1.0.1.2 2539 2545 REFUSE +surface-all-arms 4.1.4.13.1.1.1 2545 2558 REFUSE +surface-all-arms 4.1.4.13.1.1.1.0 2546 2558 REFUSE +surface-all-arms 4.1.4.13.1.1.1.0.0 2547 2558 REFUSE +surface-all-arms 4.1.4.13.1.1.1.0.0.0 2548 2549 REFUSE +surface-all-arms 4.1.4.13.1.1.1.0.0.1 2549 2558 REFUSE +surface-all-arms 4.1.4.13.1.1.1.0.0.1.0 2550 2558 REFUSE +surface-all-arms 4.1.4.13.1.1.2 2558 2561 ACCEPT +surface-all-arms 4.1.4.13.1.1.2.0 2559 2560 REFUSE +surface-all-arms 4.1.4.13.1.1.2.1 2560 2561 REFUSE +surface-all-arms 4.1.4.13.1.2 2561 2564 REFUSE +surface-all-arms 4.1.4.13.1.2.0 2562 2563 REFUSE +surface-all-arms 4.1.4.13.1.2.1 2563 2564 REFUSE +surface-all-arms 4.1.4.13.1.3 2564 2573 ACCEPT +surface-all-arms 4.1.4.13.1.4 2573 2574 ACCEPT +surface-all-arms 4.1.4.13.1.5 2574 2575 ACCEPT +surface-all-arms 4.1.4.13.1.6 2575 2584 ACCEPT +surface-all-arms 4.1.4.14 2584 2637 REFUSE +surface-all-arms 4.1.4.14.0 2585 2586 REFUSE +surface-all-arms 4.1.4.14.1 2586 2637 REFUSE +surface-all-arms 4.1.4.14.1.0 2587 2602 REFUSE +surface-all-arms 4.1.4.14.1.0.0 2588 2597 REFUSE +surface-all-arms 4.1.4.14.1.0.1 2597 2601 REFUSE +surface-all-arms 4.1.4.14.1.0.1.0 2598 2599 REFUSE +surface-all-arms 4.1.4.14.1.0.1.1 2599 2601 REFUSE +surface-all-arms 4.1.4.14.1.0.1.1.0 2600 2601 REFUSE +surface-all-arms 4.1.4.14.1.0.2 2601 2602 ACCEPT +surface-all-arms 4.1.4.14.1.1 2602 2614 REFUSE +surface-all-arms 4.1.4.14.1.2 2614 2619 REFUSE +surface-all-arms 4.1.4.14.1.3 2619 2628 REFUSE +surface-all-arms 4.1.4.14.1.4 2628 2637 REFUSE +surface-all-arms 4.1.4.15 2637 2682 REFUSE +surface-all-arms 4.1.4.15.0 2638 2639 REFUSE +surface-all-arms 4.1.4.15.1 2639 2682 REFUSE +surface-all-arms 4.1.4.15.1.0 2640 2649 REFUSE +surface-all-arms 4.1.4.15.1.0.0 2641 2644 REFUSE +surface-all-arms 4.1.4.15.1.0.1 2644 2648 REFUSE +surface-all-arms 4.1.4.15.1.0.1.0 2645 2646 REFUSE +surface-all-arms 4.1.4.15.1.0.1.1 2646 2648 REFUSE +surface-all-arms 4.1.4.15.1.0.1.1.0 2647 2648 REFUSE +surface-all-arms 4.1.4.15.1.0.2 2648 2649 ACCEPT +surface-all-arms 4.1.4.15.1.1 2649 2671 REFUSE +surface-all-arms 4.1.4.15.1.1.0 2650 2660 REFUSE +surface-all-arms 4.1.4.15.1.1.1 2660 2670 REFUSE +surface-all-arms 4.1.4.15.1.1.2 2670 2671 REFUSE +surface-all-arms 4.1.4.15.1.2 2671 2682 REFUSE +surface-all-arms 4.1.4.15.1.2.0 2672 2682 REFUSE +surface-all-arms 4.1.4.15.1.2.0.0 2673 2677 REFUSE +surface-all-arms 4.1.4.15.1.2.0.1 2677 2682 REFUSE +surface-all-arms 4.1.4.15.1.2.0.1.0 2678 2679 REFUSE +surface-all-arms 4.1.4.15.1.2.0.1.1 2679 2682 REFUSE +surface-all-arms 4.1.4.15.1.2.0.1.1.0 2680 2682 REFUSE +surface-all-arms 4.1.4.16 2682 2764 REFUSE +surface-all-arms 4.1.4.16.0 2683 2684 REFUSE +surface-all-arms 4.1.4.16.1 2684 2764 REFUSE +surface-all-arms 4.1.4.16.1.0 2685 2702 REFUSE +surface-all-arms 4.1.4.16.1.0.0 2686 2697 REFUSE +surface-all-arms 4.1.4.16.1.0.1 2697 2701 REFUSE +surface-all-arms 4.1.4.16.1.0.1.0 2698 2699 REFUSE +surface-all-arms 4.1.4.16.1.0.1.1 2699 2701 REFUSE +surface-all-arms 4.1.4.16.1.0.1.1.0 2700 2701 REFUSE +surface-all-arms 4.1.4.16.1.0.2 2701 2702 ACCEPT +surface-all-arms 4.1.4.16.1.1 2702 2757 REFUSE +surface-all-arms 4.1.4.16.1.1.0 2703 2746 REFUSE +surface-all-arms 4.1.4.16.1.1.0.0 2704 2705 REFUSE +surface-all-arms 4.1.4.16.1.1.0.1 2705 2746 REFUSE +surface-all-arms 4.1.4.16.1.1.0.1.0 2706 2717 ACCEPT +surface-all-arms 4.1.4.16.1.1.0.1.1 2717 2740 REFUSE +surface-all-arms 4.1.4.16.1.1.0.1.2 2740 2746 REFUSE +surface-all-arms 4.1.4.16.1.1.1 2746 2754 REFUSE +surface-all-arms 4.1.4.16.1.1.1.0 2747 2754 REFUSE +surface-all-arms 4.1.4.16.1.1.1.0.0 2748 2754 REFUSE +surface-all-arms 4.1.4.16.1.1.1.0.0.0 2749 2750 REFUSE +surface-all-arms 4.1.4.16.1.1.1.0.0.1 2750 2754 REFUSE +surface-all-arms 4.1.4.16.1.1.1.0.0.1.0 2751 2754 REFUSE +surface-all-arms 4.1.4.16.1.1.2 2754 2757 ACCEPT +surface-all-arms 4.1.4.16.1.1.2.0 2755 2756 REFUSE +surface-all-arms 4.1.4.16.1.1.2.1 2756 2757 REFUSE +surface-all-arms 4.1.4.16.1.2 2757 2760 REFUSE +surface-all-arms 4.1.4.16.1.2.0 2758 2759 REFUSE +surface-all-arms 4.1.4.16.1.2.1 2759 2760 REFUSE +surface-all-arms 4.1.4.16.1.3 2760 2761 ACCEPT +surface-all-arms 4.1.4.16.1.4 2761 2762 ACCEPT +surface-all-arms 4.1.4.16.1.5 2762 2763 ACCEPT +surface-all-arms 4.1.4.16.1.6 2763 2764 ACCEPT +surface-all-arms 4.1.4.17 2764 2845 REFUSE +surface-all-arms 4.1.4.17.0 2765 2766 REFUSE +surface-all-arms 4.1.4.17.1 2766 2845 REFUSE +surface-all-arms 4.1.4.17.1.0 2767 2783 REFUSE +surface-all-arms 4.1.4.17.1.0.0 2768 2778 REFUSE +surface-all-arms 4.1.4.17.1.0.1 2778 2782 REFUSE +surface-all-arms 4.1.4.17.1.0.1.0 2779 2780 REFUSE +surface-all-arms 4.1.4.17.1.0.1.1 2780 2782 REFUSE +surface-all-arms 4.1.4.17.1.0.1.1.0 2781 2782 REFUSE +surface-all-arms 4.1.4.17.1.0.2 2782 2783 ACCEPT +surface-all-arms 4.1.4.17.1.1 2783 2838 REFUSE +surface-all-arms 4.1.4.17.1.1.0 2784 2827 REFUSE +surface-all-arms 4.1.4.17.1.1.0.0 2785 2786 REFUSE +surface-all-arms 4.1.4.17.1.1.0.1 2786 2827 REFUSE +surface-all-arms 4.1.4.17.1.1.0.1.0 2787 2798 ACCEPT +surface-all-arms 4.1.4.17.1.1.0.1.1 2798 2821 REFUSE +surface-all-arms 4.1.4.17.1.1.0.1.2 2821 2827 REFUSE +surface-all-arms 4.1.4.17.1.1.1 2827 2835 REFUSE +surface-all-arms 4.1.4.17.1.1.1.0 2828 2835 REFUSE +surface-all-arms 4.1.4.17.1.1.1.0.0 2829 2835 REFUSE +surface-all-arms 4.1.4.17.1.1.1.0.0.0 2830 2831 REFUSE +surface-all-arms 4.1.4.17.1.1.1.0.0.1 2831 2835 REFUSE +surface-all-arms 4.1.4.17.1.1.1.0.0.1.0 2832 2835 REFUSE +surface-all-arms 4.1.4.17.1.1.2 2835 2838 ACCEPT +surface-all-arms 4.1.4.17.1.1.2.0 2836 2837 REFUSE +surface-all-arms 4.1.4.17.1.1.2.1 2837 2838 REFUSE +surface-all-arms 4.1.4.17.1.2 2838 2841 REFUSE +surface-all-arms 4.1.4.17.1.2.0 2839 2840 REFUSE +surface-all-arms 4.1.4.17.1.2.1 2840 2841 REFUSE +surface-all-arms 4.1.4.17.1.3 2841 2842 ACCEPT +surface-all-arms 4.1.4.17.1.4 2842 2843 ACCEPT +surface-all-arms 4.1.4.17.1.5 2843 2844 ACCEPT +surface-all-arms 4.1.4.17.1.6 2844 2845 ACCEPT +surface-all-arms 4.1.4.18 2845 2882 REFUSE +surface-all-arms 4.1.4.18.0 2846 2847 REFUSE +surface-all-arms 4.1.4.18.1 2847 2882 REFUSE +surface-all-arms 4.1.4.18.1.0 2848 2864 REFUSE +surface-all-arms 4.1.4.18.1.0.0 2849 2859 REFUSE +surface-all-arms 4.1.4.18.1.0.1 2859 2863 REFUSE +surface-all-arms 4.1.4.18.1.0.1.0 2860 2861 REFUSE +surface-all-arms 4.1.4.18.1.0.1.1 2861 2863 REFUSE +surface-all-arms 4.1.4.18.1.0.1.1.0 2862 2863 REFUSE +surface-all-arms 4.1.4.18.1.0.2 2863 2864 ACCEPT +surface-all-arms 4.1.4.18.1.1 2864 2870 REFUSE +surface-all-arms 4.1.4.18.1.2 2870 2875 REFUSE +surface-all-arms 4.1.4.18.1.3 2875 2878 REFUSE +surface-all-arms 4.1.4.18.1.3.0 2876 2877 REFUSE +surface-all-arms 4.1.4.18.1.3.1 2877 2878 REFUSE +surface-all-arms 4.1.4.18.1.4 2878 2882 REFUSE +surface-all-arms 4.1.4.18.1.4.0 2879 2880 REFUSE +surface-all-arms 4.1.4.18.1.4.1 2880 2882 REFUSE +surface-all-arms 4.1.4.18.1.4.1.0 2881 2882 REFUSE +surface-all-arms 4.1.4.19 2882 2919 REFUSE +surface-all-arms 4.1.4.19.0 2883 2884 REFUSE +surface-all-arms 4.1.4.19.1 2884 2919 REFUSE +surface-all-arms 4.1.4.19.1.0 2885 2901 REFUSE +surface-all-arms 4.1.4.19.1.0.0 2886 2896 REFUSE +surface-all-arms 4.1.4.19.1.0.1 2896 2900 REFUSE +surface-all-arms 4.1.4.19.1.0.1.0 2897 2898 REFUSE +surface-all-arms 4.1.4.19.1.0.1.1 2898 2900 REFUSE +surface-all-arms 4.1.4.19.1.0.1.1.0 2899 2900 REFUSE +surface-all-arms 4.1.4.19.1.0.2 2900 2901 ACCEPT +surface-all-arms 4.1.4.19.1.1 2901 2907 REFUSE +surface-all-arms 4.1.4.19.1.2 2907 2912 REFUSE +surface-all-arms 4.1.4.19.1.3 2912 2915 REFUSE +surface-all-arms 4.1.4.19.1.3.0 2913 2914 REFUSE +surface-all-arms 4.1.4.19.1.3.1 2914 2915 REFUSE +surface-all-arms 4.1.4.19.1.4 2915 2919 REFUSE +surface-all-arms 4.1.4.19.1.4.0 2916 2917 REFUSE +surface-all-arms 4.1.4.19.1.4.1 2917 2919 REFUSE +surface-all-arms 4.1.4.19.1.4.1.0 2918 2919 REFUSE +surface-all-arms 4.1.4.20 2919 2956 REFUSE +surface-all-arms 4.1.4.20.0 2920 2921 REFUSE +surface-all-arms 4.1.4.20.1 2921 2956 REFUSE +surface-all-arms 4.1.4.20.1.0 2922 2938 REFUSE +surface-all-arms 4.1.4.20.1.0.0 2923 2933 REFUSE +surface-all-arms 4.1.4.20.1.0.1 2933 2937 REFUSE +surface-all-arms 4.1.4.20.1.0.1.0 2934 2935 REFUSE +surface-all-arms 4.1.4.20.1.0.1.1 2935 2937 REFUSE +surface-all-arms 4.1.4.20.1.0.1.1.0 2936 2937 REFUSE +surface-all-arms 4.1.4.20.1.0.2 2937 2938 ACCEPT +surface-all-arms 4.1.4.20.1.1 2938 2944 REFUSE +surface-all-arms 4.1.4.20.1.2 2944 2949 REFUSE +surface-all-arms 4.1.4.20.1.3 2949 2952 REFUSE +surface-all-arms 4.1.4.20.1.3.0 2950 2951 REFUSE +surface-all-arms 4.1.4.20.1.3.1 2951 2952 REFUSE +surface-all-arms 4.1.4.20.1.4 2952 2956 REFUSE +surface-all-arms 4.1.4.20.1.4.0 2953 2954 REFUSE +surface-all-arms 4.1.4.20.1.4.1 2954 2956 REFUSE +surface-all-arms 4.1.4.20.1.4.1.0 2955 2956 REFUSE +surface-all-arms 4.1.4.21 2956 3189 REFUSE +surface-all-arms 4.1.4.21.0 2957 2958 REFUSE +surface-all-arms 4.1.4.21.1 2958 3189 REFUSE +surface-all-arms 4.1.4.21.1.0 2959 2972 REFUSE +surface-all-arms 4.1.4.21.1.0.0 2960 2967 REFUSE +surface-all-arms 4.1.4.21.1.0.1 2967 2971 REFUSE +surface-all-arms 4.1.4.21.1.0.1.0 2968 2969 REFUSE +surface-all-arms 4.1.4.21.1.0.1.1 2969 2971 REFUSE +surface-all-arms 4.1.4.21.1.0.1.1.0 2970 2971 REFUSE +surface-all-arms 4.1.4.21.1.0.2 2971 2972 ACCEPT +surface-all-arms 4.1.4.21.1.1 2972 3173 REFUSE +surface-all-arms 4.1.4.21.1.1.0 2975 2978 REFUSE +surface-all-arms 4.1.4.21.1.1.0.0 2976 2977 REFUSE +surface-all-arms 4.1.4.21.1.1.0.1 2977 2978 REFUSE +surface-all-arms 4.1.4.21.1.1.1 2978 2981 REFUSE +surface-all-arms 4.1.4.21.1.1.1.0 2979 2980 REFUSE +surface-all-arms 4.1.4.21.1.1.1.1 2980 2981 REFUSE +surface-all-arms 4.1.4.21.1.1.2 2981 2984 REFUSE +surface-all-arms 4.1.4.21.1.1.2.0 2982 2983 REFUSE +surface-all-arms 4.1.4.21.1.1.2.1 2983 2984 REFUSE +surface-all-arms 4.1.4.21.1.1.3 2984 3009 REFUSE +surface-all-arms 4.1.4.21.1.1.3.0 2985 2997 REFUSE +surface-all-arms 4.1.4.21.1.1.3.0.0 2986 2987 REFUSE +surface-all-arms 4.1.4.21.1.1.3.0.1 2987 2997 REFUSE +surface-all-arms 4.1.4.21.1.1.3.0.1.0 2988 2997 REFUSE +surface-all-arms 4.1.4.21.1.1.3.1 2997 3009 REFUSE +surface-all-arms 4.1.4.21.1.1.3.1.0 2998 2999 REFUSE +surface-all-arms 4.1.4.21.1.1.3.1.1 2999 3009 REFUSE +surface-all-arms 4.1.4.21.1.1.3.1.1.0 3000 3009 REFUSE +surface-all-arms 4.1.4.21.1.1.4 3009 3058 REFUSE +surface-all-arms 4.1.4.21.1.1.4.0 3010 3022 REFUSE +surface-all-arms 4.1.4.21.1.1.4.0.0 3011 3012 REFUSE +surface-all-arms 4.1.4.21.1.1.4.0.1 3012 3022 REFUSE +surface-all-arms 4.1.4.21.1.1.4.0.1.0 3013 3022 REFUSE +surface-all-arms 4.1.4.21.1.1.4.1 3022 3034 REFUSE +surface-all-arms 4.1.4.21.1.1.4.1.0 3023 3024 REFUSE +surface-all-arms 4.1.4.21.1.1.4.1.1 3024 3034 REFUSE +surface-all-arms 4.1.4.21.1.1.4.1.1.0 3025 3034 REFUSE +surface-all-arms 4.1.4.21.1.1.4.2 3034 3046 REFUSE +surface-all-arms 4.1.4.21.1.1.4.2.0 3035 3036 REFUSE +surface-all-arms 4.1.4.21.1.1.4.2.1 3036 3046 REFUSE +surface-all-arms 4.1.4.21.1.1.4.2.1.0 3037 3046 REFUSE +surface-all-arms 4.1.4.21.1.1.4.3 3046 3058 REFUSE +surface-all-arms 4.1.4.21.1.1.4.3.0 3047 3048 REFUSE +surface-all-arms 4.1.4.21.1.1.4.3.1 3048 3058 REFUSE +surface-all-arms 4.1.4.21.1.1.4.3.1.0 3049 3058 REFUSE +surface-all-arms 4.1.4.21.1.1.5 3058 3071 REFUSE +surface-all-arms 4.1.4.21.1.1.5.0 3059 3062 REFUSE +surface-all-arms 4.1.4.21.1.1.5.0.0 3060 3061 REFUSE +surface-all-arms 4.1.4.21.1.1.5.0.1 3061 3062 REFUSE +surface-all-arms 4.1.4.21.1.1.5.1 3062 3065 REFUSE +surface-all-arms 4.1.4.21.1.1.5.1.0 3063 3064 REFUSE +surface-all-arms 4.1.4.21.1.1.5.1.1 3064 3065 REFUSE +surface-all-arms 4.1.4.21.1.1.5.2 3065 3068 REFUSE +surface-all-arms 4.1.4.21.1.1.5.2.0 3066 3067 REFUSE +surface-all-arms 4.1.4.21.1.1.5.2.1 3067 3068 REFUSE +surface-all-arms 4.1.4.21.1.1.5.3 3068 3071 REFUSE +surface-all-arms 4.1.4.21.1.1.5.3.0 3069 3070 REFUSE +surface-all-arms 4.1.4.21.1.1.5.3.1 3070 3071 REFUSE +surface-all-arms 4.1.4.21.1.1.6 3071 3087 REFUSE +surface-all-arms 4.1.4.21.1.1.6.0 3072 3084 REFUSE +surface-all-arms 4.1.4.21.1.1.6.0.0 3073 3074 REFUSE +surface-all-arms 4.1.4.21.1.1.6.0.1 3074 3084 REFUSE +surface-all-arms 4.1.4.21.1.1.6.0.1.0 3075 3084 REFUSE +surface-all-arms 4.1.4.21.1.1.6.1 3084 3087 REFUSE +surface-all-arms 4.1.4.21.1.1.6.1.0 3085 3086 REFUSE +surface-all-arms 4.1.4.21.1.1.6.1.1 3086 3087 REFUSE +surface-all-arms 4.1.4.21.1.1.7 3087 3112 REFUSE +surface-all-arms 4.1.4.21.1.1.7.0 3088 3100 REFUSE +surface-all-arms 4.1.4.21.1.1.7.0.0 3089 3090 REFUSE +surface-all-arms 4.1.4.21.1.1.7.0.1 3090 3100 REFUSE +surface-all-arms 4.1.4.21.1.1.7.0.1.0 3091 3100 REFUSE +surface-all-arms 4.1.4.21.1.1.7.1 3100 3112 REFUSE +surface-all-arms 4.1.4.21.1.1.7.1.0 3101 3102 REFUSE +surface-all-arms 4.1.4.21.1.1.7.1.1 3102 3112 REFUSE +surface-all-arms 4.1.4.21.1.1.7.1.1.0 3103 3112 REFUSE +surface-all-arms 4.1.4.21.1.1.8 3112 3119 REFUSE +surface-all-arms 4.1.4.21.1.1.8.0 3113 3116 REFUSE +surface-all-arms 4.1.4.21.1.1.8.0.0 3114 3115 REFUSE +surface-all-arms 4.1.4.21.1.1.8.0.1 3115 3116 REFUSE +surface-all-arms 4.1.4.21.1.1.8.1 3116 3119 REFUSE +surface-all-arms 4.1.4.21.1.1.8.1.0 3117 3118 REFUSE +surface-all-arms 4.1.4.21.1.1.8.1.1 3118 3119 REFUSE +surface-all-arms 4.1.4.21.1.1.9 3119 3122 REFUSE +surface-all-arms 4.1.4.21.1.1.9.0 3120 3121 REFUSE +surface-all-arms 4.1.4.21.1.1.9.1 3121 3122 REFUSE +surface-all-arms 4.1.4.21.1.1.10 3122 3135 REFUSE +surface-all-arms 4.1.4.21.1.1.10.0 3123 3126 REFUSE +surface-all-arms 4.1.4.21.1.1.10.0.0 3124 3125 REFUSE +surface-all-arms 4.1.4.21.1.1.10.0.1 3125 3126 REFUSE +surface-all-arms 4.1.4.21.1.1.10.1 3126 3129 REFUSE +surface-all-arms 4.1.4.21.1.1.10.1.0 3127 3128 REFUSE +surface-all-arms 4.1.4.21.1.1.10.1.1 3128 3129 REFUSE +surface-all-arms 4.1.4.21.1.1.10.2 3129 3132 REFUSE +surface-all-arms 4.1.4.21.1.1.10.2.0 3130 3131 REFUSE +surface-all-arms 4.1.4.21.1.1.10.2.1 3131 3132 REFUSE +surface-all-arms 4.1.4.21.1.1.10.3 3132 3135 REFUSE +surface-all-arms 4.1.4.21.1.1.10.3.0 3133 3134 REFUSE +surface-all-arms 4.1.4.21.1.1.10.3.1 3134 3135 REFUSE +surface-all-arms 4.1.4.21.1.1.11 3135 3138 REFUSE +surface-all-arms 4.1.4.21.1.1.11.0 3136 3137 REFUSE +surface-all-arms 4.1.4.21.1.1.11.1 3137 3138 REFUSE +surface-all-arms 4.1.4.21.1.1.12 3138 3141 REFUSE +surface-all-arms 4.1.4.21.1.1.12.0 3139 3140 REFUSE +surface-all-arms 4.1.4.21.1.1.12.1 3140 3141 REFUSE +surface-all-arms 4.1.4.21.1.1.13 3141 3144 REFUSE +surface-all-arms 4.1.4.21.1.1.13.0 3142 3143 REFUSE +surface-all-arms 4.1.4.21.1.1.13.1 3143 3144 REFUSE +surface-all-arms 4.1.4.21.1.1.14 3144 3147 REFUSE +surface-all-arms 4.1.4.21.1.1.14.0 3145 3146 REFUSE +surface-all-arms 4.1.4.21.1.1.14.1 3146 3147 REFUSE +surface-all-arms 4.1.4.21.1.1.15 3147 3150 REFUSE +surface-all-arms 4.1.4.21.1.1.15.0 3148 3149 REFUSE +surface-all-arms 4.1.4.21.1.1.15.1 3149 3150 REFUSE +surface-all-arms 4.1.4.21.1.1.16 3150 3159 REFUSE +surface-all-arms 4.1.4.21.1.1.17 3159 3168 REFUSE +surface-all-arms 4.1.4.21.1.1.18 3168 3171 REFUSE +surface-all-arms 4.1.4.21.1.1.18.0 3169 3170 REFUSE +surface-all-arms 4.1.4.21.1.1.18.1 3170 3171 REFUSE +surface-all-arms 4.1.4.21.1.1.19 3171 3172 REFUSE +surface-all-arms 4.1.4.21.1.1.20 3172 3173 REFUSE +surface-all-arms 4.1.4.21.1.2 3173 3185 REFUSE +surface-all-arms 4.1.4.21.1.2.0 3174 3175 ACCEPT +surface-all-arms 4.1.4.21.1.2.1 3175 3176 ACCEPT +surface-all-arms 4.1.4.21.1.2.2 3176 3185 REFUSE +surface-all-arms 4.1.4.21.1.3 3185 3188 REFUSE +surface-all-arms 4.1.4.21.1.3.0 3186 3187 REFUSE +surface-all-arms 4.1.4.21.1.3.1 3187 3188 REFUSE +surface-all-arms 4.1.4.21.1.4 3188 3189 REFUSE +surface-all-arms 4.1.4.22 3189 3422 REFUSE +surface-all-arms 4.1.4.22.0 3190 3191 REFUSE +surface-all-arms 4.1.4.22.1 3191 3422 REFUSE +surface-all-arms 4.1.4.22.1.0 3192 3205 REFUSE +surface-all-arms 4.1.4.22.1.0.0 3193 3200 REFUSE +surface-all-arms 4.1.4.22.1.0.1 3200 3204 REFUSE +surface-all-arms 4.1.4.22.1.0.1.0 3201 3202 REFUSE +surface-all-arms 4.1.4.22.1.0.1.1 3202 3204 REFUSE +surface-all-arms 4.1.4.22.1.0.1.1.0 3203 3204 REFUSE +surface-all-arms 4.1.4.22.1.0.2 3204 3205 ACCEPT +surface-all-arms 4.1.4.22.1.1 3205 3406 REFUSE +surface-all-arms 4.1.4.22.1.1.0 3208 3211 REFUSE +surface-all-arms 4.1.4.22.1.1.0.0 3209 3210 REFUSE +surface-all-arms 4.1.4.22.1.1.0.1 3210 3211 REFUSE +surface-all-arms 4.1.4.22.1.1.1 3211 3214 REFUSE +surface-all-arms 4.1.4.22.1.1.1.0 3212 3213 REFUSE +surface-all-arms 4.1.4.22.1.1.1.1 3213 3214 REFUSE +surface-all-arms 4.1.4.22.1.1.2 3214 3217 REFUSE +surface-all-arms 4.1.4.22.1.1.2.0 3215 3216 REFUSE +surface-all-arms 4.1.4.22.1.1.2.1 3216 3217 REFUSE +surface-all-arms 4.1.4.22.1.1.3 3217 3242 REFUSE +surface-all-arms 4.1.4.22.1.1.3.0 3218 3230 REFUSE +surface-all-arms 4.1.4.22.1.1.3.0.0 3219 3220 REFUSE +surface-all-arms 4.1.4.22.1.1.3.0.1 3220 3230 REFUSE +surface-all-arms 4.1.4.22.1.1.3.0.1.0 3221 3230 REFUSE +surface-all-arms 4.1.4.22.1.1.3.1 3230 3242 REFUSE +surface-all-arms 4.1.4.22.1.1.3.1.0 3231 3232 REFUSE +surface-all-arms 4.1.4.22.1.1.3.1.1 3232 3242 REFUSE +surface-all-arms 4.1.4.22.1.1.3.1.1.0 3233 3242 REFUSE +surface-all-arms 4.1.4.22.1.1.4 3242 3291 REFUSE +surface-all-arms 4.1.4.22.1.1.4.0 3243 3255 REFUSE +surface-all-arms 4.1.4.22.1.1.4.0.0 3244 3245 REFUSE +surface-all-arms 4.1.4.22.1.1.4.0.1 3245 3255 REFUSE +surface-all-arms 4.1.4.22.1.1.4.0.1.0 3246 3255 REFUSE +surface-all-arms 4.1.4.22.1.1.4.1 3255 3267 REFUSE +surface-all-arms 4.1.4.22.1.1.4.1.0 3256 3257 REFUSE +surface-all-arms 4.1.4.22.1.1.4.1.1 3257 3267 REFUSE +surface-all-arms 4.1.4.22.1.1.4.1.1.0 3258 3267 REFUSE +surface-all-arms 4.1.4.22.1.1.4.2 3267 3279 REFUSE +surface-all-arms 4.1.4.22.1.1.4.2.0 3268 3269 REFUSE +surface-all-arms 4.1.4.22.1.1.4.2.1 3269 3279 REFUSE +surface-all-arms 4.1.4.22.1.1.4.2.1.0 3270 3279 REFUSE +surface-all-arms 4.1.4.22.1.1.4.3 3279 3291 REFUSE +surface-all-arms 4.1.4.22.1.1.4.3.0 3280 3281 REFUSE +surface-all-arms 4.1.4.22.1.1.4.3.1 3281 3291 REFUSE +surface-all-arms 4.1.4.22.1.1.4.3.1.0 3282 3291 REFUSE +surface-all-arms 4.1.4.22.1.1.5 3291 3304 REFUSE +surface-all-arms 4.1.4.22.1.1.5.0 3292 3295 REFUSE +surface-all-arms 4.1.4.22.1.1.5.0.0 3293 3294 REFUSE +surface-all-arms 4.1.4.22.1.1.5.0.1 3294 3295 REFUSE +surface-all-arms 4.1.4.22.1.1.5.1 3295 3298 REFUSE +surface-all-arms 4.1.4.22.1.1.5.1.0 3296 3297 REFUSE +surface-all-arms 4.1.4.22.1.1.5.1.1 3297 3298 REFUSE +surface-all-arms 4.1.4.22.1.1.5.2 3298 3301 REFUSE +surface-all-arms 4.1.4.22.1.1.5.2.0 3299 3300 REFUSE +surface-all-arms 4.1.4.22.1.1.5.2.1 3300 3301 REFUSE +surface-all-arms 4.1.4.22.1.1.5.3 3301 3304 REFUSE +surface-all-arms 4.1.4.22.1.1.5.3.0 3302 3303 REFUSE +surface-all-arms 4.1.4.22.1.1.5.3.1 3303 3304 REFUSE +surface-all-arms 4.1.4.22.1.1.6 3304 3320 REFUSE +surface-all-arms 4.1.4.22.1.1.6.0 3305 3317 REFUSE +surface-all-arms 4.1.4.22.1.1.6.0.0 3306 3307 REFUSE +surface-all-arms 4.1.4.22.1.1.6.0.1 3307 3317 REFUSE +surface-all-arms 4.1.4.22.1.1.6.0.1.0 3308 3317 REFUSE +surface-all-arms 4.1.4.22.1.1.6.1 3317 3320 REFUSE +surface-all-arms 4.1.4.22.1.1.6.1.0 3318 3319 REFUSE +surface-all-arms 4.1.4.22.1.1.6.1.1 3319 3320 REFUSE +surface-all-arms 4.1.4.22.1.1.7 3320 3345 REFUSE +surface-all-arms 4.1.4.22.1.1.7.0 3321 3333 REFUSE +surface-all-arms 4.1.4.22.1.1.7.0.0 3322 3323 REFUSE +surface-all-arms 4.1.4.22.1.1.7.0.1 3323 3333 REFUSE +surface-all-arms 4.1.4.22.1.1.7.0.1.0 3324 3333 REFUSE +surface-all-arms 4.1.4.22.1.1.7.1 3333 3345 REFUSE +surface-all-arms 4.1.4.22.1.1.7.1.0 3334 3335 REFUSE +surface-all-arms 4.1.4.22.1.1.7.1.1 3335 3345 REFUSE +surface-all-arms 4.1.4.22.1.1.7.1.1.0 3336 3345 REFUSE +surface-all-arms 4.1.4.22.1.1.8 3345 3352 REFUSE +surface-all-arms 4.1.4.22.1.1.8.0 3346 3349 REFUSE +surface-all-arms 4.1.4.22.1.1.8.0.0 3347 3348 REFUSE +surface-all-arms 4.1.4.22.1.1.8.0.1 3348 3349 REFUSE +surface-all-arms 4.1.4.22.1.1.8.1 3349 3352 REFUSE +surface-all-arms 4.1.4.22.1.1.8.1.0 3350 3351 REFUSE +surface-all-arms 4.1.4.22.1.1.8.1.1 3351 3352 REFUSE +surface-all-arms 4.1.4.22.1.1.9 3352 3355 REFUSE +surface-all-arms 4.1.4.22.1.1.9.0 3353 3354 REFUSE +surface-all-arms 4.1.4.22.1.1.9.1 3354 3355 REFUSE +surface-all-arms 4.1.4.22.1.1.10 3355 3368 REFUSE +surface-all-arms 4.1.4.22.1.1.10.0 3356 3359 REFUSE +surface-all-arms 4.1.4.22.1.1.10.0.0 3357 3358 REFUSE +surface-all-arms 4.1.4.22.1.1.10.0.1 3358 3359 REFUSE +surface-all-arms 4.1.4.22.1.1.10.1 3359 3362 REFUSE +surface-all-arms 4.1.4.22.1.1.10.1.0 3360 3361 REFUSE +surface-all-arms 4.1.4.22.1.1.10.1.1 3361 3362 REFUSE +surface-all-arms 4.1.4.22.1.1.10.2 3362 3365 REFUSE +surface-all-arms 4.1.4.22.1.1.10.2.0 3363 3364 REFUSE +surface-all-arms 4.1.4.22.1.1.10.2.1 3364 3365 REFUSE +surface-all-arms 4.1.4.22.1.1.10.3 3365 3368 REFUSE +surface-all-arms 4.1.4.22.1.1.10.3.0 3366 3367 REFUSE +surface-all-arms 4.1.4.22.1.1.10.3.1 3367 3368 REFUSE +surface-all-arms 4.1.4.22.1.1.11 3368 3371 REFUSE +surface-all-arms 4.1.4.22.1.1.11.0 3369 3370 REFUSE +surface-all-arms 4.1.4.22.1.1.11.1 3370 3371 REFUSE +surface-all-arms 4.1.4.22.1.1.12 3371 3374 REFUSE +surface-all-arms 4.1.4.22.1.1.12.0 3372 3373 REFUSE +surface-all-arms 4.1.4.22.1.1.12.1 3373 3374 REFUSE +surface-all-arms 4.1.4.22.1.1.13 3374 3377 REFUSE +surface-all-arms 4.1.4.22.1.1.13.0 3375 3376 REFUSE +surface-all-arms 4.1.4.22.1.1.13.1 3376 3377 REFUSE +surface-all-arms 4.1.4.22.1.1.14 3377 3380 REFUSE +surface-all-arms 4.1.4.22.1.1.14.0 3378 3379 REFUSE +surface-all-arms 4.1.4.22.1.1.14.1 3379 3380 REFUSE +surface-all-arms 4.1.4.22.1.1.15 3380 3383 REFUSE +surface-all-arms 4.1.4.22.1.1.15.0 3381 3382 REFUSE +surface-all-arms 4.1.4.22.1.1.15.1 3382 3383 REFUSE +surface-all-arms 4.1.4.22.1.1.16 3383 3392 REFUSE +surface-all-arms 4.1.4.22.1.1.17 3392 3401 REFUSE +surface-all-arms 4.1.4.22.1.1.18 3401 3404 REFUSE +surface-all-arms 4.1.4.22.1.1.18.0 3402 3403 REFUSE +surface-all-arms 4.1.4.22.1.1.18.1 3403 3404 REFUSE +surface-all-arms 4.1.4.22.1.1.19 3404 3405 REFUSE +surface-all-arms 4.1.4.22.1.1.20 3405 3406 REFUSE +surface-all-arms 4.1.4.22.1.2 3406 3418 REFUSE +surface-all-arms 4.1.4.22.1.2.0 3407 3408 ACCEPT +surface-all-arms 4.1.4.22.1.2.1 3408 3409 ACCEPT +surface-all-arms 4.1.4.22.1.2.2 3409 3418 REFUSE +surface-all-arms 4.1.4.22.1.3 3418 3421 REFUSE +surface-all-arms 4.1.4.22.1.3.0 3419 3420 REFUSE +surface-all-arms 4.1.4.22.1.3.1 3420 3421 REFUSE +surface-all-arms 4.1.4.22.1.4 3421 3422 REFUSE +surface-all-arms 4.1.4.23 3422 3655 REFUSE +surface-all-arms 4.1.4.23.0 3423 3424 REFUSE +surface-all-arms 4.1.4.23.1 3424 3655 REFUSE +surface-all-arms 4.1.4.23.1.0 3425 3438 REFUSE +surface-all-arms 4.1.4.23.1.0.0 3426 3433 REFUSE +surface-all-arms 4.1.4.23.1.0.1 3433 3437 REFUSE +surface-all-arms 4.1.4.23.1.0.1.0 3434 3435 REFUSE +surface-all-arms 4.1.4.23.1.0.1.1 3435 3437 REFUSE +surface-all-arms 4.1.4.23.1.0.1.1.0 3436 3437 REFUSE +surface-all-arms 4.1.4.23.1.0.2 3437 3438 ACCEPT +surface-all-arms 4.1.4.23.1.1 3438 3639 REFUSE +surface-all-arms 4.1.4.23.1.1.0 3441 3444 REFUSE +surface-all-arms 4.1.4.23.1.1.0.0 3442 3443 REFUSE +surface-all-arms 4.1.4.23.1.1.0.1 3443 3444 REFUSE +surface-all-arms 4.1.4.23.1.1.1 3444 3447 REFUSE +surface-all-arms 4.1.4.23.1.1.1.0 3445 3446 REFUSE +surface-all-arms 4.1.4.23.1.1.1.1 3446 3447 REFUSE +surface-all-arms 4.1.4.23.1.1.2 3447 3450 REFUSE +surface-all-arms 4.1.4.23.1.1.2.0 3448 3449 REFUSE +surface-all-arms 4.1.4.23.1.1.2.1 3449 3450 REFUSE +surface-all-arms 4.1.4.23.1.1.3 3450 3475 REFUSE +surface-all-arms 4.1.4.23.1.1.3.0 3451 3463 REFUSE +surface-all-arms 4.1.4.23.1.1.3.0.0 3452 3453 REFUSE +surface-all-arms 4.1.4.23.1.1.3.0.1 3453 3463 REFUSE +surface-all-arms 4.1.4.23.1.1.3.0.1.0 3454 3463 REFUSE +surface-all-arms 4.1.4.23.1.1.3.1 3463 3475 REFUSE +surface-all-arms 4.1.4.23.1.1.3.1.0 3464 3465 REFUSE +surface-all-arms 4.1.4.23.1.1.3.1.1 3465 3475 REFUSE +surface-all-arms 4.1.4.23.1.1.3.1.1.0 3466 3475 REFUSE +surface-all-arms 4.1.4.23.1.1.4 3475 3524 REFUSE +surface-all-arms 4.1.4.23.1.1.4.0 3476 3488 REFUSE +surface-all-arms 4.1.4.23.1.1.4.0.0 3477 3478 REFUSE +surface-all-arms 4.1.4.23.1.1.4.0.1 3478 3488 REFUSE +surface-all-arms 4.1.4.23.1.1.4.0.1.0 3479 3488 REFUSE +surface-all-arms 4.1.4.23.1.1.4.1 3488 3500 REFUSE +surface-all-arms 4.1.4.23.1.1.4.1.0 3489 3490 REFUSE +surface-all-arms 4.1.4.23.1.1.4.1.1 3490 3500 REFUSE +surface-all-arms 4.1.4.23.1.1.4.1.1.0 3491 3500 REFUSE +surface-all-arms 4.1.4.23.1.1.4.2 3500 3512 REFUSE +surface-all-arms 4.1.4.23.1.1.4.2.0 3501 3502 REFUSE +surface-all-arms 4.1.4.23.1.1.4.2.1 3502 3512 REFUSE +surface-all-arms 4.1.4.23.1.1.4.2.1.0 3503 3512 REFUSE +surface-all-arms 4.1.4.23.1.1.4.3 3512 3524 REFUSE +surface-all-arms 4.1.4.23.1.1.4.3.0 3513 3514 REFUSE +surface-all-arms 4.1.4.23.1.1.4.3.1 3514 3524 REFUSE +surface-all-arms 4.1.4.23.1.1.4.3.1.0 3515 3524 REFUSE +surface-all-arms 4.1.4.23.1.1.5 3524 3537 REFUSE +surface-all-arms 4.1.4.23.1.1.5.0 3525 3528 REFUSE +surface-all-arms 4.1.4.23.1.1.5.0.0 3526 3527 REFUSE +surface-all-arms 4.1.4.23.1.1.5.0.1 3527 3528 REFUSE +surface-all-arms 4.1.4.23.1.1.5.1 3528 3531 REFUSE +surface-all-arms 4.1.4.23.1.1.5.1.0 3529 3530 REFUSE +surface-all-arms 4.1.4.23.1.1.5.1.1 3530 3531 REFUSE +surface-all-arms 4.1.4.23.1.1.5.2 3531 3534 REFUSE +surface-all-arms 4.1.4.23.1.1.5.2.0 3532 3533 REFUSE +surface-all-arms 4.1.4.23.1.1.5.2.1 3533 3534 REFUSE +surface-all-arms 4.1.4.23.1.1.5.3 3534 3537 REFUSE +surface-all-arms 4.1.4.23.1.1.5.3.0 3535 3536 REFUSE +surface-all-arms 4.1.4.23.1.1.5.3.1 3536 3537 REFUSE +surface-all-arms 4.1.4.23.1.1.6 3537 3553 REFUSE +surface-all-arms 4.1.4.23.1.1.6.0 3538 3550 REFUSE +surface-all-arms 4.1.4.23.1.1.6.0.0 3539 3540 REFUSE +surface-all-arms 4.1.4.23.1.1.6.0.1 3540 3550 REFUSE +surface-all-arms 4.1.4.23.1.1.6.0.1.0 3541 3550 REFUSE +surface-all-arms 4.1.4.23.1.1.6.1 3550 3553 REFUSE +surface-all-arms 4.1.4.23.1.1.6.1.0 3551 3552 REFUSE +surface-all-arms 4.1.4.23.1.1.6.1.1 3552 3553 REFUSE +surface-all-arms 4.1.4.23.1.1.7 3553 3578 REFUSE +surface-all-arms 4.1.4.23.1.1.7.0 3554 3566 REFUSE +surface-all-arms 4.1.4.23.1.1.7.0.0 3555 3556 REFUSE +surface-all-arms 4.1.4.23.1.1.7.0.1 3556 3566 REFUSE +surface-all-arms 4.1.4.23.1.1.7.0.1.0 3557 3566 REFUSE +surface-all-arms 4.1.4.23.1.1.7.1 3566 3578 REFUSE +surface-all-arms 4.1.4.23.1.1.7.1.0 3567 3568 REFUSE +surface-all-arms 4.1.4.23.1.1.7.1.1 3568 3578 REFUSE +surface-all-arms 4.1.4.23.1.1.7.1.1.0 3569 3578 REFUSE +surface-all-arms 4.1.4.23.1.1.8 3578 3585 REFUSE +surface-all-arms 4.1.4.23.1.1.8.0 3579 3582 REFUSE +surface-all-arms 4.1.4.23.1.1.8.0.0 3580 3581 REFUSE +surface-all-arms 4.1.4.23.1.1.8.0.1 3581 3582 REFUSE +surface-all-arms 4.1.4.23.1.1.8.1 3582 3585 REFUSE +surface-all-arms 4.1.4.23.1.1.8.1.0 3583 3584 REFUSE +surface-all-arms 4.1.4.23.1.1.8.1.1 3584 3585 REFUSE +surface-all-arms 4.1.4.23.1.1.9 3585 3588 REFUSE +surface-all-arms 4.1.4.23.1.1.9.0 3586 3587 REFUSE +surface-all-arms 4.1.4.23.1.1.9.1 3587 3588 REFUSE +surface-all-arms 4.1.4.23.1.1.10 3588 3601 REFUSE +surface-all-arms 4.1.4.23.1.1.10.0 3589 3592 REFUSE +surface-all-arms 4.1.4.23.1.1.10.0.0 3590 3591 REFUSE +surface-all-arms 4.1.4.23.1.1.10.0.1 3591 3592 REFUSE +surface-all-arms 4.1.4.23.1.1.10.1 3592 3595 REFUSE +surface-all-arms 4.1.4.23.1.1.10.1.0 3593 3594 REFUSE +surface-all-arms 4.1.4.23.1.1.10.1.1 3594 3595 REFUSE +surface-all-arms 4.1.4.23.1.1.10.2 3595 3598 REFUSE +surface-all-arms 4.1.4.23.1.1.10.2.0 3596 3597 REFUSE +surface-all-arms 4.1.4.23.1.1.10.2.1 3597 3598 REFUSE +surface-all-arms 4.1.4.23.1.1.10.3 3598 3601 REFUSE +surface-all-arms 4.1.4.23.1.1.10.3.0 3599 3600 REFUSE +surface-all-arms 4.1.4.23.1.1.10.3.1 3600 3601 REFUSE +surface-all-arms 4.1.4.23.1.1.11 3601 3604 REFUSE +surface-all-arms 4.1.4.23.1.1.11.0 3602 3603 REFUSE +surface-all-arms 4.1.4.23.1.1.11.1 3603 3604 REFUSE +surface-all-arms 4.1.4.23.1.1.12 3604 3607 REFUSE +surface-all-arms 4.1.4.23.1.1.12.0 3605 3606 REFUSE +surface-all-arms 4.1.4.23.1.1.12.1 3606 3607 REFUSE +surface-all-arms 4.1.4.23.1.1.13 3607 3610 REFUSE +surface-all-arms 4.1.4.23.1.1.13.0 3608 3609 REFUSE +surface-all-arms 4.1.4.23.1.1.13.1 3609 3610 REFUSE +surface-all-arms 4.1.4.23.1.1.14 3610 3613 REFUSE +surface-all-arms 4.1.4.23.1.1.14.0 3611 3612 REFUSE +surface-all-arms 4.1.4.23.1.1.14.1 3612 3613 REFUSE +surface-all-arms 4.1.4.23.1.1.15 3613 3616 REFUSE +surface-all-arms 4.1.4.23.1.1.15.0 3614 3615 REFUSE +surface-all-arms 4.1.4.23.1.1.15.1 3615 3616 REFUSE +surface-all-arms 4.1.4.23.1.1.16 3616 3625 REFUSE +surface-all-arms 4.1.4.23.1.1.17 3625 3634 REFUSE +surface-all-arms 4.1.4.23.1.1.18 3634 3637 REFUSE +surface-all-arms 4.1.4.23.1.1.18.0 3635 3636 REFUSE +surface-all-arms 4.1.4.23.1.1.18.1 3636 3637 REFUSE +surface-all-arms 4.1.4.23.1.1.19 3637 3638 REFUSE +surface-all-arms 4.1.4.23.1.1.20 3638 3639 REFUSE +surface-all-arms 4.1.4.23.1.2 3639 3651 REFUSE +surface-all-arms 4.1.4.23.1.2.0 3640 3641 ACCEPT +surface-all-arms 4.1.4.23.1.2.1 3641 3642 ACCEPT +surface-all-arms 4.1.4.23.1.2.2 3642 3651 REFUSE +surface-all-arms 4.1.4.23.1.3 3651 3654 REFUSE +surface-all-arms 4.1.4.23.1.3.0 3652 3653 REFUSE +surface-all-arms 4.1.4.23.1.3.1 3653 3654 REFUSE +surface-all-arms 4.1.4.23.1.4 3654 3655 REFUSE +surface-all-arms 4.1.4.24 3655 3888 REFUSE +surface-all-arms 4.1.4.24.0 3656 3657 REFUSE +surface-all-arms 4.1.4.24.1 3657 3888 REFUSE +surface-all-arms 4.1.4.24.1.0 3658 3671 REFUSE +surface-all-arms 4.1.4.24.1.0.0 3659 3666 REFUSE +surface-all-arms 4.1.4.24.1.0.1 3666 3670 REFUSE +surface-all-arms 4.1.4.24.1.0.1.0 3667 3668 REFUSE +surface-all-arms 4.1.4.24.1.0.1.1 3668 3670 REFUSE +surface-all-arms 4.1.4.24.1.0.1.1.0 3669 3670 REFUSE +surface-all-arms 4.1.4.24.1.0.2 3670 3671 ACCEPT +surface-all-arms 4.1.4.24.1.1 3671 3872 REFUSE +surface-all-arms 4.1.4.24.1.1.0 3674 3677 REFUSE +surface-all-arms 4.1.4.24.1.1.0.0 3675 3676 REFUSE +surface-all-arms 4.1.4.24.1.1.0.1 3676 3677 REFUSE +surface-all-arms 4.1.4.24.1.1.1 3677 3680 REFUSE +surface-all-arms 4.1.4.24.1.1.1.0 3678 3679 REFUSE +surface-all-arms 4.1.4.24.1.1.1.1 3679 3680 REFUSE +surface-all-arms 4.1.4.24.1.1.2 3680 3683 REFUSE +surface-all-arms 4.1.4.24.1.1.2.0 3681 3682 REFUSE +surface-all-arms 4.1.4.24.1.1.2.1 3682 3683 REFUSE +surface-all-arms 4.1.4.24.1.1.3 3683 3708 REFUSE +surface-all-arms 4.1.4.24.1.1.3.0 3684 3696 REFUSE +surface-all-arms 4.1.4.24.1.1.3.0.0 3685 3686 REFUSE +surface-all-arms 4.1.4.24.1.1.3.0.1 3686 3696 REFUSE +surface-all-arms 4.1.4.24.1.1.3.0.1.0 3687 3696 REFUSE +surface-all-arms 4.1.4.24.1.1.3.1 3696 3708 REFUSE +surface-all-arms 4.1.4.24.1.1.3.1.0 3697 3698 REFUSE +surface-all-arms 4.1.4.24.1.1.3.1.1 3698 3708 REFUSE +surface-all-arms 4.1.4.24.1.1.3.1.1.0 3699 3708 REFUSE +surface-all-arms 4.1.4.24.1.1.4 3708 3757 REFUSE +surface-all-arms 4.1.4.24.1.1.4.0 3709 3721 REFUSE +surface-all-arms 4.1.4.24.1.1.4.0.0 3710 3711 REFUSE +surface-all-arms 4.1.4.24.1.1.4.0.1 3711 3721 REFUSE +surface-all-arms 4.1.4.24.1.1.4.0.1.0 3712 3721 REFUSE +surface-all-arms 4.1.4.24.1.1.4.1 3721 3733 REFUSE +surface-all-arms 4.1.4.24.1.1.4.1.0 3722 3723 REFUSE +surface-all-arms 4.1.4.24.1.1.4.1.1 3723 3733 REFUSE +surface-all-arms 4.1.4.24.1.1.4.1.1.0 3724 3733 REFUSE +surface-all-arms 4.1.4.24.1.1.4.2 3733 3745 REFUSE +surface-all-arms 4.1.4.24.1.1.4.2.0 3734 3735 REFUSE +surface-all-arms 4.1.4.24.1.1.4.2.1 3735 3745 REFUSE +surface-all-arms 4.1.4.24.1.1.4.2.1.0 3736 3745 REFUSE +surface-all-arms 4.1.4.24.1.1.4.3 3745 3757 REFUSE +surface-all-arms 4.1.4.24.1.1.4.3.0 3746 3747 REFUSE +surface-all-arms 4.1.4.24.1.1.4.3.1 3747 3757 REFUSE +surface-all-arms 4.1.4.24.1.1.4.3.1.0 3748 3757 REFUSE +surface-all-arms 4.1.4.24.1.1.5 3757 3770 REFUSE +surface-all-arms 4.1.4.24.1.1.5.0 3758 3761 REFUSE +surface-all-arms 4.1.4.24.1.1.5.0.0 3759 3760 REFUSE +surface-all-arms 4.1.4.24.1.1.5.0.1 3760 3761 REFUSE +surface-all-arms 4.1.4.24.1.1.5.1 3761 3764 REFUSE +surface-all-arms 4.1.4.24.1.1.5.1.0 3762 3763 REFUSE +surface-all-arms 4.1.4.24.1.1.5.1.1 3763 3764 REFUSE +surface-all-arms 4.1.4.24.1.1.5.2 3764 3767 REFUSE +surface-all-arms 4.1.4.24.1.1.5.2.0 3765 3766 REFUSE +surface-all-arms 4.1.4.24.1.1.5.2.1 3766 3767 REFUSE +surface-all-arms 4.1.4.24.1.1.5.3 3767 3770 REFUSE +surface-all-arms 4.1.4.24.1.1.5.3.0 3768 3769 REFUSE +surface-all-arms 4.1.4.24.1.1.5.3.1 3769 3770 REFUSE +surface-all-arms 4.1.4.24.1.1.6 3770 3786 REFUSE +surface-all-arms 4.1.4.24.1.1.6.0 3771 3783 REFUSE +surface-all-arms 4.1.4.24.1.1.6.0.0 3772 3773 REFUSE +surface-all-arms 4.1.4.24.1.1.6.0.1 3773 3783 REFUSE +surface-all-arms 4.1.4.24.1.1.6.0.1.0 3774 3783 REFUSE +surface-all-arms 4.1.4.24.1.1.6.1 3783 3786 REFUSE +surface-all-arms 4.1.4.24.1.1.6.1.0 3784 3785 REFUSE +surface-all-arms 4.1.4.24.1.1.6.1.1 3785 3786 REFUSE +surface-all-arms 4.1.4.24.1.1.7 3786 3811 REFUSE +surface-all-arms 4.1.4.24.1.1.7.0 3787 3799 REFUSE +surface-all-arms 4.1.4.24.1.1.7.0.0 3788 3789 REFUSE +surface-all-arms 4.1.4.24.1.1.7.0.1 3789 3799 REFUSE +surface-all-arms 4.1.4.24.1.1.7.0.1.0 3790 3799 REFUSE +surface-all-arms 4.1.4.24.1.1.7.1 3799 3811 REFUSE +surface-all-arms 4.1.4.24.1.1.7.1.0 3800 3801 REFUSE +surface-all-arms 4.1.4.24.1.1.7.1.1 3801 3811 REFUSE +surface-all-arms 4.1.4.24.1.1.7.1.1.0 3802 3811 REFUSE +surface-all-arms 4.1.4.24.1.1.8 3811 3818 REFUSE +surface-all-arms 4.1.4.24.1.1.8.0 3812 3815 REFUSE +surface-all-arms 4.1.4.24.1.1.8.0.0 3813 3814 REFUSE +surface-all-arms 4.1.4.24.1.1.8.0.1 3814 3815 REFUSE +surface-all-arms 4.1.4.24.1.1.8.1 3815 3818 REFUSE +surface-all-arms 4.1.4.24.1.1.8.1.0 3816 3817 REFUSE +surface-all-arms 4.1.4.24.1.1.8.1.1 3817 3818 REFUSE +surface-all-arms 4.1.4.24.1.1.9 3818 3821 REFUSE +surface-all-arms 4.1.4.24.1.1.9.0 3819 3820 REFUSE +surface-all-arms 4.1.4.24.1.1.9.1 3820 3821 REFUSE +surface-all-arms 4.1.4.24.1.1.10 3821 3834 REFUSE +surface-all-arms 4.1.4.24.1.1.10.0 3822 3825 REFUSE +surface-all-arms 4.1.4.24.1.1.10.0.0 3823 3824 REFUSE +surface-all-arms 4.1.4.24.1.1.10.0.1 3824 3825 REFUSE +surface-all-arms 4.1.4.24.1.1.10.1 3825 3828 REFUSE +surface-all-arms 4.1.4.24.1.1.10.1.0 3826 3827 REFUSE +surface-all-arms 4.1.4.24.1.1.10.1.1 3827 3828 REFUSE +surface-all-arms 4.1.4.24.1.1.10.2 3828 3831 REFUSE +surface-all-arms 4.1.4.24.1.1.10.2.0 3829 3830 REFUSE +surface-all-arms 4.1.4.24.1.1.10.2.1 3830 3831 REFUSE +surface-all-arms 4.1.4.24.1.1.10.3 3831 3834 REFUSE +surface-all-arms 4.1.4.24.1.1.10.3.0 3832 3833 REFUSE +surface-all-arms 4.1.4.24.1.1.10.3.1 3833 3834 REFUSE +surface-all-arms 4.1.4.24.1.1.11 3834 3837 REFUSE +surface-all-arms 4.1.4.24.1.1.11.0 3835 3836 REFUSE +surface-all-arms 4.1.4.24.1.1.11.1 3836 3837 REFUSE +surface-all-arms 4.1.4.24.1.1.12 3837 3840 REFUSE +surface-all-arms 4.1.4.24.1.1.12.0 3838 3839 REFUSE +surface-all-arms 4.1.4.24.1.1.12.1 3839 3840 REFUSE +surface-all-arms 4.1.4.24.1.1.13 3840 3843 REFUSE +surface-all-arms 4.1.4.24.1.1.13.0 3841 3842 REFUSE +surface-all-arms 4.1.4.24.1.1.13.1 3842 3843 REFUSE +surface-all-arms 4.1.4.24.1.1.14 3843 3846 REFUSE +surface-all-arms 4.1.4.24.1.1.14.0 3844 3845 REFUSE +surface-all-arms 4.1.4.24.1.1.14.1 3845 3846 REFUSE +surface-all-arms 4.1.4.24.1.1.15 3846 3849 REFUSE +surface-all-arms 4.1.4.24.1.1.15.0 3847 3848 REFUSE +surface-all-arms 4.1.4.24.1.1.15.1 3848 3849 REFUSE +surface-all-arms 4.1.4.24.1.1.16 3849 3858 REFUSE +surface-all-arms 4.1.4.24.1.1.17 3858 3867 REFUSE +surface-all-arms 4.1.4.24.1.1.18 3867 3870 REFUSE +surface-all-arms 4.1.4.24.1.1.18.0 3868 3869 REFUSE +surface-all-arms 4.1.4.24.1.1.18.1 3869 3870 REFUSE +surface-all-arms 4.1.4.24.1.1.19 3870 3871 REFUSE +surface-all-arms 4.1.4.24.1.1.20 3871 3872 REFUSE +surface-all-arms 4.1.4.24.1.2 3872 3884 REFUSE +surface-all-arms 4.1.4.24.1.2.0 3873 3874 ACCEPT +surface-all-arms 4.1.4.24.1.2.1 3874 3875 ACCEPT +surface-all-arms 4.1.4.24.1.2.2 3875 3884 REFUSE +surface-all-arms 4.1.4.24.1.3 3884 3887 REFUSE +surface-all-arms 4.1.4.24.1.3.0 3885 3886 REFUSE +surface-all-arms 4.1.4.24.1.3.1 3886 3887 REFUSE +surface-all-arms 4.1.4.24.1.4 3887 3888 REFUSE +surface-all-arms 4.1.4.25 3888 4121 REFUSE +surface-all-arms 4.1.4.25.0 3889 3890 REFUSE +surface-all-arms 4.1.4.25.1 3890 4121 REFUSE +surface-all-arms 4.1.4.25.1.0 3891 3904 REFUSE +surface-all-arms 4.1.4.25.1.0.0 3892 3899 REFUSE +surface-all-arms 4.1.4.25.1.0.1 3899 3903 REFUSE +surface-all-arms 4.1.4.25.1.0.1.0 3900 3901 REFUSE +surface-all-arms 4.1.4.25.1.0.1.1 3901 3903 REFUSE +surface-all-arms 4.1.4.25.1.0.1.1.0 3902 3903 REFUSE +surface-all-arms 4.1.4.25.1.0.2 3903 3904 ACCEPT +surface-all-arms 4.1.4.25.1.1 3904 4105 REFUSE +surface-all-arms 4.1.4.25.1.1.0 3907 3910 REFUSE +surface-all-arms 4.1.4.25.1.1.0.0 3908 3909 REFUSE +surface-all-arms 4.1.4.25.1.1.0.1 3909 3910 REFUSE +surface-all-arms 4.1.4.25.1.1.1 3910 3913 REFUSE +surface-all-arms 4.1.4.25.1.1.1.0 3911 3912 REFUSE +surface-all-arms 4.1.4.25.1.1.1.1 3912 3913 REFUSE +surface-all-arms 4.1.4.25.1.1.2 3913 3916 REFUSE +surface-all-arms 4.1.4.25.1.1.2.0 3914 3915 REFUSE +surface-all-arms 4.1.4.25.1.1.2.1 3915 3916 REFUSE +surface-all-arms 4.1.4.25.1.1.3 3916 3941 REFUSE +surface-all-arms 4.1.4.25.1.1.3.0 3917 3929 REFUSE +surface-all-arms 4.1.4.25.1.1.3.0.0 3918 3919 REFUSE +surface-all-arms 4.1.4.25.1.1.3.0.1 3919 3929 REFUSE +surface-all-arms 4.1.4.25.1.1.3.0.1.0 3920 3929 REFUSE +surface-all-arms 4.1.4.25.1.1.3.1 3929 3941 REFUSE +surface-all-arms 4.1.4.25.1.1.3.1.0 3930 3931 REFUSE +surface-all-arms 4.1.4.25.1.1.3.1.1 3931 3941 REFUSE +surface-all-arms 4.1.4.25.1.1.3.1.1.0 3932 3941 REFUSE +surface-all-arms 4.1.4.25.1.1.4 3941 3990 REFUSE +surface-all-arms 4.1.4.25.1.1.4.0 3942 3954 REFUSE +surface-all-arms 4.1.4.25.1.1.4.0.0 3943 3944 REFUSE +surface-all-arms 4.1.4.25.1.1.4.0.1 3944 3954 REFUSE +surface-all-arms 4.1.4.25.1.1.4.0.1.0 3945 3954 REFUSE +surface-all-arms 4.1.4.25.1.1.4.1 3954 3966 REFUSE +surface-all-arms 4.1.4.25.1.1.4.1.0 3955 3956 REFUSE +surface-all-arms 4.1.4.25.1.1.4.1.1 3956 3966 REFUSE +surface-all-arms 4.1.4.25.1.1.4.1.1.0 3957 3966 REFUSE +surface-all-arms 4.1.4.25.1.1.4.2 3966 3978 REFUSE +surface-all-arms 4.1.4.25.1.1.4.2.0 3967 3968 REFUSE +surface-all-arms 4.1.4.25.1.1.4.2.1 3968 3978 REFUSE +surface-all-arms 4.1.4.25.1.1.4.2.1.0 3969 3978 REFUSE +surface-all-arms 4.1.4.25.1.1.4.3 3978 3990 REFUSE +surface-all-arms 4.1.4.25.1.1.4.3.0 3979 3980 REFUSE +surface-all-arms 4.1.4.25.1.1.4.3.1 3980 3990 REFUSE +surface-all-arms 4.1.4.25.1.1.4.3.1.0 3981 3990 REFUSE +surface-all-arms 4.1.4.25.1.1.5 3990 4003 REFUSE +surface-all-arms 4.1.4.25.1.1.5.0 3991 3994 REFUSE +surface-all-arms 4.1.4.25.1.1.5.0.0 3992 3993 REFUSE +surface-all-arms 4.1.4.25.1.1.5.0.1 3993 3994 REFUSE +surface-all-arms 4.1.4.25.1.1.5.1 3994 3997 REFUSE +surface-all-arms 4.1.4.25.1.1.5.1.0 3995 3996 REFUSE +surface-all-arms 4.1.4.25.1.1.5.1.1 3996 3997 REFUSE +surface-all-arms 4.1.4.25.1.1.5.2 3997 4000 REFUSE +surface-all-arms 4.1.4.25.1.1.5.2.0 3998 3999 REFUSE +surface-all-arms 4.1.4.25.1.1.5.2.1 3999 4000 REFUSE +surface-all-arms 4.1.4.25.1.1.5.3 4000 4003 REFUSE +surface-all-arms 4.1.4.25.1.1.5.3.0 4001 4002 REFUSE +surface-all-arms 4.1.4.25.1.1.5.3.1 4002 4003 REFUSE +surface-all-arms 4.1.4.25.1.1.6 4003 4019 REFUSE +surface-all-arms 4.1.4.25.1.1.6.0 4004 4016 REFUSE +surface-all-arms 4.1.4.25.1.1.6.0.0 4005 4006 REFUSE +surface-all-arms 4.1.4.25.1.1.6.0.1 4006 4016 REFUSE +surface-all-arms 4.1.4.25.1.1.6.0.1.0 4007 4016 REFUSE +surface-all-arms 4.1.4.25.1.1.6.1 4016 4019 REFUSE +surface-all-arms 4.1.4.25.1.1.6.1.0 4017 4018 REFUSE +surface-all-arms 4.1.4.25.1.1.6.1.1 4018 4019 REFUSE +surface-all-arms 4.1.4.25.1.1.7 4019 4044 REFUSE +surface-all-arms 4.1.4.25.1.1.7.0 4020 4032 REFUSE +surface-all-arms 4.1.4.25.1.1.7.0.0 4021 4022 REFUSE +surface-all-arms 4.1.4.25.1.1.7.0.1 4022 4032 REFUSE +surface-all-arms 4.1.4.25.1.1.7.0.1.0 4023 4032 REFUSE +surface-all-arms 4.1.4.25.1.1.7.1 4032 4044 REFUSE +surface-all-arms 4.1.4.25.1.1.7.1.0 4033 4034 REFUSE +surface-all-arms 4.1.4.25.1.1.7.1.1 4034 4044 REFUSE +surface-all-arms 4.1.4.25.1.1.7.1.1.0 4035 4044 REFUSE +surface-all-arms 4.1.4.25.1.1.8 4044 4051 REFUSE +surface-all-arms 4.1.4.25.1.1.8.0 4045 4048 REFUSE +surface-all-arms 4.1.4.25.1.1.8.0.0 4046 4047 REFUSE +surface-all-arms 4.1.4.25.1.1.8.0.1 4047 4048 REFUSE +surface-all-arms 4.1.4.25.1.1.8.1 4048 4051 REFUSE +surface-all-arms 4.1.4.25.1.1.8.1.0 4049 4050 REFUSE +surface-all-arms 4.1.4.25.1.1.8.1.1 4050 4051 REFUSE +surface-all-arms 4.1.4.25.1.1.9 4051 4054 REFUSE +surface-all-arms 4.1.4.25.1.1.9.0 4052 4053 REFUSE +surface-all-arms 4.1.4.25.1.1.9.1 4053 4054 REFUSE +surface-all-arms 4.1.4.25.1.1.10 4054 4067 REFUSE +surface-all-arms 4.1.4.25.1.1.10.0 4055 4058 REFUSE +surface-all-arms 4.1.4.25.1.1.10.0.0 4056 4057 REFUSE +surface-all-arms 4.1.4.25.1.1.10.0.1 4057 4058 REFUSE +surface-all-arms 4.1.4.25.1.1.10.1 4058 4061 REFUSE +surface-all-arms 4.1.4.25.1.1.10.1.0 4059 4060 REFUSE +surface-all-arms 4.1.4.25.1.1.10.1.1 4060 4061 REFUSE +surface-all-arms 4.1.4.25.1.1.10.2 4061 4064 REFUSE +surface-all-arms 4.1.4.25.1.1.10.2.0 4062 4063 REFUSE +surface-all-arms 4.1.4.25.1.1.10.2.1 4063 4064 REFUSE +surface-all-arms 4.1.4.25.1.1.10.3 4064 4067 REFUSE +surface-all-arms 4.1.4.25.1.1.10.3.0 4065 4066 REFUSE +surface-all-arms 4.1.4.25.1.1.10.3.1 4066 4067 REFUSE +surface-all-arms 4.1.4.25.1.1.11 4067 4070 REFUSE +surface-all-arms 4.1.4.25.1.1.11.0 4068 4069 REFUSE +surface-all-arms 4.1.4.25.1.1.11.1 4069 4070 REFUSE +surface-all-arms 4.1.4.25.1.1.12 4070 4073 REFUSE +surface-all-arms 4.1.4.25.1.1.12.0 4071 4072 REFUSE +surface-all-arms 4.1.4.25.1.1.12.1 4072 4073 REFUSE +surface-all-arms 4.1.4.25.1.1.13 4073 4076 REFUSE +surface-all-arms 4.1.4.25.1.1.13.0 4074 4075 REFUSE +surface-all-arms 4.1.4.25.1.1.13.1 4075 4076 REFUSE +surface-all-arms 4.1.4.25.1.1.14 4076 4079 REFUSE +surface-all-arms 4.1.4.25.1.1.14.0 4077 4078 REFUSE +surface-all-arms 4.1.4.25.1.1.14.1 4078 4079 REFUSE +surface-all-arms 4.1.4.25.1.1.15 4079 4082 REFUSE +surface-all-arms 4.1.4.25.1.1.15.0 4080 4081 REFUSE +surface-all-arms 4.1.4.25.1.1.15.1 4081 4082 REFUSE +surface-all-arms 4.1.4.25.1.1.16 4082 4091 REFUSE +surface-all-arms 4.1.4.25.1.1.17 4091 4100 REFUSE +surface-all-arms 4.1.4.25.1.1.18 4100 4103 REFUSE +surface-all-arms 4.1.4.25.1.1.18.0 4101 4102 REFUSE +surface-all-arms 4.1.4.25.1.1.18.1 4102 4103 REFUSE +surface-all-arms 4.1.4.25.1.1.19 4103 4104 REFUSE +surface-all-arms 4.1.4.25.1.1.20 4104 4105 REFUSE +surface-all-arms 4.1.4.25.1.2 4105 4117 REFUSE +surface-all-arms 4.1.4.25.1.2.0 4106 4107 ACCEPT +surface-all-arms 4.1.4.25.1.2.1 4107 4108 ACCEPT +surface-all-arms 4.1.4.25.1.2.2 4108 4117 REFUSE +surface-all-arms 4.1.4.25.1.3 4117 4120 REFUSE +surface-all-arms 4.1.4.25.1.3.0 4118 4119 REFUSE +surface-all-arms 4.1.4.25.1.3.1 4119 4120 REFUSE +surface-all-arms 4.1.4.25.1.4 4120 4121 REFUSE +surface-all-arms 4.1.4.26 4121 4353 REFUSE +surface-all-arms 4.1.4.26.0 4122 4123 REFUSE +surface-all-arms 4.1.4.26.1 4123 4353 REFUSE +surface-all-arms 4.1.4.26.1.0 4124 4136 REFUSE +surface-all-arms 4.1.4.26.1.0.0 4125 4131 REFUSE +surface-all-arms 4.1.4.26.1.0.1 4131 4135 REFUSE +surface-all-arms 4.1.4.26.1.0.1.0 4132 4133 REFUSE +surface-all-arms 4.1.4.26.1.0.1.1 4133 4135 REFUSE +surface-all-arms 4.1.4.26.1.0.1.1.0 4134 4135 REFUSE +surface-all-arms 4.1.4.26.1.0.2 4135 4136 ACCEPT +surface-all-arms 4.1.4.26.1.1 4136 4337 REFUSE +surface-all-arms 4.1.4.26.1.1.0 4139 4142 REFUSE +surface-all-arms 4.1.4.26.1.1.0.0 4140 4141 REFUSE +surface-all-arms 4.1.4.26.1.1.0.1 4141 4142 REFUSE +surface-all-arms 4.1.4.26.1.1.1 4142 4145 REFUSE +surface-all-arms 4.1.4.26.1.1.1.0 4143 4144 REFUSE +surface-all-arms 4.1.4.26.1.1.1.1 4144 4145 REFUSE +surface-all-arms 4.1.4.26.1.1.2 4145 4148 REFUSE +surface-all-arms 4.1.4.26.1.1.2.0 4146 4147 REFUSE +surface-all-arms 4.1.4.26.1.1.2.1 4147 4148 REFUSE +surface-all-arms 4.1.4.26.1.1.3 4148 4173 REFUSE +surface-all-arms 4.1.4.26.1.1.3.0 4149 4161 REFUSE +surface-all-arms 4.1.4.26.1.1.3.0.0 4150 4151 REFUSE +surface-all-arms 4.1.4.26.1.1.3.0.1 4151 4161 REFUSE +surface-all-arms 4.1.4.26.1.1.3.0.1.0 4152 4161 REFUSE +surface-all-arms 4.1.4.26.1.1.3.1 4161 4173 REFUSE +surface-all-arms 4.1.4.26.1.1.3.1.0 4162 4163 REFUSE +surface-all-arms 4.1.4.26.1.1.3.1.1 4163 4173 REFUSE +surface-all-arms 4.1.4.26.1.1.3.1.1.0 4164 4173 REFUSE +surface-all-arms 4.1.4.26.1.1.4 4173 4222 REFUSE +surface-all-arms 4.1.4.26.1.1.4.0 4174 4186 REFUSE +surface-all-arms 4.1.4.26.1.1.4.0.0 4175 4176 REFUSE +surface-all-arms 4.1.4.26.1.1.4.0.1 4176 4186 REFUSE +surface-all-arms 4.1.4.26.1.1.4.0.1.0 4177 4186 REFUSE +surface-all-arms 4.1.4.26.1.1.4.1 4186 4198 REFUSE +surface-all-arms 4.1.4.26.1.1.4.1.0 4187 4188 REFUSE +surface-all-arms 4.1.4.26.1.1.4.1.1 4188 4198 REFUSE +surface-all-arms 4.1.4.26.1.1.4.1.1.0 4189 4198 REFUSE +surface-all-arms 4.1.4.26.1.1.4.2 4198 4210 REFUSE +surface-all-arms 4.1.4.26.1.1.4.2.0 4199 4200 REFUSE +surface-all-arms 4.1.4.26.1.1.4.2.1 4200 4210 REFUSE +surface-all-arms 4.1.4.26.1.1.4.2.1.0 4201 4210 REFUSE +surface-all-arms 4.1.4.26.1.1.4.3 4210 4222 REFUSE +surface-all-arms 4.1.4.26.1.1.4.3.0 4211 4212 REFUSE +surface-all-arms 4.1.4.26.1.1.4.3.1 4212 4222 REFUSE +surface-all-arms 4.1.4.26.1.1.4.3.1.0 4213 4222 REFUSE +surface-all-arms 4.1.4.26.1.1.5 4222 4235 REFUSE +surface-all-arms 4.1.4.26.1.1.5.0 4223 4226 REFUSE +surface-all-arms 4.1.4.26.1.1.5.0.0 4224 4225 REFUSE +surface-all-arms 4.1.4.26.1.1.5.0.1 4225 4226 REFUSE +surface-all-arms 4.1.4.26.1.1.5.1 4226 4229 REFUSE +surface-all-arms 4.1.4.26.1.1.5.1.0 4227 4228 REFUSE +surface-all-arms 4.1.4.26.1.1.5.1.1 4228 4229 REFUSE +surface-all-arms 4.1.4.26.1.1.5.2 4229 4232 REFUSE +surface-all-arms 4.1.4.26.1.1.5.2.0 4230 4231 REFUSE +surface-all-arms 4.1.4.26.1.1.5.2.1 4231 4232 REFUSE +surface-all-arms 4.1.4.26.1.1.5.3 4232 4235 REFUSE +surface-all-arms 4.1.4.26.1.1.5.3.0 4233 4234 REFUSE +surface-all-arms 4.1.4.26.1.1.5.3.1 4234 4235 REFUSE +surface-all-arms 4.1.4.26.1.1.6 4235 4251 REFUSE +surface-all-arms 4.1.4.26.1.1.6.0 4236 4248 REFUSE +surface-all-arms 4.1.4.26.1.1.6.0.0 4237 4238 REFUSE +surface-all-arms 4.1.4.26.1.1.6.0.1 4238 4248 REFUSE +surface-all-arms 4.1.4.26.1.1.6.0.1.0 4239 4248 REFUSE +surface-all-arms 4.1.4.26.1.1.6.1 4248 4251 REFUSE +surface-all-arms 4.1.4.26.1.1.6.1.0 4249 4250 REFUSE +surface-all-arms 4.1.4.26.1.1.6.1.1 4250 4251 REFUSE +surface-all-arms 4.1.4.26.1.1.7 4251 4276 REFUSE +surface-all-arms 4.1.4.26.1.1.7.0 4252 4264 REFUSE +surface-all-arms 4.1.4.26.1.1.7.0.0 4253 4254 REFUSE +surface-all-arms 4.1.4.26.1.1.7.0.1 4254 4264 REFUSE +surface-all-arms 4.1.4.26.1.1.7.0.1.0 4255 4264 REFUSE +surface-all-arms 4.1.4.26.1.1.7.1 4264 4276 REFUSE +surface-all-arms 4.1.4.26.1.1.7.1.0 4265 4266 REFUSE +surface-all-arms 4.1.4.26.1.1.7.1.1 4266 4276 REFUSE +surface-all-arms 4.1.4.26.1.1.7.1.1.0 4267 4276 REFUSE +surface-all-arms 4.1.4.26.1.1.8 4276 4283 REFUSE +surface-all-arms 4.1.4.26.1.1.8.0 4277 4280 REFUSE +surface-all-arms 4.1.4.26.1.1.8.0.0 4278 4279 REFUSE +surface-all-arms 4.1.4.26.1.1.8.0.1 4279 4280 REFUSE +surface-all-arms 4.1.4.26.1.1.8.1 4280 4283 REFUSE +surface-all-arms 4.1.4.26.1.1.8.1.0 4281 4282 REFUSE +surface-all-arms 4.1.4.26.1.1.8.1.1 4282 4283 REFUSE +surface-all-arms 4.1.4.26.1.1.9 4283 4286 REFUSE +surface-all-arms 4.1.4.26.1.1.9.0 4284 4285 REFUSE +surface-all-arms 4.1.4.26.1.1.9.1 4285 4286 REFUSE +surface-all-arms 4.1.4.26.1.1.10 4286 4299 REFUSE +surface-all-arms 4.1.4.26.1.1.10.0 4287 4290 REFUSE +surface-all-arms 4.1.4.26.1.1.10.0.0 4288 4289 REFUSE +surface-all-arms 4.1.4.26.1.1.10.0.1 4289 4290 REFUSE +surface-all-arms 4.1.4.26.1.1.10.1 4290 4293 REFUSE +surface-all-arms 4.1.4.26.1.1.10.1.0 4291 4292 REFUSE +surface-all-arms 4.1.4.26.1.1.10.1.1 4292 4293 REFUSE +surface-all-arms 4.1.4.26.1.1.10.2 4293 4296 REFUSE +surface-all-arms 4.1.4.26.1.1.10.2.0 4294 4295 REFUSE +surface-all-arms 4.1.4.26.1.1.10.2.1 4295 4296 REFUSE +surface-all-arms 4.1.4.26.1.1.10.3 4296 4299 REFUSE +surface-all-arms 4.1.4.26.1.1.10.3.0 4297 4298 REFUSE +surface-all-arms 4.1.4.26.1.1.10.3.1 4298 4299 REFUSE +surface-all-arms 4.1.4.26.1.1.11 4299 4302 REFUSE +surface-all-arms 4.1.4.26.1.1.11.0 4300 4301 REFUSE +surface-all-arms 4.1.4.26.1.1.11.1 4301 4302 REFUSE +surface-all-arms 4.1.4.26.1.1.12 4302 4305 REFUSE +surface-all-arms 4.1.4.26.1.1.12.0 4303 4304 REFUSE +surface-all-arms 4.1.4.26.1.1.12.1 4304 4305 REFUSE +surface-all-arms 4.1.4.26.1.1.13 4305 4308 REFUSE +surface-all-arms 4.1.4.26.1.1.13.0 4306 4307 REFUSE +surface-all-arms 4.1.4.26.1.1.13.1 4307 4308 REFUSE +surface-all-arms 4.1.4.26.1.1.14 4308 4311 REFUSE +surface-all-arms 4.1.4.26.1.1.14.0 4309 4310 REFUSE +surface-all-arms 4.1.4.26.1.1.14.1 4310 4311 REFUSE +surface-all-arms 4.1.4.26.1.1.15 4311 4314 REFUSE +surface-all-arms 4.1.4.26.1.1.15.0 4312 4313 REFUSE +surface-all-arms 4.1.4.26.1.1.15.1 4313 4314 REFUSE +surface-all-arms 4.1.4.26.1.1.16 4314 4323 REFUSE +surface-all-arms 4.1.4.26.1.1.17 4323 4332 REFUSE +surface-all-arms 4.1.4.26.1.1.18 4332 4335 REFUSE +surface-all-arms 4.1.4.26.1.1.18.0 4333 4334 REFUSE +surface-all-arms 4.1.4.26.1.1.18.1 4334 4335 REFUSE +surface-all-arms 4.1.4.26.1.1.19 4335 4336 REFUSE +surface-all-arms 4.1.4.26.1.1.20 4336 4337 REFUSE +surface-all-arms 4.1.4.26.1.2 4337 4349 REFUSE +surface-all-arms 4.1.4.26.1.2.0 4338 4339 ACCEPT +surface-all-arms 4.1.4.26.1.2.1 4339 4340 ACCEPT +surface-all-arms 4.1.4.26.1.2.2 4340 4349 REFUSE +surface-all-arms 4.1.4.26.1.3 4349 4352 REFUSE +surface-all-arms 4.1.4.26.1.3.0 4350 4351 REFUSE +surface-all-arms 4.1.4.26.1.3.1 4351 4352 REFUSE +surface-all-arms 4.1.4.26.1.4 4352 4353 REFUSE +surface-all-arms 4.1.4.27 4353 4388 REFUSE +surface-all-arms 4.1.4.27.0 4354 4355 REFUSE +surface-all-arms 4.1.4.27.1 4355 4388 REFUSE +surface-all-arms 4.1.4.27.1.0 4356 4370 REFUSE +surface-all-arms 4.1.4.27.1.0.0 4357 4365 REFUSE +surface-all-arms 4.1.4.27.1.0.1 4365 4369 REFUSE +surface-all-arms 4.1.4.27.1.0.1.0 4366 4367 REFUSE +surface-all-arms 4.1.4.27.1.0.1.1 4367 4369 REFUSE +surface-all-arms 4.1.4.27.1.0.1.1.0 4368 4369 REFUSE +surface-all-arms 4.1.4.27.1.0.2 4369 4370 ACCEPT +surface-all-arms 4.1.4.27.1.1 4370 4379 REFUSE +surface-all-arms 4.1.4.27.1.1.0 4371 4372 REFUSE +surface-all-arms 4.1.4.27.1.1.1 4372 4379 REFUSE +surface-all-arms 4.1.4.27.1.1.1.0 4373 4379 REFUSE +surface-all-arms 4.1.4.27.1.2 4379 4385 REFUSE +surface-all-arms 4.1.4.27.1.3 4385 4386 REFUSE +surface-all-arms 4.1.4.27.1.4 4386 4387 ACCEPT +surface-all-arms 4.1.4.27.1.5 4387 4388 REFUSE +surface-all-arms 4.1.4.28 4388 4427 REFUSE +surface-all-arms 4.1.4.28.0 4389 4390 REFUSE +surface-all-arms 4.1.4.28.1 4390 4427 REFUSE +surface-all-arms 4.1.4.28.1.0 4391 4413 REFUSE +surface-all-arms 4.1.4.28.1.0.0 4392 4407 REFUSE +surface-all-arms 4.1.4.28.1.0.1 4407 4412 REFUSE +surface-all-arms 4.1.4.28.1.0.1.0 4408 4409 REFUSE +surface-all-arms 4.1.4.28.1.0.1.1 4409 4412 REFUSE +surface-all-arms 4.1.4.28.1.0.1.1.0 4410 4412 REFUSE +surface-all-arms 4.1.4.28.1.0.2 4412 4413 ACCEPT +surface-all-arms 4.1.4.28.1.1 4413 4417 REFUSE +surface-all-arms 4.1.4.28.1.1.0 4414 4415 REFUSE +surface-all-arms 4.1.4.28.1.1.1 4415 4417 REFUSE +surface-all-arms 4.1.4.28.1.1.1.0 4416 4417 REFUSE +surface-all-arms 4.1.4.28.1.2 4417 4427 REFUSE +surface-all-arms 4.1.4.28.1.2.0 4418 4419 REFUSE +surface-all-arms 4.1.4.28.1.2.1 4419 4427 REFUSE +surface-all-arms 4.1.4.28.1.2.1.0 4420 4427 REFUSE +surface-all-arms 4.1.4.29 4427 4503 REFUSE +surface-all-arms 4.1.4.29.0 4428 4429 REFUSE +surface-all-arms 4.1.4.29.1 4429 4503 REFUSE +surface-all-arms 4.1.4.29.1.0 4430 4451 REFUSE +surface-all-arms 4.1.4.29.1.0.0 4431 4446 REFUSE +surface-all-arms 4.1.4.29.1.0.1 4446 4450 REFUSE +surface-all-arms 4.1.4.29.1.0.1.0 4447 4448 REFUSE +surface-all-arms 4.1.4.29.1.0.1.1 4448 4450 REFUSE +surface-all-arms 4.1.4.29.1.0.1.1.0 4449 4450 REFUSE +surface-all-arms 4.1.4.29.1.0.2 4450 4451 ACCEPT +surface-all-arms 4.1.4.29.1.1 4451 4460 REFUSE +surface-all-arms 4.1.4.29.1.2 4460 4469 REFUSE +surface-all-arms 4.1.4.29.1.3 4469 4478 REFUSE +surface-all-arms 4.1.4.29.1.4 4478 4490 REFUSE +surface-all-arms 4.1.4.29.1.4.0 4479 4480 REFUSE +surface-all-arms 4.1.4.29.1.4.1 4480 4490 REFUSE +surface-all-arms 4.1.4.29.1.4.1.0 4481 4490 REFUSE +surface-all-arms 4.1.4.29.1.5 4490 4503 REFUSE +surface-all-arms 4.1.4.29.1.5.0 4491 4492 REFUSE +surface-all-arms 4.1.4.29.1.5.1 4492 4503 REFUSE +surface-all-arms 4.1.4.29.1.5.1.0 4493 4503 REFUSE +surface-all-arms 4.1.4.30 4503 4570 REFUSE +surface-all-arms 4.1.4.30.0 4504 4505 REFUSE +surface-all-arms 4.1.4.30.1 4505 4570 REFUSE +surface-all-arms 4.1.4.30.1.0 4506 4525 REFUSE +surface-all-arms 4.1.4.30.1.0.0 4507 4520 REFUSE +surface-all-arms 4.1.4.30.1.0.1 4520 4524 REFUSE +surface-all-arms 4.1.4.30.1.0.1.0 4521 4522 REFUSE +surface-all-arms 4.1.4.30.1.0.1.1 4522 4524 REFUSE +surface-all-arms 4.1.4.30.1.0.1.1.0 4523 4524 REFUSE +surface-all-arms 4.1.4.30.1.0.2 4524 4525 ACCEPT +surface-all-arms 4.1.4.30.1.1 4525 4534 REFUSE +surface-all-arms 4.1.4.30.1.2 4534 4543 REFUSE +surface-all-arms 4.1.4.30.1.3 4543 4552 REFUSE +surface-all-arms 4.1.4.30.1.4 4552 4557 REFUSE +surface-all-arms 4.1.4.30.1.4.0 4553 4554 REFUSE +surface-all-arms 4.1.4.30.1.4.1 4554 4557 REFUSE +surface-all-arms 4.1.4.30.1.4.1.0 4555 4557 REFUSE +surface-all-arms 4.1.4.30.1.5 4557 4570 REFUSE +surface-all-arms 4.1.4.30.1.5.0 4558 4559 REFUSE +surface-all-arms 4.1.4.30.1.5.1 4559 4570 REFUSE +surface-all-arms 4.1.4.30.1.5.1.0 4560 4570 REFUSE +surface-all-arms 4.1.4.31 4570 4638 REFUSE +surface-all-arms 4.1.4.31.0 4571 4572 REFUSE +surface-all-arms 4.1.4.31.1 4572 4638 REFUSE +surface-all-arms 4.1.4.31.1.0 4573 4590 REFUSE +surface-all-arms 4.1.4.31.1.0.0 4574 4585 REFUSE +surface-all-arms 4.1.4.31.1.0.1 4585 4589 REFUSE +surface-all-arms 4.1.4.31.1.0.1.0 4586 4587 REFUSE +surface-all-arms 4.1.4.31.1.0.1.1 4587 4589 REFUSE +surface-all-arms 4.1.4.31.1.0.1.1.0 4588 4589 REFUSE +surface-all-arms 4.1.4.31.1.0.2 4589 4590 ACCEPT +surface-all-arms 4.1.4.31.1.1 4590 4598 REFUSE +surface-all-arms 4.1.4.31.1.1.0 4591 4592 REFUSE +surface-all-arms 4.1.4.31.1.1.1 4592 4598 REFUSE +surface-all-arms 4.1.4.31.1.1.1.0 4593 4598 REFUSE +surface-all-arms 4.1.4.31.1.2 4598 4606 REFUSE +surface-all-arms 4.1.4.31.1.2.0 4599 4606 REFUSE +surface-all-arms 4.1.4.31.1.2.0.0 4600 4606 REFUSE +surface-all-arms 4.1.4.31.1.2.0.0.0 4601 4602 REFUSE +surface-all-arms 4.1.4.31.1.2.0.0.1 4602 4606 REFUSE +surface-all-arms 4.1.4.31.1.2.0.0.1.0 4603 4606 REFUSE +surface-all-arms 4.1.4.31.1.3 4606 4638 REFUSE +surface-all-arms 4.1.4.31.1.3.0 4607 4608 REFUSE +surface-all-arms 4.1.4.31.1.3.1 4608 4638 REFUSE +surface-all-arms 4.1.4.31.1.3.1.0 4609 4625 REFUSE +surface-all-arms 4.1.4.31.1.3.1.0.0 4610 4620 REFUSE +surface-all-arms 4.1.4.31.1.3.1.0.1 4620 4624 REFUSE +surface-all-arms 4.1.4.31.1.3.1.0.1.0 4621 4622 REFUSE +surface-all-arms 4.1.4.31.1.3.1.0.1.1 4622 4624 REFUSE +surface-all-arms 4.1.4.31.1.3.1.0.1.1.0 4623 4624 REFUSE +surface-all-arms 4.1.4.31.1.3.1.0.2 4624 4625 ACCEPT +surface-all-arms 4.1.4.31.1.3.1.1 4625 4630 REFUSE +surface-all-arms 4.1.4.31.1.3.1.1.0 4626 4627 REFUSE +surface-all-arms 4.1.4.31.1.3.1.1.1 4627 4630 REFUSE +surface-all-arms 4.1.4.31.1.3.1.1.1.0 4628 4630 REFUSE +surface-all-arms 4.1.4.31.1.3.1.2 4630 4635 REFUSE +surface-all-arms 4.1.4.31.1.3.1.3 4635 4636 REFUSE +surface-all-arms 4.1.4.31.1.3.1.4 4636 4637 ACCEPT +surface-all-arms 4.1.4.31.1.3.1.5 4637 4638 REFUSE +surface-all-arms 5 4638 4733 REFUSE +surface-all-arms 5.0 4639 4695 REFUSE +surface-all-arms 5.0.0 4640 4643 REFUSE +surface-all-arms 5.0.1 4643 4669 REFUSE +surface-all-arms 5.0.2 4669 4687 REFUSE +surface-all-arms 5.0.2.0 4670 4681 REFUSE +surface-all-arms 5.0.2.1 4681 4687 REFUSE +surface-all-arms 5.0.3 4687 4695 ACCEPT +surface-all-arms 5.1 4695 4733 REFUSE +surface-all-arms 5.1.0 4696 4702 REFUSE +surface-all-arms 5.1.1 4702 4731 REFUSE +surface-all-arms 5.1.2 4731 4732 REFUSE +surface-all-arms 5.1.3 4732 4733 ACCEPT +composition-all-params 0 1 12 REFUSE +composition-all-params 1 12 18 REFUSE +composition-all-params 2 18 19 REFUSE +composition-all-params 3 19 84 REFUSE +composition-all-params 3.0 20 30 REFUSE +composition-all-params 3.0.0 21 27 REFUSE +composition-all-params 3.0.1 27 30 REFUSE +composition-all-params 3.0.1.0 28 29 REFUSE +composition-all-params 3.0.1.1 29 30 REFUSE +composition-all-params 3.1 30 40 REFUSE +composition-all-params 3.1.0 31 37 REFUSE +composition-all-params 3.1.1 37 40 REFUSE +composition-all-params 3.1.1.0 38 39 REFUSE +composition-all-params 3.1.1.1 39 40 REFUSE +composition-all-params 3.2 40 47 REFUSE +composition-all-params 3.2.0 41 44 REFUSE +composition-all-params 3.2.1 44 47 REFUSE +composition-all-params 3.2.1.0 45 46 REFUSE +composition-all-params 3.2.1.1 46 47 REFUSE +composition-all-params 3.3 47 58 REFUSE +composition-all-params 3.3.0 48 55 REFUSE +composition-all-params 3.3.1 55 58 REFUSE +composition-all-params 3.3.1.0 56 57 REFUSE +composition-all-params 3.3.1.1 57 58 REFUSE +composition-all-params 3.4 58 67 REFUSE +composition-all-params 3.4.0 59 64 REFUSE +composition-all-params 3.4.1 64 67 REFUSE +composition-all-params 3.4.1.0 65 66 REFUSE +composition-all-params 3.4.1.1 66 67 REFUSE +composition-all-params 3.5 67 75 REFUSE +composition-all-params 3.5.0 68 72 REFUSE +composition-all-params 3.5.1 72 75 REFUSE +composition-all-params 3.5.1.0 73 74 REFUSE +composition-all-params 3.5.1.1 74 75 REFUSE +composition-all-params 3.6 75 84 REFUSE +composition-all-params 3.6.0 76 81 REFUSE +composition-all-params 3.6.1 81 84 REFUSE +composition-all-params 3.6.1.0 82 83 REFUSE +composition-all-params 3.6.1.1 83 84 REFUSE +composition-all-params 4 84 821 REFUSE +composition-all-params 4.0 85 86 REFUSE +composition-all-params 4.1 86 821 REFUSE +composition-all-params 4.1.0 87 104 REFUSE +composition-all-params 4.1.0.0 88 99 REFUSE +composition-all-params 4.1.0.1 99 103 REFUSE +composition-all-params 4.1.0.1.0 100 101 REFUSE +composition-all-params 4.1.0.1.1 101 103 REFUSE +composition-all-params 4.1.0.1.1.0 102 103 REFUSE +composition-all-params 4.1.0.2 103 104 ACCEPT +composition-all-params 4.1.1 104 305 REFUSE +composition-all-params 4.1.1.0 107 110 REFUSE +composition-all-params 4.1.1.0.0 108 109 REFUSE +composition-all-params 4.1.1.0.1 109 110 REFUSE +composition-all-params 4.1.1.1 110 113 REFUSE +composition-all-params 4.1.1.1.0 111 112 REFUSE +composition-all-params 4.1.1.1.1 112 113 REFUSE +composition-all-params 4.1.1.2 113 116 REFUSE +composition-all-params 4.1.1.2.0 114 115 REFUSE +composition-all-params 4.1.1.2.1 115 116 REFUSE +composition-all-params 4.1.1.3 116 141 REFUSE +composition-all-params 4.1.1.3.0 117 129 REFUSE +composition-all-params 4.1.1.3.0.0 118 119 REFUSE +composition-all-params 4.1.1.3.0.1 119 129 REFUSE +composition-all-params 4.1.1.3.0.1.0 120 129 REFUSE +composition-all-params 4.1.1.3.1 129 141 REFUSE +composition-all-params 4.1.1.3.1.0 130 131 REFUSE +composition-all-params 4.1.1.3.1.1 131 141 REFUSE +composition-all-params 4.1.1.3.1.1.0 132 141 REFUSE +composition-all-params 4.1.1.4 141 190 REFUSE +composition-all-params 4.1.1.4.0 142 154 REFUSE +composition-all-params 4.1.1.4.0.0 143 144 REFUSE +composition-all-params 4.1.1.4.0.1 144 154 REFUSE +composition-all-params 4.1.1.4.0.1.0 145 154 REFUSE +composition-all-params 4.1.1.4.1 154 166 REFUSE +composition-all-params 4.1.1.4.1.0 155 156 REFUSE +composition-all-params 4.1.1.4.1.1 156 166 REFUSE +composition-all-params 4.1.1.4.1.1.0 157 166 REFUSE +composition-all-params 4.1.1.4.2 166 178 REFUSE +composition-all-params 4.1.1.4.2.0 167 168 REFUSE +composition-all-params 4.1.1.4.2.1 168 178 REFUSE +composition-all-params 4.1.1.4.2.1.0 169 178 REFUSE +composition-all-params 4.1.1.4.3 178 190 REFUSE +composition-all-params 4.1.1.4.3.0 179 180 REFUSE +composition-all-params 4.1.1.4.3.1 180 190 REFUSE +composition-all-params 4.1.1.4.3.1.0 181 190 REFUSE +composition-all-params 4.1.1.5 190 203 REFUSE +composition-all-params 4.1.1.5.0 191 194 REFUSE +composition-all-params 4.1.1.5.0.0 192 193 REFUSE +composition-all-params 4.1.1.5.0.1 193 194 REFUSE +composition-all-params 4.1.1.5.1 194 197 REFUSE +composition-all-params 4.1.1.5.1.0 195 196 REFUSE +composition-all-params 4.1.1.5.1.1 196 197 REFUSE +composition-all-params 4.1.1.5.2 197 200 REFUSE +composition-all-params 4.1.1.5.2.0 198 199 REFUSE +composition-all-params 4.1.1.5.2.1 199 200 REFUSE +composition-all-params 4.1.1.5.3 200 203 REFUSE +composition-all-params 4.1.1.5.3.0 201 202 REFUSE +composition-all-params 4.1.1.5.3.1 202 203 REFUSE +composition-all-params 4.1.1.6 203 219 REFUSE +composition-all-params 4.1.1.6.0 204 216 REFUSE +composition-all-params 4.1.1.6.0.0 205 206 REFUSE +composition-all-params 4.1.1.6.0.1 206 216 REFUSE +composition-all-params 4.1.1.6.0.1.0 207 216 REFUSE +composition-all-params 4.1.1.6.1 216 219 REFUSE +composition-all-params 4.1.1.6.1.0 217 218 REFUSE +composition-all-params 4.1.1.6.1.1 218 219 REFUSE +composition-all-params 4.1.1.7 219 244 REFUSE +composition-all-params 4.1.1.7.0 220 232 REFUSE +composition-all-params 4.1.1.7.0.0 221 222 REFUSE +composition-all-params 4.1.1.7.0.1 222 232 REFUSE +composition-all-params 4.1.1.7.0.1.0 223 232 REFUSE +composition-all-params 4.1.1.7.1 232 244 REFUSE +composition-all-params 4.1.1.7.1.0 233 234 REFUSE +composition-all-params 4.1.1.7.1.1 234 244 REFUSE +composition-all-params 4.1.1.7.1.1.0 235 244 REFUSE +composition-all-params 4.1.1.8 244 251 REFUSE +composition-all-params 4.1.1.8.0 245 248 REFUSE +composition-all-params 4.1.1.8.0.0 246 247 REFUSE +composition-all-params 4.1.1.8.0.1 247 248 REFUSE +composition-all-params 4.1.1.8.1 248 251 REFUSE +composition-all-params 4.1.1.8.1.0 249 250 REFUSE +composition-all-params 4.1.1.8.1.1 250 251 REFUSE +composition-all-params 4.1.1.9 251 254 REFUSE +composition-all-params 4.1.1.9.0 252 253 REFUSE +composition-all-params 4.1.1.9.1 253 254 REFUSE +composition-all-params 4.1.1.10 254 267 REFUSE +composition-all-params 4.1.1.10.0 255 258 REFUSE +composition-all-params 4.1.1.10.0.0 256 257 REFUSE +composition-all-params 4.1.1.10.0.1 257 258 REFUSE +composition-all-params 4.1.1.10.1 258 261 REFUSE +composition-all-params 4.1.1.10.1.0 259 260 REFUSE +composition-all-params 4.1.1.10.1.1 260 261 REFUSE +composition-all-params 4.1.1.10.2 261 264 REFUSE +composition-all-params 4.1.1.10.2.0 262 263 REFUSE +composition-all-params 4.1.1.10.2.1 263 264 REFUSE +composition-all-params 4.1.1.10.3 264 267 REFUSE +composition-all-params 4.1.1.10.3.0 265 266 REFUSE +composition-all-params 4.1.1.10.3.1 266 267 REFUSE +composition-all-params 4.1.1.11 267 270 REFUSE +composition-all-params 4.1.1.11.0 268 269 REFUSE +composition-all-params 4.1.1.11.1 269 270 REFUSE +composition-all-params 4.1.1.12 270 273 REFUSE +composition-all-params 4.1.1.12.0 271 272 REFUSE +composition-all-params 4.1.1.12.1 272 273 REFUSE +composition-all-params 4.1.1.13 273 276 REFUSE +composition-all-params 4.1.1.13.0 274 275 REFUSE +composition-all-params 4.1.1.13.1 275 276 REFUSE +composition-all-params 4.1.1.14 276 279 REFUSE +composition-all-params 4.1.1.14.0 277 278 REFUSE +composition-all-params 4.1.1.14.1 278 279 REFUSE +composition-all-params 4.1.1.15 279 282 REFUSE +composition-all-params 4.1.1.15.0 280 281 REFUSE +composition-all-params 4.1.1.15.1 281 282 REFUSE +composition-all-params 4.1.1.16 282 291 REFUSE +composition-all-params 4.1.1.17 291 300 REFUSE +composition-all-params 4.1.1.18 300 303 REFUSE +composition-all-params 4.1.1.18.0 301 302 REFUSE +composition-all-params 4.1.1.18.1 302 303 REFUSE +composition-all-params 4.1.1.19 303 304 REFUSE +composition-all-params 4.1.1.20 304 305 REFUSE +composition-all-params 4.1.2 305 317 REFUSE +composition-all-params 4.1.2.0 306 307 ACCEPT +composition-all-params 4.1.2.1 307 308 ACCEPT +composition-all-params 4.1.2.2 308 317 REFUSE +composition-all-params 4.1.3 317 320 REFUSE +composition-all-params 4.1.3.0 318 319 REFUSE +composition-all-params 4.1.3.1 319 320 REFUSE +composition-all-params 4.1.4 320 821 REFUSE +composition-all-params 4.1.4.0 321 355 REFUSE +composition-all-params 4.1.4.0.0 322 323 REFUSE +composition-all-params 4.1.4.0.1 323 355 REFUSE +composition-all-params 4.1.4.0.1.0 324 342 REFUSE +composition-all-params 4.1.4.0.1.0.0 325 337 REFUSE +composition-all-params 4.1.4.0.1.0.1 337 341 REFUSE +composition-all-params 4.1.4.0.1.0.1.0 338 339 REFUSE +composition-all-params 4.1.4.0.1.0.1.1 339 341 REFUSE +composition-all-params 4.1.4.0.1.0.1.1.0 340 341 REFUSE +composition-all-params 4.1.4.0.1.0.2 341 342 ACCEPT +composition-all-params 4.1.4.0.1.1 342 347 REFUSE +composition-all-params 4.1.4.0.1.1.0 343 344 REFUSE +composition-all-params 4.1.4.0.1.1.1 344 347 REFUSE +composition-all-params 4.1.4.0.1.1.1.0 345 347 REFUSE +composition-all-params 4.1.4.0.1.2 347 352 REFUSE +composition-all-params 4.1.4.0.1.3 352 353 REFUSE +composition-all-params 4.1.4.0.1.4 353 354 ACCEPT +composition-all-params 4.1.4.0.1.5 354 355 REFUSE +composition-all-params 4.1.4.1 355 812 REFUSE +composition-all-params 4.1.4.1.0 356 357 REFUSE +composition-all-params 4.1.4.1.1 357 812 REFUSE +composition-all-params 4.1.4.1.1.0 358 370 REFUSE +composition-all-params 4.1.4.1.1.0.0 359 365 REFUSE +composition-all-params 4.1.4.1.1.0.1 365 369 REFUSE +composition-all-params 4.1.4.1.1.0.1.0 366 367 REFUSE +composition-all-params 4.1.4.1.1.0.1.1 367 369 REFUSE +composition-all-params 4.1.4.1.1.0.1.1.0 368 369 REFUSE +composition-all-params 4.1.4.1.1.0.2 369 370 ACCEPT +composition-all-params 4.1.4.1.1.1 370 387 REFUSE +composition-all-params 4.1.4.1.1.1.0 371 381 REFUSE +composition-all-params 4.1.4.1.1.1.1 381 386 REFUSE +composition-all-params 4.1.4.1.1.1.2 386 387 REFUSE +composition-all-params 4.1.4.1.1.2 387 812 REFUSE +composition-all-params 4.1.4.1.1.2.0 388 399 REFUSE +composition-all-params 4.1.4.1.1.2.0.0 389 394 REFUSE +composition-all-params 4.1.4.1.1.2.0.1 394 399 REFUSE +composition-all-params 4.1.4.1.1.2.0.1.0 395 396 REFUSE +composition-all-params 4.1.4.1.1.2.0.1.1 396 399 REFUSE +composition-all-params 4.1.4.1.1.2.0.1.1.0 397 399 REFUSE +composition-all-params 4.1.4.1.1.2.1 399 419 REFUSE +composition-all-params 4.1.4.1.1.2.1.0 400 407 REFUSE +composition-all-params 4.1.4.1.1.2.1.1 407 419 REFUSE +composition-all-params 4.1.4.1.1.2.1.1.0 408 409 REFUSE +composition-all-params 4.1.4.1.1.2.1.1.1 409 419 REFUSE +composition-all-params 4.1.4.1.1.2.1.1.1.0 410 419 REFUSE +composition-all-params 4.1.4.1.1.2.2 419 429 REFUSE +composition-all-params 4.1.4.1.1.2.2.0 420 425 REFUSE +composition-all-params 4.1.4.1.1.2.2.1 425 429 REFUSE +composition-all-params 4.1.4.1.1.2.2.1.0 426 427 REFUSE +composition-all-params 4.1.4.1.1.2.2.1.1 427 429 REFUSE +composition-all-params 4.1.4.1.1.2.2.1.1.0 428 429 REFUSE +composition-all-params 4.1.4.1.1.2.3 429 489 REFUSE +composition-all-params 4.1.4.1.1.2.3.0 430 435 REFUSE +composition-all-params 4.1.4.1.1.2.3.1 435 489 REFUSE +composition-all-params 4.1.4.1.1.2.3.1.0 436 437 REFUSE +composition-all-params 4.1.4.1.1.2.3.1.1 437 489 REFUSE +composition-all-params 4.1.4.1.1.2.3.1.1.0 438 481 REFUSE +composition-all-params 4.1.4.1.1.2.3.1.1.0.0 439 440 REFUSE +composition-all-params 4.1.4.1.1.2.3.1.1.0.1 440 481 REFUSE +composition-all-params 4.1.4.1.1.2.3.1.1.0.1.0 441 452 ACCEPT +composition-all-params 4.1.4.1.1.2.3.1.1.0.1.1 452 475 REFUSE +composition-all-params 4.1.4.1.1.2.3.1.1.0.1.2 475 481 REFUSE +composition-all-params 4.1.4.1.1.2.3.1.1.1 481 488 REFUSE +composition-all-params 4.1.4.1.1.2.3.1.1.1.0 482 488 REFUSE +composition-all-params 4.1.4.1.1.2.3.1.1.1.0.0 483 488 REFUSE +composition-all-params 4.1.4.1.1.2.3.1.1.1.0.0.0 484 485 REFUSE +composition-all-params 4.1.4.1.1.2.3.1.1.1.0.0.1 485 488 REFUSE +composition-all-params 4.1.4.1.1.2.3.1.1.1.0.0.1.0 486 488 REFUSE +composition-all-params 4.1.4.1.1.2.3.1.1.2 488 489 ACCEPT +composition-all-params 4.1.4.1.1.2.4 489 512 REFUSE +composition-all-params 4.1.4.1.1.2.4.0 490 501 REFUSE +composition-all-params 4.1.4.1.1.2.4.1 501 512 REFUSE +composition-all-params 4.1.4.1.1.2.4.1.0 502 503 REFUSE +composition-all-params 4.1.4.1.1.2.4.1.1 503 512 REFUSE +composition-all-params 4.1.4.1.1.2.4.1.1.0 504 512 REFUSE +composition-all-params 4.1.4.1.1.2.4.1.1.0.0 505 506 REFUSE +composition-all-params 4.1.4.1.1.2.4.1.1.0.1 506 512 REFUSE +composition-all-params 4.1.4.1.1.2.4.1.1.0.1.0 507 512 REFUSE +composition-all-params 4.1.4.1.1.2.5 512 530 REFUSE +composition-all-params 4.1.4.1.1.2.5.0 513 521 REFUSE +composition-all-params 4.1.4.1.1.2.5.1 521 530 REFUSE +composition-all-params 4.1.4.1.1.2.5.1.0 522 523 REFUSE +composition-all-params 4.1.4.1.1.2.5.1.1 523 530 REFUSE +composition-all-params 4.1.4.1.1.2.5.1.1.0 524 530 REFUSE +composition-all-params 4.1.4.1.1.2.5.1.1.0.0 525 526 REFUSE +composition-all-params 4.1.4.1.1.2.5.1.1.0.1 526 530 REFUSE +composition-all-params 4.1.4.1.1.2.5.1.1.0.1.0 527 530 REFUSE +composition-all-params 4.1.4.1.1.2.6 530 812 REFUSE +composition-all-params 4.1.4.1.1.2.6.0 531 536 REFUSE +composition-all-params 4.1.4.1.1.2.6.1 536 812 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.0 537 538 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1 538 812 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0 539 812 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.0 540 577 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.0.0 541 542 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.0.1 542 577 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.0.1.0 543 559 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.0.1.0.0 544 554 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.0.1.0.1 554 558 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.0.1.0.1.0 555 556 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.0.1.0.1.1 556 558 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.0.1.0.1.1.0 557 558 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.0.1.0.2 558 559 ACCEPT +composition-all-params 4.1.4.1.1.2.6.1.1.0.0.1.1 559 569 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.0.1.1.0 560 561 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.0.1.1.1 561 569 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.0.1.1.1.0 562 569 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.0.1.2 569 574 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.0.1.3 574 575 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.0.1.4 575 576 ACCEPT +composition-all-params 4.1.4.1.1.2.6.1.1.0.0.1.5 576 577 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1 577 812 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.0 578 579 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1 579 812 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.0 580 595 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.0.0 581 590 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.0.1 590 594 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.0.1.0 591 592 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.0.1.1 592 594 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.0.1.1.0 593 594 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.0.2 594 595 ACCEPT +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1 595 796 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.0 598 601 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.0.0 599 600 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.0.1 600 601 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.1 601 604 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.1.0 602 603 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.1.1 603 604 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.2 604 607 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.2.0 605 606 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.2.1 606 607 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.3 607 632 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.3.0 608 620 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.3.0.0 609 610 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.3.0.1 610 620 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.3.0.1.0 611 620 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.3.1 620 632 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.3.1.0 621 622 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.3.1.1 622 632 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.3.1.1.0 623 632 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.4 632 681 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.4.0 633 645 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.4.0.0 634 635 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.4.0.1 635 645 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.4.0.1.0 636 645 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.4.1 645 657 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.4.1.0 646 647 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.4.1.1 647 657 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.4.1.1.0 648 657 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.4.2 657 669 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.4.2.0 658 659 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.4.2.1 659 669 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.4.2.1.0 660 669 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.4.3 669 681 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.4.3.0 670 671 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.4.3.1 671 681 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.4.3.1.0 672 681 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.5 681 694 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.5.0 682 685 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.5.0.0 683 684 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.5.0.1 684 685 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.5.1 685 688 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.5.1.0 686 687 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.5.1.1 687 688 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.5.2 688 691 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.5.2.0 689 690 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.5.2.1 690 691 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.5.3 691 694 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.5.3.0 692 693 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.5.3.1 693 694 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.6 694 710 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.6.0 695 707 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.6.0.0 696 697 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.6.0.1 697 707 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.6.0.1.0 698 707 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.6.1 707 710 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.6.1.0 708 709 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.6.1.1 709 710 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.7 710 735 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.7.0 711 723 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.7.0.0 712 713 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.7.0.1 713 723 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.7.0.1.0 714 723 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.7.1 723 735 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.7.1.0 724 725 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.7.1.1 725 735 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.7.1.1.0 726 735 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.8 735 742 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.8.0 736 739 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.8.0.0 737 738 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.8.0.1 738 739 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.8.1 739 742 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.8.1.0 740 741 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.8.1.1 741 742 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.9 742 745 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.9.0 743 744 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.9.1 744 745 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.10 745 758 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.10.0 746 749 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.10.0.0 747 748 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.10.0.1 748 749 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.10.1 749 752 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.10.1.0 750 751 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.10.1.1 751 752 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.10.2 752 755 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.10.2.0 753 754 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.10.2.1 754 755 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.10.3 755 758 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.10.3.0 756 757 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.10.3.1 757 758 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.11 758 761 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.11.0 759 760 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.11.1 760 761 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.12 761 764 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.12.0 762 763 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.12.1 763 764 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.13 764 767 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.13.0 765 766 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.13.1 766 767 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.14 767 770 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.14.0 768 769 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.14.1 769 770 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.15 770 773 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.15.0 771 772 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.15.1 772 773 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.16 773 782 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.17 782 791 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.18 791 794 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.18.0 792 793 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.18.1 793 794 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.19 794 795 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.1.20 795 796 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.2 796 808 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.2.0 797 798 ACCEPT +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.2.1 798 799 ACCEPT +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.2.2 799 808 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.3 808 811 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.3.0 809 810 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.3.1 810 811 REFUSE +composition-all-params 4.1.4.1.1.2.6.1.1.0.1.1.4 811 812 REFUSE +composition-all-params 4.1.4.2 812 821 REFUSE +composition-all-params 4.1.4.2.0 813 814 REFUSE +composition-all-params 4.1.4.2.1 814 821 REFUSE +composition-all-params 4.1.4.2.1.0 815 821 REFUSE +composition-all-params 4.1.4.2.1.0.0 816 821 REFUSE +invocation-all-inputs 0 1 39 REFUSE +invocation-all-inputs 1 39 69 REFUSE +invocation-all-inputs 2 69 70 REFUSE +invocation-all-inputs 3 70 73 REFUSE +invocation-all-inputs 4 73 106 REFUSE +invocation-all-inputs 4.0 74 100 REFUSE +invocation-all-inputs 4.1 100 106 REFUSE +invocation-all-inputs 5 106 166 REFUSE +invocation-all-inputs 5.0 107 126 REFUSE +invocation-all-inputs 5.0.0 108 119 REFUSE +invocation-all-inputs 5.0.1 119 126 REFUSE +invocation-all-inputs 5.0.1.0 120 121 REFUSE +invocation-all-inputs 5.0.1.1 121 126 REFUSE +invocation-all-inputs 5.0.1.1.0 122 126 REFUSE +invocation-all-inputs 5.1 126 145 REFUSE +invocation-all-inputs 5.1.0 127 133 REFUSE +invocation-all-inputs 5.1.1 133 145 REFUSE +invocation-all-inputs 5.1.1.0 134 135 REFUSE +invocation-all-inputs 5.1.1.1 135 145 REFUSE +invocation-all-inputs 5.1.1.1.0 136 145 REFUSE +invocation-all-inputs 5.2 145 155 REFUSE +invocation-all-inputs 5.2.0 146 151 REFUSE +invocation-all-inputs 5.2.1 151 155 REFUSE +invocation-all-inputs 5.2.1.0 152 153 REFUSE +invocation-all-inputs 5.2.1.1 153 155 REFUSE +invocation-all-inputs 5.2.1.1.0 154 155 REFUSE +invocation-all-inputs 5.3 155 166 REFUSE +invocation-all-inputs 5.3.0 156 161 REFUSE +invocation-all-inputs 5.3.1 161 166 REFUSE +invocation-all-inputs 5.3.1.0 162 163 REFUSE +invocation-all-inputs 5.3.1.1 163 166 REFUSE +invocation-all-inputs 5.3.1.1.0 164 166 REFUSE +invocation-all-inputs 6 166 179 REFUSE +invocation-all-inputs 7 179 200 REFUSE +invocation-all-inputs 8 200 211 ACCEPT +result-pending 0 1 39 REFUSE +result-pending 1 39 40 REFUSE +result-pending 2 40 51 REFUSE +result-pending 2.0 41 42 REFUSE +result-pending 2.1 42 51 REFUSE +result-pending 2.1.0 43 51 REFUSE +result-completed 0 1 39 REFUSE +result-completed 1 39 40 REFUSE +result-completed 2 40 46 REFUSE +result-completed 2.0 41 42 REFUSE +result-completed 2.1 42 46 REFUSE +result-completed 2.1.0 43 44 ACCEPT +result-completed 2.1.1 44 45 REFUSE +result-completed 2.1.2 45 46 ACCEPT +result-completed-open-surface 0 1 39 REFUSE +result-completed-open-surface 1 39 40 REFUSE +result-completed-open-surface 2 40 78 REFUSE +result-completed-open-surface 2.0 41 42 REFUSE +result-completed-open-surface 2.1 42 78 REFUSE +result-completed-open-surface 2.1.0 43 44 ACCEPT +result-completed-open-surface 2.1.1 44 45 REFUSE +result-completed-open-surface 2.1.2 45 78 ACCEPT +result-completed-open-surface 2.1.2.0 46 47 REFUSE +result-completed-open-surface 2.1.2.1 47 78 REFUSE +result-completed-open-surface 2.1.2.1.0 48 78 REFUSE +result-completed-open-external 0 1 39 REFUSE +result-completed-open-external 1 39 40 REFUSE +result-completed-open-external 2 40 84 REFUSE +result-completed-open-external 2.0 41 42 REFUSE +result-completed-open-external 2.1 42 84 REFUSE +result-completed-open-external 2.1.0 43 44 ACCEPT +result-completed-open-external 2.1.1 44 45 REFUSE +result-completed-open-external 2.1.2 45 84 ACCEPT +result-completed-open-external 2.1.2.0 46 47 REFUSE +result-completed-open-external 2.1.2.1 47 84 REFUSE +result-completed-open-external 2.1.2.1.0 48 74 REFUSE +result-completed-open-external 2.1.2.1.1 74 84 REFUSE +result-completed-open-external 2.1.2.1.1.0 75 76 REFUSE +result-completed-open-external 2.1.2.1.1.1 76 84 REFUSE +result-completed-open-external 2.1.2.1.1.1.0 77 84 REFUSE +result-denied 0 1 39 REFUSE +result-denied 1 39 40 REFUSE +result-denied 2 40 56 REFUSE +result-denied 2.0 41 42 REFUSE +result-denied 2.1 42 56 REFUSE +result-denied 2.1.0 43 53 REFUSE +result-denied 2.1.1 53 56 ACCEPT +result-denied-no-node 0 1 39 REFUSE +result-denied-no-node 1 39 40 REFUSE +result-denied-no-node 2 40 56 REFUSE +result-denied-no-node 2.0 41 42 REFUSE +result-denied-no-node 2.1 42 56 REFUSE +result-denied-no-node 2.1.0 43 55 REFUSE +result-denied-no-node 2.1.1 55 56 ACCEPT +result-failed 0 1 39 REFUSE +result-failed 1 39 40 REFUSE +result-failed 2 40 49 REFUSE +result-failed 2.0 41 42 REFUSE +result-failed 2.1 42 49 REFUSE +result-failed 2.1.0 43 49 REFUSE +asset-catalog 0 1 12 REFUSE +asset-catalog 1 12 18 REFUSE +asset-catalog 2 18 19 REFUSE +asset-catalog 3 19 92 REFUSE +asset-catalog 3.0 20 54 REFUSE +asset-catalog 3.0.0 21 26 REFUSE +asset-catalog 3.0.1 26 36 REFUSE +asset-catalog 3.0.2 36 52 REFUSE +asset-catalog 3.0.3 52 53 REFUSE +asset-catalog 3.0.4 53 54 REFUSE +asset-catalog 3.1 54 92 REFUSE +asset-catalog 3.1.0 55 60 REFUSE +asset-catalog 3.1.1 60 74 REFUSE +asset-catalog 3.1.2 74 90 REFUSE +asset-catalog 3.1.3 90 91 REFUSE +asset-catalog 3.1.4 91 92 REFUSE diff --git a/crates/thing-contract/tests/goldens/node-unknown-arm.bin b/crates/thing-contract/tests/goldens/node-unknown-arm.bin index a36baf9..e9b287a 100644 --- a/crates/thing-contract/tests/goldens/node-unknown-arm.bin +++ b/crates/thing-contract/tests/goldens/node-unknown-arm.bin @@ -1 +1 @@ -–ªprovider.a¤main¯CANARY-7f3a91c2’ ‘¯CANARY-7f3a91c2� \ No newline at end of file +–ªprovider.a¤main¯CANARY-7f3a91c2’‘¯CANARY-7f3a91c2� \ No newline at end of file diff --git a/crates/thing-contract/tests/goldens/surface.cc b/crates/thing-contract/tests/goldens/surface.cc index b6cee0c..a0f7d1b 100644 Binary files a/crates/thing-contract/tests/goldens/surface.cc and b/crates/thing-contract/tests/goldens/surface.cc differ diff --git a/crates/thing-contract/tests/nil_positions.rs b/crates/thing-contract/tests/nil_positions.rs new file mode 100644 index 0000000..f39c22f --- /dev/null +++ b/crates/thing-contract/tests/nil_positions.rs @@ -0,0 +1,132 @@ +//! The nil vector: for every element of every array of every value golden, the golden with that +//! element replaced by nil, and whether the Rust decode door accepts it. A slot is required +//! exactly when its Rust type is not optional, so the rows are the required-slot set; the C# and +//! TypeScript packages hold no list of their own and are held to every row. +//! `THING_BLESS=1` rewrites `goldens/nil-positions.tsv`; any other run compares. + +use std::fmt::Debug; +use std::path::PathBuf; + +use serde::Serialize; +use serde::de::DeserializeOwned; +use thing_contract::*; +use thing_testkit::golden; + +/// One MessagePack value's byte span; `kids` is set for arrays only (maps are never walked). +struct Span { + start: usize, + end: usize, + kids: Option>, +} + +fn be(bytes: &[u8], at: usize, width: usize) -> usize { + bytes[at..at + width].iter().fold(0, |acc, byte| acc << 8 | *byte as usize) +} + +fn collection(bytes: &[u8], start: usize, mut at: usize, count: usize, is_array: bool) -> Span { + let mut kids = Vec::new(); + for _ in 0..count { + let kid = item(bytes, at); + at = kid.end; + kids.push(kid); + } + Span { start, end: at, kids: is_array.then_some(kids) } +} + +fn item(bytes: &[u8], at: usize) -> Span { + let tag = bytes[at]; + let flat = |len: usize| Span { start: at, end: at + len, kids: None }; + match tag { + 0x00..=0x7f | 0xe0..=0xff | 0xc0 | 0xc2 | 0xc3 => flat(1), + 0x80..=0x8f => collection(bytes, at, at + 1, (tag & 0x0f) as usize * 2, false), + 0x90..=0x9f => collection(bytes, at, at + 1, (tag & 0x0f) as usize, true), + 0xa0..=0xbf => flat(1 + (tag & 0x1f) as usize), + 0xc4 | 0xd9 => flat(2 + be(bytes, at + 1, 1)), + 0xc5 | 0xda => flat(3 + be(bytes, at + 1, 2)), + 0xc6 | 0xdb => flat(5 + be(bytes, at + 1, 4)), + 0xca => flat(5), + 0xcb => flat(9), + 0xcc | 0xd0 => flat(2), + 0xcd | 0xd1 => flat(3), + 0xce | 0xd2 => flat(5), + 0xcf | 0xd3 => flat(9), + 0xdc => collection(bytes, at, at + 3, be(bytes, at + 1, 2), true), + 0xdd => collection(bytes, at, at + 5, be(bytes, at + 1, 4), true), + 0xde => collection(bytes, at, at + 3, be(bytes, at + 1, 2) * 2, false), + 0xdf => collection(bytes, at, at + 5, be(bytes, at + 1, 4) * 2, false), + 0xd4 => flat(3), + 0xd5 => flat(4), + 0xd6 => flat(6), + 0xd7 => flat(10), + 0xd8 => flat(18), + 0xc7 => flat(3 + be(bytes, at + 1, 1)), + 0xc8 => flat(4 + be(bytes, at + 1, 2)), + 0xc9 => flat(6 + be(bytes, at + 1, 4)), + _ => panic!("unsupported tag {tag:#x} at {at}"), + } +} + +/// Every element inside an array, at every depth, in walk order, with its dotted index path. +fn elements(span: &Span, prefix: &str, out: &mut Vec<(String, usize, usize)>) { + for (index, kid) in span.kids.iter().flatten().enumerate() { + let path = if prefix.is_empty() { index.to_string() } else { format!("{prefix}.{index}") }; + out.push((path.clone(), kid.start, kid.end)); + elements(kid, &path, out); + } +} + +/// The rows of one golden: nil spliced over each element, decoded as `T`. An accepted variant +/// must re-encode to the spliced bytes. +fn rows(file: &str, out: &mut String) -> (usize, usize) { + let bytes = golden::read(&goldens_dir(), &format!("{file}.bin")); + let mut found = Vec::new(); + elements(&item(&bytes, 0), "", &mut found); + let (mut accepted, mut refused) = (0, 0); + for (path, start, end) in found { + let mut spliced = bytes[..start].to_vec(); + spliced.push(0xc0); + spliced.extend_from_slice(&bytes[end..]); + let verdict = match rmp_serde::from_slice::(&spliced) { + Ok(value) => { + assert_eq!(rmp_serde::to_vec(&value).unwrap(), spliced, "{file} {path}: an accepted nil must re-encode to the spliced bytes"); + accepted += 1; + "ACCEPT" + } + Err(_) => { + refused += 1; + "REFUSE" + } + }; + out.push_str(&format!("{file}\t{path}\t{start}\t{end}\t{verdict}\n")); + } + (accepted, refused) +} + +#[test] +fn nil_positions_match() { + let mut table = String::new(); + let mut totals = Vec::new(); + totals.push(("surface-all-arms", rows::("surface-all-arms", &mut table))); + totals.push(("composition-all-params", rows::("composition-all-params", &mut table))); + totals.push(("invocation-all-inputs", rows::("invocation-all-inputs", &mut table))); + for file in [ + "result-pending", + "result-completed", + "result-completed-open-surface", + "result-completed-open-external", + "result-denied", + "result-denied-no-node", + "result-failed", + ] { + totals.push((file, rows::(file, &mut table))); + } + totals.push(("asset-catalog", rows::("asset-catalog", &mut table))); + for (file, (accepted, refused)) in &totals { + println!("NILTOTAL {file} accept={accepted} refuse={refused}"); + } + golden::check(&goldens_dir(), "nil-positions.tsv", table.as_bytes()); +} + +fn goldens_dir() -> PathBuf { + PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/goldens") +} diff --git a/crates/thing-contract/tests/result.rs b/crates/thing-contract/tests/result.rs index bed0312..49fd667 100644 --- a/crates/thing-contract/tests/result.rs +++ b/crates/thing-contract/tests/result.rs @@ -1,6 +1,4 @@ -mod common; - -use common::*; +use thing_testkit::build::*; use cultcache_rs::{CultCache, CultCacheEnvelope, CultCacheRegistry, DatabaseEntry, decode_payload}; use serde::Deserialize; use serde::de::IntoDeserializer; diff --git a/crates/thing-core/Cargo.toml b/crates/thing-core/Cargo.toml new file mode 100644 index 0000000..d12f760 --- /dev/null +++ b/crates/thing-core/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "thing-core" +version = "0.1.0" +edition = "2024" +license = "MIT" +publish = false + +[dependencies] +thing-contract = { path = "../thing-contract" } +stacker = "0.1.25" + +[dev-dependencies] +thing-testkit = { path = "../thing-testkit" } diff --git a/crates/thing-core/src/diagnostic.rs b/crates/thing-core/src/diagnostic.rs new file mode 100644 index 0000000..7d8f174 --- /dev/null +++ b/crates/thing-core/src/diagnostic.rs @@ -0,0 +1,45 @@ +//! What core says about a document it could not take whole. The code set is closed: a later +//! cut adds its codes as reviewed changes, never as free strings. + +use thing_contract::NodeId; + +/// Why a document, or one node of it, was not taken as authored. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] +pub enum Code { + /// The port refused the composition's bytes. A refusal is never absence. + DecodeRefused, + /// No composition is published at the named address. + UnresolvedUse, + /// A composition that uses itself through others, or a chain deeper than the limit. + CompositionCycle, + /// An argument, a body or a composition record that does not fit its Use. + CompositionInvalid, + /// A command no surface declaration names. + UndeclaredCommand, + /// Two nodes of the expanded tree share an id. + DuplicateNodeId, + /// A Param or a Slot outside any composition. + UnboundParam, + /// The expanded tree has too many nodes or is deeper than the depth rule. + ExpansionLimit, + /// The input nests deeper than the expander can recurse. A stack bound, not the depth rule: the depth + /// rule is judged on the finished tree and reports ExpansionLimit. + TooDeepToResolve, +} + +impl Code { + /// Whether the fault leaves no tree (the whole document is refused) or only a placeholder. + pub fn refuses_document(self) -> bool { + matches!(self, Code::UndeclaredCommand | Code::DuplicateNodeId | Code::UnboundParam | Code::ExpansionLimit | Code::TooDeepToResolve) + } +} + +/// One fault. `detail` names the fault and never carries a state value. +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct Diagnostic { + pub code: Code, + /// The record key of the surface the fault is in. + pub surface: String, + pub node: Option, + pub detail: String, +} diff --git a/crates/thing-core/src/lib.rs b/crates/thing-core/src/lib.rs new file mode 100644 index 0000000..345c2dd --- /dev/null +++ b/crates/thing-core/src/lib.rs @@ -0,0 +1,6 @@ +//! Thing's core: a function of documents, state, input and time. It touches the world only +//! through ports; it reads no clock, spawns nothing and awaits nothing. + +pub mod diagnostic; +pub mod port; +pub mod resolve; diff --git a/crates/thing-core/src/port/mod.rs b/crates/thing-core/src/port/mod.rs new file mode 100644 index 0000000..1ae2ae8 --- /dev/null +++ b/crates/thing-core/src/port/mod.rs @@ -0,0 +1,144 @@ +//! What core may ask of state. The port reads and queues changes; nothing in it writes, and +//! it never awaits: core drains queued changes inside its frame. + +pub mod state; + +pub use state::StateValue; + +use thing_contract::{AssetCatalog, CommandResult, CompositionDocument, ProviderId, RecordKey, SchemaId, SurfaceDocument}; + +/// One record: the provider that holds it, its schema and its key. +#[derive(Clone, Debug, PartialEq, Eq, Hash)] +pub struct Address { + pub provider: ProviderId, + pub schema: SchemaId, + pub key: RecordKey, +} + +/// Every record of one provider and schema whose key starts with `key_prefix`. +#[derive(Clone, Debug, PartialEq, Eq, Hash)] +pub struct Prefix { + pub provider: ProviderId, + pub schema: SchemaId, + pub key_prefix: String, +} + +#[derive(Clone, Debug, PartialEq, Eq, Hash)] +pub enum Interest { + Record(Address), + Prefix(Prefix), +} + +impl Prefix { + pub fn matches(&self, address: &Address) -> bool { + self.provider == address.provider + && self.schema == address.schema + && address.key.as_str().starts_with(&self.key_prefix) + } +} + +impl Interest { + /// Whether a change at `address` is of interest. + pub fn matches(&self, address: &Address) -> bool { + match self { + Interest::Record(record) => record == address, + Interest::Prefix(prefix) => prefix.matches(address), + } + } +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] +pub struct SubscriptionId(pub u64); + +/// A record the port carries, decoded: a contract kind, or a provider's state by its schema's +/// member names. `State::schema` is the schema the record is stored under, which is not the +/// one asked for when the key holds a record of another. +#[derive(Clone, Debug, PartialEq)] +pub enum Record { + Surface(SurfaceDocument), + Composition(CompositionDocument), + Result(CommandResult), + Catalog(AssetCatalog), + State { schema: SchemaId, value: StateValue }, +} + +#[derive(Clone, Debug, PartialEq)] +pub struct Entry { + pub address: Address, + pub record: Record, +} + +/// A record the contract refused. `detail` is the decoder's message, which never carries a +/// value. +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct Refusal { + pub address: Address, + pub kind: SchemaId, + pub detail: String, +} + +/// The answer for one address. A refusal is never absence. +#[derive(Clone, Debug, PartialEq)] +pub enum Lookup { + Present(Entry), + Absent, + Refused(Refusal), +} + +#[derive(Clone, Debug, PartialEq)] +pub enum Change { + Upsert(Entry), + Delete(Address), + Refused(Refusal), +} + +/// Core's view of state. Object safe, and no method writes. +pub trait StatePort { + fn read(&self, address: &Address) -> Lookup; + + /// One lookup per record under the prefix, in key order. + fn list(&self, prefix: &Prefix) -> Vec; + + fn subscribe(&mut self, interest: Interest) -> SubscriptionId; + + fn unsubscribe(&mut self, id: SubscriptionId); + + /// Every change since the last drain that some interest matched when it happened, in mutation + /// order (unsubscribing does not recall changes already queued), + /// each once. + fn drain(&mut self) -> Vec; +} + +#[cfg(test)] +mod tests { + use super::*; + + fn address(provider: &str, schema: &str, key: &str) -> Address { + Address { provider: ProviderId::new(provider), schema: SchemaId::new(schema), key: RecordKey::new(key) } + } + + fn prefix(provider: &str, schema: &str, key_prefix: &str) -> Prefix { + Prefix { provider: ProviderId::new(provider), schema: SchemaId::new(schema), key_prefix: key_prefix.into() } + } + + #[test] + fn a_prefix_matches_provider_schema_and_key_prefix_together() { + let under = prefix("p", "s", "row-"); + assert!(under.matches(&address("p", "s", "row-1"))); + assert!(under.matches(&address("p", "s", "row-"))); + assert!(!under.matches(&address("q", "s", "row-1"))); + assert!(!under.matches(&address("p", "t", "row-1"))); + assert!(!under.matches(&address("p", "s", "col-1"))); + assert!(!under.matches(&address("p", "s", "ro"))); + } + + #[test] + fn a_record_interest_matches_only_its_address() { + let interest = Interest::Record(address("p", "s", "k")); + assert!(interest.matches(&address("p", "s", "k"))); + assert!(!interest.matches(&address("p", "s", "k2"))); + assert!(!interest.matches(&address("q", "s", "k"))); + assert!(Interest::Prefix(prefix("p", "s", "k")).matches(&address("p", "s", "k2"))); + assert!(!Interest::Prefix(prefix("p", "s", "k")).matches(&address("p", "s", "j"))); + } +} diff --git a/crates/thing-core/src/port/state.rs b/crates/thing-core/src/port/state.rs new file mode 100644 index 0000000..49f2b8d --- /dev/null +++ b/crates/thing-core/src/port/state.rs @@ -0,0 +1,26 @@ +//! A provider record's value as core sees it. Core holds no bytes and no reader of them: a state +//! port implementation decodes a record with its schema's member names (the `thing-state` crate) +//! and hands core this tree. + +/// A provider record's value: closed, ordered and named, with no case folding. +#[derive(Clone, Debug, PartialEq)] +pub enum StateValue { + Nil, + Bool(bool), + Int(i128), + Float(f64), + Text(String), + Bytes(Vec), + List(Vec), + Record(Vec<(String, StateValue)>), +} + +impl StateValue { + /// The member of a `Record` by exact name; `None` for any other shape or a missing name. + pub fn member(&self, name: &str) -> Option<&StateValue> { + match self { + StateValue::Record(members) => members.iter().find(|(member, _)| member == name).map(|(_, value)| value), + _ => None, + } + } +} diff --git a/crates/thing-core/src/resolve/expand.rs b/crates/thing-core/src/resolve/expand.rs new file mode 100644 index 0000000..5dc22b5 --- /dev/null +++ b/crates/thing-core/src/resolve/expand.rs @@ -0,0 +1,597 @@ +//! The substitution: depth first, order preserving. A surface and a composition body go through +//! the same functions; the scope says whether a Param is bound. +//! +//! Expanded ids: inside the expansion of Use `u`, the body root takes `u`'s id and every other +//! body id `b` becomes `u/b`. Arguments are expanded in the caller's scope before the body sees +//! them, so a Slot argument's nodes keep the ids they had in the caller. + +use std::collections::{HashMap, HashSet}; + +use thing_contract::*; + +use crate::diagnostic::{Code, Diagnostic}; +use crate::port::{Address, Lookup, Record, StatePort}; + +use super::{Limits, std as thing_std, validate}; + +/// The deepest input the expander recurses into. This is a stack bound and not the depth rule: the +/// rule (`Limits::max_tree_depth`) is judged by validate on the finished tree, where a slot argument +/// the body never places does not count. It exists because an in-memory tree from a Rust caller can +/// be deeper than any decoded document (CultCache bounds decoded nesting at 256), and recursion +/// over it would overflow the stack. The recursion grows its own stack (`super::grow`), so the bound +/// holds on any thread. +const STACK_BOUND: usize = 1024; + +/// A fault the nearest enclosing Use turns into a placeholder (`Invalid`), or one that ends the +/// whole expansion (`Limit`, or `Stack` for input too deep to recurse into). +pub(super) enum Fault { + Invalid(String), + Limit(String), + Stack(String), +} + +type Res = Result; + +fn invalid(detail: String) -> Res { + Err(Fault::Invalid(detail)) +} + +/// The expansion of one composition body: the Use's id and common, and the finished arguments. +struct Scope { + use_id: NodeId, + root_id: NodeId, + use_visible: BoolSource, + use_a11y: Option, + args: HashMap, +} + +pub(super) struct Expander<'a> { + port: &'a dyn StatePort, + limits: &'a Limits, + surface: String, + provider: &'a ProviderId, + commands: HashSet<&'a CommandId>, + pub diagnostics: Vec, + pub reads: HashSet
, + nodes: usize, + stack: Vec, + current: Option, +} + +fn arm_name(value: &ArgValue) -> &'static str { + match value { + ArgValue::Text(_) => "Text", + ArgValue::Number(_) => "Number", + ArgValue::Bool(_) => "Bool", + ArgValue::Bind(_) => "Bind", + ArgValue::Collection(_) => "Collection", + ArgValue::Command(_) => "Command", + ArgValue::Slot(_) => "Slot", + } +} + +fn kind_name(kind: &ParamKind) -> &'static str { + match kind { + ParamKind::Text => "Text", + ParamKind::Number => "Number", + ParamKind::Bool => "Bool", + ParamKind::Bind => "Bind", + ParamKind::Collection => "Collection", + ParamKind::Command => "Command", + ParamKind::Slot => "Slot", + } +} + +fn wrong_kind(name: &ParamName, value: &ArgValue, position: &str) -> Res { + invalid(format!("param '{}' is a {} argument, used as {position}", name.name, arm_name(value))) +} + +impl<'a> Expander<'a> { + pub fn new(document: &'a SurfaceDocument, port: &'a dyn StatePort, limits: &'a Limits) -> Self { + Self { + port, + limits, + surface: document.record_key(), + provider: &document.provider_id, + commands: document.commands.iter().map(|declared| &declared.id).collect(), + diagnostics: Vec::new(), + reads: HashSet::new(), + nodes: 0, + stack: Vec::new(), + current: None, + } + } + + pub fn diag(&mut self, code: Code, node: Option, detail: impl Into) { + self.diagnostics.push(Diagnostic { code, surface: self.surface.clone(), node, detail: detail.into() }); + } + + fn unbound(&mut self, what: &str) { + let node = self.current.clone(); + self.diag(Code::UnboundParam, node, format!("{what} outside a composition")); + } + + /// The surface root: no scope, no Use above it. + pub fn root(&mut self, root: &Node) -> Res { + self.node(root, None, 1, false) + } + + // ---- positions ---------------------------------------------------------------------- + + fn id(&self, id: &NodeId, scope: Option<&Scope>) -> NodeId { + match scope { + None => id.clone(), + Some(scope) if *id == scope.root_id => scope.use_id.clone(), + Some(scope) => NodeId::new(format!("{}/{}", scope.use_id.as_str(), id.as_str())), + } + } + + fn fill(&self, provider: &Option) -> Option { + Some(provider.clone().unwrap_or_else(|| self.provider.clone())) + } + + fn bind(&self, bind: &Bind) -> Bind { + let source = match &bind.source { + StateSource::Record(state) => StateSource::Record(StateRef { + provider: self.fill(&state.provider), + schema: state.schema.clone(), + key: state.key.clone(), + }), + StateSource::Item => StateSource::Item, + }; + Bind { source, member: bind.member.clone(), format: bind.format.clone() } + } + + fn arg_of<'s>(name: &ParamName, scope: &'s Scope) -> Res<&'s ArgValue> { + match scope.args.get(&name.name) { + Some(value) => Ok(value), + None => invalid(format!("the body names param '{}', which the composition does not declare", name.name)), + } + } + + fn text(&mut self, source: &TextSource, scope: Option<&Scope>) -> Res { + Ok(match (source, scope) { + (TextSource::Literal(_), _) => source.clone(), + (TextSource::Bound(bind), _) => TextSource::Bound(self.bind(bind)), + (TextSource::Param(name), None) => { + self.unbound(&format!("param '{}'", name.name)); + source.clone() + } + (TextSource::Param(name), Some(scope)) => match Self::arg_of(name, scope)? { + ArgValue::Text(arg) => TextSource::Literal(TextLiteral { value: arg.value.clone() }), + ArgValue::Bind(bind) => TextSource::Bound(bind.clone()), + other => return wrong_kind(name, other, "text"), + }, + }) + } + + fn number(&mut self, source: &NumberSource, scope: Option<&Scope>) -> Res { + Ok(match (source, scope) { + (NumberSource::Literal(_), _) => source.clone(), + (NumberSource::Bound(bind), _) => NumberSource::Bound(self.bind(bind)), + (NumberSource::Param(name), None) => { + self.unbound(&format!("param '{}'", name.name)); + source.clone() + } + (NumberSource::Param(name), Some(scope)) => match Self::arg_of(name, scope)? { + ArgValue::Number(arg) => NumberSource::Literal(NumberLiteral { value: arg.value }), + ArgValue::Bind(bind) => NumberSource::Bound(bind.clone()), + other => return wrong_kind(name, other, "a number"), + }, + }) + } + + fn boolean(&mut self, source: &BoolSource, scope: Option<&Scope>) -> Res { + Ok(match (source, scope) { + (BoolSource::Literal(_), _) => source.clone(), + (BoolSource::Bound(bind), _) => BoolSource::Bound(self.bind(bind)), + (BoolSource::Param(name), None) => { + self.unbound(&format!("param '{}'", name.name)); + source.clone() + } + (BoolSource::Param(name), Some(scope)) => match Self::arg_of(name, scope)? { + ArgValue::Bool(arg) => BoolSource::Literal(BoolLiteral { value: arg.value }), + ArgValue::Bind(bind) => BoolSource::Bound(bind.clone()), + other => return wrong_kind(name, other, "a bool"), + }, + }) + } + + /// Substitution only: the form an argument takes, before any position judges it. + fn subst_collection(&mut self, source: &CollectionSource, scope: Option<&Scope>) -> Res { + Ok(match (source, scope) { + (CollectionSource::Records(records), _) => CollectionSource::Records(RecordsSource { + provider: self.fill(&records.provider), + schema: records.schema.clone(), + key_prefix: records.key_prefix.clone(), + }), + (CollectionSource::Member(bind), _) => CollectionSource::Member(self.bind(bind)), + (CollectionSource::Param(_), None) => source.clone(), + (CollectionSource::Param(name), Some(scope)) => match Self::arg_of(name, scope)? { + ArgValue::Collection(arg) => arg.source.clone(), + other => return wrong_kind(name, other, "a collection"), + }, + }) + } + + fn collection(&mut self, source: &CollectionSource, scope: Option<&Scope>) -> Res { + let found = self.subst_collection(source, scope)?; + if let CollectionSource::Param(name) = &found { + self.unbound(&format!("param '{}'", name.name)); + } + Ok(found) + } + + fn subst_command(&mut self, command: &CommandRef, scope: Option<&Scope>) -> Res { + Ok(match (command, scope) { + (_, None) => command.clone(), + (CommandRef::Id(id), Some(_)) => { + return invalid(format!( + "the body names command '{}'; a composition takes its commands as params", + id.id.as_str() + )); + } + (CommandRef::Param(name), Some(scope)) => match Self::arg_of(name, scope)? { + ArgValue::Command(arg) => arg.command.clone(), + other => return wrong_kind(name, other, "a command"), + }, + }) + } + + /// A command at its final position: declared by the surface, and no Param. + fn command(&mut self, command: &CommandRef, scope: Option<&Scope>) -> Res { + let found = self.subst_command(command, scope)?; + match &found { + CommandRef::Id(id) if !self.commands.contains(&id.id) => { + let node = self.current.clone(); + self.diag(Code::UndeclaredCommand, node, format!("command '{}' is not declared", id.id.as_str())); + } + CommandRef::Param(name) => self.unbound(&format!("param '{}'", name.name)), + CommandRef::Id(_) => {} + } + Ok(found) + } + + fn common(&mut self, common: &NodeCommon, scope: Option<&Scope>, root: bool) -> Res { + let id = self.id(&common.id, scope); + self.current = Some(id.clone()); + match scope { + // A body root is the Use: its id, and its visibility and label unless the body labels it. + Some(scope) if root => { + if common.visible != BoolSource::Literal(BoolLiteral { value: true }) { + return invalid("the body root's visible is not the literal true; visibility is the Use's".into()); + } + let a11y_label = match (&scope.use_a11y, &common.a11y_label) { + (Some(label), _) => Some(label.clone()), + (None, Some(label)) => Some(self.text(label, Some(scope))?), + (None, None) => None, + }; + Ok(NodeCommon { id, visible: scope.use_visible.clone(), a11y_label }) + } + _ => { + let visible = self.boolean(&common.visible, scope)?; + let a11y_label = common.a11y_label.as_ref().map(|label| self.text(label, scope)).transpose()?; + Ok(NodeCommon { id, visible, a11y_label }) + } + } + } + + // ---- nodes -------------------------------------------------------------------------- + + fn count(&mut self, added: usize) -> Res<()> { + self.nodes += added; + if self.nodes > self.limits.max_nodes { + return Err(Fault::Limit(format!("the expansion passed {} nodes", self.limits.max_nodes))); + } + Ok(()) + } + + /// A child list. In a composition body a Slot is replaced by the nodes passed for it. + fn children(&mut self, list: &[Node], scope: Option<&Scope>, depth: usize) -> Res> { + let mut out = Vec::with_capacity(list.len()); + for node in list { + match (node, scope) { + (Node::Slot(slot), Some(scope)) => match Self::arg_of(&slot.param, scope)? { + ArgValue::Slot(arg) => { + self.count(arg.nodes.iter().map(validate::size).sum())?; + out.extend(arg.nodes.iter().map(clone_deep)); + } + other => return wrong_kind(&slot.param, other, "a slot"), + }, + _ => out.push(self.node(node, scope, depth, false)?), + } + } + Ok(out) + } + + fn node(&mut self, node: &Node, scope: Option<&Scope>, depth: usize, root: bool) -> Res { + super::grow(|| self.node_at(node, scope, depth, root)) + } + + fn node_at(&mut self, node: &Node, scope: Option<&Scope>, depth: usize, root: bool) -> Res { + if depth > STACK_BOUND { + return Err(Fault::Stack(format!("the input nests deeper than {STACK_BOUND} levels"))); + } + self.count(1)?; + // Each arm settles its own positions first and its child lists last: a diagnostic names the + // node being expanded, and a child list moves `current` on. + Ok(match node { + Node::Slot(slot) => match scope { + Some(_) => { + return invalid(format!( + "Slot '{}' is not in a child list of the body; a slot stands only in Box.children, \ + Button.content or Overlay.children", + slot.param.name + )); + } + None => { + self.current = None; + self.unbound(&format!("Slot '{}'", slot.param.name)); + node.clone() + } + }, + Node::Use(used) => self.expand_use(used, scope, depth, root)?, + Node::Box(b) => { + let common = self.common(&b.common, scope, root)?; + let children = self.children(&b.children, scope, depth + 1)?; + Node::Box(BoxNode { common, style: b.style.clone(), paint: b.paint.clone(), role: b.role.clone(), children }) + } + Node::Text(t) => { + let common = self.common(&t.common, scope, root)?; + let content = self.text(&t.content, scope)?; + Node::Text(TextNode { common, content, ..t.clone() }) + } + Node::Image(i) => { + let common = self.common(&i.common, scope, root)?; + let alt = self.text(&i.alt, scope)?; + Node::Image(ImageNode { common, alt, ..i.clone() }) + } + Node::Button(b) => { + let common = self.common(&b.common, scope, root)?; + let on_activate = self.command(&b.on_activate, scope)?; + let enabled = self.boolean(&b.enabled, scope)?; + let content = self.children(&b.content, scope, depth + 1)?; + Node::Button(ButtonNode { common, content, on_activate, enabled }) + } + Node::Toggle(t) => { + let common = self.common(&t.common, scope, root)?; + let checked = self.boolean(&t.checked, scope)?; + let on_change = self.command(&t.on_change, scope)?; + Node::Toggle(ToggleNode { common, checked, on_change }) + } + Node::Slider(s) => { + let common = self.common(&s.common, scope, root)?; + let value = self.number(&s.value, scope)?; + let commit = self.command(&s.commit, scope)?; + Node::Slider(SliderNode { common, value, commit, ..s.clone() }) + } + Node::TextInput(t) => { + let common = self.common(&t.common, scope, root)?; + let placeholder = self.text(&t.placeholder, scope)?; + let initial = self.text(&t.initial, scope)?; + let submit = self.command(&t.submit, scope)?; + Node::TextInput(TextInputNode { common, placeholder, initial, submit, ..t.clone() }) + } + Node::Select(s) => { + let common = self.common(&s.common, scope, root)?; + let options = match &s.options { + OptionList::Literal(_) => s.options.clone(), + OptionList::Bound(bound) => OptionList::Bound(BoundOptions { + collection: self.collection(&bound.collection, scope)?, + value_member: bound.value_member.clone(), + label_member: bound.label_member.clone(), + }), + }; + let value = self.bind(&s.value); + let on_change = self.command(&s.on_change, scope)?; + Node::Select(SelectNode { common, options, value, on_change }) + } + Node::Repeat(r) => { + let common = self.common(&r.common, scope, root)?; + let collection = self.collection(&r.collection, scope)?; + let template = std::boxed::Box::new(self.node(&r.template, scope, depth + 1, false)?); + Node::Repeat(RepeatNode { common, collection, key_member: r.key_member.clone(), template }) + } + Node::Overlay(o) => { + let common = self.common(&o.common, scope, root)?; + let anchor = match &o.anchor { + Anchor::Viewport => Anchor::Viewport, + Anchor::Node(anchor) => Anchor::Node(AnchorNode { node: self.id(&anchor.node, scope) }), + }; + let dismiss = self.command(&o.dismiss, scope)?; + let children = self.children(&o.children, scope, depth + 1)?; + Node::Overlay(OverlayNode { common, anchor, modal: o.modal, dismiss, children }) + } + Node::Plot(p) => { + let common = self.common(&p.common, scope, root)?; + Node::Plot(PlotNode { common, series: self.bind(&p.series), ..p.clone() }) + } + Node::Embed(e) => { + let common = self.common(&e.common, scope, root)?; + Node::Embed(EmbedNode { common, ..e.clone() }) + } + }) + } + + // ---- compositions ------------------------------------------------------------------- + + fn load(&mut self, reference: &CompositionRef) -> Result { + let name = format!("{}.{}.v{}", reference.publisher, reference.name.as_str(), reference.version.get()); + if reference.publisher == thing_std::PUBLISHER { + return thing_std::lookup(reference.name.as_str(), reference.version) + .ok_or((Code::UnresolvedUse, format!("no compiled-in composition {name}"))); + } + let address = Address { + provider: ProviderId::new(reference.publisher.clone()), + schema: SchemaId::new(CompositionDocument::SCHEMA_NAME), + key: RecordKey::new(reference.record_key()), + }; + self.reads.insert(address.clone()); + match self.port.read(&address) { + Lookup::Present(entry) => match entry.record { + Record::Composition(composition) => Ok(composition), + _ => Err((Code::CompositionInvalid, format!("the record at {name} is not a composition"))), + }, + Lookup::Absent => Err((Code::UnresolvedUse, format!("no composition published at {name}"))), + Lookup::Refused(refusal) => Err((Code::DecodeRefused, format!("{name}: {}", refusal.detail))), + } + } + + /// The first thing wrong with the composition against its Use, if anything. + fn misfit(reference: &CompositionRef, composition: &CompositionDocument, args: &[Arg]) -> Option { + if composition.publisher != reference.publisher + || composition.name != reference.name + || composition.version != reference.version + { + return Some("the composition record's publisher, name or version differs from the Use's reference".into()); + } + let mut declared: HashMap<&str, &ParamKind> = HashMap::new(); + for param in &composition.params { + if declared.insert(¶m.name, ¶m.kind).is_some() { + return Some(format!("the composition declares param '{}' twice", param.name)); + } + } + let mut given: HashSet<&str> = HashSet::new(); + for arg in args { + if !given.insert(&arg.name) { + return Some(format!("argument '{}' is given twice", arg.name)); + } + match declared.get(arg.name.as_str()) { + None => return Some(format!("argument '{}' names no param of the composition", arg.name)), + Some(kind) if kind_name(kind) != arm_name(&arg.value) => { + return Some(format!( + "argument '{}' is a {} but the param is a {}", + arg.name, + arm_name(&arg.value), + kind_name(kind) + )); + } + Some(_) => {} + } + } + composition + .params + .iter() + .find(|param| !given.contains(param.name.as_str())) + .map(|param| format!("param '{}' has no argument", param.name)) + } + + /// An argument in the caller's scope: the form the body will place. + fn arg(&mut self, value: &ArgValue, scope: Option<&Scope>, depth: usize) -> Res { + Ok(match value { + ArgValue::Text(_) | ArgValue::Number(_) | ArgValue::Bool(_) => value.clone(), + ArgValue::Bind(bind) => ArgValue::Bind(self.bind(bind)), + ArgValue::Collection(arg) => { + ArgValue::Collection(CollectionArg { source: self.subst_collection(&arg.source, scope)? }) + } + ArgValue::Command(arg) => ArgValue::Command(CommandArg { command: self.subst_command(&arg.command, scope)? }), + ArgValue::Slot(arg) => ArgValue::Slot(SlotArg { nodes: self.children(&arg.nodes, scope, depth + 1)? }), + }) + } + + fn expand_use(&mut self, used: &UseNode, scope: Option<&Scope>, depth: usize, root: bool) -> Res { + let common = self.common(&used.common, scope, root)?; + let here = common.id.clone(); + let reference = &used.composition; + let placeholder = |common: NodeCommon| Node::Use(UseNode { common, composition: reference.clone(), args: vec![] }); + + let repeats = self.stack.contains(reference); + if repeats || self.stack.len() >= self.limits.max_use_depth { + let why = if repeats { "uses itself" } else { "is nested too deep" }; + self.diag(Code::CompositionCycle, Some(here), format!("the composition {why}")); + return Ok(placeholder(common)); + } + let composition = match self.load(reference) { + Ok(composition) => composition, + Err((code, detail)) => { + self.diag(code, Some(here), detail); + return Ok(placeholder(common)); + } + }; + if let Some(detail) = Self::misfit(reference, &composition, &used.args) { + self.diag(Code::CompositionInvalid, Some(here), detail); + return Ok(placeholder(common)); + } + + let mark = self.diagnostics.len(); + let mut args = HashMap::new(); + for arg in &used.args { + args.insert(arg.name.clone(), self.arg(&arg.value, scope, depth)?); + } + let inner = Scope { + use_id: here.clone(), + root_id: body_id(&composition.body), + use_visible: common.visible.clone(), + use_a11y: common.a11y_label.clone(), + args, + }; + self.stack.push(reference.clone()); + let expanded = self.node(&composition.body, Some(&inner), depth, true); + self.stack.pop(); + match expanded { + Ok(node) => Ok(node), + Err(Fault::Invalid(detail)) => { + self.diagnostics.truncate(mark); + self.diag(Code::CompositionInvalid, Some(here), detail); + Ok(placeholder(common)) + } + Err(limit) => Err(limit), + } + } +} + +/// The id of a body root. A Slot has none, and the body fails on it before an id is read. +/// A copy of an expanded subtree that grows its own stack. The derived `Clone` of `Node` costs about +/// 12 KiB of debug stack per level, so a spliced slot argument up to `STACK_BOUND` levels deep would +/// overflow it; each container here recurses through `grow`. An expanded subtree holds no Slot and no +/// Use with arguments, so the four containers are the only nodes that hold nodes. +fn clone_deep(node: &Node) -> Node { + super::grow(|| match node { + Node::Box(b) => Node::Box(BoxNode { + common: b.common.clone(), + style: b.style.clone(), + paint: b.paint.clone(), + role: b.role.clone(), + children: b.children.iter().map(clone_deep).collect(), + }), + Node::Button(b) => Node::Button(ButtonNode { + common: b.common.clone(), + content: b.content.iter().map(clone_deep).collect(), + on_activate: b.on_activate.clone(), + enabled: b.enabled.clone(), + }), + Node::Overlay(o) => Node::Overlay(OverlayNode { + common: o.common.clone(), + anchor: o.anchor.clone(), + modal: o.modal, + dismiss: o.dismiss.clone(), + children: o.children.iter().map(clone_deep).collect(), + }), + Node::Repeat(r) => Node::Repeat(RepeatNode { + common: r.common.clone(), + collection: r.collection.clone(), + key_member: r.key_member.clone(), + template: std::boxed::Box::new(clone_deep(&r.template)), + }), + other => other.clone(), + }) +} + +fn body_id(node: &Node) -> NodeId { + match node { + Node::Box(n) => n.common.id.clone(), + Node::Text(n) => n.common.id.clone(), + Node::Image(n) => n.common.id.clone(), + Node::Button(n) => n.common.id.clone(), + Node::Toggle(n) => n.common.id.clone(), + Node::Slider(n) => n.common.id.clone(), + Node::TextInput(n) => n.common.id.clone(), + Node::Select(n) => n.common.id.clone(), + Node::Repeat(n) => n.common.id.clone(), + Node::Overlay(n) => n.common.id.clone(), + Node::Plot(n) => n.common.id.clone(), + Node::Embed(n) => n.common.id.clone(), + Node::Use(n) => n.common.id.clone(), + Node::Slot(_) => NodeId::new(""), + } +} diff --git a/crates/thing-core/src/resolve/mod.rs b/crates/thing-core/src/resolve/mod.rs new file mode 100644 index 0000000..002eb9f --- /dev/null +++ b/crates/thing-core/src/resolve/mod.rs @@ -0,0 +1,108 @@ +//! Resolve: the pure expansion of a surface document into a tree with no composition left in it. +//! This is the only code that reads Thing Script structure (Use, Param, CommandRef, node ids). +//! It reads compositions through `StatePort::read` and `thing.std` from a compiled-in table, +//! holds no state, subscribes to nothing and never drains. + +mod expand; +pub mod std; +mod validate; + +use thing_contract::SurfaceDocument; + +use crate::diagnostic::{Code, Diagnostic}; +use crate::port::{Address, StatePort}; + +/// Stack left below which recursion moves to a fresh segment, and the segment's size: the values +/// cultcache-rs uses for decode. Every recursion over a tree runs through `grow`, so a tree as deep +/// as `STACK_BOUND` resolves on a default thread. +const RED_ZONE: usize = 512 * 1024; +const SEGMENT: usize = 2 * 1024 * 1024; + +/// Runs one recursive step with room for the next, growing the stack when it is nearly spent. +fn grow(step: impl FnOnce() -> R) -> R { + stacker::maybe_grow(RED_ZONE, SEGMENT, step) +} + +/// The bounds of one expansion. +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct Limits { + /// Compositions nested in one another; a Use deeper than this is a placeholder. + pub max_use_depth: usize, + /// The contract's decode bound; a deeper expanded tree is refused. + pub max_tree_depth: usize, + /// Nodes in the expanded tree; more is refused. + pub max_nodes: usize, +} + +impl Default for Limits { + fn default() -> Self { + Self { max_use_depth: 32, max_tree_depth: 256, max_nodes: 65_536 } + } +} + +/// A surface document expanded: no Param of any kind remains, every command is declared, every +/// state reference names its provider, node ids are unique, and a Use remains only as a +/// placeholder leaf (its arguments emptied) beside a diagnostic. Only `resolve` builds one. +#[derive(Clone, Debug, PartialEq)] +pub struct ResolvedTree { + document: SurfaceDocument, +} + +impl ResolvedTree { + pub fn document(&self) -> &SurfaceDocument { + &self.document + } +} + +/// What one expansion found. `tree` is `None` when a fault refuses the whole document. +#[derive(Clone, Debug, PartialEq)] +pub struct Resolution { + pub tree: Option, + /// Expansion faults in expansion pre-order, then the finished tree's faults (duplicate ids, depth) + /// in tree pre-order. + pub diagnostics: Vec, + /// Every non-std composition address consulted, whether present, absent or refused, once each, ordered + /// by provider, schema and key. + pub reads: Vec
, +} + +pub fn resolve(document: &SurfaceDocument, port: &dyn StatePort, limits: &Limits) -> Resolution { + let mut expander = expand::Expander::new(document, port, limits); + let root = match expander.root(&document.root) { + Ok(root) => Some(root), + Err(expand::Fault::Limit(detail)) => { + expander.diag(Code::ExpansionLimit, None, detail); + None + } + Err(expand::Fault::Stack(detail)) => { + expander.diag(Code::TooDeepToResolve, None, detail); + None + } + Err(expand::Fault::Invalid(detail)) => { + expander.diag(Code::CompositionInvalid, None, detail); + None + } + }; + let mut diagnostics = ::std::mem::take(&mut expander.diagnostics); + let mut reads: Vec
= ::std::mem::take(&mut expander.reads).into_iter().collect(); + reads.sort_by(|a, b| { + let key = |address: &Address| (address.provider.as_str().to_string(), address.schema.as_str().to_string(), address.key.as_str().to_string()); + key(a).cmp(&key(b)) + }); + let tree = root.and_then(|root| { + diagnostics.extend(validate::check(&root, limits, &document.record_key())); + let refused = diagnostics.iter().any(|diagnostic| diagnostic.code.refuses_document()); + // Field by field: `..document.clone()` would clone the whole input tree to discard it. + (!refused).then(|| ResolvedTree { + document: SurfaceDocument { + provider_id: document.provider_id.clone(), + label: document.label.clone(), + version: document.version, + title: document.title.clone(), + root, + commands: document.commands.clone(), + }, + }) + }); + Resolution { tree, diagnostics, reads } +} diff --git a/crates/thing-core/src/resolve/std.rs b/crates/thing-core/src/resolve/std.rs new file mode 100644 index 0000000..e5b6f1c --- /dev/null +++ b/crates/thing-core/src/resolve/std.rs @@ -0,0 +1,95 @@ +//! `thing.std`: the compositions compiled into core. The port is never asked for this +//! publisher, so no provider can shadow one. + +use thing_contract::*; + +/// The publisher whose compositions are compiled in. +pub const PUBLISHER: &str = "thing.std"; + +/// Every compiled-in composition. +pub fn all() -> Vec { + vec![stat(), card()] +} + +pub(super) fn lookup(name: &str, version: Version) -> Option { + all().into_iter().find(|composition| composition.name.as_str() == name && composition.version == version) +} + +fn segment(name: &str) -> Segment { + Segment::new(name).expect("a std name is a segment") +} + +fn common(id: &str) -> NodeCommon { + NodeCommon { id: NodeId::new(id), visible: BoolSource::Literal(BoolLiteral { value: true }), a11y_label: None } +} + +fn text(id: &str, content: TextSource, style_token: &str) -> Node { + Node::Text(TextNode { + common: common(id), + content, + style_token: style_token.into(), + wrap: true, + max_lines: None, + selectable: false, + }) +} + +fn param(name: &str) -> ParamName { + ParamName { name: name.into() } +} + +fn column(id: &str, children: Vec) -> Node { + let zero = || Dimension::Px(Scalar { value: 0.0 }); + let auto = || Dimension::Auto; + let size = |width, height| Size2 { width, height }; + let edges = |all: Dimension| Edges { top: all.clone(), right: all.clone(), bottom: all.clone(), left: all }; + let style = BoxStyle { + display: Display::Flex, + direction: Direction::Column, + wrap: Wrap::NoWrap, + gap: size(zero(), Dimension::Px(Scalar { value: 4.0 })), + padding: edges(zero()), + margin: edges(zero()), + size: size(auto(), Dimension::Content), + min_size: size(zero(), zero()), + max_size: size(auto(), auto()), + position: Position::Relative, + inset: edges(auto()), + overflow: Overflow::Visible, + align_items: ItemAlign::Stretch, + align_self: ItemAlign::Auto, + align_content: ContentAlign::Start, + justify_content: ContentAlign::Start, + grow: 0.0, + shrink: 1.0, + basis: Dimension::Auto, + grid_columns: vec![], + grid_rows: vec![], + }; + let paint = Paint { background: None, border: None, radius: 0.0 }; + Node::Box(BoxNode { common: common(id), style, paint, role: Role::Group, children }) +} + +fn composition(name: &str, params: &[(&str, ParamKind)], body: Node) -> CompositionDocument { + CompositionDocument { + publisher: PUBLISHER.into(), + name: segment(name), + version: Version::new(1).expect("version 1"), + params: params.iter().map(|(name, kind)| ParamDecl { name: (*name).into(), kind: kind.clone() }).collect(), + body, + } +} + +/// A label over a bound value. +fn stat() -> CompositionDocument { + let label = text("stat-label", TextSource::Param(param("label")), "caption"); + let value = text("stat-value", TextSource::Param(param("value")), "title"); + composition("stat", &[("label", ParamKind::Text), ("value", ParamKind::Bind)], column("stat-root", vec![label, value])) +} + +/// A title over the nodes passed for `body`. +fn card() -> CompositionDocument { + let title = text("card-title", TextSource::Param(param("title")), "title"); + let slot = Node::Slot(SlotNode { param: param("body") }); + composition("card", &[("title", ParamKind::Text), ("body", ParamKind::Slot)], column("card-root", vec![title, slot])) +} diff --git a/crates/thing-core/src/resolve/validate.rs b/crates/thing-core/src/resolve/validate.rs new file mode 100644 index 0000000..4244e42 --- /dev/null +++ b/crates/thing-core/src/resolve/validate.rs @@ -0,0 +1,110 @@ +//! The one pass over the finished tree: ids unique, and the tree within its depth limit (a slot's +//! nodes are placed deeper than expand saw them). Commands, Params and Slots are judged where they +//! land and the node count is expand's alone (it must stop before it builds a tree it would refuse). + +use std::collections::HashSet; + +use thing_contract::{Node, NodeId}; + +use super::Limits; +use crate::diagnostic::{Code, Diagnostic}; + +/// The child nodes of a node, in order. +fn children(node: &Node) -> &[Node] { + match node { + Node::Box(b) => &b.children, + Node::Button(b) => &b.content, + Node::Overlay(o) => &o.children, + Node::Repeat(r) => std::slice::from_ref(&*r.template), + _ => &[], + } +} + +fn id(node: &Node) -> Option<&NodeId> { + match node { + Node::Box(n) => Some(&n.common.id), + Node::Text(n) => Some(&n.common.id), + Node::Image(n) => Some(&n.common.id), + Node::Button(n) => Some(&n.common.id), + Node::Toggle(n) => Some(&n.common.id), + Node::Slider(n) => Some(&n.common.id), + Node::TextInput(n) => Some(&n.common.id), + Node::Select(n) => Some(&n.common.id), + Node::Repeat(n) => Some(&n.common.id), + Node::Overlay(n) => Some(&n.common.id), + Node::Plot(n) => Some(&n.common.id), + Node::Embed(n) => Some(&n.common.id), + Node::Use(n) => Some(&n.common.id), + Node::Slot(_) => None, + } +} + +/// Nodes in the subtree, the node itself included. +pub(super) fn size(node: &Node) -> usize { + super::grow(|| 1 + children(node).iter().map(size).sum::()) +} + +/// Faults of the finished tree, in pre-order: duplicate ids, then depth. A tree deeper than the limit is not walked further. +pub(super) fn check(root: &Node, limits: &Limits, surface: &str) -> Vec { + let mut found = Vec::new(); + let fault = |code, node: Option<&NodeId>, detail: String| Diagnostic { + code, + surface: surface.to_string(), + node: node.cloned(), + detail, + }; + let mut seen: HashSet<&NodeId> = HashSet::new(); + let mut too_deep = false; + let mut stack = vec![(root, 1usize)]; + while let Some((node, depth)) = stack.pop() { + if depth > limits.max_tree_depth { + too_deep = true; + continue; + } + if let Some(id) = id(node) { + if !seen.insert(id) { + found.push(fault(Code::DuplicateNodeId, Some(id), format!("node id '{}' occurs twice", id.as_str()))); + } + } + stack.extend(children(node).iter().rev().map(|child| (child, depth + 1))); + } + if too_deep { + found.push(fault(Code::ExpansionLimit, None, format!("the tree is deeper than {} levels", limits.max_tree_depth))); + } + found +} + +#[cfg(test)] +mod tests { + use thing_testkit::build::{boxed, text}; + + use super::*; + + /// Runs `work` with about `left` bytes of stack remaining: the stack is burned first, so a recursion + /// that does not grow its own runs out inside it. + #[inline(never)] + fn with_stack_left(left: usize, work: &mut dyn FnMut()) { + if stacker::remaining_stack().expect("the thread's stack limit is known") > left { + let burn = [0u8; 4096]; + std::hint::black_box(&burn); + with_stack_left(left, work); + std::hint::black_box(&burn); + } else { + work(); + } + } + + #[test] + fn size_of_a_deep_subtree_grows_its_own_stack() { + // expand counts a slot argument with `size` after the argument was expanded, from wherever the + // stack stands; a 1,000-level argument must not run it out. + let mut deep = text("bottom", "x"); + for level in 1..1000 { + deep = boxed(&format!("level-{level}"), vec![deep]); + } + let mut counted = 0; + with_stack_left(100 * 1024, &mut || counted = size(&deep)); + assert_eq!(counted, 1000); + // Dropping a tree this deep needs the room the test thread has outside `with_stack_left`. + } +} diff --git a/crates/thing-core/tests/goldens/README.md b/crates/thing-core/tests/goldens/README.md new file mode 100644 index 0000000..af12c1d --- /dev/null +++ b/crates/thing-core/tests/goldens/README.md @@ -0,0 +1,6 @@ +# thing-core goldens + +`resolve-*.bin` is a CultCache single-file store holding one resolved surface document under the +pinned clock; `resolve-*.txt` is the `{:#?}` text of the same document. The binary is the oracle and +the text is compared beside it. `THING_BLESS=1` through `thing_testkit::golden::check_with_text` is +the only way either changes. diff --git a/crates/thing-core/tests/goldens/resolve-f09-composition-stack.bin b/crates/thing-core/tests/goldens/resolve-f09-composition-stack.bin new file mode 100644 index 0000000..147eb0f Binary files /dev/null and b/crates/thing-core/tests/goldens/resolve-f09-composition-stack.bin differ diff --git a/crates/thing-core/tests/goldens/resolve-f09-composition-stack.txt b/crates/thing-core/tests/goldens/resolve-f09-composition-stack.txt new file mode 100644 index 0000000..9c191d0 --- /dev/null +++ b/crates/thing-core/tests/goldens/resolve-f09-composition-stack.txt @@ -0,0 +1,864 @@ +SurfaceDocument { + provider_id: ProviderId( + "provider.stack", + ), + label: Segment( + "stack", + ), + version: Version( + 1, + ), + title: "Stack", + root: Box( + BoxNode { + common: NodeCommon { + id: NodeId( + "root", + ), + visible: Literal( + BoolLiteral { + value: true, + }, + ), + a11y_label: None, + }, + style: BoxStyle { + display: Flex, + direction: Column, + wrap: NoWrap, + gap: Size2 { + width: Px( + Scalar { + value: 4.0, + }, + ), + height: Px( + Scalar { + value: 8.0, + }, + ), + }, + padding: Edges { + top: Px( + Scalar { + value: 2.0, + }, + ), + right: Px( + Scalar { + value: 2.0, + }, + ), + bottom: Px( + Scalar { + value: 2.0, + }, + ), + left: Px( + Scalar { + value: 2.0, + }, + ), + }, + margin: Edges { + top: Auto, + right: Auto, + bottom: Auto, + left: Auto, + }, + size: Size2 { + width: Percent( + Scalar { + value: 100.0, + }, + ), + height: Content, + }, + min_size: Size2 { + width: Px( + Scalar { + value: 0.0, + }, + ), + height: Px( + Scalar { + value: 0.0, + }, + ), + }, + max_size: Size2 { + width: Auto, + height: Auto, + }, + position: Relative, + inset: Edges { + top: Auto, + right: Auto, + bottom: Auto, + left: Auto, + }, + overflow: Visible, + align_items: Stretch, + align_self: Auto, + align_content: Start, + justify_content: SpaceBetween, + grow: 1.0, + shrink: 0.0, + basis: Auto, + grid_columns: [], + grid_rows: [], + }, + paint: Paint { + background: None, + border: None, + radius: 0.0, + }, + role: Group, + children: [ + Box( + BoxNode { + common: NodeCommon { + id: NodeId( + "std-stat", + ), + visible: Literal( + BoolLiteral { + value: true, + }, + ), + a11y_label: None, + }, + style: BoxStyle { + display: Flex, + direction: Column, + wrap: NoWrap, + gap: Size2 { + width: Px( + Scalar { + value: 0.0, + }, + ), + height: Px( + Scalar { + value: 4.0, + }, + ), + }, + padding: Edges { + top: Px( + Scalar { + value: 0.0, + }, + ), + right: Px( + Scalar { + value: 0.0, + }, + ), + bottom: Px( + Scalar { + value: 0.0, + }, + ), + left: Px( + Scalar { + value: 0.0, + }, + ), + }, + margin: Edges { + top: Px( + Scalar { + value: 0.0, + }, + ), + right: Px( + Scalar { + value: 0.0, + }, + ), + bottom: Px( + Scalar { + value: 0.0, + }, + ), + left: Px( + Scalar { + value: 0.0, + }, + ), + }, + size: Size2 { + width: Auto, + height: Content, + }, + min_size: Size2 { + width: Px( + Scalar { + value: 0.0, + }, + ), + height: Px( + Scalar { + value: 0.0, + }, + ), + }, + max_size: Size2 { + width: Auto, + height: Auto, + }, + position: Relative, + inset: Edges { + top: Auto, + right: Auto, + bottom: Auto, + left: Auto, + }, + overflow: Visible, + align_items: Stretch, + align_self: Auto, + align_content: Start, + justify_content: Start, + grow: 0.0, + shrink: 1.0, + basis: Auto, + grid_columns: [], + grid_rows: [], + }, + paint: Paint { + background: None, + border: None, + radius: 0.0, + }, + role: Group, + children: [ + Text( + TextNode { + common: NodeCommon { + id: NodeId( + "std-stat/stat-label", + ), + visible: Literal( + BoolLiteral { + value: true, + }, + ), + a11y_label: None, + }, + content: Literal( + TextLiteral { + value: "Load", + }, + ), + style_token: "caption", + wrap: true, + max_lines: None, + selectable: false, + }, + ), + Text( + TextNode { + common: NodeCommon { + id: NodeId( + "std-stat/stat-value", + ), + visible: Literal( + BoolLiteral { + value: true, + }, + ), + a11y_label: None, + }, + content: Bound( + Bind { + source: Record( + StateRef { + provider: Some( + ProviderId( + "provider.swarm", + ), + ), + schema: SchemaId( + "gamecult.thing.test.swarm.v1", + ), + key: RecordKey( + "summary", + ), + }, + ), + member: MemberPath { + steps: [ + Name( + MemberName { + name: "Load", + }, + ), + ], + }, + format: None, + }, + ), + style_token: "title", + wrap: true, + max_lines: None, + selectable: false, + }, + ), + ], + }, + ), + Box( + BoxNode { + common: NodeCommon { + id: NodeId( + "outer-card", + ), + visible: Literal( + BoolLiteral { + value: true, + }, + ), + a11y_label: None, + }, + style: BoxStyle { + display: Flex, + direction: Column, + wrap: NoWrap, + gap: Size2 { + width: Px( + Scalar { + value: 4.0, + }, + ), + height: Px( + Scalar { + value: 8.0, + }, + ), + }, + padding: Edges { + top: Px( + Scalar { + value: 2.0, + }, + ), + right: Px( + Scalar { + value: 2.0, + }, + ), + bottom: Px( + Scalar { + value: 2.0, + }, + ), + left: Px( + Scalar { + value: 2.0, + }, + ), + }, + margin: Edges { + top: Auto, + right: Auto, + bottom: Auto, + left: Auto, + }, + size: Size2 { + width: Percent( + Scalar { + value: 100.0, + }, + ), + height: Content, + }, + min_size: Size2 { + width: Px( + Scalar { + value: 0.0, + }, + ), + height: Px( + Scalar { + value: 0.0, + }, + ), + }, + max_size: Size2 { + width: Auto, + height: Auto, + }, + position: Relative, + inset: Edges { + top: Auto, + right: Auto, + bottom: Auto, + left: Auto, + }, + overflow: Visible, + align_items: Stretch, + align_self: Auto, + align_content: Start, + justify_content: SpaceBetween, + grow: 1.0, + shrink: 0.0, + basis: Auto, + grid_columns: [], + grid_rows: [], + }, + paint: Paint { + background: None, + border: None, + radius: 0.0, + }, + role: Group, + children: [ + Text( + TextNode { + common: NodeCommon { + id: NodeId( + "outer-card/card-title", + ), + visible: Literal( + BoolLiteral { + value: true, + }, + ), + a11y_label: None, + }, + content: Literal( + TextLiteral { + value: "Card", + }, + ), + style_token: "title", + wrap: true, + max_lines: None, + selectable: false, + }, + ), + Repeat( + RepeatNode { + common: NodeCommon { + id: NodeId( + "outer-card/card-rows", + ), + visible: Literal( + BoolLiteral { + value: true, + }, + ), + a11y_label: None, + }, + collection: Records( + RecordsSource { + provider: Some( + ProviderId( + "provider.stack", + ), + ), + schema: SchemaId( + "gamecult.thing.test.swarm.v1", + ), + key_prefix: "mind-", + }, + ), + key_member: MemberPath { + steps: [ + Name( + MemberName { + name: "Id", + }, + ), + ], + }, + template: Text( + TextNode { + common: NodeCommon { + id: NodeId( + "outer-card/card-row", + ), + visible: Literal( + BoolLiteral { + value: true, + }, + ), + a11y_label: None, + }, + content: Bound( + Bind { + source: Item, + member: MemberPath { + steps: [ + Name( + MemberName { + name: "Name", + }, + ), + ], + }, + format: None, + }, + ), + style_token: "body", + wrap: false, + max_lines: None, + selectable: false, + }, + ), + }, + ), + Button( + ButtonNode { + common: NodeCommon { + id: NodeId( + "outer-card/card-act", + ), + visible: Literal( + BoolLiteral { + value: true, + }, + ), + a11y_label: None, + }, + content: [ + Text( + TextNode { + common: NodeCommon { + id: NodeId( + "outer-card/card-act-label", + ), + visible: Literal( + BoolLiteral { + value: true, + }, + ), + a11y_label: None, + }, + content: Literal( + TextLiteral { + value: "Open", + }, + ), + style_token: "body", + wrap: true, + max_lines: None, + selectable: false, + }, + ), + ], + on_activate: Id( + CommandIdRef { + id: CommandId( + "open", + ), + }, + ), + enabled: Literal( + BoolLiteral { + value: true, + }, + ), + }, + ), + Box( + BoxNode { + common: NodeCommon { + id: NodeId( + "inner-card", + ), + visible: Literal( + BoolLiteral { + value: true, + }, + ), + a11y_label: None, + }, + style: BoxStyle { + display: Flex, + direction: Column, + wrap: NoWrap, + gap: Size2 { + width: Px( + Scalar { + value: 4.0, + }, + ), + height: Px( + Scalar { + value: 8.0, + }, + ), + }, + padding: Edges { + top: Px( + Scalar { + value: 2.0, + }, + ), + right: Px( + Scalar { + value: 2.0, + }, + ), + bottom: Px( + Scalar { + value: 2.0, + }, + ), + left: Px( + Scalar { + value: 2.0, + }, + ), + }, + margin: Edges { + top: Auto, + right: Auto, + bottom: Auto, + left: Auto, + }, + size: Size2 { + width: Percent( + Scalar { + value: 100.0, + }, + ), + height: Content, + }, + min_size: Size2 { + width: Px( + Scalar { + value: 0.0, + }, + ), + height: Px( + Scalar { + value: 0.0, + }, + ), + }, + max_size: Size2 { + width: Auto, + height: Auto, + }, + position: Relative, + inset: Edges { + top: Auto, + right: Auto, + bottom: Auto, + left: Auto, + }, + overflow: Visible, + align_items: Stretch, + align_self: Auto, + align_content: Start, + justify_content: SpaceBetween, + grow: 1.0, + shrink: 0.0, + basis: Auto, + grid_columns: [], + grid_rows: [], + }, + paint: Paint { + background: None, + border: None, + radius: 0.0, + }, + role: Group, + children: [ + Text( + TextNode { + common: NodeCommon { + id: NodeId( + "inner-card/card-title", + ), + visible: Literal( + BoolLiteral { + value: true, + }, + ), + a11y_label: None, + }, + content: Literal( + TextLiteral { + value: "Card", + }, + ), + style_token: "title", + wrap: true, + max_lines: None, + selectable: false, + }, + ), + Repeat( + RepeatNode { + common: NodeCommon { + id: NodeId( + "inner-card/card-rows", + ), + visible: Literal( + BoolLiteral { + value: true, + }, + ), + a11y_label: None, + }, + collection: Records( + RecordsSource { + provider: Some( + ProviderId( + "provider.stack", + ), + ), + schema: SchemaId( + "gamecult.thing.test.swarm.v1", + ), + key_prefix: "mind-", + }, + ), + key_member: MemberPath { + steps: [ + Name( + MemberName { + name: "Id", + }, + ), + ], + }, + template: Text( + TextNode { + common: NodeCommon { + id: NodeId( + "inner-card/card-row", + ), + visible: Literal( + BoolLiteral { + value: true, + }, + ), + a11y_label: None, + }, + content: Bound( + Bind { + source: Item, + member: MemberPath { + steps: [ + Name( + MemberName { + name: "Name", + }, + ), + ], + }, + format: None, + }, + ), + style_token: "body", + wrap: false, + max_lines: None, + selectable: false, + }, + ), + }, + ), + Button( + ButtonNode { + common: NodeCommon { + id: NodeId( + "inner-card/card-act", + ), + visible: Literal( + BoolLiteral { + value: true, + }, + ), + a11y_label: None, + }, + content: [ + Text( + TextNode { + common: NodeCommon { + id: NodeId( + "inner-card/card-act-label", + ), + visible: Literal( + BoolLiteral { + value: true, + }, + ), + a11y_label: None, + }, + content: Literal( + TextLiteral { + value: "Open", + }, + ), + style_token: "body", + wrap: true, + max_lines: None, + selectable: false, + }, + ), + ], + on_activate: Id( + CommandIdRef { + id: CommandId( + "open", + ), + }, + ), + enabled: Literal( + BoolLiteral { + value: true, + }, + ), + }, + ), + Text( + TextNode { + common: NodeCommon { + id: NodeId( + "inner-note", + ), + visible: Literal( + BoolLiteral { + value: true, + }, + ), + a11y_label: None, + }, + content: Literal( + TextLiteral { + value: "nested", + }, + ), + style_token: "body", + wrap: true, + max_lines: None, + selectable: false, + }, + ), + ], + }, + ), + ], + }, + ), + ], + }, + ), + commands: [ + CommandDecl { + id: CommandId( + "open", + ), + payload_schema: SchemaId( + "gamecult.thing.test.open.v1", + ), + captures: [], + confirm: None, + }, + ], +} diff --git a/crates/thing-core/tests/resolve.rs b/crates/thing-core/tests/resolve.rs new file mode 100644 index 0000000..7f70c96 --- /dev/null +++ b/crates/thing-core/tests/resolve.rs @@ -0,0 +1,1008 @@ +//! Resolve: expansion, refusal and placeholder, the closed diagnostics, `thing.std`, and the +//! f09 golden. `THING_BLESS=1` on `f09_expands` rewrites the golden through `golden::check`. + +use std::path::PathBuf; + +use thing_contract::*; +use thing_core::diagnostic::Code; +use thing_core::port::{Address, StatePort}; +use thing_core::resolve::{Limits, Resolution, resolve, std as thing_std}; +use thing_testkit::build::*; +use thing_testkit::fixture::Fixture; +use thing_testkit::golden; +use thing_testkit::mem_state::{Call, MemState}; +use thing_testkit::store; + +const PUB: &str = "pub.t"; + +/// Room for a test that clones, prints or compares a deep Node: the contract's derived Clone, Debug +/// and PartialEq cost about 12 KiB of debug stack per level, so a 256-level tree overflows a default +/// thread outside resolve (reported as thing2:cut_report:cut-bind-pin.h1). The tests that run resolve +/// itself on a default thread do not use this. +fn with_room(work: impl FnOnce()) { + stacker::grow(64 * 1024 * 1024, work); +} + +fn surface(root: Node, commands: &[&str]) -> SurfaceDocument { + SurfaceDocument { + provider_id: ProviderId::new("provider.t"), + label: seg("main"), + version: ver(1), + title: "t".into(), + root, + commands: commands + .iter() + .map(|id| CommandDecl { + id: CommandId::new(*id), + payload_schema: SchemaId::new("gamecult.thing.test.cmd.v1"), + captures: vec![], + confirm: None, + }) + .collect(), + } +} + +fn composition(name: &str, params: &[(&str, ParamKind)], body: Node) -> CompositionDocument { + CompositionDocument { + publisher: PUB.into(), + name: seg(name), + version: ver(1), + params: params.iter().map(|(name, kind)| ParamDecl { name: (*name).into(), kind: kind.clone() }).collect(), + body, + } +} + +fn reference(name: &str) -> CompositionRef { + CompositionRef { publisher: PUB.into(), name: seg(name), version: ver(1) } +} + +fn use_of(id: &str, name: &str, args: Vec) -> Node { + Node::Use(UseNode { common: common(id), composition: reference(name), args }) +} + +fn text_arg(name: &str, value: &str) -> Arg { + Arg { name: name.into(), value: ArgValue::Text(TextArg { value: value.into() }) } +} + +fn slot_arg(name: &str, nodes: Vec) -> Arg { + Arg { name: name.into(), value: ArgValue::Slot(SlotArg { nodes }) } +} + +fn command_arg(name: &str, id: &str) -> Arg { + Arg { name: name.into(), value: ArgValue::Command(CommandArg { command: command(id) }) } +} + +fn param_text(id: &str, name: &str) -> Node { + Node::Text(TextNode { + common: common(id), + content: TextSource::Param(param(name)), + style_token: "body".into(), + wrap: false, + max_lines: None, + selectable: false, + }) +} + +fn button(id: &str, on_activate: CommandRef) -> Node { + Node::Button(ButtonNode { common: common(id), content: vec![], on_activate, enabled: lit_bool(true) }) +} + +fn slot(name: &str) -> Node { + Node::Slot(SlotNode { param: param(name) }) +} + +fn repeat(id: &str, template: Node) -> Node { + Node::Repeat(RepeatNode { + common: common(id), + collection: CollectionSource::Records(RecordsSource { + provider: None, + schema: SchemaId::new("gamecult.thing.test.row.v1"), + key_prefix: "row-".into(), + }), + key_member: path(&["id"]), + template: std::boxed::Box::new(template), + }) +} + +fn state_with(compositions: &[CompositionDocument]) -> MemState { + let mut state = MemState::new(); + for composition in compositions { + state.put(&ProviderId::new(PUB), composition); + } + state +} + +fn run(document: &SurfaceDocument, state: &MemState) -> Resolution { + resolve(document, state, &Limits::default()) +} + +fn comp_address(name: &str) -> Address { + Address { + provider: ProviderId::new(PUB), + schema: SchemaId::new(CompositionDocument::SCHEMA_NAME), + key: RecordKey::new(reference(name).record_key()), + } +} + +fn kids(node: &Node) -> &[Node] { + match node { + Node::Box(b) => &b.children, + Node::Button(b) => &b.content, + Node::Overlay(o) => &o.children, + Node::Repeat(r) => std::slice::from_ref(&*r.template), + _ => &[], + } +} + +fn id_of(node: &Node) -> &str { + match node { + Node::Box(n) => n.common.id.as_str(), + Node::Text(n) => n.common.id.as_str(), + Node::Image(n) => n.common.id.as_str(), + Node::Button(n) => n.common.id.as_str(), + Node::Toggle(n) => n.common.id.as_str(), + Node::Slider(n) => n.common.id.as_str(), + Node::TextInput(n) => n.common.id.as_str(), + Node::Select(n) => n.common.id.as_str(), + Node::Repeat(n) => n.common.id.as_str(), + Node::Overlay(n) => n.common.id.as_str(), + Node::Plot(n) => n.common.id.as_str(), + Node::Embed(n) => n.common.id.as_str(), + Node::Use(n) => n.common.id.as_str(), + Node::Slot(_) => "", + } +} + +fn ids(node: &Node, out: &mut Vec) { + out.push(id_of(node).to_string()); + kids(node).iter().for_each(|child| ids(child, out)); +} + +fn all_ids(resolution: &Resolution) -> Vec { + let mut out = Vec::new(); + ids(&resolution.tree.as_ref().expect("a tree").document().root, &mut out); + out +} + +fn find<'a>(node: &'a Node, id: &str) -> Option<&'a Node> { + if id_of(node) == id { + return Some(node); + } + kids(node).iter().find_map(|child| find(child, id)) +} + +fn node_of<'a>(resolution: &'a Resolution, id: &str) -> &'a Node { + find(&resolution.tree.as_ref().expect("a tree").document().root, id).unwrap_or_else(|| panic!("no node {id}")) +} + +/// The one diagnostic, with its code, node and a word its detail must carry. +fn only(resolution: &Resolution, code: Code, node: Option<&str>, detail: &str) { + assert_eq!(resolution.diagnostics.len(), 1, "{:?}", resolution.diagnostics); + let found = &resolution.diagnostics[0]; + assert_eq!(found.code, code, "{found:?}"); + assert_eq!(found.node.as_ref().map(NodeId::as_str), node, "{found:?}"); + assert!(found.detail.contains(detail), "{found:?} lacks '{detail}'"); +} + +fn fixture_resolution(fixture: Fixture, label: &str) -> Resolution { + let (set, state) = (fixture.load(), MemState::from_fixture(fixture)); + let document = set.surfaces.iter().find(|surface| surface.label.as_str() == label).unwrap(); + run(document, &state) +} + +#[test] +fn f09_expands() { + with_room(f09_expands_body); +} + +fn f09_expands_body() { + let set = Fixture::F09CompositionStack.load(); + let state = MemState::from_fixture(Fixture::F09CompositionStack); + let resolution = run(&set.surfaces[0], &state); + assert_eq!(resolution.diagnostics, vec![]); + let document = resolution.tree.as_ref().unwrap().document(); + + // The std Use expands under its id; the outer card's root is the Use. + let Node::Box(stat) = node_of(&resolution, "std-stat") else { panic!("std-stat is not a Box") }; + assert_eq!(stat.children.len(), 2); + assert!(find(&document.root, "std-stat/stat-label").is_some()); + let Node::Box(outer) = node_of(&resolution, "outer-card") else { panic!("outer-card is not a Box") }; + assert_eq!(outer.common.visible, lit_bool(true)); + let Node::Text(title) = node_of(&resolution, "outer-card/card-title") else { panic!("not a Text") }; + assert_eq!(title.content, lit_text("Card")); + let Node::Button(act) = node_of(&resolution, "outer-card/card-act") else { panic!("not a Button") }; + assert_eq!(act.on_activate, command("open")); + assert_eq!(act.enabled, lit_bool(true)); + let Node::Repeat(rows) = node_of(&resolution, "outer-card/card-rows") else { panic!("not a Repeat") }; + let CollectionSource::Records(records) = &rows.collection else { panic!("not Records") }; + assert_eq!(records.provider, Some(ProviderId::new("provider.stack"))); + + // The slot argument is the caller's inner card, placed after the button, keeping its ids. + let ids = all_ids(&resolution); + let at = |id: &str| ids.iter().position(|found| found == id).unwrap_or_else(|| panic!("no {id} in {ids:?}")); + assert!(at("outer-card/card-act") < at("inner-card")); + assert!(at("inner-card") < at("inner-card/card-title") && at("inner-card/card-title") < at("inner-note")); + + // No Param, no Slot, no absent provider survives. + let debug = format!("{document:#?}"); + assert!(!debug.contains("Param(") && !debug.contains("Slot("), "a Param or Slot remains"); + assert!(!debug.contains("provider: None")); + + let dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/goldens"); + let bytes = store::bytes(|cache| store::put_pinned(cache, &document.record_key(), document)); + golden::check_with_text(&dir, "resolve-f09-composition-stack", &bytes, &format!("{document:#?}\n")); +} + +#[test] +fn an_undeclared_command_refuses_the_whole_document() { + let resolution = fixture_resolution(Fixture::F10Hostile, "undeclared-command"); + assert!(resolution.tree.is_none()); + only(&resolution, Code::UndeclaredCommand, Some("go"), "missing"); + + // A command passed through a Command argument is judged where it lands. + let body = composition("c", &[("act", ParamKind::Command)], button("b", CommandRef::Param(param("act")))); + let document = surface(boxed("root", vec![use_of("u", "c", vec![command_arg("act", "nope")])]), &["real"]); + let resolution = run(&document, &state_with(&[body])); + assert!(resolution.tree.is_none()); + only(&resolution, Code::UndeclaredCommand, Some("u"), "nope"); +} + +#[test] +fn a_duplicate_id_after_expansion_refuses_the_whole_document() { + let resolution = fixture_resolution(Fixture::F10Hostile, "duplicate-id"); + assert!(resolution.tree.is_none()); + only(&resolution, Code::DuplicateNodeId, Some("dup-use/shared-id"), "twice"); +} + +#[test] +fn an_unresolved_use_is_a_placeholder_and_a_read() { + let resolution = fixture_resolution(Fixture::F10Hostile, "unresolved-use"); + only(&resolution, Code::UnresolvedUse, Some("ghost-use"), "ghost"); + let Node::Use(ghost) = node_of(&resolution, "ghost-use") else { panic!("not a Use leaf") }; + assert!(ghost.args.is_empty()); + let wanted = Address { + provider: ProviderId::new("provider.hostile"), + schema: SchemaId::new(CompositionDocument::SCHEMA_NAME), + key: RecordKey::new(ghost.composition.record_key()), + }; + assert!(resolution.reads.contains(&wanted)); +} + +#[test] +fn a_refused_composition_is_not_absence() { + let mut state = MemState::new(); + let bytes = store::payload(&surface(boxed("root", vec![]), &[])); + state.put_raw(comp_address("c"), bytes); + let document = surface(boxed("root", vec![use_of("u", "c", vec![])]), &[]); + let resolution = run(&document, &state); + assert!(resolution.tree.is_some()); + only(&resolution, Code::DecodeRefused, Some("u"), "pub.t.c.v1"); + assert!(resolution.reads.contains(&comp_address("c"))); +} + +#[test] +fn the_composition_record_must_be_the_one_the_use_names() { + // Version 2's bytes sit at version 1's address; and a different name likewise. + let mut v2 = composition("c", &[], boxed("c-root", vec![])); + v2.version = ver(2); + let other = composition("other", &[], boxed("c-root", vec![])); + for wrong in [v2, other] { + let mut state = MemState::new(); + state.put_raw(comp_address("c"), store::payload(&wrong)); + let resolution = run(&surface(boxed("root", vec![use_of("u", "c", vec![])]), &[]), &state); + only(&resolution, Code::CompositionInvalid, Some("u"), "differs"); + } +} + +#[test] +fn cycles_and_depth_end_in_a_placeholder() { + let a = composition("a", &[], boxed("a-root", vec![use_of("to-b", "b", vec![])])); + let b = composition("b", &[], boxed("b-root", vec![use_of("to-a", "a", vec![])])); + let resolution = run(&surface(boxed("root", vec![use_of("u", "a", vec![])]), &[]), &state_with(&[a, b])); + only(&resolution, Code::CompositionCycle, Some("u/to-b/to-a"), "itself"); + assert!(matches!(node_of(&resolution, "u/to-b/to-a"), Node::Use(leaf) if leaf.args.is_empty())); + + // A chain of 33 compositions: the 33rd Use is over the limit. + let chain: Vec = (1..=33) + .map(|n| { + let inner = if n < 33 { vec![use_of("next", &format!("c{}", n + 1), vec![])] } else { vec![] }; + composition(&format!("c{n}"), &[], boxed("body", inner)) + }) + .collect(); + let resolution = run(&surface(boxed("root", vec![use_of("u", "c1", vec![])]), &[]), &state_with(&chain)); + assert!(resolution.tree.is_some()); + assert_eq!(resolution.diagnostics.len(), 1); + assert_eq!(resolution.diagnostics[0].code, Code::CompositionCycle); + assert!(resolution.diagnostics[0].detail.contains("deep")); +} + +fn limited(max_nodes: usize) -> Limits { + Limits { max_nodes, ..Limits::default() } +} + +fn refused_for_limit(resolution: &Resolution) { + assert!(resolution.tree.is_none(), "{:?}", resolution.diagnostics); + assert!(resolution.diagnostics.iter().any(|found| found.code == Code::ExpansionLimit), "{:?}", resolution.diagnostics); +} + +#[test] +fn the_node_limit_is_exact_and_stops_a_doubling_expansion() { + // Exactly the limit is taken, one over is refused. + let flat = surface(boxed("root", (0..9).map(|n| text(&format!("t{n}"), "x")).collect()), &[]); + let at_limit = resolve(&flat, &MemState::new(), &limited(10)); + assert_eq!(at_limit.diagnostics, vec![]); + assert!(at_limit.tree.is_some()); + refused_for_limit(&resolve(&flat, &MemState::new(), &limited(9))); + + // A composition using the previous one twice, 30 levels: 2^30 nodes, which only an early stop + // survives. The small limit keeps the work small; the refusal is the assertion. + let mut chain = vec![composition("c0", &[], boxed("body", vec![]))]; + for n in 1..=30 { + let below = format!("c{}", n - 1); + let body = boxed("body", vec![use_of("l", &below, vec![]), use_of("r", &below, vec![])]); + chain.push(composition(&format!("c{n}"), &[], body)); + } + let document = surface(boxed("root", vec![use_of("u", "c30", vec![])]), &[]); + refused_for_limit(&resolve(&document, &state_with(&chain), &limited(100))); + + // Seven levels are 255 nodes: over 100, under the default. + let seven = surface(boxed("root", vec![use_of("u", "c7", vec![])]), &[]); + refused_for_limit(&resolve(&seven, &state_with(&chain), &limited(100))); + assert!(resolve(&seven, &state_with(&chain), &Limits::default()).tree.is_some()); +} + +#[test] +fn a_slot_placed_twice_per_level_is_counted_when_it_is_spliced() { + // Each level places its slot twice around the level below: every level's expansion is counted + // once, so only the splice count sees the doubling. + let doubling = composition("c", &[("body", ParamKind::Slot)], boxed("b", vec![slot("body"), slot("body")])); + let mut nested = text("leaf", "x"); + for level in 0..12 { + nested = use_of(&format!("u{level}"), "c", vec![slot_arg("body", vec![nested])]); + } + let document = surface(boxed("root", vec![nested]), &[]); + refused_for_limit(&resolve(&document, &state_with(&[doubling]), &limited(1000))); +} + +#[test] +fn a_tree_deeper_than_the_limit_is_refused() { + with_room(a_tree_deeper_than_the_limit_is_refused_body); +} + +fn a_tree_deeper_than_the_limit_is_refused_body() { + let mut deep = boxed("leaf", vec![]); + for level in 0..257 { + deep = boxed(&format!("level-{level}"), vec![deep]); + } + refused_for_limit(&run(&surface(deep, &[]), &MemState::new())); + + // A slot's nodes stand deeper in the body than they did in the caller: expand sees 60 and 200 + // levels, the finished tree about 265. (The body is a stored record, whose own nesting is bounded.) + let chain = |levels: usize, inner: Vec, tag: &str| { + let mut node = boxed(&format!("{tag}-bottom"), inner); + for level in 0..levels { + node = boxed(&format!("{tag}-{level}"), vec![node]); + } + node + }; + let body = composition("c", &[("body", ParamKind::Slot)], chain(60, vec![slot("body")], "b")); + let argument = slot_arg("body", vec![chain(200, vec![], "a")]); + let document = surface(boxed("root", vec![use_of("u", "c", vec![argument])]), &[]); + let resolution = run(&document, &state_with(&[body])); + refused_for_limit(&resolution); + assert!(resolution.diagnostics.iter().any(|found| found.detail.contains("deeper"))); +} + +#[test] +fn argument_and_body_faults_each_leave_a_placeholder_naming_the_case() { + let text_body = || boxed("b", vec![param_text("t", "x")]); + let t = || [("x", ParamKind::Text)]; + let cases: Vec<(&str, CompositionDocument, Vec, &str)> = vec![ + ("missing argument", composition("c", &t(), text_body()), vec![], "has no argument"), + ( + "extra argument", + composition("c", &t(), text_body()), + vec![text_arg("x", "a"), text_arg("y", "b")], + "names no param", + ), + ("duplicate argument", composition("c", &t(), text_body()), vec![text_arg("x", "a"), text_arg("x", "b")], "twice"), + ( + "duplicate param", + composition("c", &[("x", ParamKind::Text), ("x", ParamKind::Text)], text_body()), + vec![text_arg("x", "a")], + "declares param 'x' twice", + ), + ( + "arm differs from kind", + composition("c", &t(), text_body()), + vec![Arg { name: "x".into(), value: ArgValue::Number(NumberArg { value: 1.0 }) }], + "is a Number but the param is a Text", + ), + ("param names nothing", composition("c", &t(), boxed("b", vec![param_text("t", "zz")])), vec![text_arg("x", "a")], "does not declare"), + ( + "param of the wrong kind", + composition("c", &[("x", ParamKind::Number)], boxed("b", vec![param_text("t", "x")])), + vec![Arg { name: "x".into(), value: ArgValue::Number(NumberArg { value: 1.0 }) }], + "used as text", + ), + ( + "literal command in a body", + composition("c", &[], boxed("b", vec![button("go", command("real"))])), + vec![], + "composition takes its commands", + ), + ( + "root visibility", + composition("c", &[], Node::Box(BoxNode { common: NodeCommon { visible: lit_bool(false), ..common("b") }, ..match boxed("b", vec![]) { Node::Box(b) => b, _ => unreachable!() } })), + vec![], + "visible", + ), + ]; + for (name, composition, args, detail) in cases { + let document = surface(boxed("root", vec![use_of("u", "c", args)]), &["real"]); + let resolution = run(&document, &state_with(&[composition])); + assert!(resolution.tree.is_some(), "{name}"); + only(&resolution, Code::CompositionInvalid, Some("u"), detail); + assert!(matches!(node_of(&resolution, "u"), Node::Use(leaf) if leaf.args.is_empty()), "{name}"); + } +} + +#[test] +fn a_param_outside_a_composition_refuses_the_whole_document() { + let resolution = run(&surface(boxed("root", vec![param_text("t", "x")]), &[]), &MemState::new()); + assert!(resolution.tree.is_none()); + only(&resolution, Code::UnboundParam, Some("t"), "param 'x'"); + let resolution = run(&surface(boxed("root", vec![button("b", CommandRef::Param(param("x")))]), &[]), &MemState::new()); + only(&resolution, Code::UnboundParam, Some("b"), "param 'x'"); +} + +#[test] +fn ids_survive_a_republish_and_follow_sibling_order() { + let set = Fixture::F09CompositionStack.load(); + let state = MemState::from_fixture(Fixture::F09CompositionStack); + let one = run(&set.surfaces[0], &state); + let mut republished = set.surfaces[0].clone(); + republished.version = ver(2); + assert_eq!(all_ids(&run(&republished, &state)), all_ids(&one)); + + // Swapping two siblings moves their ids and renames none. + let Node::Box(root) = &mut republished.root else { unreachable!() }; + root.children.swap(0, 1); + let swapped = all_ids(&run(&republished, &state)); + assert_ne!(swapped, all_ids(&one)); + let (mut left, mut right) = (swapped, all_ids(&one)); + left.sort(); + right.sort(); + assert_eq!(left, right); +} + +#[test] +fn thing_std_is_compiled_in_and_never_read() { + // A provider's own `thing.std` stat is never asked for, so it cannot shadow core's. + let mut state = MemState::new(); + let shadow = CompositionDocument { + publisher: thing_std::PUBLISHER.into(), + name: seg("stat"), + version: ver(1), + params: vec![], + body: boxed("shadow", vec![]), + }; + state.put(&ProviderId::new(thing_std::PUBLISHER), &shadow); + let used = Node::Use(UseNode { + common: common("s"), + composition: CompositionRef { publisher: thing_std::PUBLISHER.into(), name: seg("stat"), version: ver(1) }, + args: vec![ + text_arg("label", "L"), + Arg { name: "value".into(), value: ArgValue::Bind(item_bind(path(&["v"]))) }, + ], + }); + let resolution = run(&surface(boxed("root", vec![used]), &[]), &state); + assert_eq!(resolution.diagnostics, vec![]); + assert!(find(&resolution.tree.as_ref().unwrap().document().root, "s/stat-label").is_some()); + assert!(resolution.reads.is_empty()); + let touched = |call: &Call| matches!(call, Call::Read(address) if address.provider.as_str() == thing_std::PUBLISHER); + assert!(!state.calls().iter().any(touched)); + + // A std name nobody compiled in is unresolved, and still not read. + let ghost = Node::Use(UseNode { + common: common("g"), + composition: CompositionRef { publisher: thing_std::PUBLISHER.into(), name: seg("nope"), version: ver(1) }, + args: vec![], + }); + let resolution = run(&surface(boxed("root", vec![ghost]), &[]), &state); + only(&resolution, Code::UnresolvedUse, Some("g"), "nope"); + assert!(resolution.reads.is_empty()); +} + +#[test] +fn every_std_composition_expands_with_literal_shaped_arguments() { + for composition in thing_std::all() { + let args: Vec = composition + .params + .iter() + .map(|decl| { + let value = match decl.kind { + ParamKind::Text => ArgValue::Text(TextArg { value: "x".into() }), + ParamKind::Number => ArgValue::Number(NumberArg { value: 1.0 }), + ParamKind::Bool => ArgValue::Bool(BoolArg { value: true }), + ParamKind::Bind => ArgValue::Bind(item_bind(path(&["v"]))), + ParamKind::Collection => ArgValue::Collection(CollectionArg { + source: CollectionSource::Member(item_bind(path(&["v"]))), + }), + ParamKind::Command => ArgValue::Command(CommandArg { command: command("real") }), + ParamKind::Slot => ArgValue::Slot(SlotArg { nodes: vec![text("note", "n")] }), + }; + Arg { name: decl.name.clone(), value } + }) + .collect(); + let used = Node::Use(UseNode { + common: common("u"), + composition: CompositionRef { publisher: composition.publisher.clone(), name: composition.name.clone(), version: composition.version }, + args, + }); + let resolution = run(&surface(boxed("root", vec![used]), &["real"]), &MemState::new()); + assert_eq!(resolution.diagnostics, vec![], "{}", composition.name.as_str()); + let debug = format!("{:?}", resolution.tree.unwrap().document()); + assert!(!debug.contains("Param(") && !debug.contains("Slot("), "{}", composition.name.as_str()); + } +} + +#[test] +fn every_fixture_resolves_without_panic_to_nothing_or_unique_ids() { + for fixture in Fixture::ALL { + let (set, state) = (fixture.load(), MemState::from_fixture(fixture)); + for document in &set.surfaces { + let resolution = run(document, &state); + if resolution.tree.is_some() { + let mut found = all_ids(&resolution); + let before = found.len(); + found.sort(); + found.dedup(); + assert_eq!(found.len(), before, "{} {}", fixture.file_name(), document.label.as_str()); + } + } + } +} + +#[test] +fn slot_arguments_are_spliced_where_the_body_places_them() { + // A body that places its slot twice repeats the caller's ids. + let twice = composition("c", &[("body", ParamKind::Slot)], boxed("b", vec![slot("body"), slot("body")])); + let document = surface(boxed("root", vec![use_of("u", "c", vec![slot_arg("body", vec![text("note", "n")])])]), &[]); + let resolution = run(&document, &state_with(&[twice])); + assert!(resolution.tree.is_none()); + only(&resolution, Code::DuplicateNodeId, Some("note"), "twice"); + + // A body passes its own slot argument on to a composition it uses. + let inner = composition("inner", &[("body", ParamKind::Slot)], boxed("ib", vec![slot("body")])); + let outer = composition( + "outer", + &[("body", ParamKind::Slot)], + boxed("ob", vec![use_of("in", "inner", vec![slot_arg("body", vec![slot("body")])])]), + ); + let document = surface(boxed("root", vec![use_of("u", "outer", vec![slot_arg("body", vec![text("note", "n")])])]), &[]); + let resolution = run(&document, &state_with(&[inner, outer])); + assert_eq!(resolution.diagnostics, vec![]); + assert_eq!(all_ids(&resolution), ["root", "u", "u/in", "note"]); +} + +#[test] +fn a_slot_stands_only_in_a_child_list_of_a_composition_body() { + // Outside any composition: the surface root, a surface's child list, under a non-body node, + // and in a slot argument of a surface-level Use. + let unbound = [ + ("the surface root", slot("body")), + ("a surface child list", boxed("root", vec![slot("body")])), + ("under a Repeat template", boxed("root", vec![repeat("rows", boxed("row", vec![slot("body")]))])), + ("a surface-level slot argument", boxed("root", vec![use_of("u", "c", vec![slot_arg("body", vec![slot("body")])])])), + ]; + let c = composition("c", &[("body", ParamKind::Slot)], boxed("b", vec![slot("body")])); + let state = state_with(std::slice::from_ref(&c)); + for (place, root) in unbound { + let resolution = run(&surface(root, &[]), &state); + assert!(resolution.tree.is_none(), "{place}"); + assert!(resolution.diagnostics.iter().all(|found| found.code == Code::UnboundParam), "{place}"); + assert!(!resolution.diagnostics.is_empty(), "{place}"); + } + + // In a body, anywhere but a child list: the template of a Repeat, or the body root. + let template = composition("t", &[("body", ParamKind::Slot)], boxed("b", vec![repeat("rows", slot("body"))])); + let root_slot = composition("r", &[("body", ParamKind::Slot)], slot("body")); + for (name, bad) in [("t", template), ("r", root_slot)] { + let document = surface(boxed("root", vec![use_of("u", name, vec![slot_arg("body", vec![text("note", "n")])])]), &[]); + let resolution = run(&document, &state_with(&[bad])); + assert!(resolution.tree.is_some(), "{name}"); + only(&resolution, Code::CompositionInvalid, Some("u"), "child list"); + } +} + +#[test] +fn resolve_reads_only_through_read() { + let set = Fixture::F09CompositionStack.load(); + let state = MemState::from_fixture(Fixture::F09CompositionStack); + run(&set.surfaces[0], &state); + assert!(state.calls().iter().all(|call| matches!(call, Call::Read(_)))); + let _: &dyn StatePort = &state; +} + +#[test] +fn an_anchor_in_a_body_follows_the_expanded_ids() { + let overlay = |anchor: &str| { + Node::Overlay(OverlayNode { + common: common("pop"), + anchor: Anchor::Node(AnchorNode { node: nid(anchor) }), + modal: false, + dismiss: CommandRef::Param(param("dismiss")), + children: vec![], + }) + }; + let body = boxed("b", vec![text("target", "t"), overlay("target"), { + let Node::Overlay(root_anchored) = overlay("b") else { unreachable!() }; + Node::Overlay(OverlayNode { common: common("pop-root"), ..root_anchored }) + }]); + let document = surface(boxed("root", vec![use_of("u", "c", vec![command_arg("dismiss", "real")])]), &["real"]); + let resolution = run(&document, &state_with(&[composition("c", &[("dismiss", ParamKind::Command)], body)])); + assert_eq!(resolution.diagnostics, vec![]); + for (id, target) in [("u/pop", "u/target"), ("u/pop-root", "u")] { + let Node::Overlay(found) = node_of(&resolution, id) else { panic!("not an Overlay") }; + assert_eq!(found.anchor, Anchor::Node(AnchorNode { node: nid(target) }), "{id}"); + } +} + +fn root_common_of(resolution: &Resolution, id: &str) -> NodeCommon { + let Node::Box(found) = node_of(resolution, id) else { panic!("not a Box") }; + found.common.clone() +} + +#[test] +fn the_expanded_root_takes_the_uses_visibility_and_label() { + let flag = |provider: Option<&str>| Bind { + source: StateSource::Record(StateRef { + provider: provider.map(ProviderId::new), + schema: SchemaId::new("gamecult.thing.test.flag.v1"), + key: RecordKey::new("shown"), + }), + member: path(&["on"]), + format: None, + }; + let labelled = |label: Option| { + let Node::Box(mut root) = boxed("b", vec![]) else { unreachable!() }; + root.common.a11y_label = label; + Node::Box(root) + }; + let used = |visible: BoolSource, label: Option, args: Vec| { + Node::Use(UseNode { + common: NodeCommon { id: nid("u"), visible, a11y_label: label }, + composition: reference("c"), + args, + }) + }; + let run_one = |body: Node, params: &[(&str, ParamKind)], used: Node| { + run(&surface(boxed("root", vec![used]), &[]), &state_with(&[composition("c", params, body)])) + }; + + // The Use's bound visibility and its label win over the body root's label. + let resolution = run_one( + labelled(Some(lit_text("body label"))), + &[], + used(BoolSource::Bound(flag(None)), Some(lit_text("use label")), vec![]), + ); + assert_eq!(resolution.diagnostics, vec![]); + let common = root_common_of(&resolution, "u"); + assert_eq!(common.visible, BoolSource::Bound(flag(Some("provider.t")))); + assert_eq!(common.a11y_label, Some(lit_text("use label"))); + + // Without a Use label the body root's own label stands, a Param of it substituted. + let resolution = run_one( + labelled(Some(TextSource::Param(param("lbl")))), + &[("lbl", ParamKind::Text)], + used(lit_bool(true), None, vec![text_arg("lbl", "from arg")]), + ); + assert_eq!(root_common_of(&resolution, "u").a11y_label, Some(lit_text("from arg"))); + let resolution = run_one(labelled(None), &[], used(lit_bool(true), None, vec![])); + assert_eq!(root_common_of(&resolution, "u").a11y_label, None); + + // A literal false on the Use hides the expansion. + let resolution = run_one(labelled(None), &[], used(lit_bool(false), None, vec![])); + assert_eq!(root_common_of(&resolution, "u").visible, lit_bool(false)); +} + +#[test] +fn a_param_left_in_any_position_outside_a_composition_refuses() { + let slider = Node::Slider(SliderNode { + common: common("s"), + min: 0.0, + max: 1.0, + step: 0.1, + value: NumberSource::Param(param("n")), + commit: command("real"), + }); + let enabled = Node::Button(ButtonNode { + common: common("b"), + content: vec![], + on_activate: command("real"), + enabled: BoolSource::Param(param("on")), + }); + let Node::Repeat(mut rows) = repeat("r", text("row", "x")) else { unreachable!() }; + rows.collection = CollectionSource::Param(param("rows")); + let Node::Text(mut shown) = text("t", "x") else { unreachable!() }; + shown.common.visible = BoolSource::Param(param("v")); + let cases = [("number", slider), ("bool", enabled), ("collection", Node::Repeat(rows)), ("visible", Node::Text(shown))]; + for (name, node) in cases { + let resolution = run(&surface(boxed("root", vec![node]), &["real"]), &MemState::new()); + assert!(resolution.tree.is_none(), "{name}"); + assert_eq!(resolution.diagnostics.len(), 1, "{name}"); + assert_eq!(resolution.diagnostics[0].code, Code::UnboundParam, "{name}"); + } +} + +#[test] +fn an_absent_provider_is_the_surfaces_in_select_and_plot_too() { + let bind = |key: &str| Bind { + source: StateSource::Record(StateRef { + provider: None, + schema: SchemaId::new("gamecult.thing.test.row.v1"), + key: RecordKey::new(key), + }), + member: path(&["v"]), + format: None, + }; + let select = Node::Select(SelectNode { + common: common("sel"), + options: OptionList::Bound(BoundOptions { + collection: CollectionSource::Records(RecordsSource { + provider: None, + schema: SchemaId::new("gamecult.thing.test.row.v1"), + key_prefix: "row-".into(), + }), + value_member: path(&["id"]), + label_member: path(&["name"]), + }), + value: bind("a"), + on_change: command("real"), + }); + let plot = Node::Plot(PlotNode { + common: common("plot"), + series: bind("b"), + mark: PlotMark::Line, + x_min: None, + x_max: None, + y_min: None, + y_max: None, + }); + let resolution = run(&surface(boxed("root", vec![select, plot]), &["real"]), &MemState::new()); + assert_eq!(resolution.diagnostics, vec![]); + let debug = format!("{:?}", resolution.tree.unwrap().document()); + assert!(!debug.contains("provider: None")); + // The surface's own provider id, then the options collection, the select value and the series. + assert_eq!(debug.matches("provider.t").count(), 4); +} + +#[test] +fn duplicate_ids_are_found_under_every_container_and_on_a_placeholder() { + let overlay = |child: Node| { + Node::Overlay(OverlayNode { + common: common("pop"), + anchor: Anchor::Viewport, + modal: false, + dismiss: command("real"), + children: vec![child], + }) + }; + let button = Node::Button(ButtonNode { + common: common("btn"), + content: vec![text("d", "x")], + on_activate: command("real"), + enabled: lit_bool(true), + }); + let cases = [ + ("repeat template", repeat("rows", text("d", "x"))), + ("overlay children", overlay(text("d", "x"))), + ("button content", button), + ("a placeholder's id", use_of("d", "ghost", vec![])), + ]; + for (name, other) in cases { + let document = surface(boxed("root", vec![text("d", "first"), other]), &["real"]); + let resolution = run(&document, &MemState::new()); + assert!(resolution.tree.is_none(), "{name}"); + let duplicates: Vec<_> = + resolution.diagnostics.iter().filter(|found| found.code == Code::DuplicateNodeId).collect(); + assert_eq!(duplicates.len(), 1, "{name}: {:?}", resolution.diagnostics); + assert_eq!(duplicates[0].node.as_ref().map(NodeId::as_str), Some("d"), "{name}"); + } +} + +#[test] +fn a_failed_body_leaves_only_its_own_diagnostic() { + // The ghost Use in the body is reported by the expansion, then the body fails on its Param: + // the whole body is replaced, so its partial diagnostics go with it. + let body = composition("c", &[], boxed("b", vec![use_of("ghost-use", "ghost", vec![]), param_text("t", "zz")])); + let resolution = run(&surface(boxed("root", vec![use_of("u", "c", vec![])]), &[]), &state_with(&[body])); + only(&resolution, Code::CompositionInvalid, Some("u"), "does not declare"); +} + +#[test] +fn a_std_reference_is_pinned_to_its_version() { + let v2 = Node::Use(UseNode { + common: common("s"), + composition: CompositionRef { publisher: thing_std::PUBLISHER.into(), name: seg("stat"), version: ver(2) }, + args: vec![], + }); + let resolution = run(&surface(boxed("root", vec![v2]), &[]), &MemState::new()); + only(&resolution, Code::UnresolvedUse, Some("s"), "stat"); +} + +#[test] +fn diagnostics_and_reads_come_out_in_a_defined_order() { + // Expansion faults first, in expansion order, then the finished tree's; reads sorted by key. + let names = ["n3", "n9", "n0", "n7", "n1", "n8", "n5", "n2", "n6", "n4"]; + let mut children = vec![text("d", "x")]; + children.extend(names.iter().map(|name| use_of(&format!("g-{name}"), name, vec![]))); + children.push(text("d", "y")); + let resolution = run(&surface(boxed("root", children), &[]), &MemState::new()); + let seen: Vec<_> = + resolution.diagnostics.iter().map(|found| (found.code, found.node.as_ref().map(NodeId::as_str))).collect(); + let mut expected: Vec<_> = names.iter().map(|_| Code::UnresolvedUse).collect(); + expected.push(Code::DuplicateNodeId); + assert_eq!(seen.iter().map(|(code, _)| *code).collect::>(), expected); + assert_eq!(seen[0].1, Some("g-n3")); + assert_eq!(seen.last().unwrap().1, Some("d")); + let mut sorted: Vec<_> = (0..10).map(|n| comp_address(&format!("n{n}"))).collect(); + sorted.sort_by_key(|address| address.key.as_str().to_string()); + assert_eq!(resolution.reads, sorted); +} + +/// A chain of `levels` nodes, the first the root: Boxes, or Repeats whose template is the next. +fn chain(levels: usize, repeats: bool) -> Node { + let mut node = text("bottom", "x"); + for level in 1..levels { + let id = format!("level-{level}"); + node = if repeats { repeat(&id, node) } else { boxed(&id, vec![node]) }; + } + node +} + +#[test] +fn the_depth_rule_is_judged_on_the_finished_tree_through_box_and_repeat() { + for repeats in [false, true] { + let at_limit = run(&surface(chain(256, repeats), &[]), &MemState::new()); + assert_eq!(at_limit.diagnostics, vec![], "repeats={repeats}"); + assert!(at_limit.tree.is_some()); + let over = run(&surface(chain(257, repeats), &[]), &MemState::new()); + refused_for_limit(&over); + assert!(over.diagnostics.iter().any(|found| found.detail.contains("deeper")), "repeats={repeats}"); + } +} + +#[test] +fn an_unplaced_slot_argument_does_not_count_toward_the_depth_rule() { + let ignoring = composition("c", &[("body", ParamKind::Slot)], boxed("b", vec![])); + let mut deep = text("leaf", "x"); + for level in 0..300 { + deep = boxed(&format!("a-{level}"), vec![deep]); + } + let document = surface(boxed("root", vec![use_of("u", "c", vec![slot_arg("body", vec![deep])])]), &[]); + let resolution = run(&document, &state_with(&[ignoring])); + assert_eq!(resolution.diagnostics, vec![]); + assert_eq!(all_ids(&resolution), ["root", "u"]); +} + +/// Runs `work` on a thread with the default stack: resolve grows its own, so no caller sizes one. +fn on_default_thread(work: impl FnOnce() -> T + Send + 'static) -> T { + std::thread::spawn(work).join().unwrap() +} + +/// The way a chain nests: the child list or position through which each level holds the next. +#[derive(Clone, Copy, Debug)] +enum Through { + BoxChildren, + RepeatTemplate, + ButtonContent, + OverlayChildren, + SlotArgument, +} + +/// A chain of `levels` nodes, the first the root, each holding the next through `through`; a slot +/// argument chain is Uses (the body composition is `c`), so its levels are Uses over a Text leaf. +fn nested(levels: usize, through: Through) -> Node { + let mut node = text("bottom", "x"); + for level in 1..levels { + let id = format!("level-{level}"); + node = match through { + Through::BoxChildren => boxed(&id, vec![node]), + Through::RepeatTemplate => repeat(&id, node), + Through::ButtonContent => { + let Node::Button(button) = button(&id, command("go")) else { unreachable!() }; + Node::Button(ButtonNode { content: vec![node], ..button }) + } + Through::OverlayChildren => Node::Overlay(OverlayNode { + common: common(&id), + anchor: Anchor::Viewport, + modal: false, + dismiss: command("go"), + children: vec![node], + }), + Through::SlotArgument => use_of(&id, "c", vec![slot_arg("body", vec![node])]), + }; + } + node +} + +fn resolve_nested(levels: usize, through: Through) -> Resolution { + on_default_thread(move || { + let state = state_with(&[composition("c", &[("body", ParamKind::Slot)], boxed("b", vec![slot("body")]))]); + run(&surface(nested(levels, through), &["go"]), &state) + }) +} + +fn too_deep_to_resolve(resolution: &Resolution) -> bool { + resolution.diagnostics.iter().any(|found| found.code == Code::TooDeepToResolve) +} + +#[test] +fn input_too_deep_to_recurse_into_is_refused_with_its_own_code() { + let resolution = resolve_nested(1100, Through::BoxChildren); + assert!(resolution.tree.is_none()); + assert_eq!(resolution.diagnostics.len(), 1, "{:?}", resolution.diagnostics); + assert_eq!(resolution.diagnostics[0].code, Code::TooDeepToResolve); +} + +#[test] +fn a_chain_past_the_depth_rule_and_within_the_stack_bound_resolves_then_is_refused_for_depth() { + let resolution = resolve_nested(1000, Through::BoxChildren); + refused_for_limit(&resolution); + assert!(!too_deep_to_resolve(&resolution), "{:?}", resolution.diagnostics); +} + +/// The bound is reached without overflow (the splice's clone and every drop run on the same default +/// thread), and one level past it is `TooDeepToResolve`, whichever way the levels nest. +fn stack_bound_counts(through: Through) { + let at_bound = resolve_nested(1024, through); + assert!(!too_deep_to_resolve(&at_bound), "{through:?}: {:?}", at_bound.diagnostics); + let past = resolve_nested(1025, through); + assert!(past.tree.is_none(), "{through:?}"); + assert!(too_deep_to_resolve(&past), "{through:?}: {:?}", past.diagnostics); +} + +#[test] +fn the_stack_bound_is_inclusive() { + // 1,024 levels is the deepest the expander recurses into; the depth rule refuses it later. + let at_bound = resolve_nested(1024, Through::BoxChildren); + refused_for_limit(&at_bound); + assert!(!too_deep_to_resolve(&at_bound), "{:?}", at_bound.diagnostics); +} + +#[test] +fn the_stack_bound_counts_box_children() { + stack_bound_counts(Through::BoxChildren); +} + +#[test] +fn the_stack_bound_counts_a_repeat_template() { + stack_bound_counts(Through::RepeatTemplate); +} + +#[test] +fn the_stack_bound_counts_button_content() { + stack_bound_counts(Through::ButtonContent); +} + +#[test] +fn the_stack_bound_counts_overlay_children() { + stack_bound_counts(Through::OverlayChildren); +} + +#[test] +fn the_stack_bound_counts_a_slot_argument() { + stack_bound_counts(Through::SlotArgument); +} + +#[test] +fn a_slot_naming_a_param_of_another_kind_is_invalid() { + let body = composition("c", &[("x", ParamKind::Text)], boxed("b", vec![slot("x")])); + let document = surface(boxed("root", vec![use_of("u", "c", vec![text_arg("x", "t")])]), &[]); + let resolution = run(&document, &state_with(&[body])); + only(&resolution, Code::CompositionInvalid, Some("u"), "used as a slot"); +} + + diff --git a/crates/thing-state/Cargo.toml b/crates/thing-state/Cargo.toml new file mode 100644 index 0000000..81fe55e --- /dev/null +++ b/crates/thing-state/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "thing-state" +version = "0.1.0" +edition = "2024" +license = "MIT" +publish = false + +[dependencies] +thing-core = { path = "../thing-core" } +cultcache-rs = { workspace = true } +rmp-serde = { workspace = true } +serde = { workspace = true } diff --git a/crates/thing-state/src/lib.rs b/crates/thing-state/src/lib.rs new file mode 100644 index 0000000..425db4c --- /dev/null +++ b/crates/thing-state/src/lib.rs @@ -0,0 +1,184 @@ +//! The one by-name decode of a provider record. A state port implementation (`MemState` now, +//! thing-mesh next) calls `decode` with the record's payload and the catalog member rows of its +//! schema; core never sees bytes. The catalog names only a document's top-level members, so below +//! that level a payload decodes by its own shape. +//! +//! Registration contract: a provider's state record type must be registered with its entry type +//! equal to its schema id (`TYPE == SCHEMA_NAME`). A CultCache store names a record's schema by +//! its entry type, so the id a `Bind` names is the id the store holds only when the two are one +//! string; the member rows a reader finds are the rows published under that id. + +use std::cell::RefCell; +use std::collections::HashSet; +use std::fmt; +use std::io::Cursor; + +use cultcache_rs::{SchemaCatalogMember, check_payload_depth}; +use thing_core::port::StateValue; +use serde::de::{self, DeserializeSeed, MapAccess, SeqAccess, Visitor}; + +/// Why a payload is not a `StateValue`. Display names slots, counts and positions, never a value. +#[derive(Clone, Debug, PartialEq, Eq)] +pub enum StateDecodeError { + /// The schema published no member rows: a reader cannot name what the writer did not publish. + NoMembers, + NotARecord, + TrailingBytes { count: usize }, + TooDeep, + UndescribedSlot { slot: usize }, + DuplicateKey { position: usize }, + Extension, + Malformed, +} + +impl fmt::Display for StateDecodeError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::NoMembers => f.write_str("the schema published no member rows, so its members cannot be named"), + Self::NotARecord => f.write_str("the payload is not one MessagePack array"), + Self::TrailingBytes { count } => write!(f, "{count} bytes follow the record"), + Self::TooDeep => f.write_str("the payload nests deeper than CultCache admits"), + Self::UndescribedSlot { slot } => write!(f, "slot {slot} holds a value no member row names"), + Self::DuplicateKey { position } => write!(f, "the map repeats a key at entry {position}"), + Self::Extension => f.write_str("the payload holds a MessagePack extension value"), + Self::Malformed => f.write_str("the payload is not well-formed MessagePack"), + } + } +} + +impl std::error::Error for StateDecodeError {} + +/// Decode `payload`, one MessagePack array, into a `StateValue::Record` of the rows' member +/// names in slot order. A row whose slot lies past the array's end is `Nil`; a non-nil element at +/// a slot no row names is refused. An empty row list is refused. +pub fn decode(payload: &[u8], members: &[SchemaCatalogMember]) -> Result { + if members.is_empty() { + return Err(StateDecodeError::NoMembers); + } + check_payload_depth(payload).map_err(|_| StateDecodeError::TooDeep)?; + let failure = RefCell::new(None); + let mut reader = rmp_serde::Deserializer::new(Cursor::new(payload)); + let value = match (Shape { failure: &failure }).deserialize(&mut reader) { + Ok(value) => value, + Err(_) => return Err(failure.into_inner().unwrap_or(StateDecodeError::Malformed)), + }; + let StateValue::List(elements) = value else { return Err(StateDecodeError::NotARecord) }; + let count = payload.len() - reader.position() as usize; + if count != 0 { + return Err(StateDecodeError::TrailingBytes { count }); + } + let described: HashSet = members.iter().map(|row| row.slot as usize).collect(); + if let Some(slot) = + elements.iter().enumerate().position(|(slot, value)| !described.contains(&slot) && *value != StateValue::Nil) + { + return Err(StateDecodeError::UndescribedSlot { slot }); + } + let mut rows: Vec<&SchemaCatalogMember> = members.iter().collect(); + rows.sort_by_key(|row| row.slot); + Ok(StateValue::Record( + rows.into_iter() + .map(|row| (row.member_name.clone(), elements.get(row.slot as usize).cloned().unwrap_or(StateValue::Nil))) + .collect(), + )) +} + +/// The shape of a payload below the catalog's reach. A semantic refusal is parked in `failure` +/// and surfaces as the serde error that unwinds the walk. +#[derive(Clone, Copy)] +struct Shape<'a> { + failure: &'a RefCell>, +} + +impl Shape<'_> { + fn refuse(&self, error: StateDecodeError) -> E { + self.failure.borrow_mut().get_or_insert(error); + E::custom("refused") + } +} + +impl<'de> DeserializeSeed<'de> for Shape<'_> { + type Value = StateValue; + + fn deserialize>(self, deserializer: D) -> Result { + deserializer.deserialize_any(self) + } +} + +impl<'de> Visitor<'de> for Shape<'_> { + type Value = StateValue; + + fn expecting(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("a MessagePack value") + } + + fn visit_unit(self) -> Result { + Ok(StateValue::Nil) + } + + fn visit_none(self) -> Result { + Ok(StateValue::Nil) + } + + fn visit_bool(self, value: bool) -> Result { + Ok(StateValue::Bool(value)) + } + + fn visit_i64(self, value: i64) -> Result { + Ok(StateValue::Int(value.into())) + } + + fn visit_u64(self, value: u64) -> Result { + Ok(StateValue::Int(value.into())) + } + + fn visit_f32(self, value: f32) -> Result { + Ok(StateValue::Float(value.into())) + } + + fn visit_f64(self, value: f64) -> Result { + Ok(StateValue::Float(value)) + } + + fn visit_str(self, value: &str) -> Result { + Ok(StateValue::Text(value.into())) + } + + fn visit_bytes(self, value: &[u8]) -> Result { + Ok(StateValue::Bytes(value.into())) + } + + fn visit_newtype_struct>(self, _: D) -> Result { + // rmp-serde presents an extension value as a newtype struct. + Err(self.refuse(StateDecodeError::Extension)) + } + + fn visit_seq>(self, mut seq: A) -> Result { + let mut elements = Vec::new(); + while let Some(element) = seq.next_element_seed(self)? { + elements.push(element); + } + Ok(StateValue::List(elements)) + } + + fn visit_map>(self, mut map: A) -> Result { + let mut entries: Vec<(StateValue, StateValue)> = Vec::new(); + while let Some(key) = map.next_key_seed(self)? { + let value = map.next_value_seed(self)?; + entries.push((key, value)); + } + if entries.iter().all(|(key, _)| matches!(key, StateValue::Text(_))) { + let mut seen = HashSet::new(); + let mut members = Vec::with_capacity(entries.len()); + for (position, (key, value)) in entries.into_iter().enumerate() { + let StateValue::Text(name) = key else { unreachable!("every key is text") }; + if !seen.insert(name.clone()) { + return Err(self.refuse(StateDecodeError::DuplicateKey { position })); + } + members.push((name, value)); + } + Ok(StateValue::Record(members)) + } else { + Ok(StateValue::List(entries.into_iter().map(|(key, value)| StateValue::List(vec![key, value])).collect())) + } + } +} diff --git a/crates/thing-state/tests/state_decode.rs b/crates/thing-state/tests/state_decode.rs new file mode 100644 index 0000000..bf4a1ae --- /dev/null +++ b/crates/thing-state/tests/state_decode.rs @@ -0,0 +1,192 @@ +//! `thing_state::decode`: each StateValue arm, the slot rules, and the refusals. Payloads are +//! written byte by byte so the test does not lean on the encoder it checks. + +use cultcache_rs::SchemaCatalogMember; +use thing_core::port::StateValue::{self, *}; +use thing_state::{StateDecodeError, decode}; + +const CANARY: &str = "CANARY-7f3a91c2"; + +fn rows(names: &[&str]) -> Vec { + names + .iter() + .enumerate() + .map(|(slot, name)| SchemaCatalogMember { + slot: slot as u32, + member_name: (*name).into(), + type_name: "System.Object".into(), + is_reference: false, + is_many: false, + target_schema_name: None, + is_name: false, + index_alias: None, + }) + .collect() +} + +fn array(elements: &[Vec]) -> Vec { + assert!(elements.len() < 16); + let mut bytes = vec![0x90 | elements.len() as u8]; + bytes.extend(elements.iter().flatten()); + bytes +} + +fn map(pairs: &[(Vec, Vec)]) -> Vec { + let mut bytes = vec![0x80 | pairs.len() as u8]; + for (key, value) in pairs { + bytes.extend(key); + bytes.extend(value); + } + bytes +} + +fn text(value: &str) -> Vec { + let mut bytes = vec![0xa0 | value.len() as u8]; + bytes.extend(value.as_bytes()); + bytes +} + +fn int(value: u8) -> Vec { + assert!(value < 0x80); + vec![value] +} + +fn nil() -> Vec { + vec![0xc0] +} + +fn nested(levels: usize) -> Vec { + let mut bytes = vec![0x91; levels - 1]; + bytes.push(0x90); + bytes +} + +fn record(pairs: &[(&str, StateValue)]) -> StateValue { + Record(pairs.iter().map(|(name, value)| ((*name).to_string(), value.clone())).collect()) +} + +#[test] +fn every_arm_decodes_by_the_rows_names() { + let f64_bytes = [vec![0xcb], 2.5f64.to_be_bytes().to_vec()].concat(); + let f32_bytes = [vec![0xca], 1.5f32.to_be_bytes().to_vec()].concat(); + let u64_max = [vec![0xcf], vec![0xff; 8]].concat(); + let i64_min = [vec![0xd3], i64::MIN.to_be_bytes().to_vec()].concat(); + let payload = array(&[ + nil(), + vec![0xc3], + u64_max, + i64_min, + f64_bytes, + f32_bytes, + text("hi"), + vec![0xc4, 2, 9, 8], + array(&[int(1), int(2)]), + map(&[(text("x"), int(1)), (text("y"), nil())]), + map(&[(int(1), text("one")), (text("k"), int(2))]), + ]); + let names = ["Nil", "Bool", "Max", "Min", "F64", "F32", "Text", "Bytes", "List", "Rec", "PairList"]; + let decoded = decode(&payload, &rows(&names)).unwrap(); + assert_eq!( + decoded, + record(&[ + ("Nil", Nil), + ("Bool", Bool(true)), + ("Max", Int(u64::MAX as i128)), + ("Min", Int(i64::MIN as i128)), + ("F64", Float(2.5)), + ("F32", Float(1.5)), + ("Text", Text("hi".into())), + ("Bytes", Bytes(vec![9, 8])), + ("List", List(vec![Int(1), Int(2)])), + ("Rec", record(&[("x", Int(1)), ("y", Nil)])), + ("PairList", List(vec![List(vec![Int(1), Text("one".into())]), List(vec![Text("k".into()), Int(2)])])), + ]) + ); + assert_eq!(decoded.member("Text"), Some(&Text("hi".into()))); + assert_eq!(decoded.member("text"), None, "names match exactly, with no case folding"); +} + +#[test] +fn a_row_past_the_arrays_end_is_nil() { + let decoded = decode(&array(&[int(7)]), &rows(&["A", "B", "C"])).unwrap(); + assert_eq!(decoded, record(&[("A", Int(7)), ("B", Nil), ("C", Nil)])); +} + +#[test] +fn rows_decode_in_slot_order_whatever_the_order_given() { + let mut given = rows(&["A", "B"]); + given.reverse(); + let decoded = decode(&array(&[int(1), int(2)]), &given).unwrap(); + assert_eq!(decoded, record(&[("A", Int(1)), ("B", Int(2))])); +} + +#[test] +fn a_non_nil_element_at_an_unnamed_slot_is_refused_and_a_nil_one_is_skipped() { + let mut described = rows(&["A", "B", "C"]); + described.remove(1); // slots 0 and 2 + assert_eq!( + decode(&array(&[int(1), int(5), nil()]), &described), + Err(StateDecodeError::UndescribedSlot { slot: 1 }) + ); + assert_eq!(decode(&array(&[int(1), nil(), int(3)]), &described).unwrap(), record(&[("A", Int(1)), ("C", Int(3))])); + assert_eq!(decode(&array(&[int(1), int(2)]), &rows(&["A"])), Err(StateDecodeError::UndescribedSlot { slot: 1 })); +} + +#[test] +fn no_member_rows_refuses_even_a_good_payload() { + assert_eq!(decode(&array(&[int(1)]), &[]), Err(StateDecodeError::NoMembers)); +} + +#[test] +fn the_payload_must_be_one_array_with_nothing_after_it() { + let names = rows(&["A"]); + assert_eq!(decode(&int(1), &names), Err(StateDecodeError::NotARecord)); + assert_eq!(decode(&map(&[(text("A"), int(1))]), &names), Err(StateDecodeError::NotARecord)); + let mut trailing = array(&[int(1)]); + trailing.extend([0xc0, 0xc0, 0xc0]); + assert_eq!(decode(&trailing, &names), Err(StateDecodeError::TrailingBytes { count: 3 })); + assert_eq!(decode(&[0x92, 0x01], &names), Err(StateDecodeError::Malformed)); + assert_eq!(decode(&[], &names), Err(StateDecodeError::Malformed)); +} + +#[test] +fn an_extension_value_is_refused_wherever_it_sits() { + let names = rows(&["A"]); + assert_eq!(decode(&array(&[vec![0xd4, 0x01, 0x00]]), &names), Err(StateDecodeError::Extension)); + assert_eq!(decode(&array(&[array(&[vec![0xd4, 0x01, 0x00]])]), &names), Err(StateDecodeError::Extension)); +} + +#[test] +fn a_repeated_text_key_is_refused_by_position() { + let names = rows(&["A"]); + let twice = map(&[(text("a"), int(1)), (text("b"), int(2)), (text("a"), int(3))]); + assert_eq!(decode(&array(&[twice]), &names), Err(StateDecodeError::DuplicateKey { position: 2 })); + // Distinct keys of different kinds are not duplicates. + let mixed = map(&[(int(1), int(1)), (text("1"), int(2))]); + assert!(decode(&array(&[mixed]), &names).is_ok()); +} + +#[test] +fn nesting_is_bounded_by_cultcaches_depth() { + let names = rows(&["A"]); + assert!(decode(&nested(256), &names).is_ok()); + assert_eq!(decode(&nested(257), &names), Err(StateDecodeError::TooDeep)); +} + +#[test] +fn refusals_never_print_a_value() { + let names = rows(&["A"]); + let secret = text(CANARY); + let cases = [ + array(&[secret.clone(), secret.clone()]), + [array(&[secret.clone()]), vec![0xc0]].concat(), + array(&[map(&[(text(CANARY), int(1)), (text(CANARY), int(2))])]), + array(&[secret.clone(), vec![0xd4, 0x01, 0x00]]), + secret.clone(), + ]; + for payload in cases { + let error = decode(&payload, &names).unwrap_err(); + assert!(!error.to_string().contains(CANARY), "{error}"); + assert!(!format!("{error:?}").contains(CANARY), "{error:?}"); + } +} diff --git a/crates/thing-testkit/Cargo.toml b/crates/thing-testkit/Cargo.toml new file mode 100644 index 0000000..c184cd1 --- /dev/null +++ b/crates/thing-testkit/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "thing-testkit" +version = "0.1.0" +edition = "2024" +license = "MIT" +publish = false + +[dependencies] +thing-contract = { path = "../thing-contract" } +cultcache-rs = { workspace = true } +thing-core = { path = "../thing-core" } +thing-state = { path = "../thing-state" } +anyhow = { workspace = true } +rmp-serde = { workspace = true } +serde = { workspace = true } + diff --git a/crates/thing-testkit/fixtures/README.md b/crates/thing-testkit/fixtures/README.md new file mode 100644 index 0000000..dbc345d --- /dev/null +++ b/crates/thing-testkit/fixtures/README.md @@ -0,0 +1,34 @@ +# thing-testkit fixtures + +Each `.cc` is a CultCache single-file store of contract documents, written under the pinned +clock `2026-01-01T00:00:00Z`. The builders are `thing_testkit::fixture`; the bytes below are +frozen, and a normal test run only compares and reads them. The rows are the fixture table of +`docs/thing2-build-spec.md` section 2.5; map rules are those of the build spec. + +| File | Holds | Map rules | +|---|---|---| +| `f01-swarm-dashboard.surface.cc` | One surface: a Grid Box root, a Text bound with a Number Format, a Repeat over a RecordsSource prefix whose template binds Item members, and a Button whose CommandRef is declared | 6, 9 | +| `f02-login-effect.surface.cc` | One surface (a Text TextInput and a Button whose command captures it, plus the declared resume command), the CommandInvocation of it, and its two results: Pending, then Completed with an `OpenExternal` effect whose `resume` names the declared command | 1, 2 | +| `f03-input-target.surface.cc` | One surface (an Image over a position: absolute Box with insets, holding a bound label) and the AssetCatalog the Image names | - | +| `f04-form.surface.cc` | One surface (Toggle, Slider, Select with literal options, TextInput of Number kind) and one command capturing all four, its invocation, and a Completed result declaring `clear_drafts` | 1 | +| `f05-modal-overlay.surface.cc` | One surface with a modal Overlay anchored to the viewport, a dismiss CommandRef and two Buttons inside | - | +| `f06-scroll-list.surface.cc` | One surface: a Box with `overflow: scroll` holding a Repeat over a RecordsSource prefix, template keyed by the item's `id` (the 1,000 items are provider state, not here) | - | +| `f07-plot.surface.cc` | One surface with a Plot of each mark (Line, Bar, Area) over a bound series, with and without axis bounds | - | +| `f08-embed-viewport.surface.cc` | One surface: an Embed of declared fixed size as a leaf between two Texts | - | +| `f09-composition-stack.surface.cc` | One surface: a `thing.std` stat Use, and a Use passing one argument of each ArgValue arm whose slot argument holds a second Use (two levels); plus the publisher CompositionDocument both name, whose body places the Slot node | 5 | +| `f10-hostile.surface.cc` | Four surfaces, one hostile shape each: an undeclared CommandRef, a duplicate id after expansion (the surface's `dup-use/shared-id` against the expansion of `dup-use`), an unresolved Use, and a Bind whose schema no fixture provides; plus the one composition (`dup`) the duplicate-id surface expands | 4, 5, 6 | +| `f11-deep.surface.cc` | One surface: the deepest Box chain whose payload CultCache's `check_payload_depth` accepts, found by the builder | - | +| `f11-deep-refused.bin` | The payload of the same chain one Box level deeper, raw: `check_payload_depth` refuses it at depth 257 and so does CultCache. No store can hold it | - | +| `f12-text-edge.surface.cc` | One surface of five Text nodes: bidi (Hebrew and Arabic in Latin), CJK wide characters, combining marks, emoji ZWJ sequences, and a paragraph long enough to wrap | - | +| `state-swarm.state.cc` | Provider state, not contract documents: f01's four swarm records (`summary`, `mind-1`..`mind-3`, schema `gamecult.thing.test.swarm.v1`) written with the test type registered, so the store's catalog publishes the member rows `Id`, `Name`, `Load` | - | +| `state-swarm-members-empty.state.cc` | The same four records written through a hand-implemented twin of the type, whose catalog publishes `[]`: every read of it is refused | - | + +A payload the contract refuses cannot live in a store: f11's refused payload is a raw file here, and an +unknown union arm is `crates/thing-contract/tests/goldens/node-unknown-arm.bin`, read in place and fed to +`MemState::put_raw`. + +## Regenerate + +`THING_BLESS=1 cargo test -p thing-testkit --test fixtures every_fixture_round_trips` rewrites +the files (the two state stores: `--test state the_committed_stores`) through `golden::check`, the one bless door; review the diff before committing. Run +the tests without `THING_BLESS` to compare. diff --git a/crates/thing-testkit/fixtures/f01-swarm-dashboard.surface.cc b/crates/thing-testkit/fixtures/f01-swarm-dashboard.surface.cc new file mode 100644 index 0000000..2ba4218 Binary files /dev/null and b/crates/thing-testkit/fixtures/f01-swarm-dashboard.surface.cc differ diff --git a/crates/thing-testkit/fixtures/f02-login-effect.surface.cc b/crates/thing-testkit/fixtures/f02-login-effect.surface.cc new file mode 100644 index 0000000..7937541 Binary files /dev/null and b/crates/thing-testkit/fixtures/f02-login-effect.surface.cc differ diff --git a/crates/thing-testkit/fixtures/f03-input-target.surface.cc b/crates/thing-testkit/fixtures/f03-input-target.surface.cc new file mode 100644 index 0000000..3e80295 Binary files /dev/null and b/crates/thing-testkit/fixtures/f03-input-target.surface.cc differ diff --git a/crates/thing-testkit/fixtures/f04-form.surface.cc b/crates/thing-testkit/fixtures/f04-form.surface.cc new file mode 100644 index 0000000..009661f Binary files /dev/null and b/crates/thing-testkit/fixtures/f04-form.surface.cc differ diff --git a/crates/thing-testkit/fixtures/f05-modal-overlay.surface.cc b/crates/thing-testkit/fixtures/f05-modal-overlay.surface.cc new file mode 100644 index 0000000..01f6b69 Binary files /dev/null and b/crates/thing-testkit/fixtures/f05-modal-overlay.surface.cc differ diff --git a/crates/thing-testkit/fixtures/f06-scroll-list.surface.cc b/crates/thing-testkit/fixtures/f06-scroll-list.surface.cc new file mode 100644 index 0000000..1b0740e Binary files /dev/null and b/crates/thing-testkit/fixtures/f06-scroll-list.surface.cc differ diff --git a/crates/thing-testkit/fixtures/f07-plot.surface.cc b/crates/thing-testkit/fixtures/f07-plot.surface.cc new file mode 100644 index 0000000..9877b27 Binary files /dev/null and b/crates/thing-testkit/fixtures/f07-plot.surface.cc differ diff --git a/crates/thing-testkit/fixtures/f08-embed-viewport.surface.cc b/crates/thing-testkit/fixtures/f08-embed-viewport.surface.cc new file mode 100644 index 0000000..b77db80 Binary files /dev/null and b/crates/thing-testkit/fixtures/f08-embed-viewport.surface.cc differ diff --git a/crates/thing-testkit/fixtures/f09-composition-stack.surface.cc b/crates/thing-testkit/fixtures/f09-composition-stack.surface.cc new file mode 100644 index 0000000..0447ecc Binary files /dev/null and b/crates/thing-testkit/fixtures/f09-composition-stack.surface.cc differ diff --git a/crates/thing-testkit/fixtures/f10-hostile.surface.cc b/crates/thing-testkit/fixtures/f10-hostile.surface.cc new file mode 100644 index 0000000..614b081 Binary files /dev/null and b/crates/thing-testkit/fixtures/f10-hostile.surface.cc differ diff --git a/crates/thing-testkit/fixtures/f11-deep-refused.bin b/crates/thing-testkit/fixtures/f11-deep-refused.bin new file mode 100644 index 0000000..62334e1 Binary files /dev/null and b/crates/thing-testkit/fixtures/f11-deep-refused.bin differ diff --git a/crates/thing-testkit/fixtures/f11-deep.surface.cc b/crates/thing-testkit/fixtures/f11-deep.surface.cc new file mode 100644 index 0000000..f9374c5 Binary files /dev/null and b/crates/thing-testkit/fixtures/f11-deep.surface.cc differ diff --git a/crates/thing-testkit/fixtures/f12-text-edge.surface.cc b/crates/thing-testkit/fixtures/f12-text-edge.surface.cc new file mode 100644 index 0000000..1ca91b2 Binary files /dev/null and b/crates/thing-testkit/fixtures/f12-text-edge.surface.cc differ diff --git a/crates/thing-testkit/fixtures/state-swarm-members-empty.state.cc b/crates/thing-testkit/fixtures/state-swarm-members-empty.state.cc new file mode 100644 index 0000000..c55bfe6 --- /dev/null +++ b/crates/thing-testkit/fixtures/state-swarm-members-empty.state.cc @@ -0,0 +1,3 @@ +“²cultcache.store.v1‘—¼gamecult.thing.test.swarm.v1¼gamecult.thing.test.swarm.v1¿gamecult.thing.test.swarm.v1.v1¼gamecult.thing.test.swarm.v1Ùl{"schemaName":"gamecult.thing.test.swarm.v1","schemaVersion":"gamecult.thing.test.swarm.v1.v1","members":[]}‘¼gamecult.thing.test.swarm.v1�””¦mind-1¼gamecult.thing.test.swarm.v1´2026-01-01T00:00:00ZÄ“¦mind-1¦EurekaË?Ó× +=p£ה¦mind-2¼gamecult.thing.test.swarm.v1´2026-01-01T00:00:00ZÄ“¦mind-2¥LibbyË?â=p£× +=”¦mind-3¼gamecult.thing.test.swarm.v1´2026-01-01T00:00:00ZÄ“¦mind-3¤KikoË?´záG®{”§summary¼gamecult.thing.test.swarm.v1´2026-01-01T00:00:00ZÄ“§summary¥SwarmË?ÚáG®zá \ No newline at end of file diff --git a/crates/thing-testkit/fixtures/state-swarm.state.cc b/crates/thing-testkit/fixtures/state-swarm.state.cc new file mode 100644 index 0000000..cf92c6f Binary files /dev/null and b/crates/thing-testkit/fixtures/state-swarm.state.cc differ diff --git a/crates/thing-contract/tests/common/mod.rs b/crates/thing-testkit/src/build.rs similarity index 95% rename from crates/thing-contract/tests/common/mod.rs rename to crates/thing-testkit/src/build.rs index ee6f71b..f042d9f 100644 --- a/crates/thing-contract/tests/common/mod.rs +++ b/crates/thing-testkit/src/build.rs @@ -1,7 +1,5 @@ -//! Constructors for the values the goldens and the other tests share. Every value is built -//! through the crate's public types; no bytes are spelled here. - -#![allow(dead_code)] +//! Constructors for the values the contract goldens, the fixtures and the other tests share. +//! Every value is built through the crate's public types; no bytes are spelled here. use thing_contract::*; diff --git a/crates/thing-testkit/src/fixture.rs b/crates/thing-testkit/src/fixture.rs new file mode 100644 index 0000000..61f480b --- /dev/null +++ b/crates/thing-testkit/src/fixture.rs @@ -0,0 +1,813 @@ +//! The frozen fixture stores: typed contract documents built here, encoded through CultCache +//! under a pinned clock, committed under `fixtures/`, and loaded back through the same door +//! every consumer uses. The bless switch is read in `golden::check` alone. + +use std::path::PathBuf; + +use cultcache_rs::{CultCache, check_payload_depth}; +use thing_contract::*; + +use crate::build::*; +use crate::{golden, store}; + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum Fixture { + F01SwarmDashboard, + F02LoginEffect, + F03InputTarget, + F04Form, + F05ModalOverlay, + F06ScrollList, + F07Plot, + F08EmbedViewport, + F09CompositionStack, + F10Hostile, + F11Deep, + F12TextEdge, +} + +/// The documents of one fixture, each kind in record-key order. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct FixtureSet { + pub surfaces: Vec, + pub compositions: Vec, + pub catalogs: Vec, + pub invocations: Vec, + pub results: Vec, +} + +impl FixtureSet { + fn sorted(mut self) -> Self { + self.surfaces.sort_by_key(SurfaceDocument::record_key); + self.compositions.sort_by_key(CompositionDocument::record_key); + self.catalogs.sort_by_key(AssetCatalog::record_key); + self.invocations.sort_by_key(CommandInvocation::record_key); + self.results.sort_by_key(CommandResult::record_key); + self + } + + fn surfaces(surfaces: Vec) -> Self { + Self { surfaces, ..Self::default() }.sorted() + } + + /// Every document in the set, counted. + pub fn document_count(&self) -> usize { + self.surfaces.len() + self.compositions.len() + self.catalogs.len() + self.invocations.len() + self.results.len() + } +} + +impl Fixture { + pub const ALL: [Fixture; 12] = [ + Fixture::F01SwarmDashboard, + Fixture::F02LoginEffect, + Fixture::F03InputTarget, + Fixture::F04Form, + Fixture::F05ModalOverlay, + Fixture::F06ScrollList, + Fixture::F07Plot, + Fixture::F08EmbedViewport, + Fixture::F09CompositionStack, + Fixture::F10Hostile, + Fixture::F11Deep, + Fixture::F12TextEdge, + ]; + + pub fn file_name(self) -> &'static str { + match self { + Fixture::F01SwarmDashboard => "f01-swarm-dashboard.surface.cc", + Fixture::F02LoginEffect => "f02-login-effect.surface.cc", + Fixture::F03InputTarget => "f03-input-target.surface.cc", + Fixture::F04Form => "f04-form.surface.cc", + Fixture::F05ModalOverlay => "f05-modal-overlay.surface.cc", + Fixture::F06ScrollList => "f06-scroll-list.surface.cc", + Fixture::F07Plot => "f07-plot.surface.cc", + Fixture::F08EmbedViewport => "f08-embed-viewport.surface.cc", + Fixture::F09CompositionStack => "f09-composition-stack.surface.cc", + Fixture::F10Hostile => "f10-hostile.surface.cc", + Fixture::F11Deep => "f11-deep.surface.cc", + Fixture::F12TextEdge => "f12-text-edge.surface.cc", + } + } + + pub fn dir() -> PathBuf { + PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("fixtures") + } + + /// The documents the builders produce. + pub fn build(self) -> FixtureSet { + match self { + Fixture::F01SwarmDashboard => FixtureSet::surfaces(vec![swarm_dashboard()]), + Fixture::F02LoginEffect => login_effect(), + Fixture::F03InputTarget => input_target(), + Fixture::F04Form => form(), + Fixture::F05ModalOverlay => FixtureSet::surfaces(vec![modal_overlay()]), + Fixture::F06ScrollList => FixtureSet::surfaces(vec![scroll_list()]), + Fixture::F07Plot => FixtureSet::surfaces(vec![plot()]), + Fixture::F08EmbedViewport => FixtureSet::surfaces(vec![embed_viewport()]), + Fixture::F09CompositionStack => { + FixtureSet { surfaces: vec![composition_stack()], compositions: vec![stack_card()], ..FixtureSet::default() } + .sorted() + } + Fixture::F10Hostile => { + FixtureSet { surfaces: hostile(), compositions: vec![hostile_dup()], ..FixtureSet::default() }.sorted() + } + Fixture::F11Deep => FixtureSet::surfaces(vec![deep_surface(deepest_accepted())]), + Fixture::F12TextEdge => FixtureSet::surfaces(vec![text_edge()]), + } + } + + /// The file holding the payload one Box level deeper than f11, which the contract refuses. + pub const DEEP_REFUSED: &'static str = "f11-deep-refused.bin"; + + /// The payload of f11's surface with one more Box level than the bound admits: raw bytes, + /// since no store can hold them. + pub fn deep_refused_payload() -> Vec { + rmp_serde::to_vec(&deep_surface(deepest_accepted() + 1)).unwrap() + } + + /// Bless or compare the committed file of the refused payload; returns the committed bytes. + pub fn write_deep_refused() -> Vec { + golden::check(&Self::dir(), Self::DEEP_REFUSED, &Self::deep_refused_payload()) + } + + /// Encode the built documents into a store and bless or compare the committed file; returns + /// the committed bytes. + pub fn write(self) -> Vec { + let set = self.build(); + let bytes = store::bytes(|cache| { + for surface in &set.surfaces { + store::put_pinned(cache, &surface.record_key(), surface); + } + for composition in &set.compositions { + store::put_pinned(cache, &composition.record_key(), composition); + } + for catalog in &set.catalogs { + store::put_pinned(cache, &catalog.record_key(), catalog); + } + for invocation in &set.invocations { + store::put_pinned(cache, &invocation.record_key(), invocation); + } + for result in &set.results { + store::put_pinned(cache, &result.record_key(), result); + } + }); + golden::check(&Self::dir(), self.file_name(), &bytes) + } + + /// The committed store, opened through the contract. Opening creates a lock file beside the + /// store, so this opens a copy in a directory of its own, removed once the store is read: + /// the fixtures directory is never written. + pub fn open(self) -> CultCache { + let work = store::scratch_dir("open"); + let copy = work.join(self.file_name()); + std::fs::copy(Self::dir().join(self.file_name()), ©).unwrap(); + let cache = store::open(©); + let _ = std::fs::remove_dir_all(&work); + cache + } + + /// The committed store, decoded through the contract. + pub fn load(self) -> FixtureSet { + let cache = self.open(); + FixtureSet { + surfaces: cache.get_all().unwrap(), + compositions: cache.get_all().unwrap(), + catalogs: cache.get_all().unwrap(), + invocations: cache.get_all().unwrap(), + results: cache.get_all().unwrap(), + } + .sorted() + } +} + +const SWARM: &str = "provider.swarm"; +const SWARM_SCHEMA: &str = "gamecult.thing.test.swarm.v1"; + +fn swarm_ref(key: &str) -> StateSource { + StateSource::Record(StateRef { + provider: Some(ProviderId::new(SWARM)), + schema: SchemaId::new(SWARM_SCHEMA), + key: RecordKey::new(key), + }) +} + +fn swarm_dashboard() -> SurfaceDocument { + let load = Bind { + source: swarm_ref("summary"), + member: path(&["Load"]), + format: Some(Format::Number(NumberFormat { precision: count(1), percent: true, unit: None })), + }; + let load_text = Node::Text(TextNode { + common: common("load"), + content: TextSource::Bound(load), + style_token: "title".into(), + wrap: false, + max_lines: Some(count(1)), + selectable: false, + }); + let minds = Node::Repeat(RepeatNode { + common: common("minds"), + collection: CollectionSource::Records(RecordsSource { + provider: Some(ProviderId::new(SWARM)), + schema: SchemaId::new(SWARM_SCHEMA), + key_prefix: "mind-".into(), + }), + key_member: path(&["Id"]), + template: std::boxed::Box::new(Node::Text(TextNode { + common: common("mind-name"), + content: TextSource::Bound(item_bind(path(&["Name"]))), + style_token: "body".into(), + wrap: false, + max_lines: Some(count(1)), + selectable: true, + })), + }); + let restart = Node::Button(ButtonNode { + common: common("restart"), + content: vec![text("restart-label", "Restart")], + on_activate: command("restart"), + enabled: lit_bool(true), + }); + let mut grid = style(); + grid.display = Display::Grid; + grid.grid_columns = vec![Dimension::Percent(Scalar { value: 50.0 }), Dimension::Percent(Scalar { value: 50.0 })]; + grid.grid_rows = vec![Dimension::Auto, Dimension::Auto]; + let root = Node::Box(BoxNode { + common: common("root"), + style: grid, + paint: plain_paint(), + role: Role::Group, + children: vec![load_text, minds, restart], + }); + SurfaceDocument { + provider_id: ProviderId::new(SWARM), + label: seg("dashboard"), + version: ver(1), + title: "Swarm".into(), + root, + commands: vec![CommandDecl { + id: CommandId::new("restart"), + payload_schema: SchemaId::new("gamecult.thing.test.restart.v1"), + captures: vec![], + confirm: Some("Restart the swarm?".into()), + }], + } +} + +const STACK: &str = "provider.stack"; + +/// A Use of the publisher's card with one argument of each arm and the given slot children. +fn card_use(id: &str, slot: Vec) -> Node { + let source = Bind { source: swarm_ref("summary"), member: path(&["Load"]), format: None }; + let rows = CollectionSource::Records(RecordsSource { + provider: None, + schema: SchemaId::new(SWARM_SCHEMA), + key_prefix: "mind-".into(), + }); + let args = vec![ + Arg { name: "title".into(), value: ArgValue::Text(TextArg { value: "Card".into() }) }, + Arg { name: "count".into(), value: ArgValue::Number(NumberArg { value: 3.0 }) }, + Arg { name: "on".into(), value: ArgValue::Bool(BoolArg { value: true }) }, + Arg { name: "source".into(), value: ArgValue::Bind(source) }, + Arg { name: "rows".into(), value: ArgValue::Collection(CollectionArg { source: rows }) }, + Arg { name: "act".into(), value: ArgValue::Command(CommandArg { command: command("open") }) }, + Arg { name: "body".into(), value: ArgValue::Slot(SlotArg { nodes: slot }) }, + ]; + Node::Use(UseNode { + common: common(id), + composition: CompositionRef { publisher: STACK.into(), name: seg("card"), version: ver(1) }, + args, + }) +} + +fn composition_stack() -> SurfaceDocument { + // Two levels: the outer card's slot holds a second card. + let inner = card_use("inner-card", vec![text("inner-note", "nested")]); + let outer = card_use("outer-card", vec![inner]); + // A compiled-in composition: thing.std is never asked of the port. + let std_stat = Node::Use(UseNode { + common: common("std-stat"), + composition: CompositionRef { publisher: "thing.std".into(), name: seg("stat"), version: ver(1) }, + args: vec![ + Arg { name: "label".into(), value: ArgValue::Text(TextArg { value: "Load".into() }) }, + Arg { + name: "value".into(), + value: ArgValue::Bind(Bind { source: swarm_ref("summary"), member: path(&["Load"]), format: None }), + }, + ], + }); + SurfaceDocument { + provider_id: ProviderId::new(STACK), + label: seg("stack"), + version: ver(1), + title: "Stack".into(), + root: boxed("root", vec![std_stat, outer]), + commands: vec![CommandDecl { + id: CommandId::new("open"), + payload_schema: SchemaId::new("gamecult.thing.test.open.v1"), + captures: vec![], + confirm: None, + }], + } +} + +fn stack_card() -> CompositionDocument { + let title = Node::Text(TextNode { + common: common("card-title"), + content: TextSource::Param(param("title")), + style_token: "title".into(), + wrap: true, + max_lines: None, + selectable: false, + }); + let rows = Node::Repeat(RepeatNode { + common: common("card-rows"), + collection: CollectionSource::Param(param("rows")), + key_member: path(&["Id"]), + template: std::boxed::Box::new(Node::Text(TextNode { + common: common("card-row"), + content: TextSource::Bound(item_bind(path(&["Name"]))), + style_token: "body".into(), + wrap: false, + max_lines: None, + selectable: false, + })), + }); + let act = Node::Button(ButtonNode { + common: common("card-act"), + content: vec![text("card-act-label", "Open")], + on_activate: CommandRef::Param(param("act")), + enabled: BoolSource::Param(param("on")), + }); + CompositionDocument { + publisher: STACK.into(), + name: seg("card"), + version: ver(1), + params: [ + ("title", ParamKind::Text), + ("count", ParamKind::Number), + ("on", ParamKind::Bool), + ("source", ParamKind::Bind), + ("rows", ParamKind::Collection), + ("act", ParamKind::Command), + ("body", ParamKind::Slot), + ] + .into_iter() + .map(|(name, kind)| ParamDecl { name: name.into(), kind }) + .collect(), + body: boxed("card-root", vec![title, rows, act, Node::Slot(SlotNode { param: param("body") })]), + } +} + +const HOSTILE: &str = "provider.hostile"; + +fn hostile_use(id: &str, name: &str) -> Node { + Node::Use(UseNode { + common: common(id), + composition: CompositionRef { publisher: HOSTILE.into(), name: seg(name), version: ver(1) }, + args: vec![], + }) +} + +fn hostile_surface(label: &str, children: Vec) -> SurfaceDocument { + SurfaceDocument { + provider_id: ProviderId::new(HOSTILE), + label: seg(label), + version: ver(1), + title: label.into(), + root: boxed("root", children), + commands: vec![], + } +} + +/// Four surfaces the resolver must refuse or flag, one hostile shape each. A surface whose +/// bytes the contract itself refuses (an unknown union arm) cannot live in a store, so that +/// case is the committed `node-unknown-arm.bin` golden, fed to a fake by the test. +fn hostile() -> Vec { + let undeclared = Node::Button(ButtonNode { + common: common("go"), + content: vec![text("go-label", "Go")], + on_activate: command("missing"), + enabled: lit_bool(true), + }); + let mismatched = Node::Text(TextNode { + common: common("mismatch"), + content: TextSource::Bound(Bind { + source: StateSource::Record(StateRef { + provider: Some(ProviderId::new(HOSTILE)), + schema: SchemaId::new("gamecult.thing.test.nowhere.v1"), + key: RecordKey::new("row-1"), + }), + member: path(&["Name"]), + format: None, + }), + style_token: "body".into(), + wrap: false, + max_lines: None, + selectable: false, + }); + vec![ + hostile_surface("undeclared-command", vec![undeclared]), + // The composition `dup` emits `shared-id`, which expands to `dup-use/shared-id`; the surface + // authors that same id beside the Use. + hostile_surface("duplicate-id", vec![hostile_use("dup-use", "dup"), text("dup-use/shared-id", "also here")]), + // No composition `ghost` exists anywhere. + hostile_surface("unresolved-use", vec![hostile_use("ghost-use", "ghost")]), + hostile_surface("schema-mismatch", vec![mismatched]), + ] +} + +/// The one composition a hostile surface needs: the duplicate-id case cannot expand without it. +fn hostile_dup() -> CompositionDocument { + CompositionDocument { + publisher: HOSTILE.into(), + name: seg("dup"), + version: ver(1), + params: vec![], + body: boxed("dup-root", vec![text("shared-id", "from the composition")]), + } +} + +// The nine fixtures below bind to test schemas only; the state scripts that fill them belong to +// the bind cut, so no provider state record lives in a fixture. + +const TEST_SCHEMA_ROOT: &str = "gamecult.thing.test"; + +fn decl(id: &str, captures: &[&str], confirm: Option<&str>) -> CommandDecl { + CommandDecl { + id: CommandId::new(id), + payload_schema: SchemaId::new(format!("{TEST_SCHEMA_ROOT}.{id}.v1")), + captures: captures.iter().map(|node| nid(node)).collect(), + confirm: confirm.map(Into::into), + } +} + +fn record_member(provider: &str, schema: &str, key: &str, member: &[&str]) -> Bind { + Bind { + source: StateSource::Record(StateRef { + provider: Some(ProviderId::new(provider)), + schema: SchemaId::new(format!("{TEST_SCHEMA_ROOT}.{schema}.v1")), + key: RecordKey::new(key), + }), + member: path(member), + format: None, + } +} + +fn surface(provider: &str, label: &str, root: Node, commands: Vec) -> SurfaceDocument { + SurfaceDocument { + provider_id: ProviderId::new(provider), + label: seg(label), + version: ver(1), + title: label.into(), + root, + commands, + } +} + +/// An invocation of `command` on `surface`, issued at the pinned clock. +fn invoke(surface: &SurfaceDocument, id: &str, command: &str, captured: Vec) -> CommandInvocation { + CommandInvocation { + invocation_id: id.into(), + surface_key: surface.record_key(), + surface_version: surface.version.clone(), + command: CommandId::new(command), + payload: RecordPayload { + schema: SchemaId::new(format!("{TEST_SCHEMA_ROOT}.{command}.v1")), + // An empty MessagePack array: the payload record has no slots to fill. + bytes: vec![0x90], + }, + captured, + client: "renderer.web".into(), + issued_at: store::PINNED_CLOCK.into(), + delegation: None, + } +} + +fn captured(node: &str, value: InputValue) -> CapturedInput { + CapturedInput { node: nid(node), value } +} + +fn text_input(id: &str, kind: InputKind, initial: &str, submit: CommandRef) -> Node { + Node::TextInput(TextInputNode { + common: common(id), + multiline: false, + input_kind: kind, + placeholder: lit_text(id), + initial: lit_text(initial), + submit, + }) +} + +fn button(id: &str, label: &str, on_activate: CommandRef) -> Node { + Node::Button(ButtonNode { + common: common(id), + content: vec![text(&format!("{id}-label"), label)], + on_activate, + enabled: lit_bool(true), + }) +} + +fn login_effect() -> FixtureSet { + let root = boxed( + "root", + vec![ + text_input("username", InputKind::Text, "", command("sign-in")), + button("sign-in-button", "Sign in", command("sign-in")), + ], + ); + let login = surface( + "provider.login", + "login", + root, + vec![decl("sign-in", &["username"], None), decl("login-resume", &[], None)], + ); + let invocation = invoke( + &login, + "6d1c0f52-7a0e-4b53-8f3d-2a9e4c7b1d10", + "sign-in", + vec![captured("username", InputValue::Text(TextValue { value: "ada".into() }))], + ); + // The answer arrives in two steps: Pending, then Completed, whose effect sends the user to + // an external page and names the command that runs when they return. + let results = vec![ + CommandResult::pending(&invocation, seq(1), "waiting for the identity provider"), + CommandResult::completed( + &invocation, + seq(2), + None, + false, + Some(Effect::OpenExternal(OpenExternalEffect { + url: "https://login.example.test/authorize".into(), + resume: command("login-resume"), + })), + ), + ]; + FixtureSet { surfaces: vec![login], invocations: vec![invocation], results, ..FixtureSet::default() }.sorted() +} + +fn input_target() -> FixtureSet { + let provider = "provider.muninn"; + let board = Node::Image(ImageNode { + common: common("board"), + catalog: "targets".into(), + asset: "board".into(), + fit: ImageFit::Contain, + alt: lit_text("The board the target sits on"), + }); + let label = Node::Text(TextNode { + common: common("target-label"), + content: TextSource::Bound(record_member(provider, "target", "cursor", &["Label"])), + style_token: "body".into(), + wrap: false, + max_lines: Some(count(1)), + selectable: false, + }); + // An absolute Box over the Image: insets from the root's top and left edges, a fixed size. + let mut over = style(); + over.position = Position::Absolute; + over.inset = Edges { top: px(120.0), right: Dimension::Auto, bottom: Dimension::Auto, left: px(200.0) }; + over.size = size2(px(48.0), px(48.0)); + let target = Node::Box(BoxNode { + common: common("target"), + style: over, + paint: plain_paint(), + role: Role::Group, + children: vec![label], + }); + let mut frame = style(); + frame.size = size2(px(640.0), px(360.0)); + let root = Node::Box(BoxNode { + common: common("root"), + style: frame, + paint: plain_paint(), + role: Role::Group, + children: vec![board, target], + }); + let catalog = AssetCatalog { + provider_id: ProviderId::new(provider), + catalog_id: seg("targets"), + version: ver(1), + assets: vec![AssetEntry { + id: "board".into(), + media_type: "image/png".into(), + uri: "asset://provider.muninn/board.png".into(), + width: count(640), + height: count(360), + }], + }; + FixtureSet { + surfaces: vec![surface(provider, "input-target", root, vec![])], + catalogs: vec![catalog], + ..FixtureSet::default() + } + .sorted() +} + +fn form() -> FixtureSet { + let provider = "provider.settings"; + let toggle = Node::Toggle(ToggleNode { + common: common("enabled"), + checked: BoolSource::Bound(record_member(provider, "settings", "current", &["Enabled"])), + on_change: command("save"), + }); + let slider = Node::Slider(SliderNode { + common: common("volume"), + min: 0.0, + max: 1.0, + step: 0.05, + value: NumberSource::Bound(record_member(provider, "settings", "current", &["Volume"])), + commit: command("save"), + }); + let select = Node::Select(SelectNode { + common: common("theme"), + options: OptionList::Literal(LiteralOptions { + options: vec![ + SelectOption { value: "dark".into(), label: "Dark".into() }, + SelectOption { value: "light".into(), label: "Light".into() }, + ], + }), + value: record_member(provider, "settings", "current", &["Theme"]), + on_change: command("save"), + }); + let port = text_input("port", InputKind::Number, "8080", command("save")); + let root = boxed("root", vec![toggle, slider, select, port]); + let form = surface(provider, "form", root, vec![decl("save", &["enabled", "volume", "theme", "port"], None)]); + let invocation = invoke( + &form, + "0b7e44aa-31c9-4e0d-a6f2-95d8c3e1b277", + "save", + vec![ + captured("enabled", InputValue::Bool(BoolValue { value: true })), + captured("volume", InputValue::Number(NumberValue { value: 0.75 })), + captured("theme", InputValue::Choice(ChoiceValue { value: "dark".into() })), + captured("port", InputValue::Number(NumberValue { value: 8080.0 })), + ], + ); + // The save succeeds and clears the drafts the invocation captured. + let result = CommandResult::completed(&invocation, seq(1), Some(ver(2)), true, None); + FixtureSet { surfaces: vec![form], invocations: vec![invocation], results: vec![result], ..FixtureSet::default() } + .sorted() +} + +fn modal_overlay() -> SurfaceDocument { + let dialog = Node::Box(BoxNode { + common: common("dialog"), + style: style(), + paint: plain_paint(), + role: Role::Dialog, + children: vec![ + text("dialog-title", "Delete the archive?"), + button("confirm", "Delete", command("confirm")), + button("cancel", "Cancel", command("dismiss")), + ], + }); + let overlay = Node::Overlay(OverlayNode { + common: common("confirm-overlay"), + anchor: Anchor::Viewport, + modal: true, + dismiss: command("dismiss"), + children: vec![dialog], + }); + surface( + "provider.dialog", + "modal", + boxed("root", vec![text("page-text", "The archive holds 12 items."), overlay]), + vec![decl("confirm", &[], Some("Delete the archive?")), decl("dismiss", &[], None)], + ) +} + +fn scroll_list() -> SurfaceDocument { + let provider = "provider.feed"; + let row = Node::Box(BoxNode { + common: common("item-row"), + style: style(), + paint: plain_paint(), + role: Role::ListItem, + children: vec![Node::Text(TextNode { + common: common("item-title"), + content: TextSource::Bound(item_bind(path(&["Title"]))), + style_token: "body".into(), + wrap: false, + max_lines: Some(count(1)), + selectable: false, + })], + }); + let items = Node::Repeat(RepeatNode { + common: common("items"), + collection: CollectionSource::Records(RecordsSource { + provider: Some(ProviderId::new(provider)), + schema: SchemaId::new(format!("{TEST_SCHEMA_ROOT}.item.v1")), + key_prefix: "item-".into(), + }), + key_member: path(&["Id"]), + template: std::boxed::Box::new(row), + }); + let mut list = style(); + list.overflow = Overflow::Scroll; + list.size = size2(Dimension::Percent(Scalar { value: 100.0 }), px(400.0)); + let root = Node::Box(BoxNode { + common: common("root"), + style: list, + paint: plain_paint(), + role: Role::List, + children: vec![items], + }); + surface(provider, "scroll-list", root, vec![]) +} + +fn plot() -> SurfaceDocument { + let provider = "provider.market"; + let series = || record_member(provider, "series", "prices", &["Values"]); + let mark = |id: &str, mark: PlotMark, x: (Option, Option), y: (Option, Option)| { + Node::Plot(PlotNode { + common: common(id), + series: series(), + mark, + x_min: x.0, + x_max: x.1, + y_min: y.0, + y_max: y.1, + }) + }; + let root = boxed( + "root", + vec![ + mark("line", PlotMark::Line, (None, None), (None, None)), + mark("bar", PlotMark::Bar, (None, None), (Some(0.0), None)), + mark("area", PlotMark::Area, (Some(0.0), Some(99.0)), (Some(-1.0), Some(1.0))), + ], + ); + surface(provider, "plot", root, vec![]) +} + +fn embed_viewport() -> SurfaceDocument { + let embed = Node::Embed(EmbedNode { + common: common("viewport"), + slot_kind: "viewport.world".into(), + slot_id: "main".into(), + width: 320.0, + height: 180.0, + }); + let mut row = style(); + row.direction = Direction::Row; + let root = Node::Box(BoxNode { + common: common("root"), + style: row, + paint: plain_paint(), + role: Role::Group, + children: vec![text("before", "before"), embed, text("after", "after")], + }); + surface("provider.viewport", "embed-viewport", root, vec![]) +} + +/// A chain of `levels` Boxes, each the only child of the last, the innermost empty. +fn deep_surface(levels: usize) -> SurfaceDocument { + let mut chain = boxed(&format!("deep-{}", levels - 1), vec![]); + for level in (0..levels - 1).rev() { + chain = boxed(&format!("deep-{level}"), vec![chain]); + } + surface("provider.deep", "deep", chain, vec![]) +} + +/// The most Box levels whose surface payload CultCache's depth check accepts, found by trying +/// one more level until the check refuses. The bound is CultCache's, never restated here. +fn deepest_accepted() -> usize { + let mut levels = 1; + while check_payload_depth(&rmp_serde::to_vec(&deep_surface(levels + 1)).unwrap()).is_ok() { + levels += 1; + } + levels +} + +fn text_edge() -> SurfaceDocument { + let paragraph = "The quick brown fox jumps over the lazy dog while the evening light slides across the \ + valley, and the long paragraph keeps going so that any reasonable column must break it \ + across several lines. " + .repeat(4); + let samples = [ + // Hebrew and Arabic runs inside a Latin sentence. + ("bidi", "Hello \u{5e9}\u{5dc}\u{5d5}\u{5dd} \u{5e2}\u{5d5}\u{5dc}\u{5dd} and \u{645}\u{631}\u{62d}\u{628}\u{627} \u{628}\u{627}\u{644}\u{639}\u{627}\u{644}\u{645} then 123 end."), + // Han, kana, hangul and fullwidth Latin: two columns each. + ("cjk", "\u{65e5}\u{672c}\u{8a9e}\u{30c6}\u{30b9}\u{30c8} \u{4f60}\u{597d}\u{4e16}\u{754c} \u{d55c}\u{ad6d}\u{c5b4} \u{ff21}\u{ff22}\u{ff23}\u{ff11}\u{ff12}\u{ff13}"), + // Marks that attach to the letter before them. + ("combining", "e\u{301} a\u{308} n\u{303} o\u{302}\u{323} z\u{35b}\u{34f}\u{300}"), + // A family, a skin-toned technologist and a flag, each one cluster of joined scalars. + ("emoji-zwj", "\u{1f469}\u{200d}\u{1f469}\u{200d}\u{1f467}\u{200d}\u{1f466} \u{1f468}\u{1f3fd}\u{200d}\u{1f4bb} \u{1f3f3}\u{fe0f}\u{200d}\u{1f308}"), + ("long-wrap", paragraph.as_str()), + ]; + let nodes = samples + .iter() + .map(|(id, content)| { + Node::Text(TextNode { + common: common(id), + content: lit_text(content), + style_token: "body".into(), + wrap: true, + max_lines: None, + selectable: true, + }) + }) + .collect(); + surface("provider.text", "text-edge", boxed("root", nodes), vec![]) +} diff --git a/crates/thing-testkit/src/golden.rs b/crates/thing-testkit/src/golden.rs new file mode 100644 index 0000000..728389a --- /dev/null +++ b/crates/thing-testkit/src/golden.rs @@ -0,0 +1,32 @@ +//! The one bless door. `THING_BLESS=1` writes; any other run compares and never writes. + +use std::path::Path; + +fn blessing() -> bool { + std::env::var("THING_BLESS").as_deref() == Ok("1") +} + +/// Bless the file or compare against it. Returns the committed bytes. A mismatch panics naming +/// the file and leaves it unchanged. +pub fn check(dir: &Path, file: &str, produced: &[u8]) -> Vec { + let path = dir.join(file); + if blessing() { + std::fs::write(&path, produced).unwrap_or_else(|error| panic!("{file}: {error}")); + } + let committed = std::fs::read(&path).unwrap_or_else(|error| panic!("{file}: {error}")); + assert_eq!(committed, produced, "{file}: the committed golden differs from what the crate writes"); + committed +} + +/// Bless or compare `stem.bin` and `stem.txt` together: the binary is the oracle, the text is +/// compared too so it cannot rot. Returns the committed binary. +pub fn check_with_text(dir: &Path, stem: &str, bytes: &[u8], text: &str) -> Vec { + let committed = check(dir, &format!("{stem}.bin"), bytes); + check(dir, &format!("{stem}.txt"), text.as_bytes()); + committed +} + +/// Read a committed file. Never writes: backends read core's goldens through this. +pub fn read(dir: &Path, file: &str) -> Vec { + std::fs::read(dir.join(file)).unwrap_or_else(|error| panic!("{file}: {error}")) +} diff --git a/crates/thing-testkit/src/lib.rs b/crates/thing-testkit/src/lib.rs new file mode 100644 index 0000000..a7d5d18 --- /dev/null +++ b/crates/thing-testkit/src/lib.rs @@ -0,0 +1,9 @@ +//! The fakes, builders and the one bless door the Thing crates test with. A test crate +//! depends on this; no shipped crate does. + +pub mod build; +pub mod fixture; +pub mod golden; +pub mod mem_state; +pub mod state; +pub mod store; diff --git a/crates/thing-testkit/src/mem_state.rs b/crates/thing-testkit/src/mem_state.rs new file mode 100644 index 0000000..26ce94c --- /dev/null +++ b/crates/thing-testkit/src/mem_state.rs @@ -0,0 +1,402 @@ +//! `MemState`: an in-memory `StatePort`. Each provider's records live in a CultCache with the +//! contract registered, so a typed value and a raw payload meet one decode door. A payload the +//! contract refuses is never stored: the address becomes refused, and stays refused until a +//! record or a delete replaces it. +//! +//! A provider's own state (any schema outside the contract) is held per (provider, key), one record +//! per key as CultCache holds them, already decoded by `thing_state::decode` with +//! the schema's catalog member rows. A payload that decode refuses is held as a refusal. + +use std::cell::RefCell; +use std::collections::HashMap; +use std::path::Path; + +use cultcache_rs::{ + CacheBackingStore, CultCache, CultCacheEnvelope, DatabaseEntry, SchemaCatalogMember, SingleFileMessagePackBackingStore, + resolve_schema_entry, +}; +use thing_contract::*; +use thing_state::decode; +use thing_core::port::{ + Address, Change, Entry, Interest, Lookup, Prefix, Record, Refusal, StatePort, StateValue, SubscriptionId, +}; + +use crate::store; + +/// A contract kind the port carries. +pub trait StateKind: DatabaseEntry { + fn record_key(&self) -> String; + fn into_record(self) -> Record; +} + +macro_rules! state_kinds { + ($($kind:ident => $arm:ident),* $(,)?) => { + $(impl StateKind for $kind { + fn record_key(&self) -> String { + $kind::record_key(self) + } + fn into_record(self) -> Record { + Record::$arm(self) + } + })* + }; +} + +state_kinds!( + SurfaceDocument => Surface, + CompositionDocument => Composition, + CommandResult => Result, + AssetCatalog => Catalog, +); + +/// Run `$body` with `$t` bound to the contract kind whose schema is `$schema`, or `$none` for +/// a schema the port does not carry. +macro_rules! by_schema { + ($schema:expr, $t:ident => $body:expr, else $none:expr) => { + match $schema { + SurfaceDocument::SCHEMA_NAME => { + type $t = SurfaceDocument; + $body + } + CompositionDocument::SCHEMA_NAME => { + type $t = CompositionDocument; + $body + } + CommandResult::SCHEMA_NAME => { + type $t = CommandResult; + $body + } + AssetCatalog::SCHEMA_NAME => { + type $t = AssetCatalog; + $body + } + _ => $none, + } + }; +} + +/// One call the port received. +#[derive(Clone, Debug, PartialEq)] +pub enum Call { + Read(Address), + List(Prefix), + Subscribe(Interest), + Unsubscribe(SubscriptionId), + Drain, +} + +/// What a provider key holds of provider state. +#[derive(Clone)] +enum Held { + Value { schema: SchemaId, value: StateValue }, + Refused(Refusal), +} + +impl Held { + fn schema(&self) -> &SchemaId { + match self { + Held::Value { schema, .. } => schema, + Held::Refused(refusal) => &refusal.kind, + } + } +} + +/// The schema id of the contract kind whose CultCache entry type is `entry_type`. +fn contract_schema(entry_type: &str) -> Option<&'static str> { + [ + (SurfaceDocument::TYPE, SurfaceDocument::SCHEMA_NAME), + (CompositionDocument::TYPE, CompositionDocument::SCHEMA_NAME), + (CommandResult::TYPE, CommandResult::SCHEMA_NAME), + (AssetCatalog::TYPE, AssetCatalog::SCHEMA_NAME), + ] + .into_iter() + .find_map(|(entry, schema)| (entry == entry_type).then_some(schema)) +} + +fn is_contract(schema: &SchemaId) -> bool { + by_schema!(schema.as_str(), _T => true, else false) +} + +pub struct MemState { + providers: HashMap, + state: HashMap<(String, String), Held>, + refused: HashMap, + interests: Vec<(SubscriptionId, Interest)>, + next_subscription: u64, + queue: Vec, + calls: RefCell>, +} + +impl Default for MemState { + fn default() -> Self { + Self::new() + } +} + +impl MemState { + pub fn new() -> Self { + Self { + providers: HashMap::new(), + state: HashMap::new(), + refused: HashMap::new(), + interests: Vec::new(), + next_subscription: 0, + queue: Vec::new(), + calls: RefCell::new(Vec::new()), + } + } + + /// A state holding every document of a fixture, each under the provider that publishes it. + pub fn from_fixture(fixture: crate::fixture::Fixture) -> Self { + let set = fixture.load(); + let mut state = Self::new(); + for surface in &set.surfaces { + state.put(&surface.provider_id, surface); + } + for composition in &set.compositions { + state.put(&ProviderId::new(composition.publisher.clone()), composition); + } + for catalog in &set.catalogs { + state.put(&catalog.provider_id, catalog); + } + state + } + + /// Store a record under its record key at `provider`. + pub fn put(&mut self, provider: &ProviderId, value: &T) { + let address = Address { + provider: provider.clone(), + schema: SchemaId::new(T::SCHEMA_NAME), + key: RecordKey::new(value.record_key()), + }; + let outcome = self.cache(provider).put(address.key.as_str(), value); + self.admit::(address, outcome); + } + + /// Store a payload under `address`; the address's schema names the contract kind. A payload + /// the contract refuses makes the address refused. + pub fn put_raw(&mut self, address: Address, payload: Vec) { + by_schema!(address.schema.as_str(), T => { + let envelope = CultCacheEnvelope { + key: address.key.as_str().into(), + r#type: T::TYPE.into(), + payload, + stored_at: store::PINNED_CLOCK.into(), + schema_id: Some(T::SCHEMA_NAME.into()), + }; + let outcome = self.cache(&address.provider).put_envelope::(envelope); + self.admit::(address, outcome); + }, else panic!("no contract record kind has schema {}", address.schema.as_str())) + } + + /// Store provider state `value` under `key` at `provider`: the type's own schema and member + /// rows decode it, as a store written by this type would. + pub fn put_state(&mut self, provider: &ProviderId, key: &str, value: &T) { + assert_eq!( + T::TYPE, + T::SCHEMA_NAME, + "a provider state type must be registered with its entry type equal to its schema id" + ); + let mut cache = CultCache::new(); + cache.register_entry_type::().unwrap(); + let payload = cache.prepare_entry(key, value).unwrap().0.payload; + let address = Address { provider: provider.clone(), schema: SchemaId::new(T::SCHEMA_NAME), key: RecordKey::new(key) }; + self.put_state_raw(address, payload, &T::schema_members()); + } + + /// Store a provider-state payload under `address`, decoded with the schema's member `rows`. + /// A payload decode refuses makes the key refused, replacing any record it held. + pub fn put_state_raw(&mut self, address: Address, payload: Vec, rows: &[SchemaCatalogMember]) { + assert!(!is_contract(&address.schema), "{} is a contract kind: put_raw", address.schema.as_str()); + let slot = (address.provider.as_str().to_string(), address.key.as_str().to_string()); + match decode(&payload, rows) { + Ok(value) => { + let schema = address.schema.clone(); + self.state.insert(slot, Held::Value { schema: schema.clone(), value: value.clone() }); + self.queue(Change::Upsert(Entry { address, record: Record::State { schema, value } })); + } + Err(error) => { + let detail = format!("{}: {error}", address.schema.as_str()); + let refusal = Refusal { kind: address.schema.clone(), address, detail }; + self.state.insert(slot, Held::Refused(refusal.clone())); + self.queue(Change::Refused(refusal)); + } + } + } + + /// Read a single-file store, routing each record: a contract kind to `put_raw`, anything else + /// to `put_state_raw` with the member rows the store's own catalog publishes for its schema. + /// The store is read from a copy, so the file and its directory are never written. + pub fn load_store(&mut self, provider: &ProviderId, path: &Path) { + let work = store::scratch_dir("load"); + let copy = work.join("store.cc"); + std::fs::copy(path, ©).unwrap(); + let backing = SingleFileMessagePackBackingStore::new(©); + let catalog = backing.pull_schema_catalog().unwrap(); + let mut envelopes = backing.pull_all().unwrap(); + drop(backing); + let _ = std::fs::remove_dir_all(&work); + envelopes.sort_by(|a, b| a.key.cmp(&b.key)); + for envelope in envelopes { + // A store names a record's schema by its entry type: a contract kind's type maps to + // its schema id, and any other type is the schema id of provider state. + let key = RecordKey::new(envelope.key); + if let Some(schema) = contract_schema(&envelope.r#type) { + self.put_raw(Address { provider: provider.clone(), schema: SchemaId::new(schema), key }, envelope.payload); + } else { + let schema = envelope.schema_id.unwrap_or(envelope.r#type); + let rows = resolve_schema_entry(&catalog, &schema).map(|entry| entry.members.clone()); + let address = Address { provider: provider.clone(), schema: SchemaId::new(schema), key }; + self.put_state_raw(address, envelope.payload, &rows.unwrap_or_default()); + } + } + } + + /// Remove the record or the refusal at `address`; removing nothing is not a change. + pub fn delete(&mut self, address: &Address) { + if !is_contract(&address.schema) { + let slot = (address.provider.as_str().to_string(), address.key.as_str().to_string()); + if self.state.get(&slot).is_some_and(|held| held.schema() == &address.schema) { + self.state.remove(&slot); + self.queue(Change::Delete(address.clone())); + } + return; + } + let refused = self.refused.remove(address).is_some(); + let stored = by_schema!(address.schema.as_str(), T => { + match self.providers.get_mut(address.provider.as_str()) { + Some(cache) => cache.delete::(address.key.as_str()).unwrap(), + None => false, + } + }, else false); + if refused || stored { + self.queue(Change::Delete(address.clone())); + } + } + + /// Every call the port received, in order. + pub fn calls(&self) -> Vec { + self.calls.borrow().clone() + } + + fn cache(&mut self, provider: &ProviderId) -> &mut CultCache { + self.providers.entry(provider.as_str().to_string()).or_insert_with(store::memory) + } + + fn admit(&mut self, address: Address, outcome: anyhow::Result) { + match outcome { + Ok(value) => { + self.refused.remove(&address); + self.queue(Change::Upsert(Entry { address, record: value.into_record() })); + } + Err(error) => { + // The address is now refused: an older valid record under it no longer stands. + self.cache(&address.provider).delete::(address.key.as_str()).unwrap(); + let refusal = + Refusal { address: address.clone(), kind: address.schema.clone(), detail: format!("{error:#}") }; + self.refused.insert(address, refusal.clone()); + self.queue(Change::Refused(refusal)); + } + } + } + + fn queue(&mut self, change: Change) { + let address = match &change { + Change::Upsert(entry) => &entry.address, + Change::Delete(address) => address, + Change::Refused(refusal) => &refusal.address, + }; + if self.interests.iter().any(|(_, interest)| interest.matches(address)) { + self.queue.push(change); + } + } +} + +impl StatePort for MemState { + fn read(&self, address: &Address) -> Lookup { + self.calls.borrow_mut().push(Call::Read(address.clone())); + if !is_contract(&address.schema) { + return match self.state.get(&(address.provider.as_str().to_string(), address.key.as_str().to_string())) { + Some(Held::Value { schema, value }) => Lookup::Present(Entry { + address: address.clone(), + record: Record::State { schema: schema.clone(), value: value.clone() }, + }), + Some(Held::Refused(refusal)) => Lookup::Refused(refusal.clone()), + None => Lookup::Absent, + }; + } + if let Some(refusal) = self.refused.get(address) { + return Lookup::Refused(refusal.clone()); + } + by_schema!(address.schema.as_str(), T => { + let stored = self.providers.get(address.provider.as_str()); + match stored.and_then(|cache| cache.get::(address.key.as_str()).expect("stored records decode")) { + Some(value) => Lookup::Present(Entry { address: address.clone(), record: value.into_record() }), + None => Lookup::Absent, + } + }, else unreachable!("is_contract admitted the schema")) + } + + fn list(&self, prefix: &Prefix) -> Vec { + self.calls.borrow_mut().push(Call::List(prefix.clone())); + let at = |key: &str| Address { + provider: prefix.provider.clone(), + schema: prefix.schema.clone(), + key: RecordKey::new(key), + }; + let mut found: Vec<(String, Lookup)> = self + .refused + .values() + .filter(|refusal| prefix.matches(&refusal.address)) + .map(|refusal| (refusal.address.key.as_str().to_string(), Lookup::Refused(refusal.clone()))) + .collect(); + if !is_contract(&prefix.schema) { + for ((provider, key), held) in &self.state { + if provider != prefix.provider.as_str() || !key.starts_with(&prefix.key_prefix) { + continue; + } + match held { + Held::Value { schema, value } if schema == &prefix.schema => { + let record = Record::State { schema: schema.clone(), value: value.clone() }; + found.push((key.clone(), Lookup::Present(Entry { address: at(key), record }))); + } + Held::Refused(refusal) if refusal.kind == prefix.schema => { + found.push((key.clone(), Lookup::Refused(refusal.clone()))); + } + _ => {} + } + } + } else { + by_schema!(prefix.schema.as_str(), T => { + if let Some(cache) = self.providers.get(prefix.provider.as_str()) { + for (key, value) in cache.get_all_with_keys::().expect("stored records decode") { + if key.starts_with(&prefix.key_prefix) { + let entry = Entry { address: at(&key), record: value.into_record() }; + found.push((key, Lookup::Present(entry))); + } + } + } + }, else unreachable!("is_contract admitted the schema")); + } + found.sort_by(|a, b| a.0.cmp(&b.0)); + found.into_iter().map(|(_, lookup)| lookup).collect() + } + + fn subscribe(&mut self, interest: Interest) -> SubscriptionId { + self.calls.borrow_mut().push(Call::Subscribe(interest.clone())); + let id = SubscriptionId(self.next_subscription); + self.next_subscription += 1; + self.interests.push((id, interest)); + id + } + + fn unsubscribe(&mut self, id: SubscriptionId) { + self.calls.borrow_mut().push(Call::Unsubscribe(id)); + self.interests.retain(|(live, _)| *live != id); + } + + fn drain(&mut self) -> Vec { + self.calls.borrow_mut().push(Call::Drain); + std::mem::take(&mut self.queue) + } +} diff --git a/crates/thing-testkit/src/state.rs b/crates/thing-testkit/src/state.rs new file mode 100644 index 0000000..7b92911 --- /dev/null +++ b/crates/thing-testkit/src/state.rs @@ -0,0 +1,157 @@ +//! The provider state the fixtures bind: test schemas whose Rust field names, PascalCased, are +//! the member names the fixtures read, and the script that fills a `MemState` with each +//! fixture's records. Fixture builders name these schemas by id; none of them is a contract kind. +//! +//! A CultCache store names a record's schema by its entry type, not by `SCHEMA_NAME`, so each type +//! here is registered under its schema id: the id a Bind names is the id the store holds. + +use cultcache_rs::DatabaseEntry; +use serde::{Deserialize, Serialize}; +use thing_contract::{ProviderId, RecordKey, SchemaId}; +use thing_core::port::Address; + +use crate::fixture::Fixture; +use crate::mem_state::MemState; + +#[derive(Clone, Debug, PartialEq, DatabaseEntry)] +#[cultcache(type = "gamecult.thing.test.swarm.v1", schema = "gamecult.thing.test.swarm.v1")] +pub struct Swarm { + #[cultcache(key = 0)] + pub id: String, + #[cultcache(key = 1)] + pub name: String, + #[cultcache(key = 2)] + pub load: f64, +} + +/// `Swarm`'s twin as today's hand-written crates publish it: the same type, schema and bytes, +/// and no member rows. +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SwarmWithoutRows { + pub id: String, + pub name: String, + pub load: f64, +} + +impl DatabaseEntry for SwarmWithoutRows { + const TYPE: &'static str = "gamecult.thing.test.swarm.v1"; + const SCHEMA_NAME: &'static str = "gamecult.thing.test.swarm.v1"; +} + +#[derive(Clone, Debug, PartialEq, DatabaseEntry)] +#[cultcache(type = "gamecult.thing.test.target.v1", schema = "gamecult.thing.test.target.v1")] +pub struct Target { + #[cultcache(key = 0)] + pub label: String, +} + +#[derive(Clone, Debug, PartialEq, DatabaseEntry)] +#[cultcache(type = "gamecult.thing.test.settings.v1", schema = "gamecult.thing.test.settings.v1")] +pub struct Settings { + #[cultcache(key = 0)] + pub enabled: bool, + #[cultcache(key = 1)] + pub volume: f64, + #[cultcache(key = 2)] + pub theme: String, +} + +#[derive(Clone, Debug, PartialEq, DatabaseEntry)] +#[cultcache(type = "gamecult.thing.test.item.v1", schema = "gamecult.thing.test.item.v1")] +pub struct Item { + #[cultcache(key = 0)] + pub id: String, + #[cultcache(key = 1)] + pub title: String, +} + +#[derive(Clone, Debug, PartialEq, DatabaseEntry)] +#[cultcache(type = "gamecult.thing.test.series.v1", schema = "gamecult.thing.test.series.v1")] +pub struct Series { + #[cultcache(key = 0)] + pub values: Vec, +} + +/// The swarm records of f01 and, under the hostile provider, f10's: the three minds and the +/// summary. +pub fn swarm_records() -> Vec<(&'static str, Swarm)> { + let swarm = |id: &str, name: &str, load: f64| Swarm { id: id.into(), name: name.into(), load }; + vec![ + ("summary", swarm("summary", "Swarm", 0.42)), + ("mind-1", swarm("mind-1", "Eureka", 0.31)), + ("mind-2", swarm("mind-2", "Libby", 0.57)), + ("mind-3", swarm("mind-3", "Kiko", 0.08)), + ] +} + +/// Fill `state` with the provider records `fixture`'s surfaces bind. A fixture that binds no +/// provider state adds nothing. +pub fn script(fixture: Fixture, state: &mut MemState) { + match fixture { + Fixture::F01SwarmDashboard => { + let provider = ProviderId::new("provider.swarm"); + for (key, swarm) in swarm_records() { + state.put_state(&provider, key, &swarm); + } + } + Fixture::F03InputTarget => { + state.put_state(&ProviderId::new("provider.muninn"), "cursor", &Target { label: "Ready".into() }); + } + Fixture::F04Form => { + let settings = Settings { enabled: true, volume: 40.0, theme: "dark".into() }; + state.put_state(&ProviderId::new("provider.settings"), "current", &settings); + } + Fixture::F06ScrollList => { + let provider = ProviderId::new("provider.feed"); + for n in 0..1000 { + let id = format!("item-{n:04}"); + state.put_state(&provider, &id, &Item { id: id.clone(), title: format!("Item {n}") }); + } + } + Fixture::F07Plot => { + let series = Series { values: vec![3.0, 5.5, 4.25, 8.0, 6.5] }; + state.put_state(&ProviderId::new("provider.market"), "prices", &series); + } + Fixture::F10Hostile => { + // A swarm record where the hostile surface's Bind asks for nowhere.v1. + let swarm = Swarm { id: "row-1".into(), name: "Elsewhere".into(), load: 0.0 }; + state.put_state(&ProviderId::new("provider.hostile"), "row-1", &swarm); + } + _ => {} + } +} + +/// The address of a record of `schema` at `provider` and `key`. +pub fn address(provider: &str, schema: &str, key: &str) -> Address { + Address { provider: ProviderId::new(provider), schema: SchemaId::new(schema), key: RecordKey::new(key) } +} + +/// The committed store of f01's swarm records, written with `Swarm` registered: its schema +/// publishes member rows. +pub const SWARM_STORE: &str = "state-swarm.state.cc"; + +/// The same records written through `SwarmWithoutRows`: the schema publishes `[]`. +pub const SWARM_STORE_MEMBERS_EMPTY: &str = "state-swarm-members-empty.state.cc"; + +/// Bless or compare the committed swarm store; returns the committed bytes. +pub fn write_swarm_store() -> Vec { + let bytes = crate::store::bytes(|cache| { + cache.register_entry_type::().unwrap(); + for (key, swarm) in swarm_records() { + crate::store::put_pinned(cache, key, &swarm); + } + }); + crate::golden::check(&Fixture::dir(), SWARM_STORE, &bytes) +} + +/// Bless or compare the committed members-`[]` swarm store; returns the committed bytes. +pub fn write_swarm_store_members_empty() -> Vec { + let bytes = crate::store::bytes(|cache| { + cache.register_entry_type::().unwrap(); + for (key, swarm) in swarm_records() { + let twin = SwarmWithoutRows { id: swarm.id, name: swarm.name, load: swarm.load }; + crate::store::put_pinned(cache, key, &twin); + } + }); + crate::golden::check(&Fixture::dir(), SWARM_STORE_MEMBERS_EMPTY, &bytes) +} diff --git a/crates/thing-testkit/src/store.rs b/crates/thing-testkit/src/store.rs new file mode 100644 index 0000000..919a24b --- /dev/null +++ b/crates/thing-testkit/src/store.rs @@ -0,0 +1,70 @@ +//! CultCache single-file stores of contract documents, written under a pinned clock so the +//! bytes are reproducible. + +use std::path::{Path, PathBuf}; + +use cultcache_rs::{CultCache, CultCacheRegistry, DatabaseEntry, SingleFileMessagePackBackingStore}; +use thing_contract::ThingContract; + +pub const PINNED_CLOCK: &str = "2026-01-01T00:00:00Z"; + +/// A cache with the contract registered and no backing store. +pub fn memory() -> CultCache { + let mut cache = CultCache::new(); + ThingContract.register_entries(&mut cache).unwrap(); + cache +} + +/// An empty cache with the contract registered over a fresh single-file store at `path`. +pub fn create(path: &Path) -> CultCache { + let _ = std::fs::remove_file(path); + let mut cache = memory(); + cache.add_generic_backing_store(SingleFileMessagePackBackingStore::new(path)).unwrap(); + // From cultcache-rs 0.4 a cache that attached a store refuses writes until it pulls; the file + // was just removed, so the pull is empty. + cache.pull_all_backing_stores().unwrap(); + cache +} + +/// Store `value` under `key` with `stored_at` pinned. +pub fn put_pinned(cache: &mut CultCache, key: &str, value: &T) { + let (mut envelope, _) = cache.prepare_entry(key, value).unwrap(); + envelope.stored_at = PINNED_CLOCK.into(); + cache.put_envelope::(envelope).unwrap(); +} + +/// A cache with the contract registered, pulled from the store at `path`. +pub fn open(path: &Path) -> CultCache { + let mut cache = memory(); + cache.add_generic_backing_store(SingleFileMessagePackBackingStore::new(path)).unwrap(); + cache.pull_all_backing_stores().unwrap(); + cache +} + +/// A fresh directory of its own under the temp directory (process id and a serial), so the lock +/// file a store creates beside its file goes when the directory does. +pub(crate) fn scratch_dir(purpose: &str) -> PathBuf { + static SERIAL: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(0); + let serial = SERIAL.fetch_add(1, std::sync::atomic::Ordering::Relaxed); + let work = std::env::temp_dir().join(format!("thing-testkit-{purpose}-{}-{serial}", std::process::id())); + std::fs::create_dir_all(&work).unwrap(); + work +} + +/// The bytes of a scratch single-file store that `fill` filled under the pinned clock. The scratch +/// store and its lock file are removed. +pub fn bytes(fill: impl FnOnce(&mut CultCache)) -> Vec { + let work = scratch_dir("write"); + let scratch = work.join("store.cc"); + let mut cache = create(&scratch); + fill(&mut cache); + drop(cache); + let bytes = std::fs::read(&scratch).unwrap(); + let _ = std::fs::remove_dir_all(&work); + bytes +} + +/// The payload the contract writes for `value`, as a store would hold it. +pub fn payload(value: &T) -> Vec { + memory().prepare_entry("payload", value).unwrap().0.payload +} diff --git a/crates/thing-testkit/tests/fixtures.rs b/crates/thing-testkit/tests/fixtures.rs new file mode 100644 index 0000000..990b67e --- /dev/null +++ b/crates/thing-testkit/tests/fixtures.rs @@ -0,0 +1,480 @@ +//! The committed fixture stores: they open through the contract, the builders reproduce them +//! byte for byte, and each holds the shapes its row of the fixture table names. +//! `THING_BLESS=1` on this test rewrites them; any other run compares. + +use cultcache_rs::{CultCacheEnvelope, PayloadTooDeep, check_payload_depth}; +use thing_contract::*; +use thing_testkit::fixture::{Fixture, FixtureSet}; +use thing_testkit::golden; +use thing_testkit::mem_state::MemState; +use thing_testkit::store; +use thing_core::port::{Address, Lookup, StatePort}; + +fn load(fixture: Fixture) -> FixtureSet { + fixture.load() +} + +#[test] +fn every_fixture_round_trips_through_the_contract() { + for fixture in Fixture::ALL { + // The builders reproduce the committed file byte for byte (or bless it). + let committed = fixture.write(); + assert_eq!(committed, std::fs::read(Fixture::dir().join(fixture.file_name())).unwrap()); + assert!(!committed.is_empty()); + let built = fixture.build(); + let loaded = fixture.load(); + assert_eq!(loaded, built, "{}: the store decodes to the built documents", fixture.file_name()); + + // Each record re-encodes to its stored payload. + let cache = fixture.open(); + let stored = cache.snapshot_envelopes(); + let payload = |kind: &str, key: String| { + stored.iter().find(|envelope| envelope.r#type == kind && envelope.key == key).unwrap().payload.clone() + }; + for surface in &loaded.surfaces { + assert_eq!(rmp_serde::to_vec(surface).unwrap(), payload("gamecult.thing.surface", surface.record_key())); + } + for composition in &loaded.compositions { + let key = composition.record_key(); + assert_eq!(rmp_serde::to_vec(composition).unwrap(), payload("gamecult.thing.composition", key)); + } + for catalog in &loaded.catalogs { + assert_eq!(rmp_serde::to_vec(catalog).unwrap(), payload("gamecult.thing.asset_catalog", catalog.record_key())); + } + for invocation in &loaded.invocations { + let key = invocation.record_key(); + assert_eq!(rmp_serde::to_vec(invocation).unwrap(), payload("gamecult.thing.command_invocation", key)); + } + for result in &loaded.results { + assert_eq!(rmp_serde::to_vec(result).unwrap(), payload("gamecult.thing.command_result", result.record_key())); + } + assert_eq!( + stored.len(), + loaded.document_count(), + "{}: the store holds the documents and nothing else", + fixture.file_name() + ); + } + // The payload one Box level past f11's chain is a raw file, not a store. + assert_eq!(Fixture::write_deep_refused(), Fixture::deep_refused_payload()); +} + +fn commands_declared(surface: &SurfaceDocument) -> Vec<&str> { + surface.commands.iter().map(|decl| decl.id.as_str()).collect() +} + +fn box_children(node: &Node) -> &[Node] { + match node { + Node::Box(node) => &node.children, + other => panic!("not a Box: {other:?}"), + } +} + +#[test] +fn f01_is_the_swarm_dashboard() { + let set = load(Fixture::F01SwarmDashboard); + assert_eq!(set.surfaces.len(), 1); + let surface = &set.surfaces[0]; + let Node::Box(root) = &surface.root else { panic!("root is not a Box") }; + assert_eq!(root.style.display, Display::Grid); + let [load, minds, restart] = &root.children[..] else { panic!("three children expected") }; + + let Node::Text(load) = load else { panic!("not a Text") }; + let TextSource::Bound(bind) = &load.content else { panic!("Text is not bound") }; + assert!(matches!(bind.format, Some(Format::Number(_)))); + + let Node::Repeat(minds) = minds else { panic!("not a Repeat") }; + assert!(matches!(minds.collection, CollectionSource::Records(_))); + + let Node::Button(restart) = restart else { panic!("not a Button") }; + let CommandRef::Id(command) = &restart.on_activate else { panic!("not a command id") }; + assert_eq!(commands_declared(surface), [command.id.as_str()]); +} + +#[test] +fn f09_stacks_compositions_with_every_argument_arm() { + let set = load(Fixture::F09CompositionStack); + assert_eq!((set.surfaces.len(), set.compositions.len()), (1, 1)); + let surface = &set.surfaces[0]; + let [std_stat, outer] = box_children(&surface.root) else { panic!("two Uses expected") }; + let Node::Use(std_stat) = std_stat else { panic!("not a Use") }; + assert_eq!((std_stat.composition.publisher.as_str(), std_stat.composition.name.as_str()), ("thing.std", "stat")); + let Node::Use(outer) = outer else { panic!("not a Use") }; + assert_eq!(outer.composition.publisher, set.compositions[0].publisher); + assert_eq!(outer.composition.name, set.compositions[0].name); + assert_eq!(outer.composition.version, set.compositions[0].version); + + let arms: Vec<&str> = outer + .args + .iter() + .map(|arg| match arg.value { + ArgValue::Text(_) => "text", + ArgValue::Number(_) => "number", + ArgValue::Bool(_) => "bool", + ArgValue::Bind(_) => "bind", + ArgValue::Collection(_) => "collection", + ArgValue::Command(_) => "command", + ArgValue::Slot(_) => "slot", + }) + .collect(); + assert_eq!(arms, ["text", "number", "bool", "bind", "collection", "command", "slot"]); + + // The slot holds a second Use of the same composition: two levels. + let ArgValue::Slot(slot) = &outer.args[6].value else { unreachable!() }; + assert!(slot.nodes.iter().any(|node| matches!(node, Node::Use(inner) if inner.composition == outer.composition))); +} + +#[test] +fn f10_holds_exactly_the_four_hostile_surfaces() { + let set = load(Fixture::F10Hostile); + let labels: Vec<&str> = set.surfaces.iter().map(|surface| surface.label.as_str()).collect(); + assert_eq!(labels, ["duplicate-id", "schema-mismatch", "undeclared-command", "unresolved-use"]); + + let by = |label: &str| set.surfaces.iter().find(|surface| surface.label.as_str() == label).unwrap(); + + let undeclared = by("undeclared-command"); + let Node::Button(button) = &box_children(&undeclared.root)[0] else { panic!("not a Button") }; + let CommandRef::Id(command) = &button.on_activate else { panic!("not a command id") }; + assert!(!commands_declared(undeclared).contains(&command.id.as_str())); + + // The composition emits `shared-id`, which expands to `dup-use/shared-id`: the surface authors that id. + let dup = by("duplicate-id"); + let children = box_children(&dup.root); + assert!(children.iter().any(|node| matches!(node, Node::Text(text) if text.common.id.as_str() == "dup-use/shared-id"))); + let Node::Use(used) = &children[0] else { panic!("not a Use") }; + let composition = set.compositions.iter().find(|composition| composition.name == used.composition.name).unwrap(); + assert!(box_children(&composition.body).iter().any(|node| matches!(node, Node::Text(text) if text.common.id.as_str() == "shared-id"))); + + // The unresolved Use names a composition no document holds. + let Node::Use(ghost) = &box_children(&by("unresolved-use").root)[0] else { panic!("not a Use") }; + assert!(set.compositions.iter().all(|composition| composition.name != ghost.composition.name)); + + // The Bind names a schema none of the fixtures use for state. + let Node::Text(text) = &box_children(&by("schema-mismatch").root)[0] else { panic!("not a Text") }; + let TextSource::Bound(Bind { source: StateSource::Record(state), .. }) = &text.content else { + panic!("Text is not bound to a record") + }; + let f01 = load(Fixture::F01SwarmDashboard); + let Node::Box(root) = &f01.surfaces[0].root else { unreachable!() }; + let Node::Text(f01_text) = &root.children[0] else { unreachable!() }; + let TextSource::Bound(Bind { source: StateSource::Record(f01_state), .. }) = &f01_text.content else { unreachable!() }; + assert_ne!(state.schema, f01_state.schema); +} + +#[test] +fn a_state_holds_every_fixture_document_under_its_publisher() { + let state = MemState::from_fixture(Fixture::F09CompositionStack); + let set = load(Fixture::F09CompositionStack); + let at = Address { + provider: ProviderId::new(set.compositions[0].publisher.clone()), + schema: SchemaId::new("gamecult.thing.composition.v1"), + key: RecordKey::new(set.compositions[0].record_key()), + }; + assert!(matches!(state.read(&at), Lookup::Present(_))); +} + +#[test] +fn loading_a_fixture_writes_nothing_in_the_fixtures_directory() { + let listing = || { + let mut names: Vec<_> = std::fs::read_dir(Fixture::dir()) + .unwrap() + .map(|entry| entry.unwrap().file_name().into_string().unwrap()) + .collect(); + names.sort(); + names + }; + let before = listing(); + // Restores the directory's permissions even when the test panics. + struct Restore(std::fs::Permissions); + impl Drop for Restore { + fn drop(&mut self) { + let _ = std::fs::set_permissions(Fixture::dir(), self.0.clone()); + } + } + let mut permissions = std::fs::metadata(Fixture::dir()).unwrap().permissions(); + let _restore = Restore(permissions.clone()); + permissions.set_readonly(true); + std::fs::set_permissions(Fixture::dir(), permissions).unwrap(); + for fixture in Fixture::ALL { + load(fixture); + } + assert_eq!(listing(), before); +} + +fn arm(node: &Node) -> &'static str { + match node { + Node::Box(_) => "Box", + Node::Text(_) => "Text", + Node::Image(_) => "Image", + Node::Button(_) => "Button", + Node::Toggle(_) => "Toggle", + Node::Slider(_) => "Slider", + Node::TextInput(_) => "TextInput", + Node::Select(_) => "Select", + Node::Repeat(_) => "Repeat", + Node::Overlay(_) => "Overlay", + Node::Plot(_) => "Plot", + Node::Embed(_) => "Embed", + Node::Use(_) => "Use", + Node::Slot(_) => "Slot", + } +} + +// The fourteen arms the fixtures place; the Slot stands in f09's composition body. +const ALL_ARMS: [&str; 14] = [ + "Box", "Button", "Embed", "Image", "Overlay", "Plot", "Repeat", "Select", "Slider", "Slot", "Text", "TextInput", + "Toggle", "Use", +]; + +/// Every node under `node`, itself first, through every child position the union has. +fn walk<'a>(node: &'a Node, out: &mut Vec<&'a Node>) { + out.push(node); + match node { + Node::Box(node) => node.children.iter().for_each(|child| walk(child, out)), + Node::Button(node) => node.content.iter().for_each(|child| walk(child, out)), + Node::Repeat(node) => walk(&node.template, out), + Node::Overlay(node) => node.children.iter().for_each(|child| walk(child, out)), + Node::Use(node) => { + for arg in &node.args { + if let ArgValue::Slot(slot) = &arg.value { + slot.nodes.iter().for_each(|child| walk(child, out)); + } + } + } + _ => {} + } +} + +fn nodes(set: &FixtureSet) -> Vec<&Node> { + let mut out = Vec::new(); + set.surfaces.iter().for_each(|surface| walk(&surface.root, &mut out)); + set.compositions.iter().for_each(|composition| walk(&composition.body, &mut out)); + out +} + +fn arms_of(fixture: Fixture) -> std::collections::BTreeSet<&'static str> { + nodes(&load(fixture)).into_iter().map(arm).collect() +} + +fn holds(fixture: Fixture, wanted: &[&str]) { + let arms = arms_of(fixture); + for name in wanted { + assert!(arms.contains(name), "{}: no {name} node", fixture.file_name()); + } +} + +#[test] +fn the_twelve_fixtures_cover_all_fourteen_node_arms() { + let mut covered = std::collections::BTreeSet::new(); + for fixture in Fixture::ALL { + covered.extend(arms_of(fixture)); + } + assert_eq!(covered.into_iter().collect::>(), ALL_ARMS); + + holds(Fixture::F02LoginEffect, &["TextInput", "Button"]); + holds(Fixture::F03InputTarget, &["Image", "Box", "Text"]); + holds(Fixture::F04Form, &["Toggle", "Slider", "Select", "TextInput"]); + holds(Fixture::F05ModalOverlay, &["Overlay", "Button"]); + holds(Fixture::F06ScrollList, &["Box", "Repeat"]); + holds(Fixture::F07Plot, &["Plot"]); + holds(Fixture::F08EmbedViewport, &["Embed", "Text"]); + holds(Fixture::F11Deep, &["Box"]); + holds(Fixture::F12TextEdge, &["Text"]); +} + +fn single_surface(fixture: Fixture) -> (FixtureSet, SurfaceDocument) { + let set = load(fixture); + assert_eq!(set.surfaces.len(), 1, "{}", fixture.file_name()); + let surface = set.surfaces[0].clone(); + (set, surface) +} + +#[test] +fn f02_completes_with_an_external_step_whose_resume_command_the_surface_declares() { + let (set, surface) = single_surface(Fixture::F02LoginEffect); + let [invocation] = &set.invocations[..] else { panic!("one invocation expected") }; + assert_eq!(invocation.surface_key, surface.record_key()); + assert!(commands_declared(&surface).contains(&invocation.command.as_str())); + let decl = surface.commands.iter().find(|decl| decl.id == invocation.command).unwrap(); + assert_eq!(decl.captures.len(), 1); + assert_eq!(invocation.captured.len(), 1); + assert_eq!(invocation.captured[0].node, decl.captures[0]); + + let [pending, completed] = &set.results[..] else { panic!("two results expected") }; + assert!(pending.seq().get() < completed.seq().get(), "Pending precedes Completed in seq"); + assert!(matches!(pending.outcome(), Outcome::Pending(_))); + let Outcome::Completed(done) = completed.outcome() else { panic!("not Completed") }; + let Some(Effect::OpenExternal(external)) = &done.effect else { panic!("not OpenExternal") }; + let CommandRef::Id(resume) = &external.resume else { panic!("resume is not a command id") }; + assert!(commands_declared(&surface).contains(&resume.id.as_str()), "the resume command is declared"); + for result in &set.results { + assert_eq!(result.invocation_id(), invocation.invocation_id); + } +} + +#[test] +fn f03_places_an_absolute_target_over_an_image_from_its_catalog() { + let (set, surface) = single_surface(Fixture::F03InputTarget); + let root_children = box_children(&surface.root); + let Node::Image(image) = &root_children[0] else { panic!("the Image comes first") }; + let [catalog] = &set.catalogs[..] else { panic!("one catalog expected") }; + assert_eq!(catalog.catalog_id.as_str(), image.catalog); + assert!(catalog.assets.iter().any(|asset| asset.id == image.asset), "the catalog holds the asset"); + + let Node::Box(target) = &root_children[1] else { panic!("the target Box follows the Image") }; + assert_eq!(target.style.position, Position::Absolute); + assert_ne!(target.style.inset.top, Dimension::Auto); + assert_ne!(target.style.inset.left, Dimension::Auto); + let Node::Text(label) = &target.children[0] else { panic!("not a Text") }; + assert!(matches!(label.content, TextSource::Bound(_)), "the label is bound"); +} + +#[test] +fn f04_one_command_captures_all_four_inputs_and_clears_drafts() { + let (set, surface) = single_surface(Fixture::F04Form); + let [save] = &surface.commands[..] else { panic!("one command expected") }; + let inputs: Vec<&str> = nodes(&set) + .into_iter() + .filter(|node| matches!(node, Node::Toggle(_) | Node::Slider(_) | Node::Select(_) | Node::TextInput(_))) + .map(|node| match node { + Node::Toggle(node) => node.common.id.as_str(), + Node::Slider(node) => node.common.id.as_str(), + Node::Select(node) => node.common.id.as_str(), + Node::TextInput(node) => node.common.id.as_str(), + _ => unreachable!(), + }) + .collect(); + let captures: Vec<&str> = save.captures.iter().map(NodeId::as_str).collect(); + assert_eq!(captures, inputs); + + let [invocation] = &set.invocations[..] else { panic!("one invocation expected") }; + let carried: Vec<&str> = invocation.captured.iter().map(|input| input.node.as_str()).collect(); + assert_eq!(carried, captures); + let [result] = &set.results[..] else { panic!("one result expected") }; + assert!(matches!(result.outcome(), Outcome::Completed(done) if done.clear_drafts)); + + let kinds: Vec<&InputKind> = nodes(&set) + .into_iter() + .filter_map(|node| if let Node::TextInput(input) = node { Some(&input.input_kind) } else { None }) + .collect(); + assert_eq!(kinds, [&InputKind::Number]); + let options = nodes(&set).into_iter().find_map(|node| if let Node::Select(select) = node { Some(select) } else { None }); + assert!(matches!(&options.unwrap().options, OptionList::Literal(literal) if literal.options.len() == 2)); +} + +#[test] +fn f05_is_a_modal_viewport_overlay_with_two_focusable_controls_and_a_declared_dismiss() { + let (set, surface) = single_surface(Fixture::F05ModalOverlay); + let all = nodes(&set); + let Some(Node::Overlay(overlay)) = all.iter().copied().find(|node| matches!(node, Node::Overlay(_))) else { + panic!("no Overlay") + }; + assert_eq!(overlay.anchor, Anchor::Viewport); + assert!(overlay.modal); + let CommandRef::Id(dismiss) = &overlay.dismiss else { panic!("dismiss is not a command id") }; + assert!(commands_declared(&surface).contains(&dismiss.id.as_str())); + let mut inside = Vec::new(); + overlay.children.iter().for_each(|child| walk(child, &mut inside)); + assert_eq!(inside.iter().filter(|node| matches!(node, Node::Button(_))).count(), 2); +} + +#[test] +fn f06_scrolls_a_repeat_over_a_records_prefix() { + let (_, surface) = single_surface(Fixture::F06ScrollList); + let Node::Box(root) = &surface.root else { panic!("root is not a Box") }; + assert_eq!(root.style.overflow, Overflow::Scroll); + let [Node::Repeat(items)] = &root.children[..] else { panic!("one Repeat expected") }; + assert!(matches!(&items.collection, CollectionSource::Records(records) if !records.key_prefix.is_empty())); + assert_eq!(items.key_member, thing_testkit::build::path(&["Id"])); +} + +#[test] +fn f07_plots_each_mark_over_a_bound_series() { + let (set, _) = single_surface(Fixture::F07Plot); + let marks: Vec<&PlotMark> = nodes(&set) + .into_iter() + .filter_map(|node| if let Node::Plot(plot) = node { Some(&plot.mark) } else { None }) + .collect(); + assert_eq!(marks, [&PlotMark::Line, &PlotMark::Bar, &PlotMark::Area]); + for node in nodes(&set) { + if let Node::Plot(plot) = node { + assert!(matches!(plot.series.source, StateSource::Record(_))); + } + } +} + +#[test] +fn f08_embeds_a_fixed_size_leaf_among_siblings() { + let (_, surface) = single_surface(Fixture::F08EmbedViewport); + let children = box_children(&surface.root); + assert!(children.len() >= 3); + let embeds: Vec<&EmbedNode> = children.iter().filter_map(|node| if let Node::Embed(e) = node { Some(e) } else { None }).collect(); + let [embed] = &embeds[..] else { panic!("one Embed expected") }; + assert!(embed.width > 0.0 && embed.height > 0.0); + assert!(children.iter().any(|node| matches!(node, Node::Text(_))), "siblings around the Embed"); +} + +#[test] +fn f11_is_the_deepest_chain_the_bound_admits_and_one_more_level_is_refused() { + let (set, surface) = single_surface(Fixture::F11Deep); + let cache = Fixture::F11Deep.open(); + let stored = cache.snapshot_envelopes(); + assert_eq!(stored.len(), 1); + // The committed surface passes CultCache's own check and decodes to the built chain. + assert_eq!(check_payload_depth(&stored[0].payload), Ok(())); + assert_eq!(rmp_serde::to_vec(&surface).unwrap(), stored[0].payload); + let levels = { + let mut levels = 0; + let mut node = &surface.root; + while let Node::Box(boxed) = node { + levels += 1; + match boxed.children.first() { + Some(child) => node = child, + None => break, + } + } + levels + }; + assert!(levels > 1, "a chain, not one Box"); + assert_eq!(set.surfaces.len(), 1); + + // One Box level deeper is refused by the check, naming depth 257, and by CultCache. + let refused = golden::read(&Fixture::dir(), Fixture::DEEP_REFUSED); + assert_eq!(refused, Fixture::deep_refused_payload()); + assert_eq!(check_payload_depth(&refused), Err(PayloadTooDeep { depth: 257, limit: 256 })); + let mut cache = store::memory(); + let envelope = CultCacheEnvelope { + key: surface.record_key(), + r#type: "gamecult.thing.surface".into(), + payload: refused, + stored_at: store::PINNED_CLOCK.into(), + schema_id: Some("gamecult.thing.surface.v1".into()), + }; + let error = cache.put_raw_envelope(envelope).unwrap_err(); + assert!(error.downcast_ref::().is_some(), "{error:#}"); + assert!(cache.get::(&surface.record_key()).unwrap().is_none()); +} + +#[test] +fn f12_holds_each_text_edge_case_as_its_own_node() { + let (set, _) = single_surface(Fixture::F12TextEdge); + let texts: Vec<(&str, &str)> = nodes(&set) + .into_iter() + .filter_map(|node| match node { + Node::Text(text) => match &text.content { + TextSource::Literal(literal) => Some((text.common.id.as_str(), literal.value.as_str())), + _ => None, + }, + _ => None, + }) + .collect(); + let ids: Vec<&str> = texts.iter().map(|(id, _)| *id).collect(); + assert_eq!(ids, ["bidi", "cjk", "combining", "emoji-zwj", "long-wrap"]); + let content = |id: &str| texts.iter().find(|(name, _)| *name == id).unwrap().1; + assert!(content("bidi").chars().any(|c| ('\u{590}'..='\u{6ff}').contains(&c)) && content("bidi").is_ascii() == false); + assert!(content("bidi").contains("Hello")); + assert!(content("cjk").chars().any(|c| ('\u{4e00}'..='\u{9fff}').contains(&c))); + assert!(content("combining").chars().any(|c| ('\u{300}'..='\u{36f}').contains(&c))); + assert!(content("emoji-zwj").contains('\u{200d}')); + assert!(content("long-wrap").len() > 400); +} diff --git a/crates/thing-testkit/tests/golden.rs b/crates/thing-testkit/tests/golden.rs new file mode 100644 index 0000000..367cddd --- /dev/null +++ b/crates/thing-testkit/tests/golden.rs @@ -0,0 +1,86 @@ +//! The bless door compares and never writes unless `THING_BLESS=1`. These tests assume it is +//! unset; the bless job runs only the fixtures test. + +use std::panic::catch_unwind; +use std::path::PathBuf; + +use thing_testkit::golden; + +fn scratch(name: &str) -> PathBuf { + let dir = PathBuf::from(env!("CARGO_TARGET_TMPDIR")).join(format!("golden-{name}")); + let _ = std::fs::remove_dir_all(&dir); + std::fs::create_dir_all(&dir).unwrap(); + dir +} + +#[test] +fn a_mismatch_panics_naming_the_file_and_leaves_it_unchanged() { + let dir = scratch("mismatch"); + std::fs::write(dir.join("a.bin"), b"committed").unwrap(); + + assert_eq!(golden::check(&dir, "a.bin", b"committed"), b"committed"); + + let panic = catch_unwind(|| golden::check(&dir, "a.bin", b"different")).unwrap_err(); + let message = panic.downcast_ref::().cloned().unwrap_or_default(); + assert!(message.contains("a.bin"), "the panic names the file: {message}"); + assert_eq!(std::fs::read(dir.join("a.bin")).unwrap(), b"committed"); +} + +#[test] +fn a_missing_file_is_a_failure_not_a_write() { + let dir = scratch("missing"); + assert!(catch_unwind(|| golden::check(&dir, "absent.bin", b"x")).is_err()); + assert!(catch_unwind(|| golden::read(&dir, "absent.bin")).is_err()); + assert!(!dir.join("absent.bin").exists()); +} + +#[test] +fn the_text_beside_the_binary_is_compared_too() { + let dir = scratch("text"); + std::fs::write(dir.join("s.bin"), b"bytes").unwrap(); + std::fs::write(dir.join("s.txt"), "text").unwrap(); + + assert_eq!(golden::check_with_text(&dir, "s", b"bytes", "text"), b"bytes"); + + let panic = catch_unwind(|| golden::check_with_text(&dir, "s", b"bytes", "other")).unwrap_err(); + let message = panic.downcast_ref::().cloned().unwrap_or_default(); + assert!(message.contains("s.txt"), "the panic names the text file: {message}"); + assert_eq!(std::fs::read(dir.join("s.txt")).unwrap(), b"text"); + + assert!(catch_unwind(|| golden::check_with_text(&dir, "s", b"changed", "text")).is_err()); + assert_eq!(std::fs::read(dir.join("s.bin")).unwrap(), b"bytes"); +} + +#[test] +fn read_returns_the_committed_bytes() { + let dir = scratch("read"); + std::fs::write(dir.join("r.bin"), b"abc").unwrap(); + assert_eq!(golden::read(&dir, "r.bin"), b"abc"); +} + +/// Re-runs this binary with THING_BLESS=1 so the writer is observed without touching this +/// process's environment. +#[test] +fn blessing_writes_the_file_and_the_text() { + let dir = scratch("bless"); + let status = std::process::Command::new(std::env::current_exe().unwrap()) + .args(["--exact", "bless_child", "--test-threads=1"]) + .env("THING_BLESS", "1") + .env("THING_BLESS_CHILD_DIR", &dir) + .status() + .unwrap(); + assert!(status.success()); + assert_eq!(std::fs::read(dir.join("b.bin")).unwrap(), b"blessed"); + assert_eq!(std::fs::read(dir.join("t.bin")).unwrap(), b"tb"); + assert_eq!(std::fs::read(dir.join("t.txt")).unwrap(), b"tt"); +} + +/// The child half of the test above; does nothing in a normal run. +#[test] +fn bless_child() { + if let Ok(dir) = std::env::var("THING_BLESS_CHILD_DIR") { + let dir = PathBuf::from(dir); + golden::check(&dir, "b.bin", b"blessed"); + golden::check_with_text(&dir, "t", b"tb", "tt"); + } +} diff --git a/crates/thing-testkit/tests/mem_state.rs b/crates/thing-testkit/tests/mem_state.rs new file mode 100644 index 0000000..44651bd --- /dev/null +++ b/crates/thing-testkit/tests/mem_state.rs @@ -0,0 +1,305 @@ +//! MemState as core sees it: through `StatePort`, with its own put and delete as the only +//! writers. + +use std::path::PathBuf; + +use thing_contract::*; +use thing_core::port::{Address, Change, Entry, Interest, Lookup, Prefix, Record, StatePort, SubscriptionId}; +use thing_testkit::build::*; +use thing_testkit::golden; +use thing_testkit::mem_state::{Call, MemState}; + +const SURFACE: &str = "gamecult.thing.surface.v1"; +const COMPOSITION: &str = "gamecult.thing.composition.v1"; +const RESULT: &str = "gamecult.thing.command_result.v1"; +const CATALOG: &str = "gamecult.thing.asset_catalog.v1"; +// A value that must never appear in a refusal; node-unknown-arm.bin carries it. +const CANARY: &str = "CANARY-7f3a91c2"; + +fn provider(name: &str) -> ProviderId { + ProviderId::new(name) +} + +fn address(provider_name: &str, schema: &str, key: &str) -> Address { + Address { provider: provider(provider_name), schema: SchemaId::new(schema), key: RecordKey::new(key) } +} + +fn prefix(provider_name: &str, schema: &str, key_prefix: &str) -> Prefix { + Prefix { provider: provider(provider_name), schema: SchemaId::new(schema), key_prefix: key_prefix.into() } +} + +fn surface(provider_name: &str, label: &str) -> SurfaceDocument { + SurfaceDocument { + provider_id: provider(provider_name), + label: seg(label), + version: ver(1), + title: label.into(), + root: boxed("root", vec![]), + commands: vec![], + } +} + +fn composition(publisher: &str, name: &str) -> CompositionDocument { + CompositionDocument { + publisher: publisher.into(), + name: seg(name), + version: ver(1), + params: vec![], + body: boxed("body", vec![]), + } +} + +fn catalog(provider_name: &str, id: &str) -> AssetCatalog { + AssetCatalog { provider_id: provider(provider_name), catalog_id: seg(id), version: ver(1), assets: vec![] } +} + +fn surface_at(provider_name: &str, value: &SurfaceDocument) -> Address { + address(provider_name, SURFACE, &value.record_key()) +} + +fn unknown_arm() -> Vec { + let dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../thing-contract/tests/goldens"); + golden::read(&dir, "node-unknown-arm.bin") +} + +#[test] +fn port_is_object_safe() { + let one = surface("provider.a", "one"); + let mut state = MemState::new(); + state.put(&provider("provider.a"), &one); + let port: &mut dyn StatePort = &mut state; + let id = port.subscribe(Interest::Record(surface_at("provider.a", &one))); + assert!(matches!(port.read(&surface_at("provider.a", &one)), Lookup::Present(_))); + assert_eq!(port.list(&prefix("provider.a", SURFACE, "thing:")).len(), 1); + port.unsubscribe(id); + assert!(port.drain().is_empty()); + let boxed: Box = Box::new(MemState::new()); + assert_eq!(boxed.read(&address("provider.a", SURFACE, "k")), Lookup::Absent); +} + +#[test] +fn a_refusal_is_not_absence() { + let main = surface("provider.a", "main"); + let at = surface_at("provider.a", &main); + assert_eq!(at.key.as_str(), "thing:surface:provider.a.main"); + let mut state = MemState::new(); + state.subscribe(Interest::Prefix(prefix("provider.a", SURFACE, "thing:"))); + + state.put_raw(at.clone(), unknown_arm()); + + let drained = state.drain(); + assert_eq!(drained.len(), 1, "one change: {drained:?}"); + let Change::Refused(refusal) = &drained[0] else { panic!("not a refusal: {drained:?}") }; + assert_eq!(refusal.address, at); + assert_eq!(refusal.kind, SchemaId::new(SURFACE)); + assert!(refusal.detail.contains(at.key.as_str()), "the detail names the key: {}", refusal.detail); + assert!(!refusal.detail.contains(CANARY), "the detail echoed a value: {}", refusal.detail); + assert_eq!(state.read(&at), Lookup::Refused(refusal.clone())); + assert_eq!(state.list(&prefix("provider.a", SURFACE, "thing:")), vec![Lookup::Refused(refusal.clone())]); + + // A valid record replaces the refusal; a refusal over a valid record leaves the address + // refused, not the older record. + state.put(&provider("provider.a"), &main); + assert!(matches!(state.read(&at), Lookup::Present(_))); + state.put_raw(at.clone(), unknown_arm()); + assert!(matches!(state.read(&at), Lookup::Refused(_))); + assert_eq!(state.list(&prefix("provider.a", SURFACE, "thing:")).len(), 1); + state.drain(); + + // Deleting a refusal is a change; deleting nothing is not. + state.delete(&at); + assert_eq!(state.read(&at), Lookup::Absent); + assert_eq!(state.drain(), vec![Change::Delete(at.clone())]); + state.delete(&at); + assert!(state.drain().is_empty()); +} + +#[test] +fn changes_drain_in_mutation_order_for_live_interests() { + let provider_a = provider("provider.a"); + let one = surface("provider.a", "one"); + let two = surface("provider.a", "two"); + let panel = composition("provider.a", "panel"); + let other = composition("provider.a", "other"); + let icons = catalog("provider.a", "icons"); + let one_at = surface_at("provider.a", &one); + let panel_at = address("provider.a", COMPOSITION, &panel.record_key()); + + let mut state = MemState::new(); + let ids: Vec = vec![ + state.subscribe(Interest::Record(one_at.clone())), + state.subscribe(Interest::Record(panel_at.clone())), + state.subscribe(Interest::Prefix(prefix("provider.a", SURFACE, "thing:"))), + ]; + + state.put(&provider_a, &one); // matches two interests and drains once + state.put(&provider_a, &panel); + state.put(&provider_a, &icons); // another schema under the same provider + state.put(&provider_a, &other); // a composition nobody asked for + // The same key and schema under another provider. + state.put_raw(address("provider.b", SURFACE, &two.record_key()), rmp_serde::to_vec(&two).unwrap()); + state.put(&provider_a, &two); + state.delete(&one_at); + + let entry = |address: Address, record: Record| Change::Upsert(Entry { address, record }); + assert_eq!( + state.drain(), + vec![ + entry(one_at.clone(), Record::Surface(one.clone())), + entry(panel_at, Record::Composition(panel)), + entry(surface_at("provider.a", &two), Record::Surface(two.clone())), + Change::Delete(one_at), + ] + ); + assert!(state.drain().is_empty(), "each change drains once"); + + for id in ids { + state.unsubscribe(id); + } + state.put(&provider_a, &one); + assert!(state.drain().is_empty()); +} + +#[test] +fn without_a_live_interest_nothing_queues() { + let mut state = MemState::new(); + state.put_raw(address("provider.a", SURFACE, "thing:surface:provider.a.main"), unknown_arm()); + state.put(&provider("provider.a"), &surface("provider.a", "one")); + assert!(state.drain().is_empty()); +} + +#[test] +fn each_kind_reads_back_as_its_own_arm() { + let provider_a = provider("provider.a"); + let mut state = MemState::new(); + let first = surface("provider.a", "b"); + let invocation = invocation(); + let result = CommandResult::pending(&invocation, seq(1), "working"); + let panel = composition("provider.a", "panel"); + let icons = catalog("provider.a", "icons"); + state.put(&provider_a, &first); + state.put(&provider_a, &panel); + state.put(&provider_a, &result); + state.put(&provider_a, &icons); + + let present = |at: Address, record: Record| Lookup::Present(Entry { address: at, record }); + let first_at = surface_at("provider.a", &first); + assert_eq!(state.read(&first_at), present(first_at.clone(), Record::Surface(first.clone()))); + let panel_at = address("provider.a", COMPOSITION, &panel.record_key()); + assert_eq!(state.read(&panel_at), present(panel_at.clone(), Record::Composition(panel))); + let result_at = address("provider.a", RESULT, &result.record_key()); + assert_eq!(state.read(&result_at), present(result_at.clone(), Record::Result(result))); + let icons_at = address("provider.a", CATALOG, &icons.record_key()); + assert_eq!(state.read(&icons_at), present(icons_at.clone(), Record::Catalog(icons))); + + // A newer record replaces the older; an absent key, another provider and another schema read Absent. + let mut newer = first.clone(); + newer.title = "newer".into(); + state.put(&provider_a, &newer); + assert_eq!(state.read(&first_at), present(first_at.clone(), Record::Surface(newer))); + assert_eq!(state.read(&address("provider.a", SURFACE, "missing")), Lookup::Absent); + assert_eq!(state.read(&address("provider.b", SURFACE, first_at.key.as_str())), Lookup::Absent); + assert_eq!(state.read(&address("provider.a", COMPOSITION, first_at.key.as_str())), Lookup::Absent); + assert_eq!(state.read(&address("provider.a", "gamecult.thing.nowhere.v1", "k")), Lookup::Absent); + + // A list holds the prefix's records in key order and no others. + let a = surface("provider.a", "a"); + let c = surface("provider.a", "c"); + state.put(&provider_a, &c); + state.put(&provider_a, &a); + let keys: Vec = state + .list(&prefix("provider.a", SURFACE, "thing:surface:provider.a.")) + .into_iter() + .map(|lookup| match lookup { + Lookup::Present(entry) => entry.address.key.as_str().to_string(), + other => panic!("{other:?}"), + }) + .collect(); + assert_eq!(keys, ["thing:surface:provider.a.a", "thing:surface:provider.a.b", "thing:surface:provider.a.c"]); + assert_eq!(state.list(&prefix("provider.a", SURFACE, "thing:surface:provider.a.b")).len(), 1); + assert!(state.list(&prefix("provider.b", SURFACE, "thing:")).is_empty()); +} + +#[test] +fn every_call_is_logged_in_order() { + let at = address("provider.a", SURFACE, "k"); + let under = prefix("provider.a", SURFACE, "p"); + let mut state = MemState::new(); + state.read(&at); + let id = state.subscribe(Interest::Prefix(under.clone())); + state.list(&under); + state.drain(); + state.unsubscribe(id); + assert_eq!( + state.calls(), + vec![ + Call::Read(at.clone()), + Call::Subscribe(Interest::Prefix(under.clone())), + Call::List(under), + Call::Drain, + Call::Unsubscribe(id), + ] + ); + let second = state.subscribe(Interest::Record(at)); + assert_ne!(second, id, "a subscription id is never reused"); +} + +#[test] +fn unsubscribing_ends_only_that_interest() { + let provider_a = provider("provider.a"); + let panel = composition("provider.a", "panel"); + let one = surface("provider.a", "one"); + let panel_at = address("provider.a", COMPOSITION, &panel.record_key()); + let mut state = MemState::new(); + let by_record = state.subscribe(Interest::Record(panel_at.clone())); + let by_prefix = state.subscribe(Interest::Prefix(prefix("provider.a", SURFACE, "thing:"))); + + state.unsubscribe(by_prefix); + state.put(&provider_a, &one); + state.put(&provider_a, &panel); + let drained = state.drain(); + assert_eq!(drained.len(), 1, "only the composition interest is live: {drained:?}"); + assert!(matches!(&drained[0], Change::Upsert(entry) if entry.address == panel_at)); + + state.unsubscribe(by_record); + state.put(&provider_a, &panel); + assert!(state.drain().is_empty()); +} + +#[test] +fn unsubscribing_keeps_changes_already_queued() { + let one = surface("provider.a", "one"); + let mut state = MemState::new(); + let id = state.subscribe(Interest::Record(surface_at("provider.a", &one))); + state.put(&provider("provider.a"), &one); + state.unsubscribe(id); + assert_eq!(state.drain().len(), 1, "a change queued while the interest was live is still drained"); +} + +#[test] +fn a_list_mixes_refused_and_present_in_key_order() { + let a = surface("provider.a", "a"); + let c = surface("provider.a", "c"); + let b_at = address("provider.a", SURFACE, "thing:surface:provider.a.b"); + let mut state = MemState::new(); + state.put(&provider("provider.a"), &c); + state.put_raw(b_at.clone(), unknown_arm()); + state.put(&provider("provider.a"), &a); + let kinds: Vec<(&str, String)> = state + .list(&prefix("provider.a", SURFACE, "thing:")) + .into_iter() + .map(|lookup| match lookup { + Lookup::Present(entry) => ("present", entry.address.key.as_str().to_string()), + Lookup::Refused(refusal) => ("refused", refusal.address.key.as_str().to_string()), + Lookup::Absent => panic!("a list holds no absence"), + }) + .collect(); + assert_eq!( + kinds, + [ + ("present", "thing:surface:provider.a.a".to_string()), + ("refused", b_at.key.as_str().to_string()), + ("present", "thing:surface:provider.a.c".to_string()), + ] + ); +} diff --git a/crates/thing-testkit/tests/scratch.rs b/crates/thing-testkit/tests/scratch.rs new file mode 100644 index 0000000..5f7c126 --- /dev/null +++ b/crates/thing-testkit/tests/scratch.rs @@ -0,0 +1,24 @@ +//! Writing a fixture leaves nothing behind. This is the only test in its binary, so no other +//! thread creates scratch files while it counts. + +use thing_testkit::fixture::Fixture; + +fn scratch_entries() -> Vec { + let prefix = "thing-testkit-"; + let mut names: Vec = std::fs::read_dir(std::env::temp_dir()) + .unwrap() + .filter_map(|entry| entry.unwrap().file_name().into_string().ok()) + .filter(|name| name.starts_with(prefix) && name.contains(&format!("-{}-", std::process::id()))) + .collect(); + names.sort(); + names +} + +#[test] +fn writing_a_fixture_leaves_no_scratch_file_or_lock_behind() { + let before = scratch_entries(); + for fixture in Fixture::ALL { + fixture.write(); + } + assert_eq!(scratch_entries(), before); +} diff --git a/crates/thing-testkit/tests/state.rs b/crates/thing-testkit/tests/state.rs new file mode 100644 index 0000000..64c21d0 --- /dev/null +++ b/crates/thing-testkit/tests/state.rs @@ -0,0 +1,223 @@ +//! Provider state through MemState: decoded by name from a Rust-written store, refused from a +//! store that published no member rows, and held one record per key as CultCache holds them. + +use cultcache_rs::DatabaseEntry; +use thing_contract::{ProviderId, SchemaId}; +use thing_state::StateDecodeError; +use thing_core::port::{Address, Change, Entry, Interest, Lookup, Prefix, Record, StatePort, StateValue}; +use thing_testkit::fixture::Fixture; +use thing_testkit::mem_state::MemState; +use thing_testkit::state::*; + +use StateValue::*; + +const SWARM_SCHEMA: &str = "gamecult.thing.test.swarm.v1"; +const NOWHERE: &str = "gamecult.thing.test.nowhere.v1"; +const PROVIDER: &str = "provider.swarm"; + +fn at(schema: &str, key: &str) -> Address { + address(PROVIDER, schema, key) +} + +fn prefix(schema: &str, key_prefix: &str) -> Prefix { + Prefix { provider: ProviderId::new(PROVIDER), schema: SchemaId::new(schema), key_prefix: key_prefix.into() } +} + +fn loaded(file: &str) -> MemState { + let mut state = MemState::new(); + state.load_store(&ProviderId::new(PROVIDER), &Fixture::dir().join(file)); + state +} + +fn swarm_value(id: &str, name: &str, load: f64) -> StateValue { + Record(vec![("Id".into(), Text(id.into())), ("Name".into(), Text(name.into())), ("Load".into(), Float(load))]) +} + +#[test] +fn the_committed_stores_are_what_the_crate_writes() { + assert!(!write_swarm_store().is_empty()); + assert!(!write_swarm_store_members_empty().is_empty()); +} + +#[test] +fn a_rust_written_store_reads_by_the_names_it_published() { + let state = loaded(SWARM_STORE); + let found = state.read(&at(SWARM_SCHEMA, "summary")); + let Lookup::Present(entry) = found else { panic!("{found:?}") }; + assert_eq!(entry.address, at(SWARM_SCHEMA, "summary")); + assert_eq!( + entry.record, + Record::State { schema: SchemaId::new(SWARM_SCHEMA), value: swarm_value("summary", "Swarm", 0.42) } + ); + let Record::State { value, .. } = entry.record else { unreachable!() }; + assert_eq!(value.member("Load"), Some(&Float(0.42))); + assert_eq!(state.read(&at(SWARM_SCHEMA, "unused")), Lookup::Absent); + let listed = state.list(&prefix(SWARM_SCHEMA, "mind-")); + let keys: Vec<_> = listed + .iter() + .map(|lookup| match lookup { + Lookup::Present(entry) => entry.address.key.as_str().to_string(), + other => panic!("{other:?}"), + }) + .collect(); + assert_eq!(keys, ["mind-1", "mind-2", "mind-3"]); +} + +#[test] +fn a_store_with_no_member_rows_is_refused_never_read_positionally() { + let state = loaded(SWARM_STORE_MEMBERS_EMPTY); + for key in ["summary", "mind-1", "mind-2", "mind-3"] { + let found = state.read(&at(SWARM_SCHEMA, key)); + let Lookup::Refused(refusal) = found else { panic!("{key}: {found:?}") }; + assert_eq!(refusal.kind, SchemaId::new(SWARM_SCHEMA)); + assert!(refusal.detail.contains(SWARM_SCHEMA), "{}", refusal.detail); + assert!(refusal.detail.contains(&StateDecodeError::NoMembers.to_string()), "{}", refusal.detail); + } + let listed = state.list(&prefix(SWARM_SCHEMA, "mind-")); + assert_eq!(listed.len(), 3); + assert!(listed.iter().all(|lookup| matches!(lookup, Lookup::Refused(_))), "{listed:?}"); +} + +#[test] +fn a_script_and_a_store_hold_the_same_records() { + let mut scripted = MemState::new(); + script(Fixture::F01SwarmDashboard, &mut scripted); + let stored = loaded(SWARM_STORE); + for key in ["summary", "mind-1", "mind-2", "mind-3"] { + assert_eq!(scripted.read(&at(SWARM_SCHEMA, key)), stored.read(&at(SWARM_SCHEMA, key)), "{key}"); + } +} + +#[test] +fn another_schema_at_the_key_answers_present_under_its_own_schema() { + let mut state = MemState::new(); + script(Fixture::F10Hostile, &mut state); + let asked = address("provider.hostile", NOWHERE, "row-1"); + let found = state.read(&asked); + let Lookup::Present(entry) = found else { panic!("{found:?}") }; + assert_eq!(entry.address, asked); + let Record::State { schema, .. } = entry.record else { panic!("not state") }; + assert_eq!(schema, SchemaId::new(SWARM_SCHEMA)); + assert_eq!(state.read(&address("provider.hostile", NOWHERE, "row-2")), Lookup::Absent); + // A list names only the records of the schema asked for. + let none = state.list(&Prefix { + provider: ProviderId::new("provider.hostile"), + schema: SchemaId::new(NOWHERE), + key_prefix: String::new(), + }); + assert!(none.is_empty()); +} + +#[test] +fn every_state_script_fills_the_provider_its_fixture_binds() { + let mut feed = MemState::new(); + script(Fixture::F06ScrollList, &mut feed); + let items = feed.list(&Prefix { + provider: ProviderId::new("provider.feed"), + schema: SchemaId::new("gamecult.thing.test.item.v1"), + key_prefix: "item-".into(), + }); + assert_eq!(items.len(), 1000); + let Lookup::Present(first) = &items[0] else { panic!() }; + assert_eq!(first.address.key.as_str(), "item-0000"); + for (fixture, provider, schema, key, member) in [ + (Fixture::F03InputTarget, "provider.muninn", "target", "cursor", "Label"), + (Fixture::F04Form, "provider.settings", "settings", "current", "Volume"), + (Fixture::F07Plot, "provider.market", "series", "prices", "Values"), + ] { + let mut state = MemState::new(); + script(fixture, &mut state); + let found = state.read(&address(provider, &format!("gamecult.thing.test.{schema}.v1"), key)); + let Lookup::Present(Entry { record: Record::State { value, .. }, .. }) = found else { + panic!("{schema}: {found:?}") + }; + assert!(value.member(member).is_some(), "{schema}.{member}"); + } +} + +#[test] +fn a_refused_put_replaces_an_older_good_record() { + let mut state = MemState::new(); + let key = at(SWARM_SCHEMA, "summary"); + state.subscribe(Interest::Record(key.clone())); + let swarm = Swarm { id: "summary".into(), name: "Swarm".into(), load: 0.5 }; + state.put_state(&ProviderId::new(PROVIDER), "summary", &swarm); + assert!(matches!(state.read(&key), Lookup::Present(_))); + state.put_state_raw(key.clone(), vec![0xc1], &Swarm::schema_members()); + let Lookup::Refused(refusal) = state.read(&key) else { panic!("not refused") }; + assert_eq!(refusal.address, key); + // Refused whichever schema is asked at that key. + assert!(matches!(state.read(&at(NOWHERE, "summary")), Lookup::Refused(_))); + let changes = state.drain(); + assert!(matches!(changes.as_slice(), [Change::Upsert(_), Change::Refused(_)]), "{changes:?}"); + // A good record replaces the refusal. + state.put_state(&ProviderId::new(PROVIDER), "summary", &swarm); + assert!(matches!(state.read(&key), Lookup::Present(_))); +} + +#[test] +fn delete_queues_only_under_a_matching_interest_and_only_for_what_was_held() { + let mut state = MemState::new(); + let key = at(SWARM_SCHEMA, "summary"); + state.subscribe(Interest::Prefix(prefix(SWARM_SCHEMA, "sum"))); + let swarm = Swarm { id: "s".into(), name: "n".into(), load: 0.0 }; + state.put_state(&ProviderId::new(PROVIDER), "summary", &swarm); + state.put_state(&ProviderId::new(PROVIDER), "mind-1", &swarm); + state.delete(&at(NOWHERE, "summary")); // another schema's address: nothing held there + assert!(matches!(state.read(&key), Lookup::Present(_))); + state.delete(&key); + state.delete(&key); // already gone + state.delete(&at(SWARM_SCHEMA, "mind-1")); // held, but no interest + assert_eq!(state.read(&key), Lookup::Absent); + assert_eq!(state.read(&at(SWARM_SCHEMA, "mind-1")), Lookup::Absent); + let changes = state.drain(); + assert!( + matches!(changes.as_slice(), [Change::Upsert(_), Change::Delete(deleted)] if *deleted == key), + "{changes:?}" + ); +} + +#[derive(Clone, Debug, PartialEq, DatabaseEntry)] +#[cultcache(type = "gamecult.thing.test.other", schema = "gamecult.thing.test.other.v1")] +struct TypeIsNotTheSchemaId { + #[cultcache(key = 0)] + id: String, +} + +#[test] +#[should_panic(expected = "entry type equal to its schema id")] +fn put_state_refuses_a_type_that_is_not_its_schema_id() { + MemState::new().put_state(&ProviderId::new(PROVIDER), "k", &TypeIsNotTheSchemaId { id: "x".into() }); +} + +#[test] +#[should_panic(expected = "is a contract kind")] +fn put_state_raw_refuses_a_contract_schema() { + let mut state = MemState::new(); + state.put_state_raw(at("gamecult.thing.surface.v1", "k"), vec![0x90], &Swarm::schema_members()); +} + +#[test] +fn load_store_names_a_record_by_its_schema_id_when_it_has_one() { + // The schema id the store carries is the record's schema, whatever its entry type is called. + let dir = std::env::temp_dir().join(format!("thing-state-alias-{}", std::process::id())); + std::fs::create_dir_all(&dir).unwrap(); + let path = dir.join("alias.cc"); + let bytes = thing_testkit::store::bytes(|cache| { + cache.register_entry_type::().unwrap(); + let swarm = Swarm { id: "a".into(), name: "n".into(), load: 1.0 }; + let (mut envelope, _) = cache.prepare_entry("k", &swarm).unwrap(); + envelope.stored_at = thing_testkit::store::PINNED_CLOCK.into(); + envelope.schema_id = Some("gamecult.thing.test.alias.v1".into()); + cache.put_envelope::(envelope).unwrap(); + }); + std::fs::write(&path, bytes).unwrap(); + let mut state = MemState::new(); + state.load_store(&ProviderId::new(PROVIDER), &path); + let _ = std::fs::remove_dir_all(&dir); + // No member rows are published under the alias, so the record is refused under it; read + // by its entry type it would have decoded. + let found = state.read(&at("gamecult.thing.test.alias.v1", "k")); + let Lookup::Refused(refusal) = found else { panic!("{found:?}") }; + assert_eq!(refusal.kind, SchemaId::new("gamecult.thing.test.alias.v1")); +} diff --git a/docs/research/swarm-dashboard.md b/docs/research/swarm-dashboard.md new file mode 100644 index 0000000..ace7afa --- /dev/null +++ b/docs/research/swarm-dashboard.md @@ -0,0 +1,201 @@ +# Swarm dashboard: contract state, sources, first cut + +Serves Eureka's ruling `swarm-dashboard-first-thing2-surface` (not readable from +the libby mind; cited by the id in the claiming follow-up +`libby-body:follow_up:chat-s354-359`). Read-only pass by the `libby` Self run +`libby:run:mind-20261031T061423908Z`, 2026-10-31. Nothing was built or deployed. +Claims below were probed on 2026-10-31 unless marked **unverified**. + +The question the dashboard answers for a stranger: **is anyone working, and on what.** + +## 1. Where Thing 2's surface contract stands + +Probed against the forge `GameCult/Thing` (main `e119e76`, 2026-10-22) and its +`hands/thing2-*` branches. The source of truth for cut status is the `thing2` +campaign in the Eureka mind, which this pass cannot read; the prose map +(`docs/thing2-map.md`, last edited 2026-10-12) is the evidence used. + +| Piece | State | +| --- | --- | +| Contract, Rust (`crates/thing-contract`) | On main. 13-arm closed `Node` union, `SurfaceDocument`, `CompositionDocument`, `CommandDecl/Invocation/Result`, `AssetCatalog`; byte goldens under `tests/goldens/`. | +| Contract, C# and TypeScript | Not on main. Branches `hands/thing2-contract-cs` (`3dadfc6`, 2026-10-14) and `hands/thing2-contract-ts` (`aeede04`, 2026-10-12). The map lists the cross-runtime store check and publication as waiting. | +| Core (resolution, `thing.std` compositions, binding via the CultMesh port, Taffy layout, command dispatch) | Not built. No crate exists. Decoding Verse surfaces waits on `cultlib-gaps:follow_up:decode-stack-safety`. | +| TUI backend | Not built. Planned first backend. | +| Web backend and shell | Not built. | +| Discovery/advertisement | Not a Thing kind (`thing2:ruling:advertisement-owner`); read through a core port; today's `gamecult.eve.provider_advertisement.v1` is unchanged. | + +`README.md` says the same: the layout solver, text, accessibility tree, render +commands and backends "are not built yet". **Nothing can render a Thing 2 +surface today.** The only live renderers are Thing 1's (browser oracle, Ghostlight's vendored lowering, +the Nightwing browser reference), and Eve dashboards are quarantined (`gamecult.md`: no new Eve surfaces). + +### What a provider must publish to render + +From `docs/thing2-map.md` "The consumer contract" and `crates/thing-contract/src`: + +1. A `SurfaceDocument` (`gamecult.thing.surface.v1`, key `thing:surface:.