Files
g3/analysis/deps/limitations.md
Dhanji R. Prasanna 4fb605fe7e Update dependency analysis artifacts
Refreshed static dependency analysis for the G3 codebase:

- graph.json: 143 nodes (9 crates, 134 files), 189 edges
- No cycles detected (DAG structure confirmed)
- Top fan-in: g3-core (43), g3-providers (27), g3-config (16)
- Top fan-out: g3-core/src/lib.rs (27), g3-cli/src/lib.rs (12)
- 4-layer architecture: Foundation → Core → Services → Application

Extraction method: Cargo.toml parsing + regex-based import analysis
Limitations documented: internal crate imports, re-exports, conditional compilation

Agent: euler
2026-01-11 16:11:01 +05:30

3.4 KiB

Analysis Limitations

What Was Observed

Source Method Confidence
Crate dependencies Parsed from Cargo.toml [dependencies] sections High
External crate imports Regex match on use g3_*:: statements High
Module declarations Regex match on mod and pub mod statements High
File classification Path pattern matching (tests/, examples/, lib.rs, etc.) High

What Was Not Observed

1. Internal Module Imports

use crate:: statements were detected but not resolved to specific target files.

Impact: File-to-file edges within a crate are incomplete. Only mod declaration edges are captured.

Example not captured:

// In ./crates/g3-core/src/streaming.rs
use crate::context_window::ContextWindow;  // Edge to context_window.rs not in graph

2. Re-exports

pub use statements that re-export items from submodules are not tracked as separate edges.

Impact: Transitive dependencies through re-exports are not visible.

Example:

// In ./crates/g3-core/src/lib.rs
pub use context_window::{ContextWindow, ThinScope};  // Re-export not tracked

3. Conditional Compilation

#[cfg(...)] attributes on imports are not parsed. All imports are treated as unconditional.

Impact: Platform-specific dependencies (e.g., macOS-only code in g3-computer-control) appear as universal.

4. Macro-Generated Imports

Imports generated by macros (e.g., derive macros, include!) are not detected.

Impact: Some edges may be missing if macros generate use statements.

5. Dev-Dependencies

Only [dependencies] sections were parsed. [dev-dependencies] were not included in crate-level edges.

Impact: Test-only dependencies (e.g., tempfile, serial_test) are not in the graph.

6. Build Dependencies

[build-dependencies] were not parsed.

Impact: Build script dependencies are not represented.

7. Feature-Gated Dependencies

Cargo features that enable optional dependencies are not tracked.

Impact: Optional dependencies appear the same as required ones.

8. Workspace Dependencies

[workspace.dependencies] are resolved but the inheritance relationship is not tracked.

Impact: Cannot distinguish workspace-inherited vs crate-specific dependency versions.

What Was Inferred

Inference Basis Confidence
File type classification Filename and path patterns Medium-High
Module file resolution Rust module naming conventions (mod.rs, name.rs) High
Crate membership File path prefix matching High

Potential Invalidation Conditions

  1. Non-standard module structure: If any crate uses #[path = "..."] attributes to override module paths, those edges will be incorrect.

  2. Generated code: If any .rs files are generated at build time (not checked into git), they are not included.

  3. Symlinks: Symbolic links in the source tree are not followed or detected.

  4. External workspace members: Only crates in ./crates/ and root ./src/ were analyzed. External workspace members would be missed.

Verification Commands

To verify crate-level dependencies match Cargo's resolution:

cargo tree --prefix none --no-dedupe | grep '^g3-'

To find imports not captured by this analysis:

rg 'use crate::' --type rust | wc -l  # Internal imports (not fully resolved)
rg 'pub use' --type rust | wc -l     # Re-exports (not tracked)