Skip to content

Commit 523ece9

Browse files
committed
docs: changelog and doc polish for the built-in HSQLDB database
1 parent faad38b commit 523ece9

4 files changed

Lines changed: 39 additions & 5 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
3636

3737
Pages still bound to the layout are **named in a warning and the drop proceeds**, matching every other DROP in mxcli (none refuse on dependents) and matching how a layout is normally corrected: re-create it under the same name and the pages rebind by qualified name — verified end to end, back to 0 errors. Left dropped, each page fails **CE1613** "The selected layout … no longer exists", which names the *page* and never the layout, so the warning names the pages and gives the `alter pages … where layout =` repoint.
3838

39+
- **`run --local --db-type hsqldb` — boot with no database server** — a local run can now use Mendix's built-in, file-based HSQLDB instead of PostgreSQL. The runtime already ships the driver and derives the file URL from `DatabaseType` and `DatabaseName`, so the data lands under `<project>/deployment/data/database/hsqldb/`. `--db-host`, `--db-user` and `--db-password` are refused with HSQLDB (it is a file, not a connection) and `--ensure-db` is refused too (there is nothing to provision); PostgreSQL remains the default and is unchanged. Intended for local development and demos only — Mendix marks HSQLDB as local-testing-only.
40+
3941
### Fixed
4042

43+
- **The runtime start cycle did not create a database that does not exist yet** — `RuntimeController.Start` only ran `execute_ddl_commands` when Mendix answered result 3 ("the database has to be updated"). A brand-new database answers result 2 ("the database to be used does not exist"), which was unhandled, so the first boot against the built-in HSQLDB database failed with `start failed: The database to be used does not exist.` Both results now trigger the schema step, and a start that still fails after it says so explicitly.
44+
4145
- **`mxcli run --local` hung forever on Windows at `Starting mxbuild --serve...`** — two POSIX assumptions in `cmd/mxcli/docker` combined. `ServeServer.alive()` (and `LocalRuntime.alive()`) asked `os.Process.Signal(syscall.Signal(0))`, which Go implements as `EWINDOWS` ("not supported by windows") for every signal but `Kill` — so a live mxbuild read as dead and `waitReady()` aborted the boot the instant it launched it. And `Stop()` waited on `cmd.Wait()` after a `killProcessGroup` that on Windows only called `p.Kill()`: mxbuild.exe is a wrapper that launches a Deno web-ext worker (`modeler/tools/deno/win-x64/deno.exe`) which inherits the stdout/stderr pipe `exec.Cmd` hands out, so the orphan kept the pipe open and `Wait()` never saw EOF — no error, no exit, just a hang. Windows now has a real liveness check (`OpenProcess(SYNCHRONIZE)` + `WaitForSingleObject`) and a tree kill (`taskkill /F /T`) behind `signalProcessGroup`/`killProcessGroup`; the POSIX implementations are unchanged. The Windows-only tests in `procgroup_windows_test.go` pin both halves — the tree-kill test fails on the pre-fix code, verified as a control — and a `windows-latest` CI job runs them (asserting they actually executed) so neither can come back.
4246

4347
- **`raise error;` on a microflow's main flow passed check and exec, then failed the build** (mendixlabs/mxcli#1030) — with `[error] [CE0710] "The main flow cannot join an error flow or end in an error event."`, one per microflow. Mendix's error event *re-raises the error being handled*, so it is legal only where an error is in scope: inside an `on error { … }` handler. Studio Pro will not draw the connection from the normal flow to an error event; mxcli could, and did. It is now **MDL084**, at error severity, so `exec`'s pre-flight refuses the script with nothing written (`--no-check` still applies it, for reproducing the build failure).

