Inspiration
Modern software testing often focuses on whether an application builds successfully and its predefined tests pass. But what happens when the application manipulates geometry? A floor-planning tool can compile successfully while producing invalid walls, misplaced doors, incorrect room areas, or inconsistent spatial data.
Inspired by this gap, we created SpatialGuard, an AI-powered spatial verification and release engineering system built around OpenPlan3D, an open-source 2D/3D floor-plan editor.
Our idea was simple: software releases should be validated not only for code quality, but also for the correctness of the real-world structures they represent. Every change has a geometry. Every release needs proof.
What it does
SpatialGuard introduces geometry-aware verification into the software development lifecycle. It combines deterministic spatial testing with an AI-agent architecture designed to investigate failures, support corrective changes, and improve release reliability.
Its core capabilities include:
- Spatial Invariant Testing: Validates important geometric properties rather than relying solely on conventional application tests.
- Opening Boundary Validation: Detects doors and windows whose placement or width violates their host wall's boundaries.
- Geometry Preservation: Checks whether supported floor-plan transformations preserve important spatial properties.
- Room Geometry Verification: Tests enclosed room boundaries and calculated areas against independently established expected results.
- Machine-Readable Evidence: Produces structured test results containing invariant identifiers, diagnostic messages, geometric measurements, and failure details.
- AI-Assisted Investigation: Establishes a foundation for agents to analyse code changes, identify relevant invariants, and investigate failures using actual test evidence.
- Supervised Release Engineering: Extends the verification concept toward bounded remediation, security checks, deployment validation, and human-approved releases.
The central principle is that an AI-generated explanation is not proof that a defect has been fixed. SpatialGuard relies on deterministic verification to establish whether the required properties actually hold.
How we built it
We built SpatialGuard around the existing MIT-licensed OpenPlan3D repository rather than creating another floor-planning application from scratch.
The verification core uses TypeScript and the application's existing geometry structures and transformations. Vitest provides deterministic testing, while Playwright supports browser-level validation. GitLab Duo Agent Platform and GitLab CI/CD form the intended foundation for agentic investigation and post-code automation.
Our initial implementation introduced a modular verification layer with three principal spatial invariants:
- Opening Attachment and Boundary Containment: Evaluates whether doors and windows satisfy their host-wall constraints.
- Prepared RoomPlan Round-Trip Conservation: Checks whether important geometric properties survive supported export and import transformations.
- Enclosed Room Boundary and Area Verification: Validates room detection and area calculations against independently derived geometric expectations.
We also introduced canonical test fixtures, actionable diagnostics, a dedicated spatial test command, and machine-readable test output.
The wider architecture is designed around a supervised workflow: analyse a code change, run relevant spatial tests, investigate failures, propose a correction, verify the result, and present release evidence for human review.
Challenges we ran into
One of the biggest challenges was distinguishing meaningful spatial correctness from superficial test success.
Coordinate systems and units: OpenPlan3D uses centimetres for its 2D floor-plan geometry and metres in relevant 3D and interchange representations. Tests needed to account for these conventions without introducing incorrect assumptions.
Independent ground truth: A test should not calculate its expected result using the same function it is testing. We therefore used independently established geometric expectations for reference scenarios.
Floating-point precision: Geometric computations require carefully defined tolerances. Arbitrary tolerances can conceal genuine defects, while overly strict comparisons can report harmless numerical differences as failures.
Realistic failure detection: Testing only valid examples is insufficient. We needed negative cases that demonstrate that a spatial invariant can actually detect an invalid result.
Reliable automation: Connecting test evidence to an AI workflow introduces additional challenges involving source revisions, stale reports, missing artifacts, execution permissions, and trustworthy release decisions.
These challenges shaped our approach: validate the underlying behaviour first, preserve the evidence, and allow automation to act only within clearly defined boundaries.
Accomplishments that we're proud of
We are proud to have established a dedicated spatial verification layer around an existing 2D/3D application without replacing its original architecture.
Our initial implementation includes:
- Three documented spatial invariants.
- A modular TypeScript verification core.
- Canonical geometry fixtures with independent expected values.
- Deterministic positive and negative test cases.
- Actionable failure diagnostics with geometric measurements and tolerances.
- A dedicated spatial verification command.
- Machine-readable test evidence intended for automated investigation.
- Documentation covering the verification contracts, architecture, and validation procedure.
The initial implementation report recorded eight passing SpatialGuard tests, a successful type check, and a successful production build. The broader existing test suite also exposed an environment-specific line-ending issue, reinforcing the importance of separating new regressions from pre-existing failures.
Most importantly, SpatialGuard establishes a concrete foundation for treating spatial correctness as a verifiable property of software rather than an assumption based on a successful build.
What we learned
We learned that reliable AI engineering requires more than connecting a language model to a code repository.
AI agents need structured evidence, clear responsibilities, explicit constraints, and independent mechanisms for verifying their decisions. A convincing explanation is not the same as a reproducible result.
We also learned the importance of distinguishing deterministic testing from AI reasoning. Tests establish whether specified properties pass; agents help determine which tests matter, investigate failures, and recommend what to do next.
Finally, we learned that autonomy must be bounded. Automated remediation should be limited, corrections should be independently verified, and production releases should remain subject to human approval.
What's next for SpatialGuard: AI-Powered Spatial Verification
Our vision is to evolve SpatialGuard into an end-to-end, geometry-aware software reliability system.
Future development will focus on connecting spatial verification to GitLab Duo Agent Platform, enabling change-aware test selection, evidence-driven failure investigation, bounded automated remediation, security scanning, verified staging deployment, and runtime health monitoring.
We also want to extend spatial verification beyond floor plans to other applications that manipulate geometry, including CAD software, 3D modelling tools, simulation environments, and digital manufacturing systems.
Our long-term goal is to make spatial correctness a first-class part of the software development lifecycle.
SpatialGuard is built around one principle: don't just ship code that builds—ship software whose critical behaviour has been verified.
Built With
- ai-agents
- automated-testing
- computational-geometry
- devsecops
- gitlab-ci/cd
- gitlab-duo-agent-platform
- javascript
- node.js
- openplan3d
- playwright
- svelte
- sveltekit
- three.js
- typescript
- vitest
Log in or sign up for Devpost to join the conversation.