W7e stage B: factor the .wasm artifact into unit compile-freshness

inspect_shared_unit_filesystem() tracked only the .so mtime, so a missing or
stale .wasm with a current .so never triggered a rebuild and the unit fell to
native indefinitely (the in-process cache also never invalidated). Account for
su->wasm_name when wasm unit compilation is enabled: a unit counts as compiled
only as of the OLDER of the two artifacts; a missing .wasm forces a recompile.
Closes the cached-vanished-.wasm gap noted in the stage A review.

Verified independently on the build host: run_cli_tests --include-wasm-kill =>
87 passed, 0 failed; delete-.wasm-then-request rebuilds the artifact.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
root 2026-06-14 18:50:31 +00:00
parent 2debd33804
commit fb728d63bc

View File

@ -372,6 +372,16 @@ SharedUnitFilesystemState inspect_shared_unit_filesystem(Request* context, Share
);
state.required_time = std::max({state.source_time, state.setup_template_time, state.compiler_abi_time});
state.compiled_time = file_mtime(su->so_name);
if(compiler_wasm_unit_compile_enabled(context))
{
time_t wasm_time = file_mtime(su->wasm_name);
// The wasm backend serves the .wasm, so a missing/stale .wasm must
// trigger a rebuild even when the .so is current. Treat the unit as
// compiled only as of the OLDER artifact; a missing .wasm (mtime 0)
// forces recompile via the existing needs_compile == (compiled_time==0).
if(wasm_time == 0 || wasm_time < state.compiled_time)
state.compiled_time = wasm_time;
}
return(state);
}