diff --git a/.github/workflows/dart-test.yaml b/.github/workflows/dart-test.yaml index ecfc6a93..63b3ed55 100644 --- a/.github/workflows/dart-test.yaml +++ b/.github/workflows/dart-test.yaml @@ -49,7 +49,6 @@ jobs: - ubuntu-22.04-arm # linux-arm64 - macos-latest # darwin-arm64 - macos-15-intel # darwin-amd64 - - windows-latest # windows-amd64 # windows-11-arm is out until kcl-lang/kcl publishes a # kcl-lib--windows-arm64.zip: kcl-lang/kcl#2219 adds the # target to that repo's release matrix, but no released version has diff --git a/dart/README.md b/dart/README.md index 34f7cb06..c774dba0 100644 --- a/dart/README.md +++ b/dart/README.md @@ -125,7 +125,10 @@ try { ``` `exec_program` and `validate_code` are **not thread-safe**, mirroring the -spec. +spec. Call them from a single isolate: the shared runtime keeps process-global +state, and overlapping calls can lose a panic payload — the KCL error then +comes back with an empty message. The test suite runs one file at a time for +the same reason; see [`dart_test.yaml`](dart_test.yaml). ## API reference diff --git a/dart/dart_test.yaml b/dart/dart_test.yaml new file mode 100644 index 00000000..512ac536 --- /dev/null +++ b/dart/dart_test.yaml @@ -0,0 +1,17 @@ +# Run one test file at a time. +# +# `dart test` normally loads and runs test *files* concurrently, each in its +# own isolate — but every isolate shares the one loaded `libkcl`, and the KCL +# runtime keeps process-global state its own C API declares not thread-safe. +# The sharpest edge is the panic hook: the Rust side takes, replaces and +# restores the *process-global* `std::panic` hook around every evaluation +# (`FastRunner::run` in kcl_runner) and records the panic payload into a +# thread-local. Two overlapping evaluations can clobber each other's hook, so +# the panicking thread's payload never reaches its own record and the KCL error +# comes back with an empty message — the plugin tests in kcl_lib_test.dart +# then fail on `expect(errMessage, contains(...))`, with the real text showing +# up only in the runtime's stderr. +# +# Serial execution costs ~0.1s on this package, so the suite stays honest +# about what it exercises instead of racing the runtime. +concurrency: 1