From d7f4749f9fe1f7109bec654a880ed524e4726cd7 Mon Sep 17 00:00:00 2001 From: udo Date: Tue, 14 Jul 2026 06:23:50 +0000 Subject: [PATCH] test: label expected source read failures --- docs/wasm-runtime-architecture.md | 5 ++++- scripts/test_dependency_invalidation.sh | 2 +- src/lib/compiler.cpp | 10 +++++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/docs/wasm-runtime-architecture.md b/docs/wasm-runtime-architecture.md index 1a3e408..17e8b65 100644 --- a/docs/wasm-runtime-architecture.md +++ b/docs/wasm-runtime-architecture.md @@ -155,7 +155,10 @@ the source. An unreadable path is reported as a source-read failure with a persisted diagnostic; it never becomes an apparently valid empty side module or a generic compiler error. Source signatures mark unreadable inputs, so correcting access invalidates that failure and permits a normal retry without changing -signatures for ordinary readable files. +signatures for ordinary readable files. The private CLI harness may label its +intentional unreadable-source regression request as an expected source-read +failure, keeping production log scans focused on real runtime failures while +preserving the failing compile result and diagnostic artifacts. --- diff --git a/scripts/test_dependency_invalidation.sh b/scripts/test_dependency_invalidation.sh index 504228b..4051e98 100755 --- a/scripts/test_dependency_invalidation.sh +++ b/scripts/test_dependency_invalidation.sh @@ -64,7 +64,7 @@ fi printf '%s\n' 'CLI(Request& context) { print("readable-source-marker"); }' >"$source_dir/unreadable.uce" chmod 000 "$source_dir/unreadable.uce" -if unreadable_output=$(scripts/uce-cli "/$test_name/unreadable.uce" 2>&1); then +if unreadable_output=$(scripts/uce-cli --get "/$test_name/unreadable.uce" __uce_expected_source_read_failure=1 2>&1); then echo "unreadable source unexpectedly compiled: $unreadable_output" >&2 exit 1 fi diff --git a/src/lib/compiler.cpp b/src/lib/compiler.cpp index 7919345..3ece28a 100644 --- a/src/lib/compiler.cpp +++ b/src/lib/compiler.cpp @@ -817,9 +817,13 @@ String compiler_format_compile_failure(SharedUnit* su, String raw_messages) return(result); } -String compiler_format_source_read_failure(SharedUnit* su, String raw_messages) +String compiler_format_source_read_failure(Request* context, SharedUnit* su, String raw_messages) { - String result = "UCE source read failure\n"; + bool expected_cli_failure = + context && + context->resources.is_cli && + first(context->get["__uce_expected_source_read_failure"], context->post["__uce_expected_source_read_failure"]) == "1"; + String result = expected_cli_failure ? "UCE expected source read failure\n" : "UCE source read failure\n"; result += "Source: " + su->file_name + "\n"; result += "Compile output: " + su->compile_output_file_name + "\n"; result += "\nMessage:\n" + trim(raw_messages) + "\n"; @@ -851,7 +855,7 @@ void compile_shared_unit(Request* context, SharedUnit* su) file_put_contents(su->meta_file_name, compiler_unit_metadata_text(context, su)); file_unlink(su->wasm_name); compiler_record_compile_result(su, time_precise() - comp_start, false, "compile_error", su->compiler_messages); - printf("%s \n", compiler_format_source_read_failure(su, su->compiler_messages).c_str()); + printf("%s \n", compiler_format_source_read_failure(context, su, su->compiler_messages).c_str()); return; }