Files
g3/analysis/deps/limitations.md
Dhanji R. Prasanna 028285825b Update dependency analysis artifacts
Refreshed static analysis of workspace dependency structure:
- graph.json: 10 crates, 17 crate-level edges, 95 files, 123 file-level edges
- graph.summary.md: Updated metrics and fan-in/fan-out rankings
- sccs.md: Confirmed no cycles (DAG structure intact)
- layers.observed.md: 5-layer hierarchy from binaries to infrastructure
- hotspots.md: Identified g3-config, g3-providers as high fan-in; g3-cli as high fan-out
- limitations.md: Documented extraction method constraints

Agent: euler
2026-01-12 20:32:16 +05:30

104 lines
2.9 KiB
Markdown

# Analysis Limitations
## Extraction Method
Dependencies extracted via:
1. Cargo.toml parsing for crate-level dependencies
2. Regex-based `use` and `mod` statement extraction from source files
## Known Limitations
### 1. Conditional Compilation Not Evaluated
```rust
#[cfg(target_os = "macos")]
use core_graphics::window::*;
```
Platform-specific imports in `g3-computer-control` are included unconditionally. The actual dependency graph varies by target platform.
**Affected files:**
- `crates/g3-computer-control/src/platform/macos.rs`
- `crates/g3-computer-control/src/platform/linux.rs`
- `crates/g3-computer-control/src/platform/windows.rs`
### 2. Macro-Generated Imports Not Detected
Imports generated by procedural macros (e.g., `#[derive(...)]`, `#[async_trait]`) are not captured. These may introduce implicit dependencies.
**Common macros in codebase:**
- `serde::Serialize`, `serde::Deserialize`
- `async_trait::async_trait`
- `clap::Parser`
### 3. Re-Exports Not Fully Traced
```rust
pub use some_module::SomeType;
```
Re-exports create transitive dependencies that are not fully traced. A file importing `SomeType` from a re-exporting module has an indirect dependency on the original module.
### 4. Glob Imports Partially Resolved
```rust
use crate::types::*;
```
Glob imports are recorded but individual items are not enumerated. The actual coupling may be higher or lower than represented.
### 5. Test Code Excluded
Files matching these patterns are excluded:
- `*_test.rs`
- `tests/*.rs`
- `mod tests { ... }` blocks
Test dependencies are not represented in the graph.
### 6. Build Scripts Not Analyzed
`build.rs` files are not included. Build-time dependencies (e.g., code generation) are not captured.
**Affected:**
- `crates/g3-computer-control/build.rs`
### 7. External Crate Dependencies Not Graphed
Only workspace-internal dependencies are represented. External crates (tokio, serde, etc.) are not included in the graph.
### 8. Inline Module Definitions
```rust
mod foo {
// inline definition
}
```
Inline module definitions without corresponding files are detected but may not resolve to file edges.
### 9. Path Aliases Not Resolved
```rust
use crate::foo as bar;
```
Aliased imports are recorded with original path, but alias usage elsewhere is not correlated.
## What May Invalidate Conclusions
1. **Feature flags**: Cargo features may enable/disable entire modules
2. **Workspace changes**: Adding/removing crates changes the graph structure
3. **Refactoring**: Moving code between modules changes edges without changing functionality
4. **Dynamic dispatch**: Trait objects create runtime dependencies not visible statically
## Confidence Assessment
| Aspect | Confidence |
|--------|------------|
| Crate-level dependencies | High (from Cargo.toml) |
| Module tree structure | High (from mod declarations) |
| Cross-crate imports | Medium (regex-based) |
| Intra-module coupling | Low (not analyzed) |
| Runtime dependencies | Not captured |