Managed view hierarchy: convert secure rectangles into render pixels before the overlap test #294
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.48) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.48 · 514 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.374
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #294"
general
weight: 0.35
krassx
Fixes #291
What changed
The managed view hierarchy compared node boxes in Unity render pixels with secure rectangles that the registry holds in native pixels. With Resolution Scaling,
Screen.SetResolutionbelow the display size, a surface offset (status bar, cutout) or an iOS render scale that differs from the screen scale, a node under a secure rectangle could keepoptions.nameandoptions.components.SecureRectSpace.NativeToRender(new): the exact inverse ofTryToNative(remove the surface offset, scale by screen size over surface size, round outwards, clamp in double).ManagedViewHierarchy.CollectSecureRectsruns it on every slice throughBugsee.ConvertSecureRectsToRender, so each slice tests nodes against rectangles in its own render space (the union over slices stays).SecureRectSpace.CoverScreen); nodes without bounds were already treated as covered.SecureRectScreenSync.CurrentViewgives the view quietly (no warning from inside a native request) and leaves the state change for the nextAdd/Tickto warn about.ManagedViewSnapshot,ManagedViewTreeJson.Write) are corrected.## [Unreleased]/### Fixedbullet (main had no unreleased section).Verification
ManagedViewSecureSpaceTests,SecureRectSpaceTests) run the real chainSecureRectScreenOwners->SecureRectRegistry->NativeToRender->ManagedViewTreeJson: native resolution (unchanged), Resolution Scaling 0.5,SetResolution720x1280 on 1080x1920, surface offset, scale plus offset, iOS scale 2 and 3, iOS render scale differing from the screen scale, manual native rectangles, partly and fully outside, no rectangles, no bounds, huge rectangles, the fail-closed paths. Every scaled/offset case also asserts the pre-fix path (unconverted rectangles) leaks the name, which is the "fails before the fix" proof.dotnet testWrapperPolicy: 2523 passed.compile-check.sh: 11/11 ok.vhsecurescale(secure rectangle exactly over a named uGUI card, managed view hierarchy captured at native 720x1612 and afterScreen.SetResolutionto 360x806, secured-node counts fromManagedViewDiagnostics; the scene's other objects are off so counts are stable):- before (origin/main runtime): native secured=4, half secured=1 -> FAIL (the covered card and its siblings kept their names)
- after (this PR): native secured=4, half secured=4 -> PASS
The check reads the wrapper's secured-node count, not the JSON name itself; the unit tests assert the names. Final sample (also asserts a named clear corner node stays named, so a PASS cannot come from covering everything): after, native secured=4 of 6 nodes, half secured=4 of 6 -> PASS, failures=0.
Known gaps
AddSecureRectanglerectangles after a surface that turns unreadable once it was read use the last good surface (same as screen-space ones).Bugsee.ConvertSecureRectsToRenderitself (its parts are tested).boundswritten to the report are still render pixels divided by the iOS scale; out of scope here.Docs that become obsolete (docs repo, not edited here)
docs/sdk/unity/view-hierarchy.mdxandprivacy/video.mdx, section "Rectangles and the Unity scene tree": the sentences stating that the managed view hierarchy compares node boxes in render pixels with rectangles in native pixels, and that under Resolution Scaling,Screen.SetResolution, a surface offset or a differing iOS scale a node under a rectangle can keep its name and components, no longer hold.🤖 Generated with Claude Code
https://claude.ai/code/session_01WeiJxQSiPP4vp79ZPpBsqf