Skip to content

fix(ci): WASM WIT compat sqlite3 duplicate symbol conflict#953

Merged
henrypark133 merged 3 commits intostagingfrom
fix/wasm-wit-compat-sqlite-conflict
Mar 11, 2026
Merged

fix(ci): WASM WIT compat sqlite3 duplicate symbol conflict#953
henrypark133 merged 3 commits intostagingfrom
fix/wasm-wit-compat-sqlite-conflict

Conversation

@henrypark133
Copy link
Copy Markdown
Collaborator

@henrypark133 henrypark133 commented Mar 11, 2026

Summary

  • The import feature (feat: Import OpenClaw memory, history and settings #903) added rusqlite[bundled] which conflicts with libsql-ffi — both bundle SQLite C code causing duplicate sqlite3_* symbol linker errors when --all-features is used
  • Root fix: Replaced rusqlite with libsql (already a dependency) in the import reader module. The import feature now implies libsql
  • Restored --all-features in the WASM WIT compat CI test (now safe since no more symbol conflict)
  • Converted all import test helpers from rusqlite to libsql
  • 67 import tests now compile and pass with --all-features

Changes

  • Cargo.toml: Removed rusqlite dependency, changed import feature to ["dep:json5", "libsql"]
  • src/import/openclaw/reader.rs: read_memory_chunks and read_conversations now use libsql (async)
  • src/import/openclaw/mod.rs: Added .await to reader calls
  • tests/import_openclaw_*.rs: Converted test DB setup from rusqlite to libsql
  • .github/workflows/test.yml: Restored --all-features for WIT compat test

Test plan

  • cargo check --all-features — no duplicate symbol errors
  • cargo test --all-features — all 67 import tests pass
  • cargo clippy --all --all-features --tests — zero warnings
  • CI WASM WIT Compatibility job passes

🤖 Generated with Claude Code

…e3 symbol conflicts

The `import` feature (added in #903) brings in `rusqlite[bundled]` which
conflicts with `libsql-ffi` — both bundle SQLite C code, causing duplicate
symbol linker errors. Use explicit features matching the test matrix instead
of `--all-features`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 11, 2026 18:01
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Note

Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported.

@github-actions github-actions bot added scope: ci CI/CD workflows size: XS < 10 changed lines (excluding docs) risk: medium Business logic, config, or moderate-risk modules contributor: core 20+ merged PRs labels Mar 11, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the WASM WIT compatibility CI job to avoid enabling incompatible feature combinations that can cause duplicate sqlite3_* symbol linker errors when running with --all-features.

Changes:

  • Replaced cargo test --all-features ... with an explicit feature list for the wit_compat test invocation.
  • Aligns the WASM WIT compat job’s features with the workflow’s existing test matrix intent.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

run: ./scripts/build-wasm-extensions.sh
- name: Instantiation test (host linker compatibility)
run: cargo test --all-features wit_compat -- --nocapture
run: cargo test --features postgres,libsql,html-to-markdown wit_compat -- --nocapture
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This command still enables default features in addition to the explicit list. If the default feature set changes in the future (e.g., import gets added to default), this job could start failing again or stop matching the intended feature set. Consider adding --no-default-features and listing the desired features explicitly so the CI configuration is stable over time.

Suggested change
run: cargo test --features postgres,libsql,html-to-markdown wit_compat -- --nocapture
run: cargo test --no-default-features --features postgres,libsql,html-to-markdown wit_compat -- --nocapture

Copilot uses AI. Check for mistakes.
run: ./scripts/build-wasm-extensions.sh
- name: Instantiation test (host linker compatibility)
run: cargo test --all-features wit_compat -- --nocapture
run: cargo test --features postgres,libsql,html-to-markdown wit_compat -- --nocapture
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switching away from --all-features means the import feature is no longer exercised by this WIT compat job (and it doesn't appear to be covered elsewhere in this workflow). To prevent the import feature from bit-rotting, consider adding a separate CI step/job that at least compiles/tests with --no-default-features --features import (and without libsql) so both feature sets stay green.

Suggested change
run: cargo test --features postgres,libsql,html-to-markdown wit_compat -- --nocapture
run: cargo test --features postgres,libsql,html-to-markdown wit_compat -- --nocapture
- name: Instantiation test with import feature (no default features, no libsql)
run: cargo test --no-default-features --features import,postgres,html-to-markdown wit_compat -- --nocapture

Copilot uses AI. Check for mistakes.
zmanian
zmanian previously approved these changes Mar 11, 2026
Copy link
Copy Markdown
Collaborator

@zmanian zmanian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: fix(ci): WASM WIT compat sqlite3 duplicate symbol conflict

Verdict: APPROVE

One-line change, clear root cause. The import feature added rusqlite[bundled] which bundles its own SQLite C code, conflicting with libsql-ffi when both are enabled via --all-features. Switching to explicit feature flags (postgres,libsql,html-to-markdown) avoids the duplicate sqlite3_* symbol linker errors while still testing everything that matters.

This is the right fix -- --all-features is not guaranteed to be a valid combination when features are mutually exclusive at the C linking level.

…bol conflict

The `import` feature used `rusqlite[bundled]` which bundled its own SQLite
C code, conflicting with `libsql-ffi` (also bundles SQLite). This caused
duplicate `sqlite3_*` symbol linker errors when both features were enabled
via `--all-features`.

Replace `rusqlite` with `libsql` (already a dependency) in the import
reader. The `import` feature now implies `libsql`. This eliminates the
duplicate symbol conflict and allows `--all-features` to compile cleanly.

Also restores `--all-features` in the WASM WIT compat CI test (now safe)
and converts all import test helpers from rusqlite to libsql.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions bot added scope: dependencies Dependency updates size: XL 500+ changed lines and removed size: XS < 10 changed lines (excluding docs) labels Mar 11, 2026
zmanian
zmanian previously approved these changes Mar 11, 2026
Copy link
Copy Markdown
Collaborator

@zmanian zmanian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-approving after force-push. One-line CI fix — switches WASM WIT compat test from --all-features to explicit feature flags to avoid sqlite3 duplicate symbol conflict. LGTM.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 11, 2026 18:28
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +83 to +87
/// Open an OpenClaw SQLite database file via libsql for read-only access.
#[cfg(feature = "import")]
async fn open_sqlite(db_path: &Path) -> Result<libsql::Connection, ImportError> {
let db = libsql::Builder::new_local(db_path)
.build()
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

open_sqlite’s doc comment says it opens the DB “for read-only access”, but libsql::Builder::new_local(db_path).build() uses the default SQLite open mode (read/write + create) and can create sidecar files (-wal/-shm) or even create an empty DB if the path doesn’t exist. Either enforce a true read-only open (if libsql exposes flags/options) or adjust the wording to avoid implying no filesystem writes.

Copilot uses AI. Check for mistakes.
@henrypark133 henrypark133 merged commit fe82469 into staging Mar 11, 2026
13 checks passed
@henrypark133 henrypark133 deleted the fix/wasm-wit-compat-sqlite-conflict branch March 11, 2026 18:48
@github-actions github-actions bot mentioned this pull request Mar 11, 2026
bkutasi pushed a commit to bkutasi/ironclaw that referenced this pull request Mar 28, 2026
* fix(ci): use explicit features in WASM WIT compat test to avoid sqlite3 symbol conflicts

The `import` feature (added in nearai#903) brings in `rusqlite[bundled]` which
conflicts with `libsql-ffi` — both bundle SQLite C code, causing duplicate
symbol linker errors. Use explicit features matching the test matrix instead
of `--all-features`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: replace rusqlite with libsql in import module to fix sqlite3 symbol conflict

The `import` feature used `rusqlite[bundled]` which bundled its own SQLite
C code, conflicting with `libsql-ffi` (also bundles SQLite). This caused
duplicate `sqlite3_*` symbol linker errors when both features were enabled
via `--all-features`.

Replace `rusqlite` with `libsql` (already a dependency) in the import
reader. The `import` feature now implies `libsql`. This eliminates the
duplicate symbol conflict and allows `--all-features` to compile cleanly.

Also restores `--all-features` in the WASM WIT compat CI test (now safe)
and converts all import test helpers from rusqlite to libsql.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* style: apply cargo fmt formatting fixes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor: core 20+ merged PRs risk: medium Business logic, config, or moderate-risk modules scope: ci CI/CD workflows scope: dependencies Dependency updates size: XL 500+ changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants