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
This commit is contained in:
Dhanji R. Prasanna
2026-01-12 20:32:16 +05:30
parent fe67e72ddd
commit 028285825b
6 changed files with 2130 additions and 2343 deletions

View File

@@ -1,103 +1,103 @@
# Analysis Limitations
## What Was Observed
## Extraction Method
| 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 |
Dependencies extracted via:
1. Cargo.toml parsing for crate-level dependencies
2. Regex-based `use` and `mod` statement extraction from source files
## What Was Not Observed
## Known Limitations
### 1. Internal Module Imports
### 1. Conditional Compilation Not Evaluated
`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**:
```rust
// In ./crates/g3-core/src/streaming.rs
use crate::context_window::ContextWindow; // Edge to context_window.rs not in graph
#[cfg(target_os = "macos")]
use core_graphics::window::*;
```
### 2. Re-exports
Platform-specific imports in `g3-computer-control` are included unconditionally. The actual dependency graph varies by target platform.
`pub use` statements that re-export items from submodules are not tracked as separate edges.
**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`
**Impact**: Transitive dependencies through re-exports are not visible.
### 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
**Example**:
```rust
// In ./crates/g3-core/src/lib.rs
pub use context_window::{ContextWindow, ThinScope}; // Re-export not tracked
pub use some_module::SomeType;
```
### 3. Conditional Compilation
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.
`#[cfg(...)]` attributes on imports are not parsed. All imports are treated as unconditional.
### 4. Glob Imports Partially Resolved
**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:
```bash
cargo tree --prefix none --no-dedupe | grep '^g3-'
```rust
use crate::types::*;
```
To find imports not captured by this analysis:
```bash
rg 'use crate::' --type rust | wc -l # Internal imports (not fully resolved)
rg 'pub use' --type rust | wc -l # Re-exports (not tracked)
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 |