Expose placement to constraints, sync 2D/3D positions, demo seed#17
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR advances SpatialDSL Studio’s “spatial” workflow by (1) exposing persisted placement/presentation data to both JS and OCL constraint contexts, (2) ensuring 2D/3D position updates stay synchronized across editor persist paths, and (3) tightening demo/reviewer readiness via seed-script and documentation updates ahead of the 2026-07-15 submission.
Changes:
- Expose
element.presentationplacement fields (withstyleprecedence) to JS and OCL constraint evaluation contexts, including peers and resolved references for JS. - Add a centralized 2D/3D position write-through mechanism in the frontend diagram service, with tests covering both persist paths and the “pure 2D” gate.
- Improve demo/reviewer readiness: demo account seeding (env-driven), seed-account email verification, updated docker/docs, updated warehouse codegen templates, and MIT licensing/docs alignment.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| README.md | Updates Sirius-compatibility wording and documents seeded demo account + adds License section. |
| LICENSE | Adds MIT license text. |
| frontend/src/services/diagram/diagram.service.ts | Adds applyPositionWriteThrough and uses it in both 3D and 2D persist paths. |
| frontend/src/services/constraint/ocl/ocl.context.ts | Adds element.presentation fields into OCL context (style precedence). |
| frontend/src/services/constraint/js/js.sandbox.ts | Adds presentation merging into JS constraint context for self, peers, and resolved refs (style precedence). |
| frontend/src/examples/js-constraint-examples.ts | Adds a new example JS constraint that reads self.position3D. |
| frontend/src/examples/data/warehouse-project.json | Updates ConveyorLocation template to emit Length/Width/Height. |
| frontend/src/examples/data/smart-warehouse-project.json | Updates ConveyorLocation template to emit Length/Width/Height. |
| frontend/src/tests/services/js-sandbox-presentation.test.ts | Adds tests verifying placement exposure in JS constraint context. |
| frontend/src/tests/services/diagram-position-writethrough.test.ts | Adds tests for 2D/3D position write-through behavior. |
| docs/reference/sirius-compatibility.md | Updates .aird compatibility status/details to reflect initial import subset. |
| docs/getting-started/docker-setup.md | Documents demo seed env vars and clarifies production seed guidance. |
| docker-compose.yml | Wires DEMO_* env vars into dev compose backend service. |
| docker-compose.prod.yml | Wires DEMO_* env vars into prod compose backend service. |
| backend/prisma/seed.ts | Adds demo/reviewer account seeding and ensures seeded accounts are email-verified. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Paper-backing features for the tool paper submission: - JS and OCL constraint contexts now merge the element presentation record (position2D/3D, size2D/3D, rotationZ, attachment fields) into self, peer elements, and resolved references, with style taking precedence; adds a bundled warehouse-bounds example constraint - 2D/3D position write-through in diagram.service.ts: a 3D move always mirrors to position2D, a 2D move mirrors to position3D only when the element already has a world-space position, so pure 2D notations never gain one; the synced delta also flows to the backend API - ConveyorLocation codegen template emits Length/Width/Height in both warehouse example projects, so conveyor resizes show up in diffs - Seed script can create a pre-verified demo account via DEMO_EMAIL/DEMO_PASSWORD/DEMO_ROLE; also fixes seeded admin being created unverified (unable to log in since PR #10) - Add MIT LICENSE; document demo seed vars; align Sirius compatibility docs with the implemented .odesign/.aird subsets
33b24cd to
93e1adb
Compare
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.
Summary
Paper-backing features ahead of the 2026-07-15 submission. Implements the two build-spec features plus the quick items.
Feature 1: placement data available to constraints
prepareContextForJSmerges the elementpresentationrecord (position2D/position3D, size2D/size3D, rotationZ, attachment fields) intoself, into peer elements viacontext.model.elements, and into resolved references, withstyletaking precedence (mirrors the codegen context builder)ocl.context.ts)self.position3Dself.position3D.xevaluates against persisted values instead ofundefinedFeature 2: 2D/3D position write-through
applyPositionWriteThroughindiagram.service.ts, the chokepoint every editor persist path funnels through (3D drag/TransformControls/property panel viaupdateElement, 2D drag/property panel viaupdateModelElementPresentationInView)position2D; a 2D move mirrors toposition3Donly when the element already carries a world-space position, so pure 2D notations (e.g. the UML activity example) never gain oneQuick items
ConveyorLocationtemplate now emitsLength/Width/Heightin both warehouse example projects (regeneration sanity-checked; the Java coordinate loader regex only reads X/Y, so nothing downstream breaks)DEMO_EMAIL/DEMO_PASSWORD/DEMO_ROLE(defaultDSL_DESIGNER), wired through both compose files and documentedemailVerified: falseand could not log in since PR Add email verification and throttle admin notifications #10; seeded accounts are now created or updated as verifiedLICENSEadded, README License section, docker-setup docs updated.odesignsubset and.airdview-import subset)Test plan
frontend: 147 tests / 17 suites pass,tsc --noEmitcleanjs-sandbox-presentation.test.ts(7 tests: undefined-before, defined-after, style precedence, peers, references, end-to-end sandbox eval)diagram-position-writethrough.test.ts(6 tests covering both update handlers and the pure-2D gate)backend: 562 tests / 29 suites pass,tsc --noEmitclean, seed script dry-runs without env vars