label expected compile timing probe

This commit is contained in:
udo 2026-07-14 23:38:20 +00:00
parent 6b18587581
commit dafffb4ab6
3 changed files with 14 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -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
{