Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/dart-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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-<version>-windows-arm64.zip: kcl-lang/kcl#2219 adds the
# target to that repo's release matrix, but no released version has
Expand Down
5 changes: 4 additions & 1 deletion dart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
17 changes: 17 additions & 0 deletions dart/dart_test.yaml
Original file line number Diff line number Diff line change
@@ -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
Loading