From dafffb4ab6ebdb2ec387c3833a8d8540081f9a51 Mon Sep 17 00:00:00 2001 From: udo Date: Tue, 14 Jul 2026 23:38:20 +0000 Subject: [PATCH] label expected compile timing probe --- docs/wasm-runtime-architecture.md | 5 ++++- scripts/test_log_timeliness.sh | 5 +++-- src/lib/compiler.cpp | 10 +++++++--- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/docs/wasm-runtime-architecture.md b/docs/wasm-runtime-architecture.md index 1287c1f..6cf7a68 100644 --- a/docs/wasm-runtime-architecture.md +++ b/docs/wasm-runtime-architecture.md @@ -410,7 +410,10 @@ header free-functions are `inline`. The wasm backend exposes only declarations - **Log timeliness**: the base process line-buffers stdout before forking workers, the proactive compiler, and the WebSocket broker. This keeps each newline-terminated diagnostic attached to its actual journal time instead of - releasing an old block-buffered failure during unrelated later traffic. + releasing an old block-buffered failure during unrelated later traffic. The + private CLI timing gate labels its deliberate invalid-source request as + `UCE expected compile error`; public and unmarked CLI compilation failures + retain the ordinary `UCE compile error` operator signal. - **WebSocket end-to-end**: a headless client performs a raw WS handshake to `:HTTP_PORT` with path `/site/tests/websockets.ws.uce` (self-resolving diff --git a/scripts/test_log_timeliness.sh b/scripts/test_log_timeliness.sh index d5e2ee2..d824032 100755 --- a/scripts/test_log_timeliness.sh +++ b/scripts/test_log_timeliness.sh @@ -33,11 +33,12 @@ rm -rf "$cache_dir" started_at=$(date '+%Y-%m-%d %H:%M:%S') set +e -scripts/uce-cli "/$test_name/probe.uce" >/dev/null 2>&1 +scripts/uce-cli --get "/$test_name/probe.uce" __uce_expected_compile_failure=1 >/dev/null 2>&1 set -e for _ in $(seq 1 20); do - if journalctl -u uce --since "$started_at" --no-pager | grep -Fq "$test_name/probe.uce"; then + journal_output=$(journalctl -u uce --since "$started_at" --no-pager) + if [[ "$journal_output" == *"UCE expected compile error"* && "$journal_output" == *"$test_name/probe.uce"* ]]; then echo "log timeliness passed" exit 0 fi diff --git a/src/lib/compiler.cpp b/src/lib/compiler.cpp index 12a8ea1..6d150d4 100644 --- a/src/lib/compiler.cpp +++ b/src/lib/compiler.cpp @@ -803,10 +803,14 @@ String compiler_source_excerpt(String file_name, s64 line_number, u64 radius = 3 return(result); } -String compiler_format_compile_failure(SharedUnit* su, String raw_messages) +String compiler_format_compile_failure(Request* context, SharedUnit* su, String raw_messages) { + bool expected_cli_failure = + context && + context->resources.is_cli && + first(context->get["__uce_expected_compile_failure"], context->post["__uce_expected_compile_failure"]) == "1"; String generated_file = compiler_generated_cpp_path(su); - String result = "UCE compile error\n"; + String result = expected_cli_failure ? "UCE expected compile error\n" : "UCE compile error\n"; result += "Source: " + su->file_name + "\n"; result += "Generated C++: " + generated_file + "\n"; result += "Compile output: " + su->compile_output_file_name + "\n"; @@ -905,7 +909,7 @@ void compile_shared_unit(Request* context, SharedUnit* su) file_put_contents(su->wasm_check_file_name, raw_messages + "\n"); compiler_unlink_unit_wasm_artifacts(su); compiler_record_compile_result(su, time_precise() - comp_start, false, "compile_error", raw_messages); - printf("%s \n", compiler_format_compile_failure(su, raw_messages).c_str()); + printf("%s \n", compiler_format_compile_failure(context, su, raw_messages).c_str()); } else {