JMLX42 opened a new pull request, #7156:
URL: https://github.com/apache/opendal/pull/7156

   # Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and 
enhancements. You can link an issue to this PR using the GitHub syntax. For 
example `Closes #123` indicates that this PR will close issue #123.
   -->
   
   N/A - This is a proactive fix discovered while working on WASI support.
   
   # Rationale for this change
   
   The `core/core/src/raw/time.rs` file uses `#[cfg(target_arch = "wasm32")]` 
to conditionally use `web_time::web::SystemTimeExt`. However, the 
`web_time::web` module only exists when `target_os = "unknown"` (browser WASM), 
not when `target_os = "wasi"`.
   
   This causes compilation to fail for WASI targets (e.g., `wasm32-wasip2`):
   
   ```
   error[E0433]: failed to resolve: could not find `web` in `web_time`
   ```
   
   This fix is part of an effort to enable OpenDAL for WASI environments, being 
developed at [opendal-wasi](https://gitlab.com/lx-industries/opendal-wasi).
   
   # What changes are included in this PR?
   
   1. **Fix cfg conditions in `core/core/src/raw/time.rs`**: Changed from 
`#[cfg(target_arch = "wasm32")]` to `#[cfg(all(target_arch = "wasm32", 
target_os = "unknown"))]` so that:
      - Browser WASM (`wasm32-unknown-unknown`) continues to use `web_time`
      - WASI (`wasm32-wasip1`, `wasm32-wasip2`) uses `std::time::SystemTime` 
which is supported
   
   2. **Add CI job for `wasm32-wasip2` target**: Added a new `build_under_wasi` 
job to `.github/workflows/ci_core.yml` to catch WASI compatibility regressions. 
The job builds with WASI-compatible features (layers and services that don't 
require reqwest/tokio).
   
   # Are there any user-facing changes?
   
   No breaking changes. This enables OpenDAL to compile for WASI targets, which 
was previously broken.
   
   # AI Usage Statement
   
   This PR was developed with assistance from Claude (Anthropic's Claude Opus 
4.5), used via Claude Code CLI. The AI assisted with:
   - Diagnosing the root cause of the WASI compilation failure
   - Implementing the cfg condition fix
   - Identifying which features are compatible with WASI (by testing locally)
   - Writing the CI workflow job
   - Drafting this PR description
   
   All changes were reviewed and verified by the human developer.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to