From cd497836b3a57c271f1c7d94715973fdf0492435 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 15 Jun 2026 23:19:41 +0100 Subject: [PATCH] Make PropertiesPanel inspection read-only --- .voidbot/state/aetheria.cc | Bin 139521 -> 141133 bytes Aetheria.State.Verify/Program.cs | 32 ++++++++++++++ .../UI/Properties Panel/PropertiesPanel.cs | 40 ++++-------------- docs/aetheria-perfect-machine-map.md | 8 +++- 4 files changed, 48 insertions(+), 32 deletions(-) diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index f7ef0a864e1a85e3561e5064d1d3e5ca18a9c11a..5159143ab00f08c0bc6e26d8b1c8c4b5a40eff16 100644 GIT binary patch delta 1510 zcmaJ>-)kII6lOP3*0v9MXtPof&x44C%%r=r$z&@?XjE2^q-mQ-T8cL_XLqj5+&kWT zC+j|?QhX3Z2&0S-f)y+NK*5)i`XFk-N2RZM^iS{)5IuKxcDBUQm#{f=&pF@uzVDp( z?l=DUv+?7d`l)uewcPEjxXWH^=b&~b`@R0bG`7+yVshr)D(1Du?;5kuKGU3g{|D`d z7_%)@noCjpR)`N9uFcl|*?#%MZ(@w48ufys4nq^7;><~uOi&q)+DVwe z$Wh1wDWZ|Xg-*~nQaSDO?WOZe`Rym_ukU-SWhVHkfsHDA!zP2mendG00fvej1eO{? z!p+G2%8wY2kN!HI60;Eyh_@*X%9a>_+${oqj!~eYFBJq_ClT8pEx;}{<_3g>NQwa} zkVB!VwFpq5aw6%o2;$T*i^GL0A<{<{Y!`rH84xNFz^k@&PxPgG8O;`pQiOz=P{WX_ zK!6b%3>J!~labxaCU^d=ooov^q>>h)2I7$``p=|FxL+F-R)C`iZ%A!GrNZzS;c73x zv{gI3uVq0C+l>%HjEH#ZNxW%b)YD*`7%m1-h)48l7uF=rNrjLLqhyf!c9x1`47g3W zUSr5PPreA^0+mX-*Bqof#z*)eccI{=f-%oDxEMKS8-zaz0@$|KcZt{Ofjz z^aP1}-(pkbGA`_|^tG!!(7r+%c>xSj{C__%UFtS+tfyR96(g{yrCKD+Mp|T*Rv-`w zFe~xe3HGg2A^nN0&WaSb;%XkJQ6XW@8?hjm!W*Pa z1@8A~WfMMHbXj)r{A%`*H+S)3Z`}5Uu_Wh;^hvDPiF0I&A=rxJy(o65Tx76RXE%CI zwmv_%acL9ZNx8yfd$&mwtkb))Dp5NzbT!+f*ChMx-iz7iFP-u{>oT%{y#o;!)|kFj zq~EblaLfex&1)Z=?@q2%H|0)sNr*G-Mv~T)w7cu4 zk?|QFzpl3Kc635e4#``I;?hT2C@H!G(XkK@SFhJ@-+Q=s_F$$ty{SvZP0gP>Q~!Ay rTyB@g_sP65UyrM7&uis3=j)%Gm;m>@?C+W8;Zn2y%Tv?zmDbLG8pkAH delta 230 zcmX?mj-&Aq$A%?LJcd>#rdCDwu}wbB)C`xfFf;;5OwMPnK!}-} zgT**l(7d!d4cdIm<8P%GJ{hsZGHA|%Wpj(jA;R1X(4Gz2?ldy_2F Leolm_xoH#t?xjJa diff --git a/Aetheria.State.Verify/Program.cs b/Aetheria.State.Verify/Program.cs index 8823ca077..6ee127843 100644 --- a/Aetheria.State.Verify/Program.cs +++ b/Aetheria.State.Verify/Program.cs @@ -13,6 +13,7 @@ RequireEveRuntimeBootstrap(root); RequireNoRendererLocalConsole(root); RequireNoRendererLocalDebugPanels(root); RequireMainMenuSettingsCommit(root); +RequirePropertiesPanelReadOnlyInspector(root); await using var node = await AetheriaStateNode.OpenAsync(statePath, "aetheria-state-verify"); @@ -455,6 +456,7 @@ Console.WriteLine("Eve runtime bootstrap: operations surface mounts through UI T Console.WriteLine("Renderer-local console authority: deleted; UI commands flow through Eve command documents"); Console.WriteLine("Renderer-local debug panels: obsolete uGUI field tester authority is deleted"); Console.WriteLine("Main-menu settings authority: gameplay and graphics settings return through typed player-settings commits"); +Console.WriteLine("PropertiesPanel inspector authority: reflection inspection is read-only display"); static void RequireCount(AetheriaMigrationLedger ledger, string documentType, int actual) { @@ -717,6 +719,36 @@ static void RequireMainMenuSettingsCommit(string root) } } +static void RequirePropertiesPanelReadOnlyInspector(string root) +{ + var propertiesPanelPath = Path.Combine(root, "Assets", "Scripts", "UI", "Properties Panel", "PropertiesPanel.cs"); + if (!File.Exists(propertiesPanelPath)) + { + throw new InvalidOperationException("Cannot verify PropertiesPanel inspector authority; PropertiesPanel.cs is missing."); + } + + var source = File.ReadAllText(propertiesPanelPath); + var forbiddenSymbols = new[] + { + "readWrite", + "field.SetValue", + "f => field.SetValue", + "i => field.SetValue", + "b => field.SetValue" + }; + + var hits = forbiddenSymbols + .Where(symbol => source.Contains(symbol, StringComparison.Ordinal)) + .ToArray(); + + if (hits.Length > 0) + { + throw new InvalidOperationException( + "PropertiesPanel reflection inspection still has renderer-local write authority: " + + string.Join(", ", hits)); + } +} + static string ExtractMethodBody(string source, string methodName) { var signature = "private void " + methodName + "()"; diff --git a/Assets/Scripts/UI/Properties Panel/PropertiesPanel.cs b/Assets/Scripts/UI/Properties Panel/PropertiesPanel.cs index dfea2458b..698c5d121 100644 --- a/Assets/Scripts/UI/Properties Panel/PropertiesPanel.cs +++ b/Assets/Scripts/UI/Properties Panel/PropertiesPanel.cs @@ -700,11 +700,11 @@ public class PropertiesPanel : MonoBehaviour RefreshValues(); } - public void Inspect(object obj, bool inspectablesOnly = false, bool readWrite = false, bool topLevel = true) + public void Inspect(object obj, bool inspectablesOnly = false, bool topLevel = true) { var fields = obj.GetType().GetFields(); foreach (var field in fields) - Inspect(obj, field, inspectablesOnly, readWrite); + Inspect(obj, field, inspectablesOnly); // if(topLevel) // foreach (var field in _propertyFields) @@ -713,7 +713,7 @@ public class PropertiesPanel : MonoBehaviour RefreshValues(); } - public void Inspect(object obj, FieldInfo field, bool inspectablesOnly = false, bool readWrite = false) + public void Inspect(object obj, FieldInfo field, bool inspectablesOnly = false) { var inspectable = field.GetCustomAttribute(); if (inspectable == null && inspectablesOnly) return; @@ -721,49 +721,27 @@ public class PropertiesPanel : MonoBehaviour if (type == typeof(float)) { - if (readWrite) - { - if (inspectable is InspectableRangedFloatAttribute ranged) - AddField(field.Name.SplitCamelCase(), () => (float) field.GetValue(obj), f => field.SetValue(obj, f), - ranged.Min, ranged.Max); - else - AddField(field.Name.SplitCamelCase(), () => (float) field.GetValue(obj), f => field.SetValue(obj, f)); - } else AddProperty(field.Name.SplitCamelCase(), () => ((float) field.GetValue(obj)).ToString("0.##")); + AddProperty(field.Name.SplitCamelCase(), () => ((float) field.GetValue(obj)).ToString("0.##")); } else if (type == typeof(int)) { - if (readWrite) - { - if (inspectable is InspectableRangedIntAttribute ranged) - AddField(field.Name.SplitCamelCase(), () => (int) field.GetValue(obj), f => field.SetValue(obj, f), - ranged.Min, ranged.Max); - else - AddField(field.Name.SplitCamelCase(), () => (int) field.GetValue(obj), f => field.SetValue(obj, f)); - } else AddProperty(field.Name.SplitCamelCase(), () => ((int) field.GetValue(obj)).ToString()); + AddProperty(field.Name.SplitCamelCase(), () => ((int) field.GetValue(obj)).ToString()); } else if (type.IsEnum) { - if (readWrite) - AddField(field.Name.SplitCamelCase(), () => (int) field.GetValue(obj), i => field.SetValue(obj, i), - Enum.GetNames(field.FieldType)); - else - AddProperty(field.Name.SplitCamelCase(), () => Enum.GetName(type, field.GetValue(obj)).SplitCamelCase()); + AddProperty(field.Name.SplitCamelCase(), () => Enum.GetName(type, field.GetValue(obj)).SplitCamelCase()); } else if (type == typeof(string)) { - if (readWrite) - AddField(field.Name.SplitCamelCase(), () => (string) field.GetValue(obj), i => field.SetValue(obj, i)); - else - AddProperty(field.Name.SplitCamelCase(), () => (string) field.GetValue(obj)); + AddProperty(field.Name.SplitCamelCase(), () => (string) field.GetValue(obj)); } - //else if (field.FieldType == typeof(Color)) Inspect(field.Name, () => (Color) field.GetValue(obj), c => field.SetValue(obj, c)); - else if (field.FieldType == typeof(bool)) AddField(field.Name, () => (bool) field.GetValue(obj), b => field.SetValue(obj, b)); + else if (field.FieldType == typeof(bool)) AddProperty(field.Name.SplitCamelCase(), () => ((bool) field.GetValue(obj)).ToString()); else if (type.GetCustomAttribute() != null) { // if(!_propertyFields.Any() || !_propertyFields.Last().gameObject.name.ToUpper().Contains("DIVIDER")) // _propertyFields.Add(Divider.Instantiate()); var list = AddList(field.Name); - list.Inspect(field.GetValue(obj), inspectablesOnly, readWrite, false); + list.Inspect(field.GetValue(obj), inspectablesOnly, false); } else Debug.Log($"Field \"{field.Name}\" has unknown type {field.FieldType.Name}. No inspector was generated."); diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index 9da332346..239cae149 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -1364,6 +1364,10 @@ First Aetheria surfaces to publish: `FieldShieldTest.unity` script binding. Future field prototype controls should be provider-owned Eve/prototype commands or local simulation code, not a `PropertiesPanel` mutating `FieldDriver` directly. + - Done: delete `PropertiesPanel` reflection write authority. The legacy + inspector can still project object fields for display, but `readWrite` + mode and `FieldInfo.SetValue` mutation are gone; renderer-local object + edits must become provider-owned typed commands or local simulation code. - Replace the next concrete uGUI screen with an Eve-owned surface. - Move the staged packages into the Eve repo once its worktree is clean, then import them back into Aetheria from Eve instead of carrying a local copy. @@ -1675,7 +1679,9 @@ Do not add behavior to `ItemData` or resurrect `RuntimeItemProjectionEntry`. The typed state spine, direct behavior factories, and migration quarantine exist; the next cuts should remove remaining live predicates that still need legacy DTO vocabulary, keep package-level MessagePack/JSON at explicit -boundaries, and replace runtime/operator UI truth with Eve surfaces. Any +boundaries, and replace runtime/operator UI truth with Eve surfaces. The old +`PropertiesPanel` reflection inspector is display-only; do not restore writable +inspection as a shortcut around typed command/state ownership. Any predicate that still needs legacy DTO objects must earn that dependency by using behavior objects or simulation-only methods that typed facets do not yet expose.