Skip to content

Fix Windows CI library linking errors with conditional compilation for database backends#200

Merged
drzo merged 1 commit into
mainfrom
copilot/explore-codebase-create-implementation-plan
Jun 14, 2026
Merged

Fix Windows CI library linking errors with conditional compilation for database backends#200
drzo merged 1 commit into
mainfrom
copilot/explore-codebase-create-implementation-plan

Conversation

Copilot AI commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Windows CI fails with Error: Cannot locate the .lib files for the following libraries: sqlite3, rocksdb because DISABLE_SQLITE3=1 is set in CI but not implemented in the codebase—sqlite3 and pg are unconditionally required.

Changes

src/atomspace/storage.cr

  • Wrap require "sqlite3" and require "pg" with compile-time macros checking DISABLE_SQLITE3 and DISABLE_POSTGRES env vars
  • Add stub implementations for SQLiteStorageNode and PostgresStorageNode when disabled (following existing rocksdb.cr pattern)
  • Add MemoryStorageNode as in-memory fallback when all DB backends are disabled

.github/workflows/crci.yml

  • Add DISABLE_POSTGRES=1 for Windows builds
  • Add libpq-dev to Linux dependencies

Documentation

  • Update shard.yml and README.md with DISABLE_* env var documentation

Usage

# Disable all database backends (Windows builds, testing)
DISABLE_ROCKSDB=1 DISABLE_SQLITE3=1 DISABLE_POSTGRES=1 crystal spec

# Use MemoryStorageNode as fallback
storage = AtomSpace::MemoryStorageNode.new("test")
storage.open

Note

Medium Risk
Changes compile-time linking and the persistence surface area (stubs vs real DB code), but behavior on Linux with libs installed should stay the same; risk is mainly misconfigured builds or tests that still expect SQLite/Postgres when disabled.

Overview
Fixes Windows CI link failures by making SQLite and PostgreSQL optional at compile time, matching the existing RocksDB DISABLE_* pattern.

In storage.cr, require "sqlite3" and require "pg" are wrapped in compile-time checks for DISABLE_SQLITE3 and DISABLE_POSTGRES. When a backend is disabled, the full implementation is replaced with stub SQLiteStorageNode / PostgresStorageNode classes that warn on construction and raise if persistence APIs are used. A new MemoryStorageNode provides a mutex-backed in-memory StorageNode for tests and builds with no native DB libs.

CI sets DISABLE_POSTGRES=1 on Windows alongside the existing RocksDB/SQLite flags, and Linux installs libpq-dev. README and shard.yml document all three disable env vars and point to MemoryStorageNode / FileStorageNode when DB backends are off.

Reviewed by Cursor Bugbot for commit 970ab98. Bugbot is set up for automated code reviews on this repo. Configure here.

- Add compile-time checks for DISABLE_SQLITE3 and DISABLE_POSTGRES env vars
- Wrap SQLiteStorageNode and PostgresStorageNode with conditional macros
- Add stub implementations when database backends are disabled
- Add MemoryStorageNode as in-memory storage fallback
- Update crci.yml to set DISABLE_POSTGRES=1 for Windows builds
- Document DISABLE_* environment variables in shard.yml and README.md
@drzo drzo marked this pull request as ready for review June 14, 2026 16:28
@drzo drzo merged commit e8dfa91 into main Jun 14, 2026
15 of 17 checks passed

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 970ab98. Configure here.

Comment thread src/atomspace/storage.cr

def open : Bool
raise "SQLite3 support is disabled. Install libsqlite3-dev and rebuild without DISABLE_SQLITE3=1"
end

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Disabled stub open raises

Medium Severity

When SQLite or PostgreSQL is compile-disabled, their stub StorageNode implementations raise exceptions from methods like open rather than returning a boolean. This can cause runtime crashes in higher-level storage nodes expecting a graceful false return.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 970ab98. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants