Selaa lähdekoodia

docs(plan): correct CMake target name and createCollection signature

Locally installed libsmartbotic-db-client-dev 1.7.1 exports
smartbotic::db-client (not smartbotic::database::client) and its
Client::createCollection takes flat params (name, defaultTtlSeconds,
encrypted, maxVersions, vectorDimension), not a CollectionOptions struct.
Updated the adapter code in Task A5 accordingly.
fszontagh 2 kuukautta sitten
vanhempi
sitoutus
fafd45aec4

+ 20 - 19
docs/superpowers/plans/2026-05-09-smartbotic-automation-debian-packaging.md

@@ -101,7 +101,7 @@ Expected: pulls in the dev headers under `/usr/include/smartbotic/database/` and
 dpkg -L libsmartbotic-db-client-dev | grep -E '(client\.hpp|smartbotic-db-client.*\.cmake|smartbotic-db-client\.pc)$'
 ```
 
-Record the CMake target name or pkg-config name in your shell history — Task A3 will need it. (Likely either `smartbotic::database::client` CMake target or `smartbotic-db-client` pkg-config name.)
+Record the CMake target name or pkg-config name in your shell history — Task A3 will need it. (Likely either `smartbotic::db-client` CMake target or `smartbotic-db-client` pkg-config name.)
 
 ### Task A3: Add `libsmartbotic-db-client` to `CMakeLists.txt`
 
@@ -113,16 +113,11 @@ Record the CMake target name or pkg-config name in your shell history — Task A
 Insert near the other `find_package` calls (top of CMakeLists, before `smartbotic_storage` definition). Use a fallback chain so we work whether the upstream ships CMake config or only pkg-config:
 
 ```cmake
-# Upstream smartbotic-database client library
-find_package(smartbotic-db-client CONFIG QUIET)
-if(NOT smartbotic-db-client_FOUND)
-    find_package(PkgConfig REQUIRED)
-    pkg_check_modules(SMARTBOTIC_DB_CLIENT REQUIRED IMPORTED_TARGET smartbotic-db-client)
-    add_library(smartbotic::database::client ALIAS PkgConfig::SMARTBOTIC_DB_CLIENT)
-endif()
+# Upstream smartbotic-database client library — provides target smartbotic::db-client
+find_package(smartbotic-db-client CONFIG REQUIRED)
 ```
 
-If Task A2 Step 3 revealed a different target name, substitute it everywhere in this plan.
+(Verified locally: `/usr/lib/x86_64-linux-gnu/cmake/smartbotic-db-client/smartbotic-db-clientConfig.cmake` exports `smartbotic::db-client` as a SHARED IMPORTED target; `INTERFACE_LINK_LIBRARIES` brings in `gRPC::grpc++` and `protobuf::libprotobuf` automatically. No pkg-config fallback is shipped, so we do not need one.)
 
 - [ ] **Step 2: Configure & verify**
 
@@ -451,16 +446,22 @@ Result<void> StorageClient::createCollection(const std::string& name,
                                              const nlohmann::json& schema,
                                              int64_t default_ttl_ms,
                                              const VersioningOptions* versioning) {
-    dbc::Client::CollectionOptions co;
-    co.schema = schema;
-    co.defaultTtlSeconds = msToSec(default_ttl_ms);
-    if (versioning) {
-        co.versioning.enabled = versioning->enabled;
-        co.versioning.maxVersions = static_cast<uint32_t>(versioning->max_versions);
-        co.versioning.versionTtlMs = static_cast<uint64_t>(versioning->version_ttl_ms);
-        co.versioning.keepOnDelete = versioning->keep_on_delete;
+    if (!schema.is_null() && !schema.empty()) {
+        LOG_WARN("Storage: createCollection 'schema' parameter is ignored by upstream client (no server-side schema validation in 1.7.x)");
     }
-    bool ok = impl_->client_->createCollection(name, co);
+    uint32_t maxVersions = 0;
+    if (versioning && versioning->enabled) {
+        maxVersions = static_cast<uint32_t>(versioning->max_versions);
+        if (versioning->version_ttl_ms != 0 || versioning->keep_on_delete) {
+            LOG_WARN("Storage: createCollection version_ttl_ms / keep_on_delete are ignored — upstream 1.7.x createCollection only takes maxVersions");
+        }
+    }
+    bool ok = impl_->client_->createCollection(
+        name,
+        msToSec(default_ttl_ms),
+        /*encrypted=*/false,
+        maxVersions,
+        /*vectorDimension=*/0);
     if (!ok) return Error{6001, "createCollection failed: " + name};
     return {};
 }
@@ -532,7 +533,7 @@ target_link_libraries(smartbotic_storage PUBLIC
     smartbotic_common
     smartbotic_logging
     nlohmann_json::nlohmann_json
-    smartbotic::database::client
+    smartbotic::db-client
 )
 ```