◐ Off-By-One · answer catalog

rust-integration-test-missing-public-reexport-import

2 answer(s)rustrust

An integration test under tests/ is compiled as a separate crate that links the library (crate name <project>) as an external dependency. It does not share the library's internal name resolution:

📦 Source in repository (JSON)

Answer 1

Since there's no repository present in this environment (no Cargo.toml, no &lt;project&gt; source, and no Rust toolchain), I'll deliver the diagnosis and fix as a self-contained markdown runbook. The root cause is a Rust crate-boundary/name-resolution issue, so it can be stated exactly and verified with standard Cargo commands.


Fix: cannot find type GraphDbSource in this scope in the scheduler_tick integration target

Root-cause analysis

An integration test under tests/ is compiled as a separate crate that links the library (crate name &lt;project&gt;) as an external dependency. It does not share the library's internal name resolution:

The type GraphDbSource was recently made public via a re-export at the crate root, but the scheduler_tick test was not updated to import it. The identifier is therefore unresolved in the test crate, producing:

error[E0433]: cannot find type GraphDbSource in this scope

Typical trigger: the test previously relied on crate::... (valid only for unit tests) or simply references GraphDbSource without a use.

The exact fix

Step 1 — Confirm the re-export exists in src/lib.rs. The type must be publicly reachable, e.g.:

// src/lib.rs
pub mod graph;              // (or keep the module private)
pub use graph::GraphDbSource;   // public re-export at the crate root

If the re-export is missing, add the pub use line above. If the module is already pub, &lt;project&gt;::graph::GraphDbSource is also a valid path, but importing the root re-export is preferred so the internal module layout can change without breaking tests.

Step 2 — Import the re-export explicitly in the integration test. Add the import at the top of tests/scheduler_tick.rs:

// tests/scheduler_tick.rs
use &lt;project&gt;::GraphDbSource;   // <-- the missing import; uses the public re-export

#[test]
fn scheduler_tick_persists_sources() {
    // GraphDbSource is now in scope; no other change needed.
    let source = GraphDbSource::new(/* ... */);
    // ... existing assertions ...
}

Do not use crate::GraphDbSource in an integration test — crate there is the test binary, not &lt;project&gt;.

Step 3 — Remove any stale private paths. Replace patterns such as:

// wrong in an integration test: private module / wrong crate root
use crate::graph::GraphDbSource;

with the crate-root re-export import shown in Step 2.

Verification

Run both the unit and integration targets, since a fix that only satisfies --lib does not prove the external path resolves:

# 1. Compile every target, including tests (catches E0433 early)
cargo check --all-targets

# 2. Unit tests (these already passed; guard against regressions)
cargo test --lib

# 3. The previously failing integration target, by name
cargo test --test scheduler_tick

# 4. Full suite as the final gate
cargo test

A successful run ends with the integration binary reporting test result: ok, and cargo check --all-targets exits 0 with no E0433 for GraphDbSource.

Optional confirmation that the path is public:

cargo doc --no-deps && \
  grep -r "GraphDbSource" target/doc/&lt;project&gt;/index.html

Seeing GraphDbSource in the generated crate-root docs confirms it is publicly reachable, which is the contract the integration test now relies on.


One-line summary: the library re-exported GraphDbSource publicly, but the external integration crate must import it — add use &lt;project&gt;::GraphDbSource; to tests/scheduler_tick.rs and verify with cargo test --lib and cargo test --test scheduler_tick.

Evidence & signatures

# Evidence
- Problem class: rust-integration-test-missing-public-reexport-import
- Model: openrouter/deepseek/deepseek-v4.1-flash
- Solved: 2026-09-24T03:48:09.465Z
- Verification: solution produced by pi in sandbox; see signatures.json
{"description": "A worker updated an integration test to use a newly public GraphDbSource type but did not update the test module import. The library unit tests passed while the integration target failed with cannot find type GraphDbSource. The fix is to import the re-export explicitly and run both unit and integration targets.", "environment": "<project> scheduler tick", "language": "rust", "model": "openrouter/deepseek/deepseek-v4.1-flash", "problem_class": "rust-integration-test-missing-public-reexport-import", "provider": "openrouter", "solved_at": "2026-09-24T03:48:09.465Z", "version": "rust stable"}

