analysis: Update dependency graph for commits b6d2582..9443f933

Focused analysis on past 10 commits covering:
- New skills module in g3-core (parser, discovery, prompt, embedded, extraction)
- Research tool externalized to skills/research/ skill
- SkillsConfig added to g3-config
- SDLC pipeline state moved to .g3/sdlc/

Key findings:
- 4 crates changed, 29 files affected (8 added, 2 deleted, 19 modified)
- No dependency cycles detected
- Clean DAG structure in new skills module
- Cross-crate coupling via g3-core::skills and g3-config::SkillsConfig
- Compile-time coupling to skills/research/ via include_str!

Agent: euler
This commit is contained in:
Dhanji R. Prasanna
2026-02-05 14:02:44 +11:00
parent 9443f9333b
commit 38da6a56ef
6 changed files with 798 additions and 782 deletions

View File

@@ -1,114 +1,66 @@
# Analysis Limitations
**Generated**: 2025-02-02
**Scope**: Changes in commits `b6d2582..9443f933` (10 commits)
## What Could Not Be Observed
### 1. Dynamic/Runtime Dependencies
- **Plugin loading**: Any runtime module loading via `dlopen` or similar
- **Reflection-based imports**: Dependencies resolved at runtime
- **Configuration-driven imports**: Modules loaded based on config values
### 2. Macro-Generated Code
- **Procedural macros**: Code generated by `#[derive(...)]` and custom proc macros
- **Declarative macros**: `macro_rules!` expansions that generate `use` statements
- **Build script outputs**: Code generated by `build.rs` files
### 3. Conditional Compilation
- **Platform-specific code**: `#[cfg(target_os = "...")]` blocks are included regardless of target
- **Feature flags**: `#[cfg(feature = "...")]` gated code is included unconditionally
- **Test-only code**: `#[cfg(test)]` modules are excluded from analysis
### 4. Re-exports and Transitive Dependencies
- **`pub use` chains**: Transitive re-exports are not fully traced
- **Glob imports**: `use module::*` does not enumerate specific items
- **Prelude imports**: Implicit prelude items are not tracked
### 5. External Crate Dependencies
- **Third-party crates**: Only internal g3 workspace crates are analyzed
- **Workspace dependency versions**: Version constraints not analyzed
- **Optional dependencies**: Not distinguished from required dependencies
| Limitation | Impact | Mitigation |
|------------|--------|------------|
| Runtime dispatch | Tool dispatch uses string matching, not static imports | Analyzed `tool_dispatch.rs` manually |
| Conditional compilation | `#[cfg(...)]` blocks not analyzed | May miss platform-specific deps |
| Macro-generated code | `include_str!` detected, other macros not | Limited to explicit macros |
| External crate deps | crates.io dependencies not enumerated | Focus on workspace crates only |
| Test-only imports | Not distinguished from production | May overcount dependencies |
| Dynamic skill loading | Skills loaded at runtime from filesystem | Only compile-time embedded skills tracked |
## What Was Inferred
### 1. Module Hierarchy
| Inference | Confidence | Rationale |
|-----------|------------|----------|
| Layer assignments | High | Based on Cargo.toml dependency direction |
| Fan-in/fan-out counts | High | Direct count of `use`/`mod` statements |
| Cross-crate edges | High | Explicit `use external_crate::` statements |
| Deleted file impact | Medium | Based on git diff, former imports not verified |
Module parent-child relationships inferred from:
- `mod` declarations in `lib.rs` and `mod.rs` files
- File system structure (`foo/mod.rs` implies `foo` module)
## Potential Invalidators
**Confidence**: High - Rust module system is deterministic
Conditions that would invalidate this analysis:
### 2. Crate Dependencies
1. **Feature flags**: If `Cargo.toml` uses `[features]` to conditionally include dependencies, the graph may be incomplete for non-default configurations.
Crate-level dependencies extracted from:
- `Cargo.toml` `[dependencies]` sections
- `path = "..."` declarations for workspace crates
2. **Workspace-level dependencies**: The `[workspace.dependencies]` section in root `Cargo.toml` was not analyzed for version constraints.
**Confidence**: High - Cargo.toml is authoritative
3. **Build scripts**: `build.rs` files may generate code or modify dependencies at build time.
### 3. File-Level Imports
4. **Proc macros**: Procedural macros in dependencies may generate additional imports not visible in source.
File imports extracted via regex pattern matching:
- `^use (g3_|crate::)` for internal imports
- `^(pub )?mod ` for module declarations
5. **Path aliases**: If `Cargo.toml` uses `[patch]` or path aliases, actual dependency resolution may differ.
**Confidence**: Medium-High - May miss unusual import patterns
## Scope Boundaries
### 4. Fan-In/Fan-Out Counts
- **Included**: All files changed in commits `b6d2582..9443f933`
- **Excluded**: Unchanged files, even if they depend on changed files
- **Excluded**: Files outside `crates/` and `skills/` directories (except prompts/)
Coupling metrics derived from edge counts in dependency graph.
## Tool Versions
**Confidence**: Medium - Depends on completeness of edge extraction
| Tool | Version | Purpose |
|------|---------|--------|
| git | system | Commit range, diff |
| rg (ripgrep) | system | Import pattern matching |
| Manual analysis | - | Cargo.toml parsing |
## What May Invalidate Conclusions
## Reproducibility
### 1. Code Changes
To reproduce this analysis:
This analysis reflects the codebase state at generation time. Any of the following invalidate the analysis:
- New files added
- Import statements changed
- Module structure reorganized
- Cargo.toml dependencies modified
```bash
# Get changed files
git diff --name-only 9443f933~10..9443f933
### 2. Incomplete Extraction
# Extract imports from Rust files
rg "^use |^mod |use g3_|use crate::" crates/*/src/*.rs
The regex-based extraction may miss:
- Multi-line `use` statements with unusual formatting
- Imports inside function bodies
- Imports in macro invocations
- `extern crate` declarations (deprecated but valid)
### 3. Test Code Exclusion
Test files (`tests/*.rs`, `#[cfg(test)]` modules) are excluded. Test-only dependencies and coupling patterns are not reflected.
### 4. Example Code Exclusion
Example files (`examples/*.rs`) are excluded from the graph.
### 5. Build Script Dependencies
`build.rs` files may introduce compile-time dependencies not reflected in the import graph.
## Extraction Method Details
| Aspect | Method | Tool |
|--------|--------|------|
| Crate dependencies | Cargo.toml parsing | Manual inspection |
| Module declarations | Regex: `^(pub )?mod ` | ripgrep |
| Internal imports | Regex: `^use (g3_\|crate::)` | ripgrep |
| File enumeration | `find crates -name "*.rs"` | find |
| Cycle detection | Manual graph traversal | N/A |
## Recommendations for Future Analysis
1. **Use cargo metadata**: `cargo metadata --format-version 1` provides authoritative dependency information
2. **Use rust-analyzer**: LSP-based analysis would capture macro expansions
3. **Use cargo-depgraph**: Specialized tool for Rust dependency visualization
4. **Include test coverage**: Analyze test files separately for test-specific coupling
# Check Cargo.toml dependencies
cat crates/*/Cargo.toml | grep -A20 "\[dependencies\]"
```