osis example fails to compile: DBTyped::new_with_index was removed but examples/basic/2_use_models.rs still calls it #104

Closed
opened 2026-05-21 02:48:20 +00:00 by sameh-farouk · 0 comments
Member

Symptom

cargo test --workspace (and cargo build --workspace --examples) fails to compile with:

error[E0599]: no function or associated item named `new_with_index` found for struct `DBTyped<T>` in the current scope
   --> crates/osis/examples/basic/2_use_models.rs:85:41
    |
 85 |     let tasks: DBTyped<Task> = DBTyped::new_with_index(&data_dir, &index_dir, 0)?;
    |                                         ^^^^^^^^^^^^^^ function or associated item not found in `DBTyped<_>`
    |
note: if you're trying to build a new `DBTyped<_>`, consider using `DBTyped::<T>::new` which returns `Result<DBTyped<_>, DbError>`
   --> crates/osis/src/db/db.rs:119:5

Root cause

API drift between example and library:

  • crates/osis/examples/basic/2_use_models.rs was added in 21a28a5 (@maintainer, 2026-03-08, feat: generate schema types in openrpc_client macro and add petstore example testing) with a DBTyped::new_with_index(&data_dir, &index_dir, 0) call (3 args: data dir, index dir, contributor id).
  • crates/osis/src/db/db.rs was rewritten in 5051525 (Timur Gordon, 2026-03-09, fix: restore db module in hero_rpc_osis) with the simpler pub fn new<P: AsRef<Path>>(data_dir: P, contributor_id: u16) -> Result<Self> signature (2 args). new_with_index no longer exists.

The example has been silently failing to compile for ~2 months because nobody runs cargo test --workspace on hero_rpc.

Reproduce

cd ~/Projects/hero/hero_rpc
cargo build -p hero_rpc_osis --example 2_use_models

Suggested fix

Update 2_use_models.rs:85 to call the current DBTyped::new signature, OR re-introduce new_with_index if external indexing is still a supported feature. Need a maintainer who knows whether the multi-arg variant was intentionally dropped to make the call.

Found while running cargo test --workspace to verify the fix for #95. There are at least two other workspace-level failures (a clippy collapsible_if in crates/oschema/src/markers.rs:49, and a runtime PATH_ROOT panic in crates/derive/tests/sse_proxy.rs that needs source ~/hero/cfg/init.sh per the bootstrap skill); those are out of scope for this issue but worth a sweep — cargo test --workspace and cargo clippy --workspace -- -D warnings are both silently broken on origin/development.

## Symptom `cargo test --workspace` (and `cargo build --workspace --examples`) fails to compile with: ``` error[E0599]: no function or associated item named `new_with_index` found for struct `DBTyped<T>` in the current scope --> crates/osis/examples/basic/2_use_models.rs:85:41 | 85 | let tasks: DBTyped<Task> = DBTyped::new_with_index(&data_dir, &index_dir, 0)?; | ^^^^^^^^^^^^^^ function or associated item not found in `DBTyped<_>` | note: if you're trying to build a new `DBTyped<_>`, consider using `DBTyped::<T>::new` which returns `Result<DBTyped<_>, DbError>` --> crates/osis/src/db/db.rs:119:5 ``` ## Root cause API drift between example and library: - `crates/osis/examples/basic/2_use_models.rs` was added in **`21a28a5`** (@maintainer, 2026-03-08, `feat: generate schema types in openrpc_client macro and add petstore example testing`) with a `DBTyped::new_with_index(&data_dir, &index_dir, 0)` call (3 args: data dir, index dir, contributor id). - `crates/osis/src/db/db.rs` was rewritten in **`5051525`** (Timur Gordon, 2026-03-09, `fix: restore db module in hero_rpc_osis`) with the simpler `pub fn new<P: AsRef<Path>>(data_dir: P, contributor_id: u16) -> Result<Self>` signature (2 args). `new_with_index` no longer exists. The example has been silently failing to compile for ~2 months because nobody runs `cargo test --workspace` on hero_rpc. ## Reproduce ```bash cd ~/Projects/hero/hero_rpc cargo build -p hero_rpc_osis --example 2_use_models ``` ## Suggested fix Update `2_use_models.rs:85` to call the current `DBTyped::new` signature, OR re-introduce `new_with_index` if external indexing is still a supported feature. Need a maintainer who knows whether the multi-arg variant was intentionally dropped to make the call. ## Related Found while running `cargo test --workspace` to verify the fix for #95. There are at least two other workspace-level failures (a clippy `collapsible_if` in `crates/oschema/src/markers.rs:49`, and a runtime `PATH_ROOT` panic in `crates/derive/tests/sse_proxy.rs` that needs `source ~/hero/cfg/init.sh` per the bootstrap skill); those are out of scope for this issue but worth a sweep — `cargo test --workspace` and `cargo clippy --workspace -- -D warnings` are both silently broken on `origin/development`.
timur closed this issue 2026-05-26 06:43:15 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_blueprint#104
No description provided.