chore(analysis): update dependency analysis artifacts

Authored by: Structural Analysis Agent (Euler)

Updated all dependency analysis artifacts with fresh extraction:
- graph.json: Canonical dependency graph with 10 crates, 139 files, 16 crate edges, 72 file edges
- graph.summary.md: Overview with fan-in/fan-out rankings and crate inventory
- sccs.md: SCC analysis confirming no cycles at crate or file level (clean DAG)
- layers.observed.md: 5-layer architecture diagram derived from dependencies
- hotspots.md: Coupling hotspots (g3-config highest fan-in, g3-cli highest fan-out)
- limitations.md: Documented extraction limitations (conditional compilation, macros, etc.)

Key findings:
- All 10 workspace crates form a directed acyclic graph
- g3-core/src/ui_writer.rs has highest file-level fan-in (10 dependents)
- g3-console is standalone with no workspace dependencies
- Clean layered architecture with no violations detected
This commit is contained in:
Dhanji R. Prasanna
2026-01-07 09:36:52 +11:00
parent ff08a622eb
commit f0bd7959b1
6 changed files with 1185 additions and 675 deletions

View File

@@ -1,64 +1,169 @@
# Strongly Connected Components Analysis
## Crate-Level SCCs
**Result: No cycles detected**
All 10 crates form a directed acyclic graph (DAG). Each crate is its own trivial SCC of size 1.
### Topological Order (Bottom to Top)
1. **Leaf crates** (no internal dependencies):
- g3-config
- g3-providers
- g3-execution
- g3-computer-control
2. **Mid-level crates**:
- g3-core (depends on: g3-providers, g3-config, g3-execution, g3-computer-control)
- g3-console (standalone, no workspace dependencies)
3. **Higher-level crates**:
- g3-planner (depends on: g3-providers, g3-core, g3-config)
- g3-ensembles (depends on: g3-core, g3-config)
4. **Application layer**:
- g3-cli (depends on: g3-core, g3-config, g3-planner, g3-providers, g3-ensembles)
5. **Root binary**:
- g3 (depends on: g3-cli, g3-providers)
## File-Level SCCs Within Crates
### g3-core
No non-trivial SCCs detected. Internal module dependencies are acyclic:
```
lib.rs
├── ui_writer.rs
├── context_window.rs
│ └── paths.rs
├── streaming_parser.rs
├── tool_dispatch.rs
│ └── tools/mod.rs
│ ├── executor.rs
│ │ ├── background_process.rs
│ │ ├── paths.rs
│ │ └── webdriver_session.rs
│ ├── file_ops.rs → utils.rs, ui_writer.rs
│ ├── shell.rs → utils.rs, ui_writer.rs
│ ├── misc.rs → ui_writer.rs
│ ├── todo.rs → ui_writer.rs
│ └── webdriver.rs → webdriver_session.rs, ui_writer.rs
├── error_handling.rs
├── retry.rs → error_handling.rs, ui_writer.rs
├── feedback_extraction.rs → ui_writer.rs
├── task_result.rs → context_window.rs
└── provider_config.rs
```
### g3-providers
No non-trivial SCCs. Provider implementations depend on lib.rs types:
```
lib.rs (types: Message, MessageRole, LLMProvider, etc.)
├── anthropic.rs
├── databricks.rs
├── openai.rs
├── embedded.rs
└── oauth.rs
```
### g3-planner
No non-trivial SCCs:
```
lib.rs
├── planner.rs
│ ├── git.rs
│ ├── history.rs
│ ├── llm.rs → prompts.rs
│ └── state.rs
├── code_explore.rs
└── prompts.rs
```
### g3-computer-control
No non-trivial SCCs:
```
lib.rs
├── types.rs
├── platform/mod.rs
│ ├── macos.rs → ocr/mod.rs, types.rs
│ ├── linux.rs → types.rs
│ └── windows.rs → types.rs
├── ocr/mod.rs → types.rs
│ ├── vision.rs → types.rs
│ └── tesseract.rs → types.rs
├── webdriver/mod.rs
│ ├── safari.rs
│ └── chrome.rs
└── macax/mod.rs
└── controller.rs
```
### g3-console
No non-trivial SCCs:
```
lib.rs
├── models/mod.rs
│ ├── instance.rs
│ └── message.rs
├── api/mod.rs
│ ├── instances.rs → logs.rs, models, process/detector.rs
│ ├── control.rs → models, process/controller.rs
│ ├── logs.rs → logs.rs, process/detector.rs
│ └── state.rs → launch.rs
├── process/mod.rs
│ ├── controller.rs → models
│ └── detector.rs → models
├── logs.rs → models
└── launch.rs
```
### g3-ensembles
No non-trivial SCCs:
```
lib.rs
├── flock.rs → status.rs
└── status.rs
```
### g3-cli
No non-trivial SCCs:
```
lib.rs
├── filter_json.rs
├── ui_writer_impl.rs → filter_json.rs
├── machine_ui_writer.rs
├── retro_tui.rs → theme.rs
├── theme.rs
├── tui.rs
└── simple_output.rs
```
## Summary
**No cycles detected in the crate-level dependency graph.**
| Scope | Non-Trivial SCCs | Largest SCC Size |
|-------|------------------|------------------|
| Crate-level | 0 | 1 (all trivial) |
| File-level (g3-core) | 0 | 1 |
| File-level (g3-providers) | 0 | 1 |
| File-level (g3-planner) | 0 | 1 |
| File-level (g3-computer-control) | 0 | 1 |
| File-level (g3-console) | 0 | 1 |
| File-level (g3-ensembles) | 0 | 1 |
| File-level (g3-cli) | 0 | 1 |
The G3 workspace exhibits a clean DAG (Directed Acyclic Graph) structure at the crate level.
## Analysis Method
Cycle detection performed via manual topological sort verification of the 16 internal dependency edges.
## Topological Order (Valid)
The following topological ordering confirms acyclicity:
1. g3-config (leaf)
2. g3-execution (leaf)
3. g3-computer-control (leaf)
4. g3-providers (leaf)
5. g3-core (depends on 1-4)
6. g3-ensembles (depends on 1, 5)
7. g3-planner (depends on 1, 4, 5)
8. g3-cli (depends on 1, 4, 5, 6, 7)
9. g3 (depends on 4, 8)
10. g3-console (standalone)
## Potential Coupling Concerns
While no cycles exist, the following patterns warrant attention:
### Diamond Dependencies
```
g3-cli ──────────────────────────────┐
│ │
├── g3-core ── g3-config ◄─────────┤
│ │
├── g3-planner ── g3-config ◄──────┤
│ │
└── g3-ensembles ── g3-config ◄────┘
```
`g3-config` is reached via multiple paths from `g3-cli`. This is not a cycle but indicates `g3-config` is a shared foundation.
### Similar Diamond for g3-core
```
g3-cli ──────────────────────────────┐
│ │
├── g3-core ◄──────────────────────┤
│ │
├── g3-planner ── g3-core ◄────────┤
│ │
└── g3-ensembles ── g3-core ◄──────┘
```
## Module-Level Analysis
Module-level cycle detection was not performed. The `use crate::` statements within each crate suggest internal module dependencies but these are expected within a single compilation unit.
## Conclusion
The crate dependency structure is healthy with no circular dependencies.
The codebase exhibits clean layered architecture with no circular dependencies.