You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(file-ops): use local AOT compilation for guaranteed compatibility
BREAKING CHANGE in architecture (but not in functionality):
Previously: Downloaded pre-compiled AOT artifacts (extracted from 22.8MB file)
Now: Compile AOT locally at build time using wasm_precompile
Why This Change?
================
**Problem:** Pre-compiled AOT artifacts are compiled for a specific Wasmtime
version. If the user's Wasmtime version doesn't match, AOT loading fails.
**Solution:** Compile AOT locally at build time using the user's Wasmtime version.
This guarantees perfect compatibility while maintaining 100x performance improvement.
Changes:
========
1. MODULE.bazel
- Switch from AOT variant (22.8MB) to regular WASM (853KB)
- AOT compilation happens locally, not downloaded
- Comment explains the approach
2. tools/file_ops_external/BUILD.bazel
- Remove all wasm_extract_aot rules (no longer needed)
- Add single wasm_precompile rule for local compilation
- Much simpler: 20 lines vs 80+ lines
3. tools/file_ops_external/main.go
- Remove platform detection (no longer needed)
- Remove AOT extraction logic (no longer needed)
- Simpler: just load locally-compiled .cwasm
- Remove getPlatformName() function
- Clean up unused imports
- 100 lines vs 170+ lines
Benefits:
=========
✅ **Guaranteed Compatibility** - Always matches user's Wasmtime version
✅ **Simpler Architecture** - No extraction, no platform detection
✅ **Same Performance** - Still 100x faster startup with native code
✅ **Smaller Download** - 853KB vs 22.8MB external file
✅ **Better CI** - No dependency on external AOT artifacts being compatible
✅ **Future-Proof** - Works with any Wasmtime version update
Technical Details:
==================
Compilation: wasm_precompile rule uses @rules_wasm_component//wasm:wasm_precompile.bzl
Output: Single .cwasm file (~3.3MB) for current platform
Execution: wasmtime run --allow-precompiled file_ops_aot.cwasm
Fallback: Regular WASM if AOT not available
Testing:
========
✅ Local AOT compilation successful (3.3MB .cwasm)
✅ Execution with local AOT working
✅ All integration tests passing (3/3)
✅ Deprecation warning still showing for embedded
This resolves the compatibility concern raised about pre-compiled AOT artifacts.
0 commit comments