Repository navigation
feat: implement Spatial Integrity Filter for zero-overlap layouts - #27
Open
google-labs-jules[bot] wants to merge 1 commit into
Open
google-labs-jules[bot] wants to merge 1 commit into
google-labs-jules[bot] wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context & Rationale
Currently, our design simulator uses an additive scoring model where high-value features can mask fatal layout errors, such as component overlaps. This allows technically broken or unusable layouts to pass audits with mediocre scores instead of being outright rejected.
To improve the technical feasibility of generated layouts, we are introducing a Spatial Integrity Filter. By applying a strict zero-score penalty to any design with detected spatial collisions, we guarantee that only physically valid layouts pass the audit process, without requiring complex and high-risk MCTS refactoring.
Key Changes
1. Broadened Collision Detection
hasInteractiveconstraint inside the layout auditor. The collision detection engine now evaluates bounding box coordinates for all mapped DOM elements to ensure comprehensive spatial integrity.2. Repaired Bounding Box Calculus
estimateElementCoordinatesto track a globalmaxYcursor, preventing sequentially processed wrapper elements (such as<main>and<section>) from incorrectly registering overlaps.bentocellcardIndexassignments that forced identical tags into identical coordinates.y = Math.min(y, 800)), which was causing components located outside the viewport to mathematically stack up and trigger false-positive collisions.3. Score Override & Audit Integrity
design-mcts.js). When a spatial violation is flagged, the parser intercepts the pipeline to force an aggregate design score of exactly0.[SPATIAL_VIOLATION]along with the exact element IDs involved in the collision for easier debugging and developer auditing.Acceptance Criteria Verified
0.