Skip to content

Expose placement to constraints, sync 2D/3D positions, demo seed#17

Merged
haphantran merged 2 commits into
mainfrom
paper-backing-features
Jul 12, 2026
Merged

Expose placement to constraints, sync 2D/3D positions, demo seed#17
haphantran merged 2 commits into
mainfrom
paper-backing-features

Conversation

@haphantran

@haphantran haphantran commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

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

  • prepareContextForJS merges the element presentation record (position2D/position3D, size2D/size3D, rotationZ, attachment fields) into self, into peer elements via context.model.elements, and into resolved references, with style taking precedence (mirrors the codegen context builder)
  • Same merge in the OCL evaluation context (ocl.context.ts)
  • New bundled example constraint "Placement Inside Warehouse Bounds" reading self.position3D
  • Makes the demo script step at 2:50-3:10 real: a JS constraint reading self.position3D.x evaluates against persisted values instead of undefined

Feature 2: 2D/3D position write-through

  • New applyPositionWriteThrough in diagram.service.ts, the chokepoint every editor persist path funnels through (3D drag/TransformControls/property panel via updateElement, 2D drag/property panel via updateModelElementPresentationInView)
  • A 3D move always mirrors to position2D; a 2D move mirrors to position3D only when the element already carries a world-space position, so pure 2D notations (e.g. the UML activity example) never gain one
  • The synced delta also flows into the backend API sync call, so the persisted record cannot diverge

Quick items

  • ConveyorLocation template now emits Length/Width/Height in both warehouse example projects (regeneration sanity-checked; the Java coordinate loader regex only reads X/Y, so nothing downstream breaks)
  • Seed script supports a pre-verified demo/reviewer account via DEMO_EMAIL/DEMO_PASSWORD/DEMO_ROLE (default DSL_DESIGNER), wired through both compose files and documented
  • Bugfix found along the way: the seeded admin was created with emailVerified: false and could not log in since PR Add email verification and throttle admin notifications #10; seeded accounts are now created or updated as verified
  • MIT LICENSE added, README License section, docker-setup docs updated
  • Includes the pending Sirius compatibility doc alignment (implemented .odesign subset and .aird view-import subset)

Test plan

  • frontend: 147 tests / 17 suites pass, tsc --noEmit clean
    • new js-sandbox-presentation.test.ts (7 tests: undefined-before, defined-after, style precedence, peers, references, end-to-end sandbox eval)
    • new diagram-position-writethrough.test.ts (6 tests covering both update handlers and the pure-2D gate)
  • backend: 562 tests / 29 suites pass, tsc --noEmit clean, seed script dry-runs without env vars
  • After deploy: retest checklist items 2-4 (2D drag visible in 3D and back after reload) and the spatial JS constraint on the deployed instance

Copilot AI review requested due to automatic review settings July 11, 2026 03:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.presentation placement fields (with style precedence) 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.

Comment thread backend/prisma/seed.ts Outdated
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
@haphantran haphantran force-pushed the paper-backing-features branch from 33b24cd to 93e1adb Compare July 11, 2026 13:42
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@haphantran haphantran merged commit a3cfc30 into main Jul 12, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants