Run Designer previews with application-owned DI adapters

This commit is contained in:
2026-11-26 16:01:19 +01:00
parent e49d586916
commit 6126967fdc
56 changed files with 2131 additions and 50 deletions
+30 -3
View File
@@ -1,6 +1,30 @@
# Preview API and target adapter qualification
Implementation history: this page records its original bootstrap work package. The [first connected workflow](first-connected-workflow.md) now supplies worker transport, draft overlays and runnable minimal hosts; historical test counts below remain scoped to that earlier step.
The compatibility checks below cover the published 1.0.6 target, the earlier
DI adapter snapshot and the separated FX snapshot. The rest of the page
records the original Java 21 bootstrap qualification. The
[first connected workflow](first-connected-workflow.md) documents worker
transport, draft overlays and runnable minimal hosts.
## Current DI compatibility checks
Use JDK 25 and install the current Designer tools in the Maven repository
that supplies the target artifacts. The release-based legacy fixtures use
`ApplicationContext`.
```sh
python3 scripts/check-preview-fixtures.py --target-java-home "$JAVA_HOME"
```
To repeat the legacy checks on the earlier development snapshot, point
`MAVEN_OPTS` at its separate repository and add
`--neitzellib-version 1.0.7-SNAPSHOT`. Follow the
[Spring fixture guide](../integration-fixtures/spring-di/README.md) for the
separated snapshot and the runtime checks without Neitzel's injection
implementation or Reflections. See the
[baseline record](runtime/neitzellib-baseline.md) for artifact identity.
## Original bootstrap qualification
Work package 6 is implemented against the [verified NeitzelLib development artifact](runtime/neitzellib-baseline.md), Java 21 and application JavaFX 21.0.7. This qualifies target-side execution; it does not connect the designer UI, snapshot activation or worker transport. Those remain work package 7.
@@ -12,7 +36,10 @@ The dependency-free Java 21 preview API contains:
- `PreviewProvider<M,C>`: `modelType()` and `open(exampleId)`.
- `PreviewSession<M,C>`: `model()`, `context()`, asynchronous `ready()` and `close()`.
The NeitzelLib target adapter requires an `ApplicationContext` context. Providers have public no-argument constructors. They create fresh Models and explicitly configured services after selection, on the target FX thread. They own cleanup of partial allocations when construction throws before returning a session. The adapter owns the returned session and calls its cleanup once on load failure, readiness failure, timeout, cancellation or normal close.
The original fixtures use `ApplicationContext`. Current workers also accept
`ViewDependencies` when the captured FX runtime supplies the DI adapter API.
The [Spring fixture](../integration-fixtures/spring-di/README.md) qualifies
that path. Providers have public no-argument constructors. They create fresh Models and explicitly configured services after selection, on the target FX thread. They own cleanup of partial allocations when construction throws before returning a session. The adapter owns the returned session and calls its cleanup once on load failure, readiness failure, timeout, cancellation or normal close.
Discovery reads UTF-8 `META-INF/neitzel-fx-designer/examples.properties` resources without loading provider or Model classes. This development metadata contract has format version 1:
@@ -35,7 +62,7 @@ These are tested development signatures, not a published API release or a promis
## Lifecycle boundary established by the fixtures
NeitzelLib's `ViewModels` retains Model/ViewModel identities in a process-wide identity map with no public disposal operation. Closing a session releases provider-owned resources but cannot clear that map. Consequently `TargetPreview` allows **one session per target JVM**, including failed sessions. Every restart and interactive preview needs a fresh process.
The original Java 21 FX artifact retained Model/ViewModel identities in a process-wide identity map. That qualification established **one session per target JVM**, including failed sessions. The same process ownership rule still applies. Current managed loaders use a `ViewModelContext`. The worker closes it before the preview session's provider-owned services.
The adapter's readiness deadline and cleanup are cooperative FX-thread operations. A blocked constructor, Controller or cleanup hook cannot be interrupted by the adapter. Work package 7 must enforce an external process deadline, bounded graceful shutdown and forced termination using the host-owned lifetime channel. The fixture runner enforces a 30-second process timeout. Session close is not proof that library-held objects have been garbage-collected.