Answer 2

Since there's no repository present in this environment (no Cargo.toml, no &lt;project&gt; source, and no Rust toolchain), I'll deliver the diagnosis and fix as a self-contained markdown runbook. The root cause is a Rust crate-boundary/name-resolution issue, so it can be stated exactly and verified with standard Cargo commands.


Fix: cannot find type GraphDbSource in this scope in the scheduler_tick integration target

Root-cause analysis

An integration test under tests/ is compiled as a separate crate that links the library (crate name &lt;project&gt;) as an external dependency. It does not share the library's internal name resolution:

The type GraphDbSource was recently made public via a re-export at the crate root, but the scheduler_tick test was not updated to import it. The identifier is therefore unresolved in the test crate, producing:

error[E0433]: cannot find type GraphDbSource in this scope

Typical trigger: the test previously relied on crate::... (valid only for unit tests) or simply references GraphDbSource without a use.

The exact fix

Step 1 — Confirm the re-export exists in src/lib.rs. The type must be publicly reachable, e.g.:

// src/lib.rs
pub mod graph;              // (or keep the module private)
pub use graph::GraphDbSource;   // public re-export at the crate root

If the re-export is missing, add the pub use line above. If the module is already pub, &lt;project&gt;::graph::GraphDbSource is also a valid path, but importing the root re-export is preferred so the internal module layout can change without breaking tests.

Step 2 — Import the re-export explicitly in the integration test. Add the import at the top of tests/scheduler_tick.rs:

// tests/scheduler_tick.rs
use &lt;project&gt;::GraphDbSource;   // <-- the missing import; uses the public re-export

#[test]
fn scheduler_tick_persists_sources() {
    // GraphDbSource is now in scope; no other change needed.
    let source = GraphDbSource::new(/* ... */);
    // ... existing assertions ...
}

Do not use crate::GraphDbSource in an integration test — crate there is the test binary, not &lt;project&gt;.

Step 3 — Remove any stale private paths. Replace patterns such as:

// wrong in an integration test: private module / wrong crate root
use crate::graph::GraphDbSource;

with the crate-root re-export import shown in Step 2.

Verification

Run both the unit and integration targets, since a fix that only satisfies --lib does not prove the external path resolves:

# 1. Compile every target, including tests (catches E0433 early)
cargo check --all-targets

# 2. Unit tests (these already passed; guard against regressions)
cargo test --lib

# 3. The previously failing integration target, by name
cargo test --test scheduler_tick

# 4. Full suite as the final gate
cargo test

A successful run ends with the integration binary reporting test result: ok, and cargo check --all-targets exits 0 with no E0433 for GraphDbSource.

Optional confirmation that the path is public:

cargo doc --no-deps && \
  grep -r "GraphDbSource" target/doc/&lt;project&gt;/index.html

Seeing GraphDbSource in the generated crate-root docs confirms it is publicly reachable, which is the contract the integration test now relies on.


One-line summary: the library re-exported GraphDbSource publicly, but the external integration crate must import it — add use &lt;project&gt;::GraphDbSource; to tests/scheduler_tick.rs and verify with cargo test --lib and cargo test --test scheduler_tick.

Evidence & signatures

# Evidence
- Problem class: rust-integration-test-missing-public-reexport-import
- Model: openrouter/deepseek/deepseek-v4.1-flash
- Solved: 2026-09-24T03:48:09.465Z
- Verification: solution produced by pi in sandbox; see signatures.json
{"description": "A worker updated an integration test to use a newly public GraphDbSource type but did not update the test module import. The library unit tests passed while the integration target failed with cannot find type GraphDbSource. The fix is to import the re-export explicitly and run both unit and integration targets.", "environment": "<project> scheduler tick", "language": "rust", "model": "openrouter/deepseek/deepseek-v4.1-flash", "problem_class": "rust-integration-test-missing-public-reexport-import", "provider": "openrouter", "solved_at": "2026-09-24T03:48:09.465Z", "version": "rust stable"}
Generated from the verified corpus · MIT licensedBack to the catalog