Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

feat(data-recipes, validators): extend OXC validator with linting mode support and integrate new modes into recipe studio

Shine1i3cafc0506e3f
diff --git a/studio/backend/core/data_recipe/local_callable_validators.py b/studio/backend/core/data_recipe/local_callable_validators.py
index b9804e4b280..abaec5b069e 100644
--- a/studio/backend/core/data_recipe/local_callable_validators.py
+++ b/studio/backend/core/data_recipe/local_callable_validators.py
@@ -19,6 +19,7 @@ _OXC_LANG_TO_NODE_LANG = {
"jsx": "jsx",
"tsx": "tsx",
}
+_OXC_VALIDATION_MODES = {"syntax", "lint", "syntax+lint"}
_OXC_TOOL_DIR = Path(__file__).resolve().parent / "oxc-validator"
_OXC_RUNNER_PATH = _OXC_TOOL_DIR / "validate.mjs"
@@ -31,6 +32,7 @@ class OxcLocalCallableValidatorSpec:
target_columns: list[str]
batch_size: int
code_lang: str
+ validation_mode: str
def split_oxc_local_callable_validators(
@@ -45,7 +47,6 @@ def split_oxc_local_callable_validators(
if not isinstance(sanitized_columns, list):
return sanitized, []
- llm_code_lang_by_name = _extract_llm_code_lang_by_name(sanitized_columns)
kept_columns: list[Any] = []
oxc_specs: list[OxcLocalCallableValidatorSpec] = []
@@ -54,10 +55,7 @@ def split_oxc_local_callable_validators(
kept_columns.append(column)
continue
- maybe_spec = _parse_oxc_spec(
- column=column,
- llm_code_lang_by_name=llm_code_lang_by_name,
- )
+ maybe_spec = _parse_oxc_spec(column=column)
if maybe_spec is None:
kept_columns.append(column)
continue
@@ -82,7 +80,10 @@ def register_oxc_local_callable_validators(
)
for spec in specs:
- validation_function = _build_oxc_validation_function(spec.code_lang)
+ validation_function = _build_oxc_validation_function(
+ spec.code_lang,
+ spec.validation_mode,
+ )
builder.add_column(
ValidationColumnConfig(
name=spec.name,
@@ -100,7 +101,6 @@ def register_oxc_local_callable_validators(
def _parse_oxc_spec(
*,
column: dict[str, Any],
- llm_code_lang_by_name: dict[str, str],
) -> OxcLocalCallableValidatorSpec | None:
if str(column.get("column_type") or "").strip() != "validation":
return None
@@ -129,11 +129,7 @@ def _parse_oxc_spec(
if not target_columns:
return None
- code_lang = _resolve_oxc_lang(
- fn_name=fn_name,
- target_columns=target_columns,
- llm_code_lang_by_name=llm_code_lang_by_name,
- )
+ code_lang, validation_mode = _parse_oxc_validation_marker(fn_name)
batch_size = _parse_batch_size(column.get("batch_size"))
drop = bool(column.get("drop") is True)
@@ -143,6 +139,7 @@ def _parse_oxc_spec(
target_columns=target_columns,
batch_size=batch_size,
code_lang=code_lang,
+ validation_mode=validation_mode,
)
@@ -154,41 +151,27 @@ def _parse_batch_size(value: Any) -> int:
return parsed if parsed >= 1 else 10
-def _extract_llm_code_lang_by_name(columns: list[Any]) -> dict[str, str]:
- out: dict[str, str] = {}
- for column in columns:
- if not isinstance(column, dict):
- continue
- if str(column.get("column_type") or "").strip() != "llm-code":
- continue
- name = str(column.get("name") or "").strip()
- code_lang = str(column.get("code_lang") or "").strip()
- if name and code_lang:
- out[name] = code_lang
- return out
-
-
-def _resolve_oxc_lang(
- *,
- fn_name: str,
- target_columns: list[str],
- llm_code_lang_by_name: dict[str, str],
-) -> str:
- _, _, marker_lang = fn_name.partition(":")
- marker_lang = marker_lang.strip()
- if marker_lang in _OXC_LANG_TO_NODE_LANG:
- return marker_lang
-
- first_target = target_columns[0]
- target_lang = llm_code_lang_by_name.get(first_target, "").strip()
- if target_lang in _OXC_LANG_TO_NODE_LANG:
- return target_lang
- return "javascript"
+def _parse_oxc_validation_marker(fn_name: str) -> tuple[str, str]:
+ marker = f"{OXC_VALIDATION_FN_MARKER}:"
+ if not fn_name.startswith(marker):
+ return "javascript", "syntax"
+ suffix = fn_name[len(marker) :]
+ parts = [part.strip() for part in suffix.split(":") if part.strip()]
+ if len(parts) < 2:
+ return "javascript", "syntax"
+ code_lang = parts[0] if parts[0] in _OXC_LANG_TO_NODE_LANG else "javascript"
+ mode = parts[1] if parts[1] in _OXC_VALIDATION_MODES else "syntax"
+ return code_lang, mode
@lru_cache(maxsize=8)
-def _build_oxc_validation_function(lang: str):
+def _build_oxc_validation_function(lang: str, validation_mode: str):
node_lang = _OXC_LANG_TO_NODE_LANG.get(lang, "js")
+ mode = (
+ validation_mode
+ if validation_mode in _OXC_VALIDATION_MODES
+ else "syntax"
+ )
def _validator(df):
import pandas as pd # imported lazily for local callable runtime
@@ -204,7 +187,11 @@ def _build_oxc_validation_function(lang: str):
else ["" if value is None else str(value) for value in df[code_column].tolist()]
)
- results = _run_oxc_batch(node_lang=node_lang, code_values=code_values)
+ results = _run_oxc_batch(
+ node_lang=node_lang,
+ validation_mode=mode,
+ code_values=code_values,
+ )
if len(results) != row_count:
results = _fallback_results(
row_count,
@@ -212,11 +199,16 @@ def _build_oxc_validation_function(lang: str):
)
return pd.DataFrame(results)
- _validator.__name__ = f"{OXC_VALIDATION_FN_MARKER}_{node_lang}"
+ _validator.__name__ = f"{OXC_VALIDATION_FN_MARKER}_{node_lang}_{mode.replace('+', '_')}"
return _validator
-def _run_oxc_batch(*, node_lang: str, code_values: list[str]) -> list[dict[str, Any]]:
+def _run_oxc_batch(
+ *,
+ node_lang: str,
+ validation_mode: str,
+ code_values: list[str],
+) -> list[dict[str, Any]]:
if not _OXC_RUNNER_PATH.exists():
return _fallback_results(
len(code_values),
@@ -225,6 +217,7 @@ def _run_oxc_batch(*, node_lang: str, code_values: list[str]) -> list[dict[str,
payload = {
"lang": node_lang,
+ "mode": validation_mode,
"codes": code_values,
}
try:
@@ -265,6 +258,7 @@ def _run_oxc_batch(*, node_lang: str, code_values: list[str]) -> list[dict[str,
"severity": None,
"labels": [],
"codeframe": None,
+ "warning_count": 0,
}
)
continue
@@ -274,6 +268,7 @@ def _run_oxc_batch(*, node_lang: str, code_values: list[str]) -> list[dict[str,
severity_raw = item.get("severity")
labels_raw = item.get("labels")
codeframe_raw = item.get("codeframe")
+ warning_count_raw = item.get("warning_count")
out.append(
{
"is_valid": bool(is_valid_raw) if isinstance(is_valid_raw, bool) else False,
@@ -282,6 +277,9 @@ def _run_oxc_batch(*, node_lang: str, code_values: list[str]) -> list[dict[str,
"severity": str(severity_raw) if isinstance(severity_raw, str) else None,
"labels": labels_raw if isinstance(labels_raw, list) else [],
"codeframe": str(codeframe_raw) if isinstance(codeframe_raw, str) else None,
+ "warning_count": int(warning_count_raw)
+ if isinstance(warning_count_raw, int)
+ else 0,
}
)
return out
@@ -296,6 +294,7 @@ def _fallback_results(row_count: int, message: str) -> list[dict[str, Any]]:
"severity": None,
"labels": [],
"codeframe": None,
+ "warning_count": 0,
}
for _ in range(row_count)
]
diff --git a/studio/backend/core/data_recipe/oxc-validator/package-lock.json b/studio/backend/core/data_recipe/oxc-validator/package-lock.json
index 2a97d4514ea..0e16cc41877 100644
--- a/studio/backend/core/data_recipe/oxc-validator/package-lock.json
+++ b/studio/backend/core/data_recipe/oxc-validator/package-lock.json
@@ -8,7 +8,8 @@
"name": "unsloth-oxc-validator-runtime",
"version": "0.0.1",
"dependencies": {
- "oxc-parser": "^0.116.0"
+ "oxc-parser": "^0.116.0",
+ "oxlint": "^1.51.0"
}
},
"node_modules/@emnapi/core": {
@@ -387,6 +388,310 @@
"url": "https://github.com/sponsors/Boshen"
}
},
+ "node_modules/@oxlint/binding-android-arm-eabi": {
+ "version": "1.51.0",
+ "resolved": "https://registry.npmjs.org/@oxlint/binding-android-arm-eabi/-/binding-android-arm-eabi-1.51.0.tgz",
+ "integrity": "sha512-jJYIqbx4sX+suIxWstc4P7SzhEwb4ArWA2KVrmEuu9vH2i0qM6QIHz/ehmbGE4/2fZbpuMuBzTl7UkfNoqiSgw==",
+ "cpu": [
+ "arm"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxlint/binding-android-arm64": {
+ "version": "1.51.0",
+ "resolved": "https://registry.npmjs.org/@oxlint/binding-android-arm64/-/binding-android-arm64-1.51.0.tgz",
+ "integrity": "sha512-GtXyBCcH4ti98YdiMNCrpBNGitx87EjEWxevnyhcBK12k/Vu4EzSB45rzSC4fGFUD6sQgeaxItRCEEWeVwPafw==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxlint/binding-darwin-arm64": {
+ "version": "1.51.0",
+ "resolved": "https://registry.npmjs.org/@oxlint/binding-darwin-arm64/-/binding-darwin-arm64-1.51.0.tgz",
+ "integrity": "sha512-3QJbeYaMHn6Bh2XeBXuITSsbnIctyTjvHf5nRjKYrT9pPeErNIpp5VDEeAXC0CZSwSVTsc8WOSDwgrAI24JolQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxlint/binding-darwin-x64": {
+ "version": "1.51.0",
+ "resolved": "https://registry.npmjs.org/@oxlint/binding-darwin-x64/-/binding-darwin-x64-1.51.0.tgz",
+ "integrity": "sha512-NzErhMaTEN1cY0E8C5APy74lw5VwsNfJfVPBMWPVQLqAbO0k4FFLjvHURvkUL+Y18Wu+8Vs1kbqPh2hjXYA4pg==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxlint/binding-freebsd-x64": {
+ "version": "1.51.0",
+ "resolved": "https://registry.npmjs.org/@oxlint/binding-freebsd-x64/-/binding-freebsd-x64-1.51.0.tgz",
+ "integrity": "sha512-msAIh3vPAoKoHlOE/oe6Q5C/n9umypv/k81lED82ibrJotn+3YG2Qp1kiR8o/Dg5iOEU97c6tl0utxcyFenpFw==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxlint/binding-linux-arm-gnueabihf": {
+ "version": "1.51.0",
+ "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.51.0.tgz",
+ "integrity": "sha512-CqQPcvqYyMe9ZBot2stjGogEzk1z8gGAngIX7srSzrzexmXixwVxBdFZyxTVM0CjGfDeV+Ru0w25/WNjlMM2Hw==",
+ "cpu": [
+ "arm"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxlint/binding-linux-arm-musleabihf": {
+ "version": "1.51.0",
+ "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm-musleabihf/-/binding-linux-arm-musleabihf-1.51.0.tgz",
+ "integrity": "sha512-dstrlYQgZMnyOssxSbolGCge/sDbko12N/35RBNuqLpoPbft2aeBidBAb0dvQlyBd9RJ6u8D4o4Eh8Un6iTgyQ==",
+ "cpu": [
+ "arm"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxlint/binding-linux-arm64-gnu": {
+ "version": "1.51.0",
+ "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.51.0.tgz",
+ "integrity": "sha512-QEjUpXO7d35rP1/raLGGbAsBLLGZIzV3ZbeSjqWlD3oRnxpRIZ6iL4o51XQHkconn3uKssc+1VKdtHJ81BBhDA==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxlint/binding-linux-arm64-musl": {
+ "version": "1.51.0",
+ "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.51.0.tgz",
+ "integrity": "sha512-YSJua5irtG4DoMAjUapDTPhkQLHhBIY0G9JqlZS6/SZPzqDkPku/1GdWs0D6h/wyx0Iz31lNCfIaWKBQhzP0wQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxlint/binding-linux-ppc64-gnu": {
+ "version": "1.51.0",
+ "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.51.0.tgz",
+ "integrity": "sha512-7L4Wj2IEUNDETKssB9IDYt16T6WlF+X2jgC/hBq3diGHda9vJLpAgb09+D3quFq7TdkFtI7hwz/jmuQmQFPc1Q==",
+ "cpu": [
+ "ppc64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxlint/binding-linux-riscv64-gnu": {
+ "version": "1.51.0",
+ "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-1.51.0.tgz",
+ "integrity": "sha512-cBUHqtOXy76G41lOB401qpFoKx1xq17qYkhWrLSM7eEjiHM9sOtYqpr6ZdqCnN9s6ZpzudX4EkeHOFH2E9q0vA==",
+ "cpu": [
+ "riscv64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxlint/binding-linux-riscv64-musl": {
+ "version": "1.51.0",
+ "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-1.51.0.tgz",
+ "integrity": "sha512-WKbg8CysgZcHfZX0ixQFBRSBvFZUHa3SBnEjHY2FVYt2nbNJEjzTxA3ZR5wMU0NOCNKIAFUFvAh5/XJKPRJuJg==",
+ "cpu": [
+ "riscv64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxlint/binding-linux-s390x-gnu": {
+ "version": "1.51.0",
+ "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.51.0.tgz",
+ "integrity": "sha512-N1QRUvJTxqXNSu35YOufdjsAVmKVx5bkrggOWAhTWBc3J4qjcBwr1IfyLh/6YCg8sYRSR1GraldS9jUgJL/U4A==",
+ "cpu": [
+ "s390x"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxlint/binding-linux-x64-gnu": {
+ "version": "1.51.0",
+ "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.51.0.tgz",
+ "integrity": "sha512-e0Mz0DizsCoqNIjeOg6OUKe8JKJWZ5zZlwsd05Bmr51Jo3AOL4UJnPvwKumr4BBtBrDZkCmOLhCvDGm95nJM2g==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxlint/binding-linux-x64-musl": {
+ "version": "1.51.0",
+ "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-x64-musl/-/binding-linux-x64-musl-1.51.0.tgz",
+ "integrity": "sha512-wD8HGTWhYBKXvRDvoBVB1y+fEYV01samhWQSy1Zkxq2vpezvMnjaFKRuiP6tBNITLGuffbNDEXOwcAhJ3gI5Ug==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxlint/binding-openharmony-arm64": {
+ "version": "1.51.0",
+ "resolved": "https://registry.npmjs.org/@oxlint/binding-openharmony-arm64/-/binding-openharmony-arm64-1.51.0.tgz",
+ "integrity": "sha512-5NSwQ2hDEJ0GPXqikjWtwzgAQCsS7P9aLMNenjjKa+gknN3lTCwwwERsT6lKXSirfU3jLjexA2XQvQALh5h27w==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openharmony"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxlint/binding-win32-arm64-msvc": {
+ "version": "1.51.0",
+ "resolved": "https://registry.npmjs.org/@oxlint/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.51.0.tgz",
+ "integrity": "sha512-JEZyah1M0RHMw8d+jjSSJmSmO8sABA1J1RtrHYujGPeCkYg1NeH0TGuClpe2h5QtioRTaF57y/TZfn/2IFV6fA==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxlint/binding-win32-ia32-msvc": {
+ "version": "1.51.0",
+ "resolved": "https://registry.npmjs.org/@oxlint/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-1.51.0.tgz",
+ "integrity": "sha512-q3cEoKH6kwjz/WRyHwSf0nlD2F5Qw536kCXvmlSu+kaShzgrA0ojmh45CA81qL+7udfCaZL2SdKCZlLiGBVFlg==",
+ "cpu": [
+ "ia32"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxlint/binding-win32-x64-msvc": {
+ "version": "1.51.0",
+ "resolved": "https://registry.npmjs.org/@oxlint/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.51.0.tgz",
+ "integrity": "sha512-Q14+fOGb9T28nWF/0EUsYqERiRA7cl1oy4TJrGmLaqhm+aO2cV+JttboHI3CbdeMCAyDI1+NoSlrM7Melhp/cw==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
"node_modules/@tybys/wasm-util": {
"version": "0.10.1",
"resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.1.tgz",
@@ -434,6 +739,50 @@
"@oxc-parser/binding-win32-x64-msvc": "0.116.0"
}
},
+ "node_modules/oxlint": {
+ "version": "1.51.0",
+ "resolved": "https://registry.npmjs.org/oxlint/-/oxlint-1.51.0.tgz",
+ "integrity": "sha512-g6DNPaV9/WI9MoX2XllafxQuxwY1TV++j7hP8fTJByVBuCoVtm3dy9f/2vtH/HU40JztcgWF4G7ua+gkainklQ==",
+ "license": "MIT",
+ "bin": {
+ "oxlint": "bin/oxlint"
+ },
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/Boshen"
+ },
+ "optionalDependencies": {
+ "@oxlint/binding-android-arm-eabi": "1.51.0",
+ "@oxlint/binding-android-arm64": "1.51.0",
+ "@oxlint/binding-darwin-arm64": "1.51.0",
+ "@oxlint/binding-darwin-x64": "1.51.0",
+ "@oxlint/binding-freebsd-x64": "1.51.0",
+ "@oxlint/binding-linux-arm-gnueabihf": "1.51.0",
+ "@oxlint/binding-linux-arm-musleabihf": "1.51.0",
+ "@oxlint/binding-linux-arm64-gnu": "1.51.0",
+ "@oxlint/binding-linux-arm64-musl": "1.51.0",
+ "@oxlint/binding-linux-ppc64-gnu": "1.51.0",
+ "@oxlint/binding-linux-riscv64-gnu": "1.51.0",
+ "@oxlint/binding-linux-riscv64-musl": "1.51.0",
+ "@oxlint/binding-linux-s390x-gnu": "1.51.0",
+ "@oxlint/binding-linux-x64-gnu": "1.51.0",
+ "@oxlint/binding-linux-x64-musl": "1.51.0",
+ "@oxlint/binding-openharmony-arm64": "1.51.0",
+ "@oxlint/binding-win32-arm64-msvc": "1.51.0",
+ "@oxlint/binding-win32-ia32-msvc": "1.51.0",
+ "@oxlint/binding-win32-x64-msvc": "1.51.0"
+ },
+ "peerDependencies": {
+ "oxlint-tsgolint": ">=0.15.0"
+ },
+ "peerDependenciesMeta": {
+ "oxlint-tsgolint": {
+ "optional": true
+ }
+ }
+ },
"node_modules/tslib": {
"version": "2.8.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
diff --git a/studio/backend/core/data_recipe/oxc-validator/package.json b/studio/backend/core/data_recipe/oxc-validator/package.json
index 2d1618162d7..a47c0ea521e 100644
--- a/studio/backend/core/data_recipe/oxc-validator/package.json
+++ b/studio/backend/core/data_recipe/oxc-validator/package.json
@@ -4,6 +4,7 @@
"version": "0.0.1",
"type": "module",
"dependencies": {
- "oxc-parser": "^0.116.0"
+ "oxc-parser": "^0.116.0",
+ "oxlint": "^1.51.0"
}
}
diff --git a/studio/backend/core/data_recipe/oxc-validator/validate.mjs b/studio/backend/core/data_recipe/oxc-validator/validate.mjs
index 2fe94e0833a..28f9f242e38 100644
--- a/studio/backend/core/data_recipe/oxc-validator/validate.mjs
+++ b/studio/backend/core/data_recipe/oxc-validator/validate.mjs
@@ -1,3 +1,8 @@
+import { spawnSync } from "node:child_process";
+import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
+import { tmpdir } from "node:os";
+import { basename, dirname, join } from "node:path";
+import { fileURLToPath } from "node:url";
import { parseSync } from "oxc-parser";
const LANG_TO_EXT = {
@@ -7,6 +12,9 @@ const LANG_TO_EXT = {
tsx: "tsx",
};
+const VALIDATION_MODES = new Set(["syntax", "lint", "syntax+lint"]);
+const TOOL_DIR = dirname(fileURLToPath(import.meta.url));
+
function mapLang(value) {
const normalized = String(value || "").trim().toLowerCase();
if (normalized === "javascript" || normalized === "js") {
@@ -24,10 +32,30 @@ function mapLang(value) {
return "js";
}
-function normalizeError(error) {
+function mapMode(value) {
+ const normalized = String(value || "").trim().toLowerCase();
+ if (VALIDATION_MODES.has(normalized)) {
+ return normalized;
+ }
+ return "syntax";
+}
+
+function parseFileIndex(filePath) {
+ if (typeof filePath !== "string") {
+ return null;
+ }
+ const match = basename(filePath).match(/^snippet_(\d+)\./);
+ if (!match) {
+ return null;
+ }
+ const parsed = Number.parseInt(match[1], 10);
+ return Number.isFinite(parsed) ? parsed : null;
+}
+
+function normalizeParserError(error) {
if (typeof error === "string") {
return {
- message: error.trim() || "Unknown OXC error",
+ message: error.trim() || "Unknown parser error",
severity: null,
labels: [],
codeframe: null,
@@ -35,13 +63,13 @@ function normalizeError(error) {
}
if (!error || typeof error !== "object") {
return {
- message: "Unknown OXC error",
+ message: "Unknown parser error",
severity: null,
labels: [],
codeframe: null,
};
}
- const message = String(error.message || error.reason || "").trim() || "Unknown OXC error";
+ const message = String(error.message || error.reason || "").trim() || "Unknown parser error";
const severity = typeof error.severity === "string" ? error.severity : null;
const labels = Array.isArray(error.labels)
? error.labels.map((label) => ({
@@ -68,7 +96,70 @@ function normalizeError(error) {
};
}
-function validateOne({ code, lang, index }) {
+function normalizeLintDiagnostic(diagnostic) {
+ if (!diagnostic || typeof diagnostic !== "object") {
+ return null;
+ }
+ const message = String(diagnostic.message || "").trim();
+ if (!message) {
+ return null;
+ }
+ const severityRaw = String(diagnostic.severity || "").trim().toLowerCase();
+ const severity = severityRaw === "error" ? "error" : "warning";
+ const labels = Array.isArray(diagnostic.labels)
+ ? diagnostic.labels.map((label) => {
+ const span = label && typeof label === "object" ? label.span : null;
+ const start =
+ span && typeof span === "object" && Number.isInteger(span.offset)
+ ? span.offset
+ : null;
+ const length =
+ span && typeof span === "object" && Number.isInteger(span.length)
+ ? span.length
+ : null;
+ return {
+ message:
+ label && typeof label === "object" && typeof label.label === "string"
+ ? label.label
+ : null,
+ start,
+ end:
+ start !== null && length !== null
+ ? start + length
+ : null,
+ };
+ })
+ : [];
+ const code = typeof diagnostic.code === "string" ? diagnostic.code : null;
+ return {
+ message: code ? `${code}: ${message}` : message,
+ severity,
+ labels,
+ codeframe: null,
+ };
+}
+
+function makeResult({
+ isValid,
+ errorCount,
+ warningCount = 0,
+ message = "",
+ severity = null,
+ labels = [],
+ codeframe = null,
+}) {
+ return {
+ is_valid: Boolean(isValid),
+ error_count: Number.isInteger(errorCount) ? errorCount : 0,
+ warning_count: Number.isInteger(warningCount) ? warningCount : 0,
+ error_message: String(message || ""),
+ severity: typeof severity === "string" ? severity : null,
+ labels: Array.isArray(labels) ? labels : [],
+ codeframe: typeof codeframe === "string" ? codeframe : null,
+ };
+}
+
+function validateSyntaxOne({ code, lang, index }) {
const ext = LANG_TO_EXT[lang] ?? "js";
const filename = `snippet_${index}.${ext}`;
const source = typeof code === "string" ? code : String(code ?? "");
@@ -80,27 +171,145 @@ function validateOne({ code, lang, index }) {
showSemanticErrors: true,
});
const errors = Array.isArray(parsed?.errors)
- ? parsed.errors.map(normalizeError).filter(Boolean)
+ ? parsed.errors.map(normalizeParserError).filter(Boolean)
: [];
const first = errors[0] ?? null;
- return {
- is_valid: errors.length === 0,
- error_count: errors.length,
- error_message: errors.slice(0, 3).map((error) => error.message).join(" | "),
+ return makeResult({
+ isValid: errors.length === 0,
+ errorCount: errors.length,
+ warningCount: 0,
+ message: errors.slice(0, 3).map((error) => error.message).join(" | "),
severity: first ? first.severity : null,
labels: first ? first.labels : [],
codeframe: first ? first.codeframe : null,
- };
+ });
} catch (error) {
- const normalized = normalizeError(error);
- return {
- is_valid: false,
- error_count: 1,
- error_message: normalized.message,
+ const normalized = normalizeParserError(error);
+ return makeResult({
+ isValid: false,
+ errorCount: 1,
+ warningCount: 0,
+ message: normalized.message,
severity: normalized.severity,
labels: normalized.labels,
codeframe: normalized.codeframe,
- };
+ });
+ }
+}
+
+function fallbackLintResults(indexedCodes, message) {
+ return new Map(
+ indexedCodes.map((item) => [
+ item.index,
+ makeResult({
+ isValid: false,
+ errorCount: 1,
+ warningCount: 0,
+ message,
+ severity: "error",
+ }),
+ ]),
+ );
+}
+
+function runLintBatch(indexedCodes, lang) {
+ if (indexedCodes.length === 0) {
+ return new Map();
+ }
+
+ const ext = LANG_TO_EXT[lang] ?? "js";
+ const tempDir = mkdtempSync(join(tmpdir(), "oxlint-"));
+ try {
+ for (const item of indexedCodes) {
+ const filePath = join(tempDir, `snippet_${item.index}.${ext}`);
+ const source = typeof item.code === "string" ? item.code : String(item.code ?? "");
+ writeFileSync(filePath, source, "utf8");
+ }
+
+ const oxlintBin = join(TOOL_DIR, "node_modules", ".bin", "oxlint");
+ const exec = spawnSync(oxlintBin, ["--format", "json", tempDir], {
+ encoding: "utf8",
+ cwd: TOOL_DIR,
+ });
+ if (exec.error) {
+ return fallbackLintResults(
+ indexedCodes,
+ `oxlint execution failed: ${exec.error.message}`,
+ );
+ }
+ const stdout = String(exec.stdout || "").trim();
+ if (!stdout) {
+ const stderr = String(exec.stderr || "").trim();
+ return fallbackLintResults(
+ indexedCodes,
+ stderr || "oxlint returned empty output",
+ );
+ }
+
+ let parsed;
+ try {
+ parsed = JSON.parse(stdout);
+ } catch {
+ return fallbackLintResults(indexedCodes, "oxlint JSON parse failed");
+ }
+
+ const rawDiagnostics = Array.isArray(parsed?.diagnostics)
+ ? parsed.diagnostics
+ : [];
+ const byIndex = new Map();
+
+ for (const diag of rawDiagnostics) {
+ const normalized = normalizeLintDiagnostic(diag);
+ if (!normalized) {
+ continue;
+ }
+ const filenameRaw =
+ typeof diag?.filename === "string" ? diag.filename : "";
+ const filename = filenameRaw.startsWith("file://")
+ ? filenameRaw.replace("file://", "")
+ : filenameRaw;
+ const index = parseFileIndex(filename);
+ if (index === null) {
+ continue;
+ }
+ const list = byIndex.get(index) ?? [];
+ list.push(normalized);
+ byIndex.set(index, list);
+ }
+
+ const results = new Map();
+ for (const item of indexedCodes) {
+ const diagnostics = byIndex.get(item.index) ?? [];
+ const errorDiagnostics = diagnostics.filter(
+ (diag) => diag.severity === "error",
+ );
+ const warningDiagnostics = diagnostics.filter(
+ (diag) => diag.severity !== "error",
+ );
+ const top = errorDiagnostics[0] ?? warningDiagnostics[0] ?? null;
+ const messageSource =
+ errorDiagnostics.length > 0 ? errorDiagnostics : warningDiagnostics;
+ results.set(
+ item.index,
+ makeResult({
+ isValid: errorDiagnostics.length === 0,
+ errorCount: errorDiagnostics.length,
+ warningCount: warningDiagnostics.length,
+ message: messageSource
+ .slice(0, 3)
+ .map((diag) => diag.message)
+ .join(" | "),
+ severity: top ? top.severity : null,
+ labels: top ? top.labels : [],
+ codeframe: top ? top.codeframe : null,
+ }),
+ );
+ }
+ return results;
+ } catch (error) {
+ return fallbackLintResults(indexedCodes, `oxlint execution failed: ${error}`);
+ } finally {
+ rmSync(tempDir, { recursive: true, force: true });
}
}
@@ -116,6 +325,47 @@ function readStdin() {
});
}
+function runValidation({ codes, lang, mode }) {
+ if (mode === "syntax") {
+ return codes.map((code, index) => validateSyntaxOne({ code, lang, index }));
+ }
+ if (mode === "lint") {
+ const indexedCodes = codes.map((code, index) => ({ index, code }));
+ const lintMap = runLintBatch(indexedCodes, lang);
+ return indexedCodes.map(
+ (item) =>
+ lintMap.get(item.index) ??
+ makeResult({
+ isValid: true,
+ errorCount: 0,
+ warningCount: 0,
+ }),
+ );
+ }
+
+ const syntaxResults = codes.map((code, index) =>
+ validateSyntaxOne({ code, lang, index }),
+ );
+ const lintTargets = codes
+ .map((code, index) => ({ index, code }))
+ .filter((item) => syntaxResults[item.index]?.is_valid === true);
+ const lintMap = runLintBatch(lintTargets, lang);
+
+ return syntaxResults.map((syntaxResult, index) => {
+ if (syntaxResult.is_valid !== true) {
+ return syntaxResult;
+ }
+ return (
+ lintMap.get(index) ??
+ makeResult({
+ isValid: true,
+ errorCount: 0,
+ warningCount: 0,
+ })
+ );
+ });
+}
+
async function main() {
const raw = await readStdin();
let payload;
@@ -124,22 +374,22 @@ async function main() {
} catch {
process.stdout.write(
JSON.stringify([
- {
- is_valid: false,
- error_count: 1,
- error_message: "Invalid JSON payload",
- severity: null,
- labels: [],
- codeframe: null,
- },
+ makeResult({
+ isValid: false,
+ errorCount: 1,
+ warningCount: 0,
+ message: "Invalid JSON payload",
+ severity: "error",
+ }),
]),
);
return;
}
const lang = mapLang(payload?.lang);
+ const mode = mapMode(payload?.mode);
const codes = Array.isArray(payload?.codes) ? payload.codes : [];
- const out = codes.map((code, index) => validateOne({ code, lang, index }));
+ const out = runValidation({ codes, lang, mode });
process.stdout.write(JSON.stringify(out));
}
diff --git a/studio/frontend/src/features/recipe-studio/dialogs/validators/validator-dialog.tsx b/studio/frontend/src/features/recipe-studio/dialogs/validators/validator-dialog.tsx
index 536d2445dab..dfe3c568ebb 100644
--- a/studio/frontend/src/features/recipe-studio/dialogs/validators/validator-dialog.tsx
+++ b/studio/frontend/src/features/recipe-studio/dialogs/validators/validator-dialog.tsx
@@ -3,6 +3,14 @@ import {
CollapsibleContent,
CollapsibleTrigger,
} from "@/components/ui/collapsible";
+import {
+ Combobox,
+ ComboboxContent,
+ ComboboxEmpty,
+ ComboboxInput,
+ ComboboxItem,
+ ComboboxList,
+} from "@/components/ui/combobox";
import { Input } from "@/components/ui/input";
import {
Select,
@@ -11,7 +19,7 @@ import {
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
-import { type ReactElement, useMemo } from "react";
+import { type ReactElement, useMemo, useRef } from "react";
import { useRecipeStudioStore } from "../../stores/recipe-studio";
import type { ValidatorConfig } from "../../types";
import {
@@ -19,6 +27,10 @@ import {
VALIDATOR_OXC_CODE_LANGS,
VALIDATOR_SQL_CODE_LANGS,
} from "../../utils/validators/code-lang";
+import {
+ OXC_VALIDATION_MODES,
+ normalizeOxcValidationMode,
+} from "../../utils/validators/oxc-mode";
import { FieldLabel } from "../shared/field-label";
import { NameField } from "../shared/name-field";
@@ -35,8 +47,11 @@ export function ValidatorDialog({
}: ValidatorDialogProps): ReactElement {
const configs = useRecipeStudioStore((state) => state.configs);
const targetColumnId = `${config.id}-target-column`;
+ const oxcModeId = `${config.id}-oxc-mode`;
const batchSizeId = `${config.id}-batch-size`;
+ const oxcModeAnchorRef = useRef<HTMLDivElement>(null);
const advancedOpen = config.advancedOpen === true;
+ const selectedOxcMode = normalizeOxcValidationMode(config.oxc_validation_mode);
const codeOptions = useMemo(
() =>
Object.values(configs)
@@ -128,6 +143,47 @@ export function ValidatorDialog({
</p>
)}
</div>
+ {config.validator_type === "oxc" && (
+ <div className="grid gap-2">
+ <FieldLabel
+ label="Validation mode"
+ htmlFor={oxcModeId}
+ hint="syntax: parser only. lint: oxlint only. syntax+lint: both."
+ />
+ <div ref={oxcModeAnchorRef}>
+ <Combobox
+ items={OXC_VALIDATION_MODES}
+ filteredItems={OXC_VALIDATION_MODES}
+ filter={null}
+ value={selectedOxcMode}
+ onValueChange={(value) =>
+ onUpdate({
+ oxc_validation_mode: normalizeOxcValidationMode(value),
+ })
+ }
+ itemToStringValue={(value) => value}
+ autoHighlight={true}
+ >
+ <ComboboxInput
+ id={oxcModeId}
+ className="nodrag w-full"
+ placeholder="Select validation mode"
+ readOnly={true}
+ />
+ <ComboboxContent anchor={oxcModeAnchorRef}>
+ <ComboboxEmpty>No modes available</ComboboxEmpty>
+ <ComboboxList>
+ {(mode: string) => (
+ <ComboboxItem key={mode} value={mode}>
+ {mode}
+ </ComboboxItem>
+ )}
+ </ComboboxList>
+ </ComboboxContent>
+ </Combobox>
+ </div>
+ </div>
+ )}
<Collapsible
open={advancedOpen}
onOpenChange={(open) => onUpdate({ advancedOpen: open })}
diff --git a/studio/frontend/src/features/recipe-studio/types/index.ts b/studio/frontend/src/features/recipe-studio/types/index.ts
index 210716a540c..2ff95b73333 100644
--- a/studio/frontend/src/features/recipe-studio/types/index.ts
+++ b/studio/frontend/src/features/recipe-studio/types/index.ts
@@ -26,6 +26,7 @@ export type ValidatorCodeLang =
| "sql:bigquery"
| "sql:ansi";
export type ValidatorType = "code" | "oxc";
+export type OxcValidationMode = "syntax" | "lint" | "syntax+lint";
export type ExpressionDtype = "str" | "int" | "float" | "bool";
@@ -268,6 +269,8 @@ export type ValidatorConfig = {
validator_type: ValidatorType;
// biome-ignore lint/style/useNamingConvention: api schema
code_lang: ValidatorCodeLang;
+ // ui-only (used for OXC validators)
+ oxc_validation_mode: OxcValidationMode;
// ui ergonomics (serialized to int in payload)
batch_size: string;
};
diff --git a/studio/frontend/src/features/recipe-studio/utils/config-factories.ts b/studio/frontend/src/features/recipe-studio/utils/config-factories.ts
index 44ca5b0fca6..941cbdd3270 100644
--- a/studio/frontend/src/features/recipe-studio/utils/config-factories.ts
+++ b/studio/frontend/src/features/recipe-studio/utils/config-factories.ts
@@ -302,6 +302,7 @@ export function makeValidatorConfig(
validator_type: validatorType,
// biome-ignore lint/style/useNamingConvention: api schema
code_lang: codeLang,
+ oxc_validation_mode: "syntax",
batch_size: "10",
};
}
diff --git a/studio/frontend/src/features/recipe-studio/utils/import/parsers/validator-parser.ts b/studio/frontend/src/features/recipe-studio/utils/import/parsers/validator-parser.ts
index f982245821a..8d28246d47e 100644
--- a/studio/frontend/src/features/recipe-studio/utils/import/parsers/validator-parser.ts
+++ b/studio/frontend/src/features/recipe-studio/utils/import/parsers/validator-parser.ts
@@ -1,35 +1,29 @@
import type { ValidatorConfig } from "../../../types";
import { readNumberString } from "../helpers";
import { normalizeValidatorCodeLang } from "../../validators/code-lang";
+import { normalizeOxcValidationMode } from "../../validators/oxc-mode";
const OXC_VALIDATION_FN_MARKER = "unsloth_oxc_validator";
-function parseOxcCodeLang(validationFunctionRaw: string): string {
- if (!validationFunctionRaw.startsWith(OXC_VALIDATION_FN_MARKER)) {
- return "";
+function parseOxcValidationMarker(
+ validationFunctionRaw: string,
+): { codeLang: string; mode: string } {
+ const marker = `${OXC_VALIDATION_FN_MARKER}:`;
+ if (!validationFunctionRaw.startsWith(marker)) {
+ return { codeLang: "", mode: "syntax" };
}
- const suffix = validationFunctionRaw
- .slice(OXC_VALIDATION_FN_MARKER.length)
- .trim();
- if (!suffix) {
- return "";
+ const parts = validationFunctionRaw
+ .slice(marker.length)
+ .split(":")
+ .map((value) => value.trim())
+ .filter(Boolean);
+ if (parts.length < 2) {
+ return { codeLang: "", mode: "syntax" };
}
- const normalizedSuffix = suffix.startsWith(":") || suffix.startsWith("_")
- ? suffix.slice(1).trim().toLowerCase()
- : suffix.toLowerCase();
- if (normalizedSuffix === "js") {
- return "javascript";
- }
- if (normalizedSuffix === "ts") {
- return "typescript";
- }
- if (normalizedSuffix === "jsx" || normalizedSuffix === "tsx") {
- return normalizedSuffix;
- }
- if (normalizedSuffix === "javascript" || normalizedSuffix === "typescript") {
- return normalizedSuffix;
- }
- return "";
+ return {
+ codeLang: parts[0],
+ mode: parts[1],
+ };
}
export function parseValidator(
@@ -54,7 +48,9 @@ export function parseValidator(
const isOxc =
String(column.validator_type ?? "").trim() === "local_callable" &&
validationFunctionRaw.startsWith(OXC_VALIDATION_FN_MARKER);
- const oxcLang = isOxc ? parseOxcCodeLang(validationFunctionRaw) : "";
+ const marker = isOxc
+ ? parseOxcValidationMarker(validationFunctionRaw)
+ : { codeLang: "", mode: "syntax" };
return {
id,
kind: "validator",
@@ -65,8 +61,11 @@ export function parseValidator(
validator_type: isOxc ? "oxc" : "code",
// biome-ignore lint/style/useNamingConvention: api schema
code_lang: normalizeValidatorCodeLang(
- isOxc ? oxcLang || "javascript" : params.code_lang,
+ isOxc ? marker.codeLang || "javascript" : params.code_lang,
),
+ oxc_validation_mode: isOxc
+ ? normalizeOxcValidationMode(marker.mode)
+ : "syntax",
batch_size: readNumberString(column.batch_size) || "10",
};
}
diff --git a/studio/frontend/src/features/recipe-studio/utils/payload/build-payload.ts b/studio/frontend/src/features/recipe-studio/utils/payload/build-payload.ts
index 0d8945a4436..64aaac4015b 100644
--- a/studio/frontend/src/features/recipe-studio/utils/payload/build-payload.ts
+++ b/studio/frontend/src/features/recipe-studio/utils/payload/build-payload.ts
@@ -113,8 +113,16 @@ export function buildRecipePayload(
const toolConfigJsonByAlias = new Map<string, string>();
const nameSet = new Set<string>();
const nameToConfig = new Map<string, NodeConfig>();
+ const allNameToConfig = new Map<string, NodeConfig>();
const firstSeed = pickFirstSeedConfig(configs);
+ for (const config of Object.values(configs)) {
+ if (config.kind === "seed") {
+ continue;
+ }
+ allNameToConfig.set(config.name, config);
+ }
+
for (const node of nodes) {
const config = configs[node.id];
if (!config) {
@@ -205,7 +213,7 @@ export function buildRecipePayload(
continue;
}
if (config.kind === "validator") {
- columns.push(buildValidatorColumn(config, errors));
+ columns.push(buildValidatorColumn(config, errors, allNameToConfig));
nameToConfig.set(config.name, config);
continue;
}
diff --git a/studio/frontend/src/features/recipe-studio/utils/payload/builders-validator.ts b/studio/frontend/src/features/recipe-studio/utils/payload/builders-validator.ts
index a4c473ab248..0abe4c50b7e 100644
--- a/studio/frontend/src/features/recipe-studio/utils/payload/builders-validator.ts
+++ b/studio/frontend/src/features/recipe-studio/utils/payload/builders-validator.ts
@@ -1,4 +1,5 @@
-import type { ValidatorConfig } from "../../types";
+import type { NodeConfig, ValidatorConfig } from "../../types";
+import { isValidatorCodeLang } from "../validators/code-lang";
const OXC_VALIDATION_FN_MARKER = "unsloth_oxc_validator";
@@ -13,6 +14,7 @@ function parseBatchSize(value: string): number {
export function buildValidatorColumn(
config: ValidatorConfig,
errors: string[],
+ nameToConfig?: Map<string, NodeConfig>,
): Record<string, unknown> {
const targetColumns = (config.target_columns ?? [])
.map((value) => value.trim())
@@ -21,6 +23,19 @@ export function buildValidatorColumn(
errors.push(`Validator ${config.name}: target code column required.`);
}
if (config.validator_type === "oxc") {
+ const targetName = targetColumns[0] ?? "";
+ const targetConfig = targetName ? nameToConfig?.get(targetName) : null;
+ let codeLang = config.code_lang;
+ if (
+ targetConfig &&
+ targetConfig.kind === "llm" &&
+ targetConfig.llm_type === "code"
+ ) {
+ const targetLang = (targetConfig.code_lang ?? "").trim();
+ if (isValidatorCodeLang(targetLang)) {
+ codeLang = targetLang;
+ }
+ }
return {
// biome-ignore lint/style/useNamingConvention: api schema
column_type: "validation",
@@ -34,7 +49,7 @@ export function buildValidatorColumn(
validator_params: {
// backend resolves this marker to a real callable.
// biome-ignore lint/style/useNamingConvention: api schema
- validation_function: `${OXC_VALIDATION_FN_MARKER}:${config.code_lang}`,
+ validation_function: `${OXC_VALIDATION_FN_MARKER}:${codeLang}:${config.oxc_validation_mode}`,
},
// biome-ignore lint/style/useNamingConvention: api schema
batch_size: parseBatchSize(config.batch_size),
diff --git a/studio/frontend/src/features/recipe-studio/utils/payload/validate.ts b/studio/frontend/src/features/recipe-studio/utils/payload/validate.ts
index bc303689fbb..dd3195f6546 100644
--- a/studio/frontend/src/features/recipe-studio/utils/payload/validate.ts
+++ b/studio/frontend/src/features/recipe-studio/utils/payload/validate.ts
@@ -6,6 +6,7 @@ import type {
ValidatorConfig,
} from "../../types";
import { VALIDATOR_OXC_CODE_LANGS } from "../validators/code-lang";
+import { isOxcValidationMode } from "../validators/oxc-mode";
export function validateSubcategoryConfigs(
configs: Record<string, NodeConfig>,
@@ -147,7 +148,19 @@ export function validateValidatorConfigs(
);
continue;
}
- if ((targetConfig.code_lang ?? "").trim() !== config.code_lang.trim()) {
+ if (
+ config.validator_type === "oxc" &&
+ !isOxcValidationMode(config.oxc_validation_mode)
+ ) {
+ errors.push(
+ `Validator ${config.name}: oxc_validation_mode '${config.oxc_validation_mode}' is invalid.`,
+ );
+ continue;
+ }
+ if (
+ config.validator_type !== "oxc" &&
+ (targetConfig.code_lang ?? "").trim() !== config.code_lang.trim()
+ ) {
errors.push(
`Validator ${config.name}: code_lang '${config.code_lang}' must match target '${target}' (${targetConfig.code_lang ?? "unknown"}).`,
);
diff --git a/studio/frontend/src/features/recipe-studio/utils/validation.ts b/studio/frontend/src/features/recipe-studio/utils/validation.ts
index a130fabd156..41b30147a08 100644
--- a/studio/frontend/src/features/recipe-studio/utils/validation.ts
+++ b/studio/frontend/src/features/recipe-studio/utils/validation.ts
@@ -1,6 +1,7 @@
import type { NodeConfig } from "../types";
import { isValidSex, parseAgeRange, parseIntNumber, parseNumber } from "./parse";
import { VALIDATOR_OXC_CODE_LANGS, VALIDATOR_SQL_CODE_LANGS } from "./validators/code-lang";
+import { isOxcValidationMode } from "./validators/oxc-mode";
const TRACE_MODES = new Set(["none", "last_message", "all_messages"]);
@@ -210,6 +211,9 @@ export function getConfigErrors(config: NodeConfig | null): string[] {
if (!VALIDATOR_OXC_CODE_LANGS.includes(config.code_lang)) {
errors.push("OXC validator code language must be javascript/typescript/jsx/tsx.");
}
+ if (!isOxcValidationMode(config.oxc_validation_mode)) {
+ errors.push("OXC validation mode must be syntax, lint, or syntax+lint.");
+ }
} else if (
config.code_lang !== "python" &&
!VALIDATOR_SQL_CODE_LANGS.includes(config.code_lang)
diff --git a/studio/frontend/src/features/recipe-studio/utils/validators/oxc-mode.ts b/studio/frontend/src/features/recipe-studio/utils/validators/oxc-mode.ts
new file mode 100644
index 00000000000..70b368b9d78
--- /dev/null
+++ b/studio/frontend/src/features/recipe-studio/utils/validators/oxc-mode.ts
@@ -0,0 +1,22 @@
+import type { OxcValidationMode } from "../../types";
+
+export const OXC_VALIDATION_MODES: OxcValidationMode[] = [
+ "syntax",
+ "lint",
+ "syntax+lint",
+];
+
+export function isOxcValidationMode(value: string): value is OxcValidationMode {
+ return OXC_VALIDATION_MODES.includes(value as OxcValidationMode);
+}
+
+export function normalizeOxcValidationMode(value: unknown): OxcValidationMode {
+ if (typeof value !== "string") {
+ return "syntax";
+ }
+ const normalized = value.trim().toLowerCase();
+ if (isOxcValidationMode(normalized)) {
+ return normalized;
+ }
+ return "syntax";
+}