‎cmd/mxcli/docker/localboot.go‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ import (
3333
// already resolved, to <deployDir>/model/config.json — readDeploymentConstants
3434
// lifts them from there.
3535

36-
// DBConfig is the external Postgres the standalone runtime connects to.
36+
// DBConfig is the database the standalone runtime connects to: either an external
37+
// Postgres (Host/User/Password set) or the runtime's built-in file database
38+
// (Type "HSQLDB", Host/User/Password empty — see applyDatabaseDefaults).
3739
type DBConfig struct {
3840
Type string // e.g. "PostgreSQL"
3941
Host string // "host:port", e.g. "127.0.0.1:5432"

‎cmd/mxcli/docker/runlocal_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,6 @@ func TestDBConfig_IsFileBased(t *testing.T) {
641641
t.Error("PostgreSQL is not file-based")
642642
}
643643
if (DBConfig{Type: "hsqldb"}).IsFileBased() {
644-
t.Error("the check must use the canonical spelling, not the raw flag")
644+
t.Error("the check must use the runtime spelling set by applyDatabaseDefaults, not the raw flag")
645645
}
646646
}

‎docs/plans/2026-09-21-run-local-hsqldb-implementation-plan.md‎

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ func TestDBConfig_IsFileBased(t *testing.T) {
359359
t.Error("PostgreSQL is not file-based")
360360
}
361361
if (DBConfig{Type: "hsqldb"}).IsFileBased() {
362-
t.Error("the check must use the canonical spelling, not the raw flag")
362+
t.Error("the check must use the runtime spelling set by applyDatabaseDefaults, not the raw flag")
363363
}
364364
}
365365
```
@@ -375,10 +375,10 @@ In `cmd/mxcli/docker/localboot.go`, immediately after the `DBConfig` struct, add
375375

376376
```go
377377
// IsFileBased reports whether this is the runtime's built-in file database, which
378-
// has no host to reach. It keys on the canonical spelling set by
378+
// has no host to reach. It keys on the runtime spelling set by
379379
// applyDatabaseDefaults.
380380
func (c DBConfig) IsFileBased() bool {
381-
return IsFileBasedDBType(c.Type)
381+
return c.Type == RuntimeDatabaseType(DBTypeHSQLDB)
382382
}
383383
```
384384

@@ -677,6 +677,11 @@ Expected: compiles (no `undefined`).
677677
Run: `go test -tags integration -run TestRunLocal_HSQLDBNeedsNoDatabaseServer -count=1 -v ./cmd/mxcli/docker/`
678678
Expected: PASS (or SKIP with a clear reason when mxbuild/runtime are absent). If it fails because the HSQLDB files are not under `data/database/hsqldb/`, record the actual directory the runtime logged and update the assertion — that is the one empirical fact this test exists to pin.
679679

680+
The directory assertion was empirically confirmed: the files land at
681+
`deployment/data/database/hsqldb/<name>/app.properties` and `app.script`. The
682+
Gradle bin directory must be on `PATH` (e.g. `/c/Program Files/Mendix/gradle-8.5/bin`)
683+
with `MENDIX_GRADLE_HOME` at the Gradle root, or `mxbuild serve` cannot build.
684+
680685
- [ ] **Step 4: Commit**
681686

682687
```bash
@@ -686,6 +691,29 @@ git commit -m "test: prove run --local boots on the built-in database with no se
686691

687692
---
688693

694+
### Task 6b: Create the schema when the database does not exist yet
695+
696+
**Files:**
697+
- Modify: `cmd/mxcli/docker/runtime_controller.go` (`needsDBUpdate`)
698+
- Test: `cmd/mxcli/docker/runtime_controller_test.go` (`TestNeedsDBUpdate`)
699+
700+
The integration test proved that a **fresh** HSQLDB database does not boot: Mendix's
701+
HSQLDB URL carries `ifexists=true`, so it never creates the file, and `start`
702+
answers M2EE result 2 ("The database to be used does not exist."). `needsDBUpdate`
703+
only recognised result 3.
704+
705+
- [ ] Add test cases `{"result2", &M2EEResponse{Result: 2}, true}` and
706+
`{"no-existing-db-message", &M2EEResponse{Message: "The database to be used does not exist."}, true}`.
707+
- [ ] In `needsDBUpdate`, return true for `resp.Result == 2 || resp.Result == 3`, and
708+
match the lower-cased message `"database to be used does not exist"` as well as
709+
`"database has to be updated"`.
710+
- [ ] In `Start`, track that the schema step ran and report
711+
`start failed after creating or updating the database schema: %s` if the second
712+
start still fails.
713+
- [ ] Commit: `fix: create the schema when the database does not exist yet`.
714+
715+
---
716+
689717
### Task 7: CHANGELOG, full verification, PR
690718

691719
**Files:**

0 commit comments

Comments
 (0)