Add X/Y margin to ON relation & access by intent compiler#795
Conversation
161f149 to
d1b8e40
Compare
Greptile SummaryThis PR adds an
Confidence Score: 5/5Safe to merge. The margin logic is correct end-to-end across the loss strategy, validator, and relation class, and all previously-reported issues are resolved. The core placement math is consistent between OnLossStrategy and _validate_on_relations. Every boundary case (inverted band when child >= parent, infeasible margin, exact inset boundary) is covered by new tests with verified numerical assertions. No correctness defects were found; the two flagged items are diagnostic-quality issues in the verbose output path only. No files require special attention, though the verbose diagnostic path in object_placer.py (lines 558-569) could be improved to print the margin hint even when child >= parent on one axis. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[_validate_on_relations] --> B{edge_margin_m > 0?}
B -- No --> E
B -- Yes --> C{freespace lt 2xm on any XY axis?}
C -- No --> E[Step 2: XY inset check]
C -- Yes --> D{max_feasible_margin > 0?}
D -- Yes --> F[verbose hint + return False]
D -- No, child ge parent --> E
E -- Fails --> H[verbose: XY outside parent + return False]
E -- Passes --> G[Step 3: Z band check]
G -- Fails --> J[verbose: Z outside band + return False]
G -- Passes --> I[return True]
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[_validate_on_relations] --> B{edge_margin_m > 0?}
B -- No --> E
B -- Yes --> C{freespace lt 2xm on any XY axis?}
C -- No --> E[Step 2: XY inset check]
C -- Yes --> D{max_feasible_margin > 0?}
D -- Yes --> F[verbose hint + return False]
D -- No, child ge parent --> E
E -- Fails --> H[verbose: XY outside parent + return False]
E -- Passes --> G[Step 3: Z band check]
G -- Fails --> J[verbose: Z outside band + return False]
G -- Passes --> I[return True]
Reviews (5): Last reviewed commit: "address comments" | Re-trigger Greptile |
alexmillane
left a comment
There was a problem hiding this comment.
LGTM
A few nits but my main suggestion is to just make this margin a default then we can get rid of the complexity resulting from needing to thread the parameter around.
Summary
Short description of the change (max 50 chars)
Detailed description
edge_margin_mparameter (default 0.0) that insets the valid X/Y footprint band by the margin, so the whole footprint stays at least that far from every rim.IntentCompiler.compile()injects a default edge_margin_m (0.05 m) on every on relation built from an intent specResults
With agentic env gen pipeline
Before

After
