charoalvarez opened a new issue, #2357:
URL: https://github.com/apache/incubator-kie-issues/issues/2357
# [KIE Sandbox] "Apply Accelerator" breaks DMN files due to path-duplication
bug and unhandled "Moving not supported" error
## Summary
Applying the Quarkus Accelerator to a DMN-based workspace in KIE Sandbox
10.0.0 (Docker deployment) reliably breaks the DMN file(s), making the
subsequent Dev Deployment fail with `404 Not Found` / `File '...' doesn't
exist`. Root cause was identified by inspecting the `10.0.0` tag of
`apache/incubator-kie-tools`.
## Environment
- KIE Sandbox version: **10.0.0**
(`apache/incubator-kie-sandbox-dev-deployment-quarkus-blank-app:10.0.0`,
deployed via Docker Compose)
- Host OS: Windows, Docker Desktop
- Browser: Chrome (DevTools console used for diagnostics)
- DMN spec version in use: **1.5** (required; cannot use DMN 1.6 due to use
case constraints)
## Steps to reproduce (Bug 1 — path duplication)
1. Create a new workspace in KIE Sandbox.
2. Manually create the folder structure `src/main/resources/dmn/` inside the
workspace.
3. Create a DMN file directly inside that folder (e.g.
`src/main/resources/dmn/Despedida.dmn`).
4. Click **Apply Accelerator** → Quarkus Accelerator.
5. Observe in DevTools → Application → IndexedDB that the file before/after
the operation has its path duplicated:
```
src/main/resources/dmn/src/main/resources/dmn/Despedida.dmn
```
6. Console shows:
```
Error: File
'/fs_v1__<workspaceId>/src/main/resources/dmn/src/main/resources/dmn/Despedida.dmn'
doesn't exist
Error: HTTP Error: 404 Not Found
```
## Steps to reproduce (Bug 2 — DMN at workspace root still fails)
1. Create a new workspace, create the DMN file directly **at the workspace
root** (e.g. `/Despedida.dmn`), without any subfolders.
2. Click **Apply Accelerator** → Quarkus Accelerator.
3. Console shows (no path duplication this time, but still fails):
```
Uncaught Error: Moving not supported.
at Hp.n.onmessage (index.js:8:6760162)
Error: File '/fs_v1__<workspaceId>/src/main/resources/dmn/Despedida.dmn'
doesn't exist
Error: HTTP Error: 404 Not Found
```
4. Attempting to deploy the model (Dev Deployment) fails because the file is
never actually present at the expected path inside the generated Quarkus
project.
## Root cause analysis (source: `apache/incubator-kie-tools`, tag `10.0.0`)
### Bug 1 — Path duplication
File: `packages/online-editor/src/accelerators/AcceleratorsHooks.tsx`,
inside `applyAcceleratorToWorkspace`:
```ts
const movedFile = await workspaces.moveFile({
file,
newDirPath: join(fileNewDestination, dirname(file.relativePath)),
});
```
`fileNewDestination` is the accelerator's configured destination folder
(e.g. `src/main/resources/dmn`). The code joins it with
`dirname(file.relativePath)` — the file's **current** directory — presumably to
preserve nested folder structures. This works correctly only when the file is
at the workspace root (`dirname() === "."`). If the file already resides inside
(or under) the accelerator's destination folder, `dirname(file.relativePath)`
returns that same path, and the destination becomes:
```
join("src/main/resources/dmn", "src/main/resources/dmn")
= "src/main/resources/dmn/src/main/resources/dmn"
```
This silently produces a corrupted/duplicated path, and the file becomes
unreachable at the path the rest of the application (DMN Runner, Dev
Deployment) expects.
**Suggested fix:** the destination path computation should not blindly
concatenate the accelerator's destination folder with the file's current
directory. It should either (a) place the file directly at `fileNewDestination`
when the file has no meaningful subfolder structure of its own, or (b) detect
and strip any existing prefix that already matches `fileNewDestination` before
joining, to make the operation idempotent.
### Bug 2 — Unhandled `WSSFS_MOVE` event ("Moving not supported")
File: `packages/online-editor/src/companionFs/CompanionFsHooks.ts`, lines
93-94:
```ts
} else if (data.type === "WSSFS_MOVE") {
throw new Error("Moving not supported.");
}
```
This listener synchronizes a parallel "Companion FS" (used for DMN Runner
form data, etc.) with workspace file system events. It handles `WSSFS_ADD`,
`WSSFS_UPDATE`, `WSSFS_DELETE`, and `WSSFS_RENAME`, but the `WSSFS_MOVE` case
was apparently never implemented and instead throws unconditionally and
unhandled inside a `BroadcastChannel.onmessage` callback.
This event is dispatched from
`packages/workspaces-git-fs/src/services/WorkspaceService.tsx`, inside
`moveFile()`, which is exactly the method called by the Accelerator's
file-moving logic described above. Every time a file is moved (which `Apply
Accelerator` does for every DMN/BPMN/PMML file in the workspace), this
exception is thrown.
While the underlying file move at the storage layer
(`StorageService.moveFile`) appears to complete its own write/delete sequence
independently, this unhandled exception pollutes the console and may interact
badly with the broader multi-branch Git choreography that
`applyAcceleratorToWorkspace` performs (backup branch → temporary branch with
moved files → checkout accelerator files → checkout moved files back). We were
not able to fully confirm via static analysis alone whether this exception
interrupts that choreography in some scenarios (e.g. Bug 2's reproduction,
where the path is computed correctly but the file still ends up missing), but
it is at minimum a real, reproducible defect that should be fixed: `WSSFS_MOVE`
needs a proper handler that mirrors what's done for `WSSFS_RENAME` (copy
content to new path in the Companion FS, then delete the old entry), instead of
throwing.
## Suggested fix for Bug 2
Mirror the existing `WSSFS_RENAME` handling for `WSSFS_MOVE`, since
semantically a "move" is just a rename to a different directory:
```ts
} else if (data.type === "WSSFS_MOVE") {
companionFsService
.get({ workspaceId: data.workspaceId, workspaceFileRelativePath:
data.oldRelativePath })
.then(async (file) => {
const contentBeforeMoving = await file?.getFileContents();
if (canceled.get() || !contentBeforeMoving) {
return;
}
await companionFsService.createOrOverwrite(
{ workspaceId: data.workspaceId, workspaceFileRelativePath:
data.newRelativePath },
decoder.decode(contentBeforeMoving)
);
await companionFsService.delete({
workspaceId: data.workspaceId,
workspaceFileRelativePath: data.oldRelativePath,
});
});
}
```
## Impact
This makes **Apply Accelerator unreliable for any workspace where
DMN/BPMN/PMML files are not located exactly at the workspace root with no
pre-existing folder structure**, and even in the "file at root" case, the
resulting Dev Deployment can fail to find the file afterward. This is a
significant blocker for anyone trying to use Dev Deployments together with the
Quarkus Accelerator on 10.0.0.
## Additional context
We need to remain on KIE Sandbox 10.0.0 specifically because it is (to our
knowledge) the last version whose DMN Editor saves models using the native
**DMN 1.5** schema; later versions may introduce DMN 1.6, which is not
acceptable for our use case due to use case restrictions. We have not been able
to fully confirm from public release notes alone whether a later 10.0.x patch
release already fixes this, so any clarification from maintainers on that point
would also be appreciated.
## Question for maintainers
Has this issue already been fixed in a later release (e.g. a `10.0.x` patch,
`10.1.0`, or `main`)? If so, could you point us to the specific release/tag
where the fix landed? It would also help us a lot to know whether that release
still saves DMN files using the **native DMN 1.5** schema, or whether it has
since moved the DMN Editor's default/save format to DMN 1.6 — we need to stay
on a version that keeps generating DMN 1.5 due to a hard constraint on our use
case.
## Logs (excerpt)
```
index.js:8 Uncaught Error: Moving not supported.
at Hp.n.onmessage (index.js:8:6760162)
index.js:8 Error: File
'/fs_v1__<workspaceId>/src/main/resources/dmn/Despedida.dmn' doesn't exist
at e.callback (index.js:8:3150172)
at e.receive (index.js:8:3152079)
at Object.receive (index.js:8:3147245)
at ready.e.workspacesWorker.port.onmessage (index.js:8:5828777)
index.js:8 Error: HTTP Error: 404 Not Found
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]