feat(audit): SSDL analysis - effective codepaths + nil-sentinel + organization verdict
- src/code_path_audit_ssdl.py: 9 functions translating per-aggregate findings into SSDL primitives (compute_effective_codepaths, count_branches_in_function, detect_nil_check_pattern, compute_field_access_efficiency, suggest_defusing_technique, render_ssdl_sketch/rollup, render_organization_deductions). - src/code_path_audit.py:render_rollups() now emits ssdl_analysis.md + organization_deductions.md alongside the existing 8 rollups. - src/code_path_audit_render.py:render_full_markdown() adds SSDL sketch section per profile (effective codepaths + defusing recommendations). Real findings (Metadata aggregate): - 35 consumers, 251 total branches, 1.13e18 effective codepaths - 6 nil-check functions (candidates for [N] sentinel) - 130 field-access sites, 0% typed (candidates for immediate-mode cache) - Verdict: needs restructuring Audit output grew 2136 -> 2415 lines. All 131 tests pass. Meta-audit clean (0 violations).
This commit is contained in:
@@ -32,6 +32,11 @@ _(no field accesses detected)_
|
||||
**Dominant pattern:** mixed
|
||||
**Evidence count:** 0
|
||||
|
||||
## SSDL Sketch for ChatMessage
|
||||
|
||||
_(placeholder; candidate aggregate)_
|
||||
|
||||
|
||||
## Frequency
|
||||
|
||||
**Dominant frequency:** unknown
|
||||
|
||||
@@ -32,6 +32,23 @@ _(no field accesses detected)_
|
||||
**Dominant pattern:** mixed
|
||||
**Evidence count:** 0
|
||||
|
||||
## SSDL Sketch for `CommsLog`
|
||||
|
||||
```
|
||||
[Q:CommsLog entry-point] -> [Q:PCG lookup]
|
||||
-> [T:done]
|
||||
```
|
||||
|
||||
**Effective codepaths:** 0 (sum of 2^branches across 0 consumers)
|
||||
**Total branch points:** 0
|
||||
**Nil-check functions:** 0
|
||||
|
||||
**Defusing opportunities:**
|
||||
|
||||
- **Immediate-Mode Cache `[Q:key] -> [I:FetchCached] -> [T]`**: Introduce a `commslog_cache` keyed lookup. Consumers request by key, get cached value, no field-existence checks. Reduces 0 field-check branches to 1 cache lookup.
|
||||
- Effective codepaths: 0 -> 1
|
||||
|
||||
|
||||
## Frequency
|
||||
|
||||
**Dominant frequency:** per_turn
|
||||
|
||||
@@ -32,6 +32,23 @@ _(no field accesses detected)_
|
||||
**Dominant pattern:** mixed
|
||||
**Evidence count:** 0
|
||||
|
||||
## SSDL Sketch for `CommsLogEntry`
|
||||
|
||||
```
|
||||
[Q:CommsLogEntry entry-point] -> [Q:PCG lookup]
|
||||
-> [T:done]
|
||||
```
|
||||
|
||||
**Effective codepaths:** 0 (sum of 2^branches across 0 consumers)
|
||||
**Total branch points:** 0
|
||||
**Nil-check functions:** 0
|
||||
|
||||
**Defusing opportunities:**
|
||||
|
||||
- **Immediate-Mode Cache `[Q:key] -> [I:FetchCached] -> [T]`**: Introduce a `commslogentry_cache` keyed lookup. Consumers request by key, get cached value, no field-existence checks. Reduces 0 field-check branches to 1 cache lookup.
|
||||
- Effective codepaths: 0 -> 1
|
||||
|
||||
|
||||
## Frequency
|
||||
|
||||
**Dominant frequency:** per_turn
|
||||
|
||||
@@ -32,6 +32,23 @@ _(no field accesses detected)_
|
||||
**Dominant pattern:** mixed
|
||||
**Evidence count:** 0
|
||||
|
||||
## SSDL Sketch for `FileItem`
|
||||
|
||||
```
|
||||
[Q:FileItem entry-point] -> [Q:PCG lookup]
|
||||
-> [T:done]
|
||||
```
|
||||
|
||||
**Effective codepaths:** 0 (sum of 2^branches across 0 consumers)
|
||||
**Total branch points:** 0
|
||||
**Nil-check functions:** 0
|
||||
|
||||
**Defusing opportunities:**
|
||||
|
||||
- **Immediate-Mode Cache `[Q:key] -> [I:FetchCached] -> [T]`**: Introduce a `fileitem_cache` keyed lookup. Consumers request by key, get cached value, no field-existence checks. Reduces 0 field-check branches to 1 cache lookup.
|
||||
- Effective codepaths: 0 -> 1
|
||||
|
||||
|
||||
## Frequency
|
||||
|
||||
**Dominant frequency:** per_turn
|
||||
|
||||
@@ -11,16 +11,16 @@
|
||||
|
||||
\ === consumers (3 items) ===
|
||||
"src.ai_client._build_file_context_text" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.ai_client._build_file_diff_text" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.ai_client._reread_file_items_result" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.ai_client._build_file_diff_text" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
|
||||
\ === access_pattern ===
|
||||
"whole_struct" access-pattern
|
||||
|
||||
\ === access_pattern_evidence (3 items) ===
|
||||
"src.ai_client._build_file_context_text" "whole_struct" 0 "low" ap-evidence
|
||||
"src.ai_client._build_file_diff_text" "whole_struct" 0 "low" ap-evidence
|
||||
"src.ai_client._reread_file_items_result" "whole_struct" 0 "low" ap-evidence
|
||||
"src.ai_client._build_file_diff_text" "whole_struct" 0 "low" ap-evidence
|
||||
|
||||
\ === frequency ===
|
||||
"per_turn" frequency
|
||||
|
||||
@@ -24,8 +24,8 @@ _(none)_
|
||||
### `src\ai_client.py` (3 consumers)
|
||||
|
||||
- `src.ai_client._build_file_context_text` (line 0)
|
||||
- `src.ai_client._build_file_diff_text` (line 0)
|
||||
- `src.ai_client._reread_file_items_result` (line 0)
|
||||
- `src.ai_client._build_file_diff_text` (line 0)
|
||||
|
||||
## Field access matrix
|
||||
|
||||
@@ -40,6 +40,28 @@ _(no field accesses detected)_
|
||||
|
||||
- `whole_struct`: 3 functions (100%)
|
||||
|
||||
## SSDL Sketch for `FileItems`
|
||||
|
||||
```
|
||||
[Q:FileItems entry-point] -> [Q:PCG lookup]
|
||||
-> [1: _build_file_context_text] [B:check] (branches=3)
|
||||
-> [2: _reread_file_items_result] [B:is None?] (branches=5) [N:safe]
|
||||
-> [3: _build_file_diff_text] [B:check] (branches=6)
|
||||
-> [T:done]
|
||||
```
|
||||
|
||||
**Effective codepaths:** 104 (sum of 2^branches across 3 consumers)
|
||||
**Total branch points:** 14
|
||||
**Nil-check functions:** 1
|
||||
|
||||
**Defusing opportunities:**
|
||||
|
||||
- **Nil Sentinel `[N]`**: Introduce a module-level `NIL_<AGGREGATE>` sentinel whose field accesses return safe defaults. Replace None checks with the sentinel. Collapses 2^branch_count into ~1.
|
||||
- Effective codepaths: 104 -> 102
|
||||
- **Immediate-Mode Cache `[Q:key] -> [I:FetchCached] -> [T]`**: Introduce a `fileitems_cache` keyed lookup. Consumers request by key, get cached value, no field-existence checks. Reduces 0 field-check branches to 1 cache lookup.
|
||||
- Effective codepaths: 104 -> 1
|
||||
|
||||
|
||||
## Frequency
|
||||
|
||||
**Dominant frequency:** per_turn
|
||||
@@ -99,5 +121,5 @@ FileItems: access_pattern=whole_struct, frequency=per_turn, struct_field_count=5
|
||||
| function | pattern | field_accesses | confidence |
|
||||
|---|---|---|---|
|
||||
| `src.ai_client._build_file_context_text` | `whole_struct` | | low |
|
||||
| `src.ai_client._build_file_diff_text` | `whole_struct` | | low |
|
||||
| `src.ai_client._reread_file_items_result` | `whole_struct` | | low |
|
||||
| `src.ai_client._build_file_diff_text` | `whole_struct` | | low |
|
||||
|
||||
@@ -4,8 +4,8 @@ Metadata: FileItems
|
||||
|- producers: [0]
|
||||
|- consumers: [3]
|
||||
| |- src.ai_client._build_file_context_text (consumer)
|
||||
| |- src.ai_client._build_file_diff_text (consumer)
|
||||
| |- src.ai_client._reread_file_items_result (consumer)
|
||||
| |- src.ai_client._build_file_diff_text (consumer)
|
||||
|- access_pattern: whole_struct
|
||||
|- frequency: per_turn
|
||||
|- result_coverage: 0 producers, 3 consumers
|
||||
|
||||
@@ -32,6 +32,23 @@ _(no field accesses detected)_
|
||||
**Dominant pattern:** mixed
|
||||
**Evidence count:** 0
|
||||
|
||||
## SSDL Sketch for `History`
|
||||
|
||||
```
|
||||
[Q:History entry-point] -> [Q:PCG lookup]
|
||||
-> [T:done]
|
||||
```
|
||||
|
||||
**Effective codepaths:** 0 (sum of 2^branches across 0 consumers)
|
||||
**Total branch points:** 0
|
||||
**Nil-check functions:** 0
|
||||
|
||||
**Defusing opportunities:**
|
||||
|
||||
- **Immediate-Mode Cache `[Q:key] -> [I:FetchCached] -> [T]`**: Introduce a `history_cache` keyed lookup. Consumers request by key, get cached value, no field-existence checks. Reduces 0 field-check branches to 1 cache lookup.
|
||||
- Effective codepaths: 0 -> 1
|
||||
|
||||
|
||||
## Frequency
|
||||
|
||||
**Dominant frequency:** per_turn
|
||||
|
||||
@@ -42,6 +42,25 @@ _(none)_
|
||||
|
||||
- `mixed`: 2 functions (100%)
|
||||
|
||||
## SSDL Sketch for `HistoryMessage`
|
||||
|
||||
```
|
||||
[Q:HistoryMessage entry-point] -> [Q:PCG lookup]
|
||||
-> [1: append] [B:check] (branches=1)
|
||||
-> [2: replace_all] [B:check] (branches=1)
|
||||
-> [T:done]
|
||||
```
|
||||
|
||||
**Effective codepaths:** 4 (sum of 2^branches across 2 consumers)
|
||||
**Total branch points:** 2
|
||||
**Nil-check functions:** 0
|
||||
|
||||
**Defusing opportunities:**
|
||||
|
||||
- **Immediate-Mode Cache `[Q:key] -> [I:FetchCached] -> [T]`**: Introduce a `historymessage_cache` keyed lookup. Consumers request by key, get cached value, no field-existence checks. Reduces 4 field-check branches to 1 cache lookup.
|
||||
- Effective codepaths: 4 -> 4
|
||||
|
||||
|
||||
## Frequency
|
||||
|
||||
**Dominant frequency:** per_turn
|
||||
|
||||
@@ -8,170 +8,170 @@
|
||||
"discussion" mem-dim
|
||||
|
||||
\ === producers (77 items) ===
|
||||
"src.app_controller._api_status" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.app_controller.get_performance" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.get_financial_metrics" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.app_controller._api_get_mma_status" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.get_mma_status" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.set_value" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.ai_client._parse_tool_args_result" "src\ai_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.get_system_telemetry" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.app_controller.get_api_project" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.ai_client._load_credentials" "src\ai_client.py" 0 "producer" fn-ref
|
||||
"src.project_manager.load_history" "src\project_manager.py" 0 "producer" fn-ref
|
||||
"src.models._load_config_from_disk" "src\models.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.get_context_state" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.get_session" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.ai_client.get_token_stats" "src\ai_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.drag" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.post_gui" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.app_controller.get_session" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.app_controller.get_api_session" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.ai_client._send_cli_round_result" "src\ai_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.get_patch_status" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.ai_client.get_gemini_cache_stats" "src\ai_client.py" 0 "producer" fn-ref
|
||||
"src.app_controller._api_get_mma_status" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.get_status" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.get_gui_diagnostics" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.select_tab" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.app_controller._api_token_stats" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.app_controller._offload_entry_payload" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.project_manager.default_discussion" "src\project_manager.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.get_node_status" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.get_gui_state" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.apply_patch" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.post_project" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.app_controller.get_mma_status" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.app_controller.wait" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.wait_for_project_switch" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.ai_client.ollama_chat" "src\ai_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.get_warmup_status" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.app_controller.get_session" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.get_project_switch_status" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.get_project" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.app_controller.status" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.app_controller._api_get_api_session" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.push_event" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.drag" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.app_controller.load_config" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.ai_client._send_cli_round_result" "src\ai_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.select_tab" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.ai_client._dashscope_call" "src\ai_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.trigger_patch" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.app_controller._api_get_api_project" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.ai_client._parse_tool_args_result" "src\ai_client.py" 0 "producer" fn-ref
|
||||
"src.app_controller._api_status" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.get_mma_workers" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.app_controller._api_get_gui_state" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.ai_client.get_token_stats" "src\ai_client.py" 0 "producer" fn-ref
|
||||
"src.ai_client._add_bleed_derived" "src\ai_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.get_io_pool_status" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.ai_client._content_block_to_dict" "src\ai_client.py" 0 "producer" fn-ref
|
||||
"src.app_controller.get_diagnostics" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.get_performance" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.app_controller._api_get_session" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.app_controller.wait" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.app_controller.get_performance" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.wait_for_project_switch" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.reject_patch" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.get_mma_status" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.models._load_config_from_disk" "src\models.py" 0 "producer" fn-ref
|
||||
"src.app_controller.get_session_insights" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.get_gui_health" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.project_manager.migrate_from_legacy_config" "src\project_manager.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.get_gui_diagnostics" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.get_session" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.app_controller._api_get_diagnostics" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.get_startup_timeline" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.select_list_item" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.post_session" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.ai_client._content_block_to_dict" "src\ai_client.py" 0 "producer" fn-ref
|
||||
"src.project_manager.default_discussion" "src\project_manager.py" 0 "producer" fn-ref
|
||||
"src.app_controller.get_gui_state" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.ai_client.ollama_chat" "src\ai_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.get_context_state" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.app_controller._api_generate" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.app_controller.generate" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.models.to_dict" "src\models.py" 0 "producer" fn-ref
|
||||
"src.project_manager.load_project" "src\project_manager.py" 0 "producer" fn-ref
|
||||
"src.app_controller._offload_entry_payload" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.get_warmup_status" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.app_controller.get_context" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.app_controller.get_api_project" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.app_controller._api_get_performance" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.app_controller.get_api_session" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.right_click" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.get_system_telemetry" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.project_manager.default_project" "src\project_manager.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.get_warmup_wait" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.get_node_status" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.app_controller._api_token_stats" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.app_controller.token_stats" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.project_manager.flat_config" "src\project_manager.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.trigger_patch" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.select_list_item" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.project_manager.migrate_from_legacy_config" "src\project_manager.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.get_gui_health" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.get_patch_status" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.get_io_pool_status" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.app_controller.generate" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.post_gui" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.get_financial_metrics" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.click" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.models.to_dict" "src\models.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.get_project_switch_status" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.app_controller._api_get_api_project" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.app_controller.get_gui_state" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.app_controller._api_get_performance" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.project_manager.str_to_entry" "src\project_manager.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.post_session" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.get_startup_timeline" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.get_mma_workers" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.app_controller._api_get_api_session" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.app_controller._api_get_context" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.app_controller.get_context" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.right_click" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.ai_client._dashscope_call" "src\ai_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.get_performance" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.app_controller.get_diagnostics" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.apply_patch" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.app_controller._api_get_diagnostics" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.project_manager.load_project" "src\project_manager.py" 0 "producer" fn-ref
|
||||
"src.app_controller.status" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.app_controller.load_config" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.reject_patch" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.get_project" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.project_manager.default_project" "src\project_manager.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.post_project" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.app_controller._api_get_gui_state" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.app_controller._api_get_session" "src\app_controller.py" 0 "producer" fn-ref
|
||||
"src.ai_client.get_gemini_cache_stats" "src\ai_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.get_warmup_wait" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.get_gui_state" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.push_event" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.api_hook_client.set_value" "src\api_hook_client.py" 0 "producer" fn-ref
|
||||
"src.ai_client._load_credentials" "src\ai_client.py" 0 "producer" fn-ref
|
||||
|
||||
\ === consumers (35 items) ===
|
||||
"src.ai_client._strip_private_keys" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.project_manager.migrate_from_legacy_config" "src\project_manager.py" 0 "consumer" fn-ref
|
||||
"src.app_controller._start_track_logic" "src\app_controller.py" 0 "consumer" fn-ref
|
||||
"src.ai_client._trim_minimax_history" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.ai_client._append_comms" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.ai_client._trim_anthropic_history" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.project_manager.save_project" "src\project_manager.py" 0 "consumer" fn-ref
|
||||
"src.app_controller._start_track_logic_result" "src\app_controller.py" 0 "consumer" fn-ref
|
||||
"src.project_manager.flat_config" "src\project_manager.py" 0 "consumer" fn-ref
|
||||
"src.ai_client._add_bleed_derived" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.ai_client._estimate_prompt_tokens" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.ai_client._estimate_message_tokens" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.aggregate.build_tier3_context" "src\aggregate.py" 0 "consumer" fn-ref
|
||||
"src.ai_client._strip_cache_controls" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.project_manager.format_discussion" "src\project_manager.py" 0 "consumer" fn-ref
|
||||
"src.app_controller._offload_entry_payload" "src\app_controller.py" 0 "consumer" fn-ref
|
||||
"src.models._save_config_to_disk" "src\models.py" 0 "consumer" fn-ref
|
||||
"src.aggregate.run" "src\aggregate.py" 0 "consumer" fn-ref
|
||||
"src.app_controller._refresh_api_metrics" "src\app_controller.py" 0 "consumer" fn-ref
|
||||
"src.app_controller._on_comms_entry" "src\app_controller.py" 0 "consumer" fn-ref
|
||||
"src.ai_client._invalidate_token_estimate" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.ai_client._dashscope_call" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.models.from_dict" "src\models.py" 0 "consumer" fn-ref
|
||||
"src.ai_client._add_history_cache_breakpoint" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.ai_client._pre_dispatch" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.project_manager.format_discussion" "src\project_manager.py" 0 "consumer" fn-ref
|
||||
"src.aggregate.build_markdown_no_history" "src\aggregate.py" 0 "consumer" fn-ref
|
||||
"src.aggregate._build_files_section_from_items" "src\aggregate.py" 0 "consumer" fn-ref
|
||||
"src.ai_client._repair_minimax_history" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.ai_client._repair_anthropic_history" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.ai_client._repair_deepseek_history" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.aggregate.build_markdown_from_items" "src\aggregate.py" 0 "consumer" fn-ref
|
||||
"src.app_controller._start_track_logic" "src\app_controller.py" 0 "consumer" fn-ref
|
||||
"src.project_manager.entry_to_str" "src\project_manager.py" 0 "consumer" fn-ref
|
||||
"src.ai_client.ollama_chat" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.ai_client._execute_single_tool_call_async" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.app_controller._on_comms_entry" "src\app_controller.py" 0 "consumer" fn-ref
|
||||
"src.project_manager.flat_config" "src\project_manager.py" 0 "consumer" fn-ref
|
||||
"src.project_manager.migrate_from_legacy_config" "src\project_manager.py" 0 "consumer" fn-ref
|
||||
"src.ai_client._strip_stale_file_refreshes" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.ai_client._append_comms" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.ai_client._add_history_cache_breakpoint" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.app_controller._refresh_api_metrics" "src\app_controller.py" 0 "consumer" fn-ref
|
||||
"src.ai_client._estimate_message_tokens" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.ai_client._repair_deepseek_history" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.ai_client._invalidate_token_estimate" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.ai_client._execute_single_tool_call_async" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.models._save_config_to_disk" "src\models.py" 0 "consumer" fn-ref
|
||||
"src.ai_client._repair_minimax_history" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.ai_client._add_bleed_derived" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.ai_client.ollama_chat" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.ai_client._trim_anthropic_history" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.aggregate.build_markdown_from_items" "src\aggregate.py" 0 "consumer" fn-ref
|
||||
"src.project_manager.save_project" "src\project_manager.py" 0 "consumer" fn-ref
|
||||
"src.models.from_dict" "src\models.py" 0 "consumer" fn-ref
|
||||
"src.ai_client._strip_cache_controls" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.ai_client._pre_dispatch" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.aggregate.build_tier3_context" "src\aggregate.py" 0 "consumer" fn-ref
|
||||
"src.app_controller._start_track_logic_result" "src\app_controller.py" 0 "consumer" fn-ref
|
||||
"src.app_controller._offload_entry_payload" "src\app_controller.py" 0 "consumer" fn-ref
|
||||
"src.ai_client._strip_private_keys" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.ai_client._trim_minimax_history" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.ai_client._repair_anthropic_history" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.ai_client._dashscope_call" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.ai_client._estimate_prompt_tokens" "src\ai_client.py" 0 "consumer" fn-ref
|
||||
"src.aggregate._build_files_section_from_items" "src\aggregate.py" 0 "consumer" fn-ref
|
||||
|
||||
\ === access_pattern ===
|
||||
"whole_struct" access-pattern
|
||||
|
||||
\ === access_pattern_evidence (35 items) ===
|
||||
"src.ai_client._strip_private_keys" "whole_struct" 0 "low" ap-evidence
|
||||
"src.project_manager.migrate_from_legacy_config" "whole_struct" 1 "high" ap-evidence
|
||||
"src.app_controller._start_track_logic" "mixed" 2 "high" ap-evidence
|
||||
"src.ai_client._trim_minimax_history" "whole_struct" 1 "high" ap-evidence
|
||||
"src.ai_client._append_comms" "whole_struct" 0 "low" ap-evidence
|
||||
"src.ai_client._trim_anthropic_history" "whole_struct" 1 "high" ap-evidence
|
||||
"src.project_manager.save_project" "mixed" 2 "high" ap-evidence
|
||||
"src.app_controller._start_track_logic_result" "field_by_field" 17 "high" ap-evidence
|
||||
"src.project_manager.flat_config" "whole_struct" 1 "high" ap-evidence
|
||||
"src.ai_client._add_bleed_derived" "field_by_field" 9 "high" ap-evidence
|
||||
"src.ai_client._estimate_prompt_tokens" "whole_struct" 0 "low" ap-evidence
|
||||
"src.ai_client._estimate_message_tokens" "mixed" 2 "high" ap-evidence
|
||||
"src.aggregate.build_tier3_context" "whole_struct" 0 "low" ap-evidence
|
||||
"src.ai_client._strip_cache_controls" "whole_struct" 0 "low" ap-evidence
|
||||
"src.project_manager.format_discussion" "whole_struct" 0 "low" ap-evidence
|
||||
"src.app_controller._offload_entry_payload" "whole_struct" 0 "low" ap-evidence
|
||||
"src.models._save_config_to_disk" "whole_struct" 0 "low" ap-evidence
|
||||
"src.aggregate.run" "field_by_field" 3 "high" ap-evidence
|
||||
"src.app_controller._refresh_api_metrics" "field_by_field" 11 "high" ap-evidence
|
||||
"src.app_controller._on_comms_entry" "field_by_field" 10 "high" ap-evidence
|
||||
"src.ai_client._invalidate_token_estimate" "whole_struct" 1 "high" ap-evidence
|
||||
"src.ai_client._dashscope_call" "whole_struct" 0 "low" ap-evidence
|
||||
"src.models.from_dict" "mixed" 2 "high" ap-evidence
|
||||
"src.ai_client._add_history_cache_breakpoint" "whole_struct" 0 "low" ap-evidence
|
||||
"src.ai_client._pre_dispatch" "whole_struct" 0 "low" ap-evidence
|
||||
"src.project_manager.format_discussion" "whole_struct" 0 "low" ap-evidence
|
||||
"src.aggregate.build_markdown_no_history" "whole_struct" 0 "low" ap-evidence
|
||||
"src.aggregate._build_files_section_from_items" "whole_struct" 0 "low" ap-evidence
|
||||
"src.ai_client._repair_minimax_history" "whole_struct" 1 "high" ap-evidence
|
||||
"src.ai_client._repair_anthropic_history" "whole_struct" 1 "high" ap-evidence
|
||||
"src.ai_client._repair_deepseek_history" "whole_struct" 1 "high" ap-evidence
|
||||
"src.aggregate.build_markdown_from_items" "whole_struct" 0 "low" ap-evidence
|
||||
"src.app_controller._start_track_logic" "mixed" 2 "high" ap-evidence
|
||||
"src.project_manager.entry_to_str" "whole_struct" 1 "high" ap-evidence
|
||||
"src.ai_client.ollama_chat" "whole_struct" 0 "low" ap-evidence
|
||||
"src.ai_client._execute_single_tool_call_async" "mixed" 2 "high" ap-evidence
|
||||
"src.app_controller._on_comms_entry" "field_by_field" 10 "high" ap-evidence
|
||||
"src.project_manager.flat_config" "whole_struct" 1 "high" ap-evidence
|
||||
"src.project_manager.migrate_from_legacy_config" "whole_struct" 1 "high" ap-evidence
|
||||
"src.ai_client._strip_stale_file_refreshes" "whole_struct" 0 "low" ap-evidence
|
||||
"src.ai_client._append_comms" "whole_struct" 0 "low" ap-evidence
|
||||
"src.ai_client._add_history_cache_breakpoint" "whole_struct" 0 "low" ap-evidence
|
||||
"src.app_controller._refresh_api_metrics" "field_by_field" 11 "high" ap-evidence
|
||||
"src.ai_client._estimate_message_tokens" "mixed" 2 "high" ap-evidence
|
||||
"src.ai_client._repair_deepseek_history" "whole_struct" 1 "high" ap-evidence
|
||||
"src.ai_client._invalidate_token_estimate" "whole_struct" 1 "high" ap-evidence
|
||||
"src.ai_client._execute_single_tool_call_async" "mixed" 2 "high" ap-evidence
|
||||
"src.models._save_config_to_disk" "whole_struct" 0 "low" ap-evidence
|
||||
"src.ai_client._repair_minimax_history" "whole_struct" 1 "high" ap-evidence
|
||||
"src.ai_client._add_bleed_derived" "field_by_field" 9 "high" ap-evidence
|
||||
"src.ai_client.ollama_chat" "whole_struct" 0 "low" ap-evidence
|
||||
"src.ai_client._trim_anthropic_history" "whole_struct" 1 "high" ap-evidence
|
||||
"src.aggregate.build_markdown_from_items" "whole_struct" 0 "low" ap-evidence
|
||||
"src.project_manager.save_project" "mixed" 2 "high" ap-evidence
|
||||
"src.models.from_dict" "mixed" 2 "high" ap-evidence
|
||||
"src.ai_client._strip_cache_controls" "whole_struct" 0 "low" ap-evidence
|
||||
"src.ai_client._pre_dispatch" "whole_struct" 0 "low" ap-evidence
|
||||
"src.aggregate.build_tier3_context" "whole_struct" 0 "low" ap-evidence
|
||||
"src.app_controller._start_track_logic_result" "field_by_field" 17 "high" ap-evidence
|
||||
"src.app_controller._offload_entry_payload" "whole_struct" 0 "low" ap-evidence
|
||||
"src.ai_client._strip_private_keys" "whole_struct" 0 "low" ap-evidence
|
||||
"src.ai_client._trim_minimax_history" "whole_struct" 1 "high" ap-evidence
|
||||
"src.ai_client._repair_anthropic_history" "whole_struct" 1 "high" ap-evidence
|
||||
"src.ai_client._dashscope_call" "whole_struct" 0 "low" ap-evidence
|
||||
"src.ai_client._estimate_prompt_tokens" "whole_struct" 0 "low" ap-evidence
|
||||
"src.aggregate._build_files_section_from_items" "whole_struct" 0 "low" ap-evidence
|
||||
|
||||
\ === frequency ===
|
||||
"per_turn" frequency
|
||||
|
||||
\ === frequency_evidence (5 items) ===
|
||||
"src.app_controller._api_status" "per_turn" "static_analysis" "producer from src\app_controller.py" freq-evidence
|
||||
"src.app_controller.get_performance" "per_turn" "static_analysis" "producer from src\app_controller.py" freq-evidence
|
||||
"src.api_hook_client.get_financial_metrics" "per_turn" "static_analysis" "producer from src\api_hook_client.py" freq-evidence
|
||||
"src.project_manager.load_history" "per_turn" "static_analysis" "producer from src\project_manager.py" freq-evidence
|
||||
"src.ai_client.get_gemini_cache_stats" "per_turn" "static_analysis" "producer from src\ai_client.py" freq-evidence
|
||||
"src.app_controller._api_get_mma_status" "per_turn" "static_analysis" "producer from src\app_controller.py" freq-evidence
|
||||
"src.api_hook_client.get_mma_status" "per_turn" "static_analysis" "producer from src\api_hook_client.py" freq-evidence
|
||||
"src.api_hook_client.get_status" "per_turn" "static_analysis" "producer from src\api_hook_client.py" freq-evidence
|
||||
"src.api_hook_client.get_gui_state" "per_turn" "static_analysis" "producer from src\api_hook_client.py" freq-evidence
|
||||
|
||||
\ === result_coverage ===
|
||||
77 77 35 0 result-coverage
|
||||
|
||||
@@ -19,80 +19,80 @@
|
||||
|
||||
### `src\ai_client.py` (9 producers)
|
||||
|
||||
- `src.ai_client._parse_tool_args_result` (line 0)
|
||||
- `src.ai_client._load_credentials` (line 0)
|
||||
- `src.ai_client.get_token_stats` (line 0)
|
||||
- `src.ai_client.get_gemini_cache_stats` (line 0)
|
||||
- `src.ai_client._send_cli_round_result` (line 0)
|
||||
- `src.ai_client.ollama_chat` (line 0)
|
||||
- `src.ai_client._dashscope_call` (line 0)
|
||||
- `src.ai_client._parse_tool_args_result` (line 0)
|
||||
- `src.ai_client.get_token_stats` (line 0)
|
||||
- `src.ai_client._add_bleed_derived` (line 0)
|
||||
- `src.ai_client._content_block_to_dict` (line 0)
|
||||
- `src.ai_client._dashscope_call` (line 0)
|
||||
- `src.ai_client.get_gemini_cache_stats` (line 0)
|
||||
- `src.ai_client.ollama_chat` (line 0)
|
||||
- `src.ai_client._load_credentials` (line 0)
|
||||
|
||||
### `src\api_hook_client.py` (33 producers)
|
||||
|
||||
- `src.api_hook_client.get_financial_metrics` (line 0)
|
||||
- `src.api_hook_client.get_mma_status` (line 0)
|
||||
- `src.api_hook_client.set_value` (line 0)
|
||||
- `src.api_hook_client.get_system_telemetry` (line 0)
|
||||
- `src.api_hook_client.get_context_state` (line 0)
|
||||
- `src.api_hook_client.get_session` (line 0)
|
||||
- `src.api_hook_client.drag` (line 0)
|
||||
- `src.api_hook_client.post_gui` (line 0)
|
||||
- `src.api_hook_client.get_patch_status` (line 0)
|
||||
- `src.api_hook_client.get_status` (line 0)
|
||||
- `src.api_hook_client.get_gui_diagnostics` (line 0)
|
||||
- `src.api_hook_client.select_tab` (line 0)
|
||||
- `src.api_hook_client.get_node_status` (line 0)
|
||||
- `src.api_hook_client.wait_for_project_switch` (line 0)
|
||||
- `src.api_hook_client.get_warmup_status` (line 0)
|
||||
- `src.api_hook_client.get_io_pool_status` (line 0)
|
||||
- `src.api_hook_client.get_gui_health` (line 0)
|
||||
- `src.api_hook_client.trigger_patch` (line 0)
|
||||
- `src.api_hook_client.select_list_item` (line 0)
|
||||
- `src.api_hook_client.click` (line 0)
|
||||
- `src.api_hook_client.get_project_switch_status` (line 0)
|
||||
- `src.api_hook_client.post_session` (line 0)
|
||||
- `src.api_hook_client.get_startup_timeline` (line 0)
|
||||
- `src.api_hook_client.get_mma_workers` (line 0)
|
||||
- `src.api_hook_client.right_click` (line 0)
|
||||
- `src.api_hook_client.get_performance` (line 0)
|
||||
- `src.api_hook_client.apply_patch` (line 0)
|
||||
- `src.api_hook_client.reject_patch` (line 0)
|
||||
- `src.api_hook_client.get_project` (line 0)
|
||||
- `src.api_hook_client.post_project` (line 0)
|
||||
- `src.api_hook_client.get_warmup_wait` (line 0)
|
||||
- `src.api_hook_client.get_gui_state` (line 0)
|
||||
- `src.api_hook_client.apply_patch` (line 0)
|
||||
- `src.api_hook_client.post_project` (line 0)
|
||||
- `src.api_hook_client.get_project_switch_status` (line 0)
|
||||
- `src.api_hook_client.get_project` (line 0)
|
||||
- `src.api_hook_client.push_event` (line 0)
|
||||
- `src.api_hook_client.drag` (line 0)
|
||||
- `src.api_hook_client.select_tab` (line 0)
|
||||
- `src.api_hook_client.trigger_patch` (line 0)
|
||||
- `src.api_hook_client.get_mma_workers` (line 0)
|
||||
- `src.api_hook_client.get_performance` (line 0)
|
||||
- `src.api_hook_client.wait_for_project_switch` (line 0)
|
||||
- `src.api_hook_client.reject_patch` (line 0)
|
||||
- `src.api_hook_client.get_mma_status` (line 0)
|
||||
- `src.api_hook_client.get_gui_diagnostics` (line 0)
|
||||
- `src.api_hook_client.get_session` (line 0)
|
||||
- `src.api_hook_client.get_startup_timeline` (line 0)
|
||||
- `src.api_hook_client.select_list_item` (line 0)
|
||||
- `src.api_hook_client.post_session` (line 0)
|
||||
- `src.api_hook_client.get_context_state` (line 0)
|
||||
- `src.api_hook_client.get_warmup_status` (line 0)
|
||||
- `src.api_hook_client.right_click` (line 0)
|
||||
- `src.api_hook_client.get_system_telemetry` (line 0)
|
||||
- `src.api_hook_client.get_warmup_wait` (line 0)
|
||||
- `src.api_hook_client.get_node_status` (line 0)
|
||||
- `src.api_hook_client.get_gui_health` (line 0)
|
||||
- `src.api_hook_client.get_patch_status` (line 0)
|
||||
- `src.api_hook_client.get_io_pool_status` (line 0)
|
||||
- `src.api_hook_client.post_gui` (line 0)
|
||||
- `src.api_hook_client.get_financial_metrics` (line 0)
|
||||
- `src.api_hook_client.click` (line 0)
|
||||
- `src.api_hook_client.set_value` (line 0)
|
||||
|
||||
### `src\app_controller.py` (26 producers)
|
||||
|
||||
- `src.app_controller._api_status` (line 0)
|
||||
- `src.app_controller.get_performance` (line 0)
|
||||
- `src.app_controller._api_get_mma_status` (line 0)
|
||||
- `src.app_controller.get_api_project` (line 0)
|
||||
- `src.app_controller.get_mma_status` (line 0)
|
||||
- `src.app_controller.get_session` (line 0)
|
||||
- `src.app_controller.status` (line 0)
|
||||
- `src.app_controller._api_get_api_session` (line 0)
|
||||
- `src.app_controller.load_config` (line 0)
|
||||
- `src.app_controller._api_get_api_project` (line 0)
|
||||
- `src.app_controller._api_status` (line 0)
|
||||
- `src.app_controller._api_get_gui_state` (line 0)
|
||||
- `src.app_controller.get_diagnostics` (line 0)
|
||||
- `src.app_controller._api_get_session` (line 0)
|
||||
- `src.app_controller.wait` (line 0)
|
||||
- `src.app_controller.get_performance` (line 0)
|
||||
- `src.app_controller.get_session_insights` (line 0)
|
||||
- `src.app_controller._api_get_diagnostics` (line 0)
|
||||
- `src.app_controller.get_gui_state` (line 0)
|
||||
- `src.app_controller._api_generate` (line 0)
|
||||
- `src.app_controller._offload_entry_payload` (line 0)
|
||||
- `src.app_controller.get_context` (line 0)
|
||||
- `src.app_controller.get_api_project` (line 0)
|
||||
- `src.app_controller._api_get_performance` (line 0)
|
||||
- `src.app_controller.get_api_session` (line 0)
|
||||
- `src.app_controller._api_token_stats` (line 0)
|
||||
- `src.app_controller._offload_entry_payload` (line 0)
|
||||
- `src.app_controller.get_mma_status` (line 0)
|
||||
- `src.app_controller.wait` (line 0)
|
||||
- `src.app_controller.get_session_insights` (line 0)
|
||||
- `src.app_controller._api_generate` (line 0)
|
||||
- `src.app_controller.generate` (line 0)
|
||||
- `src.app_controller.token_stats` (line 0)
|
||||
- `src.app_controller._api_get_api_project` (line 0)
|
||||
- `src.app_controller.get_gui_state` (line 0)
|
||||
- `src.app_controller._api_get_performance` (line 0)
|
||||
- `src.app_controller._api_get_api_session` (line 0)
|
||||
- `src.app_controller.generate` (line 0)
|
||||
- `src.app_controller._api_get_context` (line 0)
|
||||
- `src.app_controller.get_context` (line 0)
|
||||
- `src.app_controller.get_diagnostics` (line 0)
|
||||
- `src.app_controller._api_get_diagnostics` (line 0)
|
||||
- `src.app_controller.status` (line 0)
|
||||
- `src.app_controller.load_config` (line 0)
|
||||
- `src.app_controller._api_get_gui_state` (line 0)
|
||||
- `src.app_controller._api_get_session` (line 0)
|
||||
|
||||
### `src\models.py` (2 producers)
|
||||
|
||||
@@ -103,50 +103,50 @@
|
||||
|
||||
- `src.project_manager.load_history` (line 0)
|
||||
- `src.project_manager.default_discussion` (line 0)
|
||||
- `src.project_manager.migrate_from_legacy_config` (line 0)
|
||||
- `src.project_manager.flat_config` (line 0)
|
||||
- `src.project_manager.str_to_entry` (line 0)
|
||||
- `src.project_manager.load_project` (line 0)
|
||||
- `src.project_manager.default_project` (line 0)
|
||||
- `src.project_manager.flat_config` (line 0)
|
||||
- `src.project_manager.migrate_from_legacy_config` (line 0)
|
||||
- `src.project_manager.str_to_entry` (line 0)
|
||||
|
||||
## Consumers (35)
|
||||
|
||||
### `src\aggregate.py` (5 consumers)
|
||||
|
||||
- `src.aggregate.build_tier3_context` (line 0)
|
||||
- `src.aggregate.run` (line 0)
|
||||
- `src.aggregate.build_markdown_no_history` (line 0)
|
||||
- `src.aggregate._build_files_section_from_items` (line 0)
|
||||
- `src.aggregate.build_markdown_from_items` (line 0)
|
||||
- `src.aggregate.build_tier3_context` (line 0)
|
||||
- `src.aggregate._build_files_section_from_items` (line 0)
|
||||
|
||||
### `src\ai_client.py` (18 consumers)
|
||||
|
||||
- `src.ai_client._strip_stale_file_refreshes` (line 0)
|
||||
- `src.ai_client._append_comms` (line 0)
|
||||
- `src.ai_client._add_history_cache_breakpoint` (line 0)
|
||||
- `src.ai_client._estimate_message_tokens` (line 0)
|
||||
- `src.ai_client._repair_deepseek_history` (line 0)
|
||||
- `src.ai_client._invalidate_token_estimate` (line 0)
|
||||
- `src.ai_client._execute_single_tool_call_async` (line 0)
|
||||
- `src.ai_client._repair_minimax_history` (line 0)
|
||||
- `src.ai_client._add_bleed_derived` (line 0)
|
||||
- `src.ai_client.ollama_chat` (line 0)
|
||||
- `src.ai_client._trim_anthropic_history` (line 0)
|
||||
- `src.ai_client._strip_cache_controls` (line 0)
|
||||
- `src.ai_client._pre_dispatch` (line 0)
|
||||
- `src.ai_client._strip_private_keys` (line 0)
|
||||
- `src.ai_client._trim_minimax_history` (line 0)
|
||||
- `src.ai_client._append_comms` (line 0)
|
||||
- `src.ai_client._trim_anthropic_history` (line 0)
|
||||
- `src.ai_client._add_bleed_derived` (line 0)
|
||||
- `src.ai_client._estimate_prompt_tokens` (line 0)
|
||||
- `src.ai_client._estimate_message_tokens` (line 0)
|
||||
- `src.ai_client._strip_cache_controls` (line 0)
|
||||
- `src.ai_client._invalidate_token_estimate` (line 0)
|
||||
- `src.ai_client._dashscope_call` (line 0)
|
||||
- `src.ai_client._add_history_cache_breakpoint` (line 0)
|
||||
- `src.ai_client._pre_dispatch` (line 0)
|
||||
- `src.ai_client._repair_minimax_history` (line 0)
|
||||
- `src.ai_client._repair_anthropic_history` (line 0)
|
||||
- `src.ai_client._repair_deepseek_history` (line 0)
|
||||
- `src.ai_client.ollama_chat` (line 0)
|
||||
- `src.ai_client._execute_single_tool_call_async` (line 0)
|
||||
- `src.ai_client._strip_stale_file_refreshes` (line 0)
|
||||
- `src.ai_client._dashscope_call` (line 0)
|
||||
- `src.ai_client._estimate_prompt_tokens` (line 0)
|
||||
|
||||
### `src\app_controller.py` (5 consumers)
|
||||
|
||||
- `src.app_controller._start_track_logic` (line 0)
|
||||
- `src.app_controller._on_comms_entry` (line 0)
|
||||
- `src.app_controller._refresh_api_metrics` (line 0)
|
||||
- `src.app_controller._start_track_logic_result` (line 0)
|
||||
- `src.app_controller._offload_entry_payload` (line 0)
|
||||
- `src.app_controller._refresh_api_metrics` (line 0)
|
||||
- `src.app_controller._on_comms_entry` (line 0)
|
||||
|
||||
### `src\models.py` (2 consumers)
|
||||
|
||||
@@ -155,51 +155,51 @@
|
||||
|
||||
### `src\project_manager.py` (5 consumers)
|
||||
|
||||
- `src.project_manager.migrate_from_legacy_config` (line 0)
|
||||
- `src.project_manager.save_project` (line 0)
|
||||
- `src.project_manager.flat_config` (line 0)
|
||||
- `src.project_manager.format_discussion` (line 0)
|
||||
- `src.project_manager.entry_to_str` (line 0)
|
||||
- `src.project_manager.flat_config` (line 0)
|
||||
- `src.project_manager.migrate_from_legacy_config` (line 0)
|
||||
- `src.project_manager.save_project` (line 0)
|
||||
|
||||
## Field access matrix
|
||||
|
||||
| consumer | _est_tokens | _gemini_cache_text | _offload_entry_payload | _pending_comms | _pending_comms_lock | _pending_gui_tasks | _pending_gui_tasks_lock | _pending_history_adds | _pending_history_adds_lock | _recalculate_session_usage | _start_track_logic_result | _token_history | _token_stats | _topological_sort_tickets_result | _update_cached_stats | active_discussion | active_project_path | active_project_root | ai_status | append |
|
||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||
| `_strip_private_keys` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `migrate_from_legacy_config` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `_start_track_logic` | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . | . | . | . | 1 | . |
|
||||
| `_trim_minimax_history` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `_append_comms` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `_trim_anthropic_history` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `save_project` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `_start_track_logic_result` | . | . | . | . | . | 2 | 2 | . | . | . | . | . | . | 1 | . | 1 | 1 | 1 | 4 | . |
|
||||
| `flat_config` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `_add_bleed_derived` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `_estimate_prompt_tokens` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `_estimate_message_tokens` | 1 | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `build_tier3_context` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `_strip_cache_controls` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `format_discussion` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `_offload_entry_payload` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `_save_config_to_disk` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `run` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `_refresh_api_metrics` | . | 1 | . | . | . | . | . | . | . | 1 | . | . | 1 | . | 1 | . | . | . | . | . |
|
||||
| `_on_comms_entry` | . | . | 1 | 1 | 1 | . | . | 4 | 4 | . | . | 1 | . | . | . | . | . | . | . | . |
|
||||
| `_invalidate_token_estimate` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `_dashscope_call` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `_add_history_cache_breakpoint` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `_pre_dispatch` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `format_discussion` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `build_markdown_no_history` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `_build_files_section_from_items` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `_repair_minimax_history` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 |
|
||||
| `_repair_anthropic_history` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 |
|
||||
| `_repair_deepseek_history` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 |
|
||||
| `build_markdown_from_items` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `_start_track_logic` | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . | . | . | . | 1 | . |
|
||||
| `entry_to_str` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `ollama_chat` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `_execute_single_tool_call_async` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `_on_comms_entry` | . | . | 1 | 1 | 1 | . | . | 4 | 4 | . | . | 1 | . | . | . | . | . | . | . | . |
|
||||
| `flat_config` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `migrate_from_legacy_config` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `_strip_stale_file_refreshes` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `_append_comms` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `_add_history_cache_breakpoint` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `_refresh_api_metrics` | . | 1 | . | . | . | . | . | . | . | 1 | . | . | 1 | . | 1 | . | . | . | . | . |
|
||||
| `_estimate_message_tokens` | 1 | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `_repair_deepseek_history` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 |
|
||||
| `_invalidate_token_estimate` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `_execute_single_tool_call_async` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `_save_config_to_disk` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `_repair_minimax_history` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 |
|
||||
| `_add_bleed_derived` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `ollama_chat` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `_trim_anthropic_history` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `build_markdown_from_items` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `save_project` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `_strip_cache_controls` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `_pre_dispatch` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `build_tier3_context` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `_start_track_logic_result` | . | . | . | . | . | 2 | 2 | . | . | . | . | . | . | 1 | . | 1 | 1 | 1 | 4 | . |
|
||||
| `_offload_entry_payload` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `_strip_private_keys` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `_trim_minimax_history` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `_repair_anthropic_history` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 |
|
||||
| `_dashscope_call` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `_estimate_prompt_tokens` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
| `_build_files_section_from_items` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
|
||||
|
||||
_... 33 more fields_
|
||||
|
||||
@@ -211,8 +211,64 @@ _... 33 more fields_
|
||||
**Per-function pattern distribution:**
|
||||
|
||||
- `whole_struct`: 25 functions (71%)
|
||||
- `mixed`: 5 functions (14%)
|
||||
- `field_by_field`: 5 functions (14%)
|
||||
- `mixed`: 5 functions (14%)
|
||||
|
||||
## SSDL Sketch for `Metadata`
|
||||
|
||||
```
|
||||
[Q:Metadata entry-point] -> [Q:PCG lookup]
|
||||
-> [1: run] [B:check] (branches=1)
|
||||
-> [2: format_discussion] [B:check] (branches=0)
|
||||
-> [3: build_markdown_no_history] [B:check] (branches=0)
|
||||
-> [4: _start_track_logic] [B:check] (branches=1)
|
||||
-> [5: entry_to_str] [B:check] (branches=3)
|
||||
-> [6: _on_comms_entry] [B:check] (branches=32)
|
||||
-> [7: flat_config] [B:check] (branches=2)
|
||||
-> [8: migrate_from_legacy_config] [B:check] (branches=2)
|
||||
-> [9: _strip_stale_file_refreshes] [B:check] (branches=12)
|
||||
-> [10: _append_comms] [B:is None?] (branches=1) [N:safe]
|
||||
-> [11: _add_history_cache_breakpoint] [B:check] (branches=5)
|
||||
-> [12: _refresh_api_metrics] [B:is None?] (branches=11) [N:safe]
|
||||
-> [13: _estimate_message_tokens] [B:is None?] (branches=9) [N:safe]
|
||||
-> [14: _repair_deepseek_history] [B:check] (branches=6)
|
||||
-> [15: _invalidate_token_estimate] [B:check] (branches=0)
|
||||
-> [16: _execute_single_tool_call_async] [B:is None?] (branches=15) [N:safe]
|
||||
-> [17: _save_config_to_disk] [B:check] (branches=1)
|
||||
-> [18: _repair_minimax_history] [B:check] (branches=10)
|
||||
-> [19: _add_bleed_derived] [B:check] (branches=0)
|
||||
-> [20: ollama_chat] [B:check] (branches=3)
|
||||
-> [21: _trim_anthropic_history] [B:check] (branches=13)
|
||||
-> [22: build_markdown_from_items] [B:check] (branches=9)
|
||||
-> [23: save_project] [B:is None?] (branches=7) [N:safe]
|
||||
-> [24: from_dict] [B:check] (branches=0)
|
||||
-> [25: _strip_cache_controls] [B:check] (branches=4)
|
||||
-> [26: _pre_dispatch] [B:check] (branches=8)
|
||||
-> [27: build_tier3_context] [B:check] (branches=50)
|
||||
-> [28: _start_track_logic_result] [B:check] (branches=10)
|
||||
-> [29: _offload_entry_payload] [B:check] (branches=10)
|
||||
-> [30: _strip_private_keys] [B:check] (branches=0)
|
||||
-> [31: _trim_minimax_history] [B:check] (branches=8)
|
||||
-> [32: _repair_anthropic_history] [B:check] (branches=6)
|
||||
-> [33: _dashscope_call] [B:check] (branches=5)
|
||||
-> [34: _estimate_prompt_tokens] [B:check] (branches=2)
|
||||
-> [35: _build_files_section_from_items] [B:is None?] (branches=5) [N:safe]
|
||||
-> [T:done]
|
||||
```
|
||||
|
||||
**Effective codepaths:** 1125904201862042 (sum of 2^branches across 35 consumers)
|
||||
**Total branch points:** 251
|
||||
**Nil-check functions:** 6
|
||||
|
||||
**Defusing opportunities:**
|
||||
|
||||
- **Nil Sentinel `[N]`**: Introduce a module-level `NIL_<AGGREGATE>` sentinel whose field accesses return safe defaults. Replace None checks with the sentinel. Collapses 2^branch_count into ~1.
|
||||
- Effective codepaths: 1125904201862042 -> 1125904201862030
|
||||
- **Immediate-Mode Cache `[Q:key] -> [I:FetchCached] -> [T]`**: Introduce a `metadata_cache` keyed lookup. Consumers request by key, get cached value, no field-existence checks. Reduces 130 field-check branches to 1 cache lookup.
|
||||
- Effective codepaths: 1125904201862042 -> 130
|
||||
- **Generational Handles `[I:ResolveHandle] -> [B:Gen matches?] -> [N|safe]`**: Wrap the aggregate in a generational handle (index + generation). Validation is one comparison; mismatch returns the nil sentinel. Reduces N lifetime branches to 1 handle validation + sentinel return.
|
||||
- Effective codepaths: 1125904201862042 -> 35
|
||||
|
||||
|
||||
## Frequency
|
||||
|
||||
@@ -265,13 +321,43 @@ _... 33 more fields_
|
||||
| field | access count | access pattern |
|
||||
|---|---|---|
|
||||
| `get` | 10 | hot |
|
||||
| `pop` | 3 | hot |
|
||||
| `append` | 3 | hot |
|
||||
| `ai_status` | 2 | used |
|
||||
| `pop` | 3 | hot |
|
||||
| `files` | 2 | used |
|
||||
| `ai_status` | 2 | used |
|
||||
| `session_usage` | 2 | used |
|
||||
| `output` | 1 | used |
|
||||
| `_start_track_logic_result` | 1 | used |
|
||||
| `local_ts` | 1 | used |
|
||||
| `_offload_entry_payload` | 1 | used |
|
||||
| `ui_auto_add_history` | 1 | used |
|
||||
| `_pending_comms_lock` | 1 | used |
|
||||
| `_pending_history_adds_lock` | 1 | used |
|
||||
| `_token_history` | 1 | used |
|
||||
| `_pending_comms` | 1 | used |
|
||||
| `_pending_history_adds` | 1 | used |
|
||||
| `latency` | 1 | used |
|
||||
| `_recalculate_session_usage` | 1 | used |
|
||||
| `_token_stats` | 1 | used |
|
||||
| `_gemini_cache_text` | 1 | used |
|
||||
| `vendor_quota` | 1 | used |
|
||||
| `last_error` | 1 | used |
|
||||
| `error` | 1 | used |
|
||||
| `_update_cached_stats` | 1 | used |
|
||||
| `usage` | 1 | used |
|
||||
| `_est_tokens` | 1 | used |
|
||||
| `items` | 1 | used |
|
||||
| `estimated_prompt_tokens` | 1 | used |
|
||||
| `max_prompt_tokens` | 1 | used |
|
||||
| `utilization_pct` | 1 | used |
|
||||
| `headroom` | 1 | used |
|
||||
| `would_trim` | 1 | used |
|
||||
| `sys_tokens` | 1 | used |
|
||||
| `tool_tokens` | 1 | used |
|
||||
| `history_tokens` | 1 | used |
|
||||
| `discussion` | 1 | used |
|
||||
| `content` | 1 | used |
|
||||
| `marker` | 1 | used |
|
||||
| `context_files` | 1 | used |
|
||||
| `_pending_gui_tasks_lock` | 1 | used |
|
||||
| `_topological_sort_tickets_result` | 1 | used |
|
||||
@@ -287,36 +373,6 @@ _... 33 more fields_
|
||||
| `_pending_gui_tasks` | 1 | used |
|
||||
| `mma_step_mode` | 1 | used |
|
||||
| `active_project_path` | 1 | used |
|
||||
| `estimated_prompt_tokens` | 1 | used |
|
||||
| `max_prompt_tokens` | 1 | used |
|
||||
| `utilization_pct` | 1 | used |
|
||||
| `headroom` | 1 | used |
|
||||
| `would_trim` | 1 | used |
|
||||
| `sys_tokens` | 1 | used |
|
||||
| `tool_tokens` | 1 | used |
|
||||
| `history_tokens` | 1 | used |
|
||||
| `_est_tokens` | 1 | used |
|
||||
| `output` | 1 | used |
|
||||
| `latency` | 1 | used |
|
||||
| `_recalculate_session_usage` | 1 | used |
|
||||
| `_token_stats` | 1 | used |
|
||||
| `_gemini_cache_text` | 1 | used |
|
||||
| `vendor_quota` | 1 | used |
|
||||
| `last_error` | 1 | used |
|
||||
| `error` | 1 | used |
|
||||
| `_update_cached_stats` | 1 | used |
|
||||
| `usage` | 1 | used |
|
||||
| `local_ts` | 1 | used |
|
||||
| `_offload_entry_payload` | 1 | used |
|
||||
| `ui_auto_add_history` | 1 | used |
|
||||
| `_pending_comms_lock` | 1 | used |
|
||||
| `_pending_history_adds_lock` | 1 | used |
|
||||
| `_token_history` | 1 | used |
|
||||
| `_pending_comms` | 1 | used |
|
||||
| `_pending_history_adds` | 1 | used |
|
||||
| `content` | 1 | used |
|
||||
| `marker` | 1 | used |
|
||||
| `items` | 1 | used |
|
||||
|
||||
## Optimization candidates
|
||||
|
||||
@@ -332,48 +388,48 @@ Metadata: access_pattern=whole_struct, frequency=per_turn, struct_field_count=10
|
||||
|
||||
| function | pattern | field_accesses | confidence |
|
||||
|---|---|---|---|
|
||||
| `src.ai_client._strip_private_keys` | `whole_struct` | | low |
|
||||
| `src.project_manager.migrate_from_legacy_config` | `whole_struct` | `get`=2 | high |
|
||||
| `src.app_controller._start_track_logic` | `mixed` | `_start_track_logic_result`=1, `ai_status`=1 | high |
|
||||
| `src.ai_client._trim_minimax_history` | `whole_struct` | `pop`=4 | high |
|
||||
| `src.ai_client._append_comms` | `whole_struct` | | low |
|
||||
| `src.ai_client._trim_anthropic_history` | `whole_struct` | `pop`=5 | high |
|
||||
| `src.project_manager.save_project` | `mixed` | `discussion`=2, `files`=3 | high |
|
||||
| `src.app_controller._start_track_logic_result` | `field_by_field` | `ai_status`=4, `context_files`=1, `get`=3, `_pending_gui_tasks_lock`=2, `_topological_sort_tickets_result`=1, `active_project_root`=1, `event_queue`=1, `engines`=1, `project`=1, `active_discussion`=1 (+7 more) | high |
|
||||
| `src.project_manager.flat_config` | `whole_struct` | `get`=7 | high |
|
||||
| `src.ai_client._add_bleed_derived` | `field_by_field` | `estimated_prompt_tokens`=1, `max_prompt_tokens`=1, `utilization_pct`=1, `headroom`=1, `would_trim`=1, `sys_tokens`=1, `tool_tokens`=1, `history_tokens`=1, `get`=3 | high |
|
||||
| `src.ai_client._estimate_prompt_tokens` | `whole_struct` | | low |
|
||||
| `src.ai_client._estimate_message_tokens` | `mixed` | `_est_tokens`=1, `get`=2 | high |
|
||||
| `src.aggregate.build_tier3_context` | `whole_struct` | | low |
|
||||
| `src.ai_client._strip_cache_controls` | `whole_struct` | | low |
|
||||
| `src.project_manager.format_discussion` | `whole_struct` | | low |
|
||||
| `src.app_controller._offload_entry_payload` | `whole_struct` | | low |
|
||||
| `src.models._save_config_to_disk` | `whole_struct` | | low |
|
||||
| `src.aggregate.run` | `field_by_field` | `output`=1, `files`=2, `get`=7 | high |
|
||||
| `src.app_controller._refresh_api_metrics` | `field_by_field` | `latency`=1, `_recalculate_session_usage`=1, `_token_stats`=1, `get`=2, `_gemini_cache_text`=1, `vendor_quota`=1, `last_error`=1, `error`=2, `_update_cached_stats`=1, `session_usage`=2 (+1 more) | high |
|
||||
| `src.app_controller._on_comms_entry` | `field_by_field` | `local_ts`=1, `_offload_entry_payload`=1, `get`=7, `ui_auto_add_history`=3, `_pending_comms_lock`=1, `session_usage`=5, `_pending_history_adds_lock`=4, `_token_history`=1, `_pending_comms`=1, `_pending_history_adds`=4 | high |
|
||||
| `src.ai_client._invalidate_token_estimate` | `whole_struct` | `pop`=1 | high |
|
||||
| `src.ai_client._dashscope_call` | `whole_struct` | | low |
|
||||
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
|
||||
| `src.ai_client._add_history_cache_breakpoint` | `whole_struct` | | low |
|
||||
| `src.ai_client._pre_dispatch` | `whole_struct` | | low |
|
||||
| `src.project_manager.format_discussion` | `whole_struct` | | low |
|
||||
| `src.aggregate.build_markdown_no_history` | `whole_struct` | | low |
|
||||
| `src.aggregate._build_files_section_from_items` | `whole_struct` | | low |
|
||||
| `src.ai_client._repair_minimax_history` | `whole_struct` | `append`=1 | high |
|
||||
| `src.ai_client._repair_anthropic_history` | `whole_struct` | `append`=1 | high |
|
||||
| `src.ai_client._repair_deepseek_history` | `whole_struct` | `append`=1 | high |
|
||||
| `src.aggregate.build_markdown_from_items` | `whole_struct` | | low |
|
||||
| `src.app_controller._start_track_logic` | `mixed` | `_start_track_logic_result`=1, `ai_status`=1 | high |
|
||||
| `src.project_manager.entry_to_str` | `whole_struct` | `get`=4 | high |
|
||||
| `src.ai_client.ollama_chat` | `whole_struct` | | low |
|
||||
| `src.ai_client._execute_single_tool_call_async` | `mixed` | `get`=2, `items`=1 | high |
|
||||
| `src.app_controller._on_comms_entry` | `field_by_field` | `local_ts`=1, `_offload_entry_payload`=1, `get`=7, `ui_auto_add_history`=3, `_pending_comms_lock`=1, `session_usage`=5, `_pending_history_adds_lock`=4, `_token_history`=1, `_pending_comms`=1, `_pending_history_adds`=4 | high |
|
||||
| `src.project_manager.flat_config` | `whole_struct` | `get`=7 | high |
|
||||
| `src.project_manager.migrate_from_legacy_config` | `whole_struct` | `get`=2 | high |
|
||||
| `src.ai_client._strip_stale_file_refreshes` | `whole_struct` | | low |
|
||||
| `src.ai_client._append_comms` | `whole_struct` | | low |
|
||||
| `src.ai_client._add_history_cache_breakpoint` | `whole_struct` | | low |
|
||||
| `src.app_controller._refresh_api_metrics` | `field_by_field` | `latency`=1, `_recalculate_session_usage`=1, `_token_stats`=1, `get`=2, `_gemini_cache_text`=1, `vendor_quota`=1, `last_error`=1, `error`=2, `_update_cached_stats`=1, `session_usage`=2 (+1 more) | high |
|
||||
| `src.ai_client._estimate_message_tokens` | `mixed` | `_est_tokens`=1, `get`=2 | high |
|
||||
| `src.ai_client._repair_deepseek_history` | `whole_struct` | `append`=1 | high |
|
||||
| `src.ai_client._invalidate_token_estimate` | `whole_struct` | `pop`=1 | high |
|
||||
| `src.ai_client._execute_single_tool_call_async` | `mixed` | `get`=2, `items`=1 | high |
|
||||
| `src.models._save_config_to_disk` | `whole_struct` | | low |
|
||||
| `src.ai_client._repair_minimax_history` | `whole_struct` | `append`=1 | high |
|
||||
| `src.ai_client._add_bleed_derived` | `field_by_field` | `estimated_prompt_tokens`=1, `max_prompt_tokens`=1, `utilization_pct`=1, `headroom`=1, `would_trim`=1, `sys_tokens`=1, `tool_tokens`=1, `history_tokens`=1, `get`=3 | high |
|
||||
| `src.ai_client.ollama_chat` | `whole_struct` | | low |
|
||||
| `src.ai_client._trim_anthropic_history` | `whole_struct` | `pop`=5 | high |
|
||||
| `src.aggregate.build_markdown_from_items` | `whole_struct` | | low |
|
||||
| `src.project_manager.save_project` | `mixed` | `discussion`=2, `files`=3 | high |
|
||||
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
|
||||
| `src.ai_client._strip_cache_controls` | `whole_struct` | | low |
|
||||
| `src.ai_client._pre_dispatch` | `whole_struct` | | low |
|
||||
| `src.aggregate.build_tier3_context` | `whole_struct` | | low |
|
||||
| `src.app_controller._start_track_logic_result` | `field_by_field` | `ai_status`=4, `context_files`=1, `get`=3, `_pending_gui_tasks_lock`=2, `_topological_sort_tickets_result`=1, `active_project_root`=1, `event_queue`=1, `engines`=1, `project`=1, `active_discussion`=1 (+7 more) | high |
|
||||
| `src.app_controller._offload_entry_payload` | `whole_struct` | | low |
|
||||
| `src.ai_client._strip_private_keys` | `whole_struct` | | low |
|
||||
| `src.ai_client._trim_minimax_history` | `whole_struct` | `pop`=4 | high |
|
||||
| `src.ai_client._repair_anthropic_history` | `whole_struct` | `append`=1 | high |
|
||||
| `src.ai_client._dashscope_call` | `whole_struct` | | low |
|
||||
| `src.ai_client._estimate_prompt_tokens` | `whole_struct` | | low |
|
||||
| `src.aggregate._build_files_section_from_items` | `whole_struct` | | low |
|
||||
|
||||
### Frequency evidence
|
||||
|
||||
| function | frequency | source | note |
|
||||
|---|---|---|---|
|
||||
| `src.app_controller._api_status` | `per_turn` | `static_analysis` | producer from src\app_controller.py |
|
||||
| `src.app_controller.get_performance` | `per_turn` | `static_analysis` | producer from src\app_controller.py |
|
||||
| `src.api_hook_client.get_financial_metrics` | `per_turn` | `static_analysis` | producer from src\api_hook_client.py |
|
||||
| `src.project_manager.load_history` | `per_turn` | `static_analysis` | producer from src\project_manager.py |
|
||||
| `src.ai_client.get_gemini_cache_stats` | `per_turn` | `static_analysis` | producer from src\ai_client.py |
|
||||
| `src.app_controller._api_get_mma_status` | `per_turn` | `static_analysis` | producer from src\app_controller.py |
|
||||
| `src.api_hook_client.get_mma_status` | `per_turn` | `static_analysis` | producer from src\api_hook_client.py |
|
||||
| `src.api_hook_client.get_status` | `per_turn` | `static_analysis` | producer from src\api_hook_client.py |
|
||||
| `src.api_hook_client.get_gui_state` | `per_turn` | `static_analysis` | producer from src\api_hook_client.py |
|
||||
|
||||
@@ -2,119 +2,119 @@ Metadata: Metadata
|
||||
|- kind: typealias
|
||||
|- memory_dim: discussion
|
||||
|- producers: [77]
|
||||
| |- src.app_controller._api_status (producer)
|
||||
| |- src.app_controller.get_performance (producer)
|
||||
| |- src.api_hook_client.get_financial_metrics (producer)
|
||||
| |- src.app_controller._api_get_mma_status (producer)
|
||||
| |- src.api_hook_client.get_mma_status (producer)
|
||||
| |- src.api_hook_client.set_value (producer)
|
||||
| |- src.ai_client._parse_tool_args_result (producer)
|
||||
| |- src.api_hook_client.get_system_telemetry (producer)
|
||||
| |- src.app_controller.get_api_project (producer)
|
||||
| |- src.ai_client._load_credentials (producer)
|
||||
| |- src.project_manager.load_history (producer)
|
||||
| |- src.models._load_config_from_disk (producer)
|
||||
| |- src.api_hook_client.get_context_state (producer)
|
||||
| |- src.api_hook_client.get_session (producer)
|
||||
| |- src.ai_client.get_token_stats (producer)
|
||||
| |- src.api_hook_client.drag (producer)
|
||||
| |- src.api_hook_client.post_gui (producer)
|
||||
| |- src.app_controller.get_session (producer)
|
||||
| |- src.app_controller.get_api_session (producer)
|
||||
| |- src.ai_client._send_cli_round_result (producer)
|
||||
| |- src.api_hook_client.get_patch_status (producer)
|
||||
| |- src.ai_client.get_gemini_cache_stats (producer)
|
||||
| |- src.app_controller._api_get_mma_status (producer)
|
||||
| |- src.api_hook_client.get_status (producer)
|
||||
| |- src.api_hook_client.get_gui_diagnostics (producer)
|
||||
| |- src.api_hook_client.select_tab (producer)
|
||||
| |- src.app_controller._api_token_stats (producer)
|
||||
| |- src.app_controller._offload_entry_payload (producer)
|
||||
| |- src.project_manager.default_discussion (producer)
|
||||
| |- src.api_hook_client.get_node_status (producer)
|
||||
| |- src.api_hook_client.get_gui_state (producer)
|
||||
| |- src.api_hook_client.apply_patch (producer)
|
||||
| |- src.api_hook_client.post_project (producer)
|
||||
| |- src.app_controller.get_mma_status (producer)
|
||||
| |- src.app_controller.wait (producer)
|
||||
| |- src.api_hook_client.wait_for_project_switch (producer)
|
||||
| |- src.ai_client.ollama_chat (producer)
|
||||
| |- src.api_hook_client.get_warmup_status (producer)
|
||||
| |- src.app_controller.get_session (producer)
|
||||
| |- src.api_hook_client.get_project_switch_status (producer)
|
||||
| |- src.api_hook_client.get_project (producer)
|
||||
| |- src.app_controller.status (producer)
|
||||
| |- src.app_controller._api_get_api_session (producer)
|
||||
| |- src.api_hook_client.push_event (producer)
|
||||
| |- src.api_hook_client.drag (producer)
|
||||
| |- src.app_controller.load_config (producer)
|
||||
| |- src.ai_client._send_cli_round_result (producer)
|
||||
| |- src.api_hook_client.select_tab (producer)
|
||||
| |- src.ai_client._dashscope_call (producer)
|
||||
| |- src.api_hook_client.trigger_patch (producer)
|
||||
| |- src.app_controller._api_get_api_project (producer)
|
||||
| |- src.ai_client._parse_tool_args_result (producer)
|
||||
| |- src.app_controller._api_status (producer)
|
||||
| |- src.api_hook_client.get_mma_workers (producer)
|
||||
| |- src.app_controller._api_get_gui_state (producer)
|
||||
| |- src.ai_client.get_token_stats (producer)
|
||||
| |- src.ai_client._add_bleed_derived (producer)
|
||||
| |- src.api_hook_client.get_io_pool_status (producer)
|
||||
| |- src.ai_client._content_block_to_dict (producer)
|
||||
| |- src.app_controller.get_diagnostics (producer)
|
||||
| |- src.api_hook_client.get_performance (producer)
|
||||
| |- src.app_controller._api_get_session (producer)
|
||||
| |- src.app_controller.wait (producer)
|
||||
| |- src.app_controller.get_performance (producer)
|
||||
| |- src.api_hook_client.wait_for_project_switch (producer)
|
||||
| |- src.api_hook_client.reject_patch (producer)
|
||||
| |- src.api_hook_client.get_mma_status (producer)
|
||||
| |- src.models._load_config_from_disk (producer)
|
||||
| |- src.app_controller.get_session_insights (producer)
|
||||
| |- src.api_hook_client.get_gui_health (producer)
|
||||
| |- src.project_manager.migrate_from_legacy_config (producer)
|
||||
| |- src.api_hook_client.get_gui_diagnostics (producer)
|
||||
| |- src.api_hook_client.get_session (producer)
|
||||
| |- src.app_controller._api_get_diagnostics (producer)
|
||||
| |- src.api_hook_client.get_startup_timeline (producer)
|
||||
| |- src.api_hook_client.select_list_item (producer)
|
||||
| |- src.api_hook_client.post_session (producer)
|
||||
| |- src.ai_client._content_block_to_dict (producer)
|
||||
| |- src.project_manager.default_discussion (producer)
|
||||
| |- src.app_controller.get_gui_state (producer)
|
||||
| |- src.ai_client.ollama_chat (producer)
|
||||
| |- src.api_hook_client.get_context_state (producer)
|
||||
| |- src.app_controller._api_generate (producer)
|
||||
| |- src.app_controller.generate (producer)
|
||||
| |- src.models.to_dict (producer)
|
||||
| |- src.project_manager.load_project (producer)
|
||||
| |- src.app_controller._offload_entry_payload (producer)
|
||||
| |- src.api_hook_client.get_warmup_status (producer)
|
||||
| |- src.app_controller.get_context (producer)
|
||||
| |- src.app_controller.get_api_project (producer)
|
||||
| |- src.app_controller._api_get_performance (producer)
|
||||
| |- src.app_controller.get_api_session (producer)
|
||||
| |- src.api_hook_client.right_click (producer)
|
||||
| |- src.api_hook_client.get_system_telemetry (producer)
|
||||
| |- src.project_manager.default_project (producer)
|
||||
| |- src.api_hook_client.get_warmup_wait (producer)
|
||||
| |- src.api_hook_client.get_node_status (producer)
|
||||
| |- src.app_controller._api_token_stats (producer)
|
||||
| |- src.app_controller.token_stats (producer)
|
||||
| |- src.project_manager.flat_config (producer)
|
||||
| |- src.api_hook_client.trigger_patch (producer)
|
||||
| |- src.api_hook_client.select_list_item (producer)
|
||||
| |- src.project_manager.migrate_from_legacy_config (producer)
|
||||
| |- src.api_hook_client.get_gui_health (producer)
|
||||
| |- src.api_hook_client.get_patch_status (producer)
|
||||
| |- src.api_hook_client.get_io_pool_status (producer)
|
||||
| |- src.app_controller.generate (producer)
|
||||
| |- src.api_hook_client.post_gui (producer)
|
||||
| |- src.api_hook_client.get_financial_metrics (producer)
|
||||
| |- src.api_hook_client.click (producer)
|
||||
| |- src.models.to_dict (producer)
|
||||
| |- src.api_hook_client.get_project_switch_status (producer)
|
||||
| |- src.app_controller._api_get_api_project (producer)
|
||||
| |- src.app_controller.get_gui_state (producer)
|
||||
| |- src.app_controller._api_get_performance (producer)
|
||||
| |- src.project_manager.str_to_entry (producer)
|
||||
| |- src.api_hook_client.post_session (producer)
|
||||
| |- src.api_hook_client.get_startup_timeline (producer)
|
||||
| |- src.api_hook_client.get_mma_workers (producer)
|
||||
| |- src.app_controller._api_get_api_session (producer)
|
||||
| |- src.app_controller._api_get_context (producer)
|
||||
| |- src.app_controller.get_context (producer)
|
||||
| |- src.api_hook_client.right_click (producer)
|
||||
| |- src.ai_client._dashscope_call (producer)
|
||||
| |- src.api_hook_client.get_performance (producer)
|
||||
| |- src.app_controller.get_diagnostics (producer)
|
||||
| |- src.api_hook_client.apply_patch (producer)
|
||||
| |- src.app_controller._api_get_diagnostics (producer)
|
||||
| |- src.project_manager.load_project (producer)
|
||||
| |- src.app_controller.status (producer)
|
||||
| |- src.app_controller.load_config (producer)
|
||||
| |- src.api_hook_client.reject_patch (producer)
|
||||
| |- src.api_hook_client.get_project (producer)
|
||||
| |- src.project_manager.default_project (producer)
|
||||
| |- src.api_hook_client.post_project (producer)
|
||||
| |- src.app_controller._api_get_gui_state (producer)
|
||||
| |- src.app_controller._api_get_session (producer)
|
||||
| |- src.ai_client.get_gemini_cache_stats (producer)
|
||||
| |- src.api_hook_client.get_warmup_wait (producer)
|
||||
| |- src.api_hook_client.get_gui_state (producer)
|
||||
| |- src.api_hook_client.push_event (producer)
|
||||
| |- src.api_hook_client.set_value (producer)
|
||||
| |- src.ai_client._load_credentials (producer)
|
||||
|- consumers: [35]
|
||||
| |- src.ai_client._strip_private_keys (consumer)
|
||||
| |- src.project_manager.migrate_from_legacy_config (consumer)
|
||||
| |- src.app_controller._start_track_logic (consumer)
|
||||
| |- src.ai_client._trim_minimax_history (consumer)
|
||||
| |- src.ai_client._append_comms (consumer)
|
||||
| |- src.ai_client._trim_anthropic_history (consumer)
|
||||
| |- src.project_manager.save_project (consumer)
|
||||
| |- src.app_controller._start_track_logic_result (consumer)
|
||||
| |- src.project_manager.flat_config (consumer)
|
||||
| |- src.ai_client._add_bleed_derived (consumer)
|
||||
| |- src.ai_client._estimate_prompt_tokens (consumer)
|
||||
| |- src.ai_client._estimate_message_tokens (consumer)
|
||||
| |- src.aggregate.build_tier3_context (consumer)
|
||||
| |- src.ai_client._strip_cache_controls (consumer)
|
||||
| |- src.project_manager.format_discussion (consumer)
|
||||
| |- src.app_controller._offload_entry_payload (consumer)
|
||||
| |- src.models._save_config_to_disk (consumer)
|
||||
| |- src.aggregate.run (consumer)
|
||||
| |- src.app_controller._refresh_api_metrics (consumer)
|
||||
| |- src.app_controller._on_comms_entry (consumer)
|
||||
| |- src.ai_client._invalidate_token_estimate (consumer)
|
||||
| |- src.ai_client._dashscope_call (consumer)
|
||||
| |- src.models.from_dict (consumer)
|
||||
| |- src.ai_client._add_history_cache_breakpoint (consumer)
|
||||
| |- src.ai_client._pre_dispatch (consumer)
|
||||
| |- src.project_manager.format_discussion (consumer)
|
||||
| |- src.aggregate.build_markdown_no_history (consumer)
|
||||
| |- src.aggregate._build_files_section_from_items (consumer)
|
||||
| |- src.ai_client._repair_minimax_history (consumer)
|
||||
| |- src.ai_client._repair_anthropic_history (consumer)
|
||||
| |- src.ai_client._repair_deepseek_history (consumer)
|
||||
| |- src.aggregate.build_markdown_from_items (consumer)
|
||||
| |- src.app_controller._start_track_logic (consumer)
|
||||
| |- src.project_manager.entry_to_str (consumer)
|
||||
| |- src.ai_client.ollama_chat (consumer)
|
||||
| |- src.ai_client._execute_single_tool_call_async (consumer)
|
||||
| |- src.app_controller._on_comms_entry (consumer)
|
||||
| |- src.project_manager.flat_config (consumer)
|
||||
| |- src.project_manager.migrate_from_legacy_config (consumer)
|
||||
| |- src.ai_client._strip_stale_file_refreshes (consumer)
|
||||
| |- src.ai_client._append_comms (consumer)
|
||||
| |- src.ai_client._add_history_cache_breakpoint (consumer)
|
||||
| |- src.app_controller._refresh_api_metrics (consumer)
|
||||
| |- src.ai_client._estimate_message_tokens (consumer)
|
||||
| |- src.ai_client._repair_deepseek_history (consumer)
|
||||
| |- src.ai_client._invalidate_token_estimate (consumer)
|
||||
| |- src.ai_client._execute_single_tool_call_async (consumer)
|
||||
| |- src.models._save_config_to_disk (consumer)
|
||||
| |- src.ai_client._repair_minimax_history (consumer)
|
||||
| |- src.ai_client._add_bleed_derived (consumer)
|
||||
| |- src.ai_client.ollama_chat (consumer)
|
||||
| |- src.ai_client._trim_anthropic_history (consumer)
|
||||
| |- src.aggregate.build_markdown_from_items (consumer)
|
||||
| |- src.project_manager.save_project (consumer)
|
||||
| |- src.models.from_dict (consumer)
|
||||
| |- src.ai_client._strip_cache_controls (consumer)
|
||||
| |- src.ai_client._pre_dispatch (consumer)
|
||||
| |- src.aggregate.build_tier3_context (consumer)
|
||||
| |- src.app_controller._start_track_logic_result (consumer)
|
||||
| |- src.app_controller._offload_entry_payload (consumer)
|
||||
| |- src.ai_client._strip_private_keys (consumer)
|
||||
| |- src.ai_client._trim_minimax_history (consumer)
|
||||
| |- src.ai_client._repair_anthropic_history (consumer)
|
||||
| |- src.ai_client._dashscope_call (consumer)
|
||||
| |- src.ai_client._estimate_prompt_tokens (consumer)
|
||||
| |- src.aggregate._build_files_section_from_items (consumer)
|
||||
|- access_pattern: whole_struct
|
||||
|- frequency: per_turn
|
||||
|- result_coverage: 77 producers, 35 consumers
|
||||
|
||||
@@ -32,6 +32,11 @@ _(no field accesses detected)_
|
||||
**Dominant pattern:** mixed
|
||||
**Evidence count:** 0
|
||||
|
||||
## SSDL Sketch for ProviderHistory
|
||||
|
||||
_(placeholder; candidate aggregate)_
|
||||
|
||||
|
||||
## Frequency
|
||||
|
||||
**Dominant frequency:** unknown
|
||||
|
||||
@@ -32,6 +32,23 @@ _(no field accesses detected)_
|
||||
**Dominant pattern:** mixed
|
||||
**Evidence count:** 0
|
||||
|
||||
## SSDL Sketch for `Result`
|
||||
|
||||
```
|
||||
[Q:Result entry-point] -> [Q:PCG lookup]
|
||||
-> [T:done]
|
||||
```
|
||||
|
||||
**Effective codepaths:** 0 (sum of 2^branches across 0 consumers)
|
||||
**Total branch points:** 0
|
||||
**Nil-check functions:** 0
|
||||
|
||||
**Defusing opportunities:**
|
||||
|
||||
- **Immediate-Mode Cache `[Q:key] -> [I:FetchCached] -> [T]`**: Introduce a `result_cache` keyed lookup. Consumers request by key, get cached value, no field-existence checks. Reduces 0 field-check branches to 1 cache lookup.
|
||||
- Effective codepaths: 0 -> 1
|
||||
|
||||
|
||||
## Frequency
|
||||
|
||||
**Dominant frequency:** per_turn
|
||||
|
||||
@@ -42,6 +42,24 @@
|
||||
|
||||
- `whole_struct`: 1 functions (100%)
|
||||
|
||||
## SSDL Sketch for `ToolCall`
|
||||
|
||||
```
|
||||
[Q:ToolCall entry-point] -> [Q:PCG lookup]
|
||||
-> [1: _to_dict_tool_call] [B:check] (branches=0)
|
||||
-> [T:done]
|
||||
```
|
||||
|
||||
**Effective codepaths:** 1 (sum of 2^branches across 1 consumers)
|
||||
**Total branch points:** 0
|
||||
**Nil-check functions:** 0
|
||||
|
||||
**Defusing opportunities:**
|
||||
|
||||
- **Immediate-Mode Cache `[Q:key] -> [I:FetchCached] -> [T]`**: Introduce a `toolcall_cache` keyed lookup. Consumers request by key, get cached value, no field-existence checks. Reduces 1 field-check branches to 1 cache lookup.
|
||||
- Effective codepaths: 1 -> 1
|
||||
|
||||
|
||||
## Frequency
|
||||
|
||||
**Dominant frequency:** per_turn
|
||||
|
||||
@@ -32,6 +32,23 @@ _(no field accesses detected)_
|
||||
**Dominant pattern:** mixed
|
||||
**Evidence count:** 0
|
||||
|
||||
## SSDL Sketch for `ToolDefinition`
|
||||
|
||||
```
|
||||
[Q:ToolDefinition entry-point] -> [Q:PCG lookup]
|
||||
-> [T:done]
|
||||
```
|
||||
|
||||
**Effective codepaths:** 0 (sum of 2^branches across 0 consumers)
|
||||
**Total branch points:** 0
|
||||
**Nil-check functions:** 0
|
||||
|
||||
**Defusing opportunities:**
|
||||
|
||||
- **Immediate-Mode Cache `[Q:key] -> [I:FetchCached] -> [T]`**: Introduce a `tooldefinition_cache` keyed lookup. Consumers request by key, get cached value, no field-existence checks. Reduces 0 field-check branches to 1 cache lookup.
|
||||
- Effective codepaths: 0 -> 1
|
||||
|
||||
|
||||
## Frequency
|
||||
|
||||
**Dominant frequency:** per_turn
|
||||
|
||||
@@ -32,6 +32,11 @@ _(no field accesses detected)_
|
||||
**Dominant pattern:** mixed
|
||||
**Evidence count:** 0
|
||||
|
||||
## SSDL Sketch for ToolSpec
|
||||
|
||||
_(placeholder; candidate aggregate)_
|
||||
|
||||
|
||||
## Frequency
|
||||
|
||||
**Dominant frequency:** unknown
|
||||
|
||||
@@ -6,118 +6,118 @@ Functions that are producers or consumers of each aggregate, grouped by file.
|
||||
|
||||
| role | fqname | file |
|
||||
|---|---|---|
|
||||
| producer | `src.app_controller._api_status` | `src\app_controller.py` |
|
||||
| producer | `src.app_controller.get_performance` | `src\app_controller.py` |
|
||||
| producer | `src.api_hook_client.get_financial_metrics` | `src\api_hook_client.py` |
|
||||
| producer | `src.app_controller._api_get_mma_status` | `src\app_controller.py` |
|
||||
| producer | `src.api_hook_client.get_mma_status` | `src\api_hook_client.py` |
|
||||
| producer | `src.api_hook_client.set_value` | `src\api_hook_client.py` |
|
||||
| producer | `src.ai_client._parse_tool_args_result` | `src\ai_client.py` |
|
||||
| producer | `src.api_hook_client.get_system_telemetry` | `src\api_hook_client.py` |
|
||||
| producer | `src.app_controller.get_api_project` | `src\app_controller.py` |
|
||||
| producer | `src.ai_client._load_credentials` | `src\ai_client.py` |
|
||||
| producer | `src.project_manager.load_history` | `src\project_manager.py` |
|
||||
| producer | `src.models._load_config_from_disk` | `src\models.py` |
|
||||
| producer | `src.api_hook_client.get_context_state` | `src\api_hook_client.py` |
|
||||
| producer | `src.api_hook_client.get_session` | `src\api_hook_client.py` |
|
||||
| producer | `src.ai_client.get_token_stats` | `src\ai_client.py` |
|
||||
| producer | `src.api_hook_client.drag` | `src\api_hook_client.py` |
|
||||
| producer | `src.api_hook_client.post_gui` | `src\api_hook_client.py` |
|
||||
| producer | `src.app_controller.get_session` | `src\app_controller.py` |
|
||||
| producer | `src.app_controller.get_api_session` | `src\app_controller.py` |
|
||||
| producer | `src.ai_client._send_cli_round_result` | `src\ai_client.py` |
|
||||
| producer | `src.api_hook_client.get_patch_status` | `src\api_hook_client.py` |
|
||||
| producer | `src.ai_client.get_gemini_cache_stats` | `src\ai_client.py` |
|
||||
| producer | `src.app_controller._api_get_mma_status` | `src\app_controller.py` |
|
||||
| producer | `src.api_hook_client.get_status` | `src\api_hook_client.py` |
|
||||
| producer | `src.api_hook_client.get_gui_diagnostics` | `src\api_hook_client.py` |
|
||||
| producer | `src.api_hook_client.select_tab` | `src\api_hook_client.py` |
|
||||
| producer | `src.app_controller._api_token_stats` | `src\app_controller.py` |
|
||||
| producer | `src.app_controller._offload_entry_payload` | `src\app_controller.py` |
|
||||
| producer | `src.project_manager.default_discussion` | `src\project_manager.py` |
|
||||
| producer | `src.api_hook_client.get_node_status` | `src\api_hook_client.py` |
|
||||
| producer | `src.api_hook_client.get_gui_state` | `src\api_hook_client.py` |
|
||||
| producer | `src.api_hook_client.apply_patch` | `src\api_hook_client.py` |
|
||||
| producer | `src.api_hook_client.post_project` | `src\api_hook_client.py` |
|
||||
| producer | `src.app_controller.get_mma_status` | `src\app_controller.py` |
|
||||
| producer | `src.app_controller.wait` | `src\app_controller.py` |
|
||||
| producer | `src.api_hook_client.wait_for_project_switch` | `src\api_hook_client.py` |
|
||||
| producer | `src.ai_client.ollama_chat` | `src\ai_client.py` |
|
||||
| producer | `src.api_hook_client.get_warmup_status` | `src\api_hook_client.py` |
|
||||
| producer | `src.app_controller.get_session` | `src\app_controller.py` |
|
||||
| producer | `src.api_hook_client.get_project_switch_status` | `src\api_hook_client.py` |
|
||||
| producer | `src.api_hook_client.get_project` | `src\api_hook_client.py` |
|
||||
| producer | `src.app_controller.status` | `src\app_controller.py` |
|
||||
| producer | `src.app_controller._api_get_api_session` | `src\app_controller.py` |
|
||||
| producer | `src.api_hook_client.push_event` | `src\api_hook_client.py` |
|
||||
| producer | `src.api_hook_client.drag` | `src\api_hook_client.py` |
|
||||
| producer | `src.app_controller.load_config` | `src\app_controller.py` |
|
||||
| producer | `src.ai_client._send_cli_round_result` | `src\ai_client.py` |
|
||||
| producer | `src.api_hook_client.select_tab` | `src\api_hook_client.py` |
|
||||
| producer | `src.ai_client._dashscope_call` | `src\ai_client.py` |
|
||||
| producer | `src.api_hook_client.trigger_patch` | `src\api_hook_client.py` |
|
||||
| producer | `src.app_controller._api_get_api_project` | `src\app_controller.py` |
|
||||
| producer | `src.ai_client._parse_tool_args_result` | `src\ai_client.py` |
|
||||
| producer | `src.app_controller._api_status` | `src\app_controller.py` |
|
||||
| producer | `src.api_hook_client.get_mma_workers` | `src\api_hook_client.py` |
|
||||
| producer | `src.app_controller._api_get_gui_state` | `src\app_controller.py` |
|
||||
| producer | `src.ai_client.get_token_stats` | `src\ai_client.py` |
|
||||
| producer | `src.ai_client._add_bleed_derived` | `src\ai_client.py` |
|
||||
| producer | `src.api_hook_client.get_io_pool_status` | `src\api_hook_client.py` |
|
||||
| producer | `src.ai_client._content_block_to_dict` | `src\ai_client.py` |
|
||||
| producer | `src.app_controller.get_diagnostics` | `src\app_controller.py` |
|
||||
| producer | `src.api_hook_client.get_performance` | `src\api_hook_client.py` |
|
||||
| producer | `src.app_controller._api_get_session` | `src\app_controller.py` |
|
||||
| producer | `src.app_controller.wait` | `src\app_controller.py` |
|
||||
| producer | `src.app_controller.get_performance` | `src\app_controller.py` |
|
||||
| producer | `src.api_hook_client.wait_for_project_switch` | `src\api_hook_client.py` |
|
||||
| producer | `src.api_hook_client.reject_patch` | `src\api_hook_client.py` |
|
||||
| producer | `src.api_hook_client.get_mma_status` | `src\api_hook_client.py` |
|
||||
| producer | `src.models._load_config_from_disk` | `src\models.py` |
|
||||
| producer | `src.app_controller.get_session_insights` | `src\app_controller.py` |
|
||||
| producer | `src.api_hook_client.get_gui_health` | `src\api_hook_client.py` |
|
||||
| producer | `src.project_manager.migrate_from_legacy_config` | `src\project_manager.py` |
|
||||
| producer | `src.api_hook_client.get_gui_diagnostics` | `src\api_hook_client.py` |
|
||||
| producer | `src.api_hook_client.get_session` | `src\api_hook_client.py` |
|
||||
| producer | `src.app_controller._api_get_diagnostics` | `src\app_controller.py` |
|
||||
| producer | `src.api_hook_client.get_startup_timeline` | `src\api_hook_client.py` |
|
||||
| producer | `src.api_hook_client.select_list_item` | `src\api_hook_client.py` |
|
||||
| producer | `src.api_hook_client.post_session` | `src\api_hook_client.py` |
|
||||
| producer | `src.ai_client._content_block_to_dict` | `src\ai_client.py` |
|
||||
| producer | `src.project_manager.default_discussion` | `src\project_manager.py` |
|
||||
| producer | `src.app_controller.get_gui_state` | `src\app_controller.py` |
|
||||
| producer | `src.ai_client.ollama_chat` | `src\ai_client.py` |
|
||||
| producer | `src.api_hook_client.get_context_state` | `src\api_hook_client.py` |
|
||||
| producer | `src.app_controller._api_generate` | `src\app_controller.py` |
|
||||
| producer | `src.app_controller.generate` | `src\app_controller.py` |
|
||||
| producer | `src.models.to_dict` | `src\models.py` |
|
||||
| producer | `src.project_manager.load_project` | `src\project_manager.py` |
|
||||
| producer | `src.app_controller._offload_entry_payload` | `src\app_controller.py` |
|
||||
| producer | `src.api_hook_client.get_warmup_status` | `src\api_hook_client.py` |
|
||||
| producer | `src.app_controller.get_context` | `src\app_controller.py` |
|
||||
| producer | `src.app_controller.get_api_project` | `src\app_controller.py` |
|
||||
| producer | `src.app_controller._api_get_performance` | `src\app_controller.py` |
|
||||
| producer | `src.app_controller.get_api_session` | `src\app_controller.py` |
|
||||
| producer | `src.api_hook_client.right_click` | `src\api_hook_client.py` |
|
||||
| producer | `src.api_hook_client.get_system_telemetry` | `src\api_hook_client.py` |
|
||||
| producer | `src.project_manager.default_project` | `src\project_manager.py` |
|
||||
| producer | `src.api_hook_client.get_warmup_wait` | `src\api_hook_client.py` |
|
||||
| producer | `src.api_hook_client.get_node_status` | `src\api_hook_client.py` |
|
||||
| producer | `src.app_controller._api_token_stats` | `src\app_controller.py` |
|
||||
| producer | `src.app_controller.token_stats` | `src\app_controller.py` |
|
||||
| producer | `src.project_manager.flat_config` | `src\project_manager.py` |
|
||||
| producer | `src.api_hook_client.trigger_patch` | `src\api_hook_client.py` |
|
||||
| producer | `src.api_hook_client.select_list_item` | `src\api_hook_client.py` |
|
||||
| producer | `src.project_manager.migrate_from_legacy_config` | `src\project_manager.py` |
|
||||
| producer | `src.api_hook_client.get_gui_health` | `src\api_hook_client.py` |
|
||||
| producer | `src.api_hook_client.get_patch_status` | `src\api_hook_client.py` |
|
||||
| producer | `src.api_hook_client.get_io_pool_status` | `src\api_hook_client.py` |
|
||||
| producer | `src.app_controller.generate` | `src\app_controller.py` |
|
||||
| producer | `src.api_hook_client.post_gui` | `src\api_hook_client.py` |
|
||||
| producer | `src.api_hook_client.get_financial_metrics` | `src\api_hook_client.py` |
|
||||
| producer | `src.api_hook_client.click` | `src\api_hook_client.py` |
|
||||
| producer | `src.models.to_dict` | `src\models.py` |
|
||||
| producer | `src.api_hook_client.get_project_switch_status` | `src\api_hook_client.py` |
|
||||
| producer | `src.app_controller._api_get_api_project` | `src\app_controller.py` |
|
||||
| producer | `src.app_controller.get_gui_state` | `src\app_controller.py` |
|
||||
| producer | `src.app_controller._api_get_performance` | `src\app_controller.py` |
|
||||
| producer | `src.project_manager.str_to_entry` | `src\project_manager.py` |
|
||||
| producer | `src.api_hook_client.post_session` | `src\api_hook_client.py` |
|
||||
| producer | `src.api_hook_client.get_startup_timeline` | `src\api_hook_client.py` |
|
||||
| producer | `src.api_hook_client.get_mma_workers` | `src\api_hook_client.py` |
|
||||
| producer | `src.app_controller._api_get_api_session` | `src\app_controller.py` |
|
||||
| producer | `src.app_controller._api_get_context` | `src\app_controller.py` |
|
||||
| producer | `src.app_controller.get_context` | `src\app_controller.py` |
|
||||
| producer | `src.api_hook_client.right_click` | `src\api_hook_client.py` |
|
||||
| producer | `src.ai_client._dashscope_call` | `src\ai_client.py` |
|
||||
| producer | `src.api_hook_client.get_performance` | `src\api_hook_client.py` |
|
||||
| producer | `src.app_controller.get_diagnostics` | `src\app_controller.py` |
|
||||
| producer | `src.api_hook_client.apply_patch` | `src\api_hook_client.py` |
|
||||
| producer | `src.app_controller._api_get_diagnostics` | `src\app_controller.py` |
|
||||
| producer | `src.project_manager.load_project` | `src\project_manager.py` |
|
||||
| producer | `src.app_controller.status` | `src\app_controller.py` |
|
||||
| producer | `src.app_controller.load_config` | `src\app_controller.py` |
|
||||
| producer | `src.api_hook_client.reject_patch` | `src\api_hook_client.py` |
|
||||
| producer | `src.api_hook_client.get_project` | `src\api_hook_client.py` |
|
||||
| producer | `src.project_manager.default_project` | `src\project_manager.py` |
|
||||
| producer | `src.api_hook_client.post_project` | `src\api_hook_client.py` |
|
||||
| producer | `src.app_controller._api_get_gui_state` | `src\app_controller.py` |
|
||||
| producer | `src.app_controller._api_get_session` | `src\app_controller.py` |
|
||||
| producer | `src.ai_client.get_gemini_cache_stats` | `src\ai_client.py` |
|
||||
| producer | `src.api_hook_client.get_warmup_wait` | `src\api_hook_client.py` |
|
||||
| producer | `src.api_hook_client.get_gui_state` | `src\api_hook_client.py` |
|
||||
| producer | `src.api_hook_client.push_event` | `src\api_hook_client.py` |
|
||||
| consumer | `src.ai_client._strip_private_keys` | `src\ai_client.py` |
|
||||
| consumer | `src.project_manager.migrate_from_legacy_config` | `src\project_manager.py` |
|
||||
| consumer | `src.app_controller._start_track_logic` | `src\app_controller.py` |
|
||||
| consumer | `src.ai_client._trim_minimax_history` | `src\ai_client.py` |
|
||||
| consumer | `src.ai_client._append_comms` | `src\ai_client.py` |
|
||||
| consumer | `src.ai_client._trim_anthropic_history` | `src\ai_client.py` |
|
||||
| consumer | `src.project_manager.save_project` | `src\project_manager.py` |
|
||||
| consumer | `src.app_controller._start_track_logic_result` | `src\app_controller.py` |
|
||||
| consumer | `src.project_manager.flat_config` | `src\project_manager.py` |
|
||||
| consumer | `src.ai_client._add_bleed_derived` | `src\ai_client.py` |
|
||||
| consumer | `src.ai_client._estimate_prompt_tokens` | `src\ai_client.py` |
|
||||
| consumer | `src.ai_client._estimate_message_tokens` | `src\ai_client.py` |
|
||||
| consumer | `src.aggregate.build_tier3_context` | `src\aggregate.py` |
|
||||
| consumer | `src.ai_client._strip_cache_controls` | `src\ai_client.py` |
|
||||
| consumer | `src.project_manager.format_discussion` | `src\project_manager.py` |
|
||||
| consumer | `src.app_controller._offload_entry_payload` | `src\app_controller.py` |
|
||||
| consumer | `src.models._save_config_to_disk` | `src\models.py` |
|
||||
| producer | `src.api_hook_client.set_value` | `src\api_hook_client.py` |
|
||||
| producer | `src.ai_client._load_credentials` | `src\ai_client.py` |
|
||||
| consumer | `src.aggregate.run` | `src\aggregate.py` |
|
||||
| consumer | `src.app_controller._refresh_api_metrics` | `src\app_controller.py` |
|
||||
| consumer | `src.app_controller._on_comms_entry` | `src\app_controller.py` |
|
||||
| consumer | `src.ai_client._invalidate_token_estimate` | `src\ai_client.py` |
|
||||
| consumer | `src.ai_client._dashscope_call` | `src\ai_client.py` |
|
||||
| consumer | `src.models.from_dict` | `src\models.py` |
|
||||
| consumer | `src.ai_client._add_history_cache_breakpoint` | `src\ai_client.py` |
|
||||
| consumer | `src.ai_client._pre_dispatch` | `src\ai_client.py` |
|
||||
| consumer | `src.project_manager.format_discussion` | `src\project_manager.py` |
|
||||
| consumer | `src.aggregate.build_markdown_no_history` | `src\aggregate.py` |
|
||||
| consumer | `src.aggregate._build_files_section_from_items` | `src\aggregate.py` |
|
||||
| consumer | `src.ai_client._repair_minimax_history` | `src\ai_client.py` |
|
||||
| consumer | `src.ai_client._repair_anthropic_history` | `src\ai_client.py` |
|
||||
| consumer | `src.ai_client._repair_deepseek_history` | `src\ai_client.py` |
|
||||
| consumer | `src.aggregate.build_markdown_from_items` | `src\aggregate.py` |
|
||||
| consumer | `src.app_controller._start_track_logic` | `src\app_controller.py` |
|
||||
| consumer | `src.project_manager.entry_to_str` | `src\project_manager.py` |
|
||||
| consumer | `src.ai_client.ollama_chat` | `src\ai_client.py` |
|
||||
| consumer | `src.ai_client._execute_single_tool_call_async` | `src\ai_client.py` |
|
||||
| consumer | `src.app_controller._on_comms_entry` | `src\app_controller.py` |
|
||||
| consumer | `src.project_manager.flat_config` | `src\project_manager.py` |
|
||||
| consumer | `src.project_manager.migrate_from_legacy_config` | `src\project_manager.py` |
|
||||
| consumer | `src.ai_client._strip_stale_file_refreshes` | `src\ai_client.py` |
|
||||
| consumer | `src.ai_client._append_comms` | `src\ai_client.py` |
|
||||
| consumer | `src.ai_client._add_history_cache_breakpoint` | `src\ai_client.py` |
|
||||
| consumer | `src.app_controller._refresh_api_metrics` | `src\app_controller.py` |
|
||||
| consumer | `src.ai_client._estimate_message_tokens` | `src\ai_client.py` |
|
||||
| consumer | `src.ai_client._repair_deepseek_history` | `src\ai_client.py` |
|
||||
| consumer | `src.ai_client._invalidate_token_estimate` | `src\ai_client.py` |
|
||||
| consumer | `src.ai_client._execute_single_tool_call_async` | `src\ai_client.py` |
|
||||
| consumer | `src.models._save_config_to_disk` | `src\models.py` |
|
||||
| consumer | `src.ai_client._repair_minimax_history` | `src\ai_client.py` |
|
||||
| consumer | `src.ai_client._add_bleed_derived` | `src\ai_client.py` |
|
||||
| consumer | `src.ai_client.ollama_chat` | `src\ai_client.py` |
|
||||
| consumer | `src.ai_client._trim_anthropic_history` | `src\ai_client.py` |
|
||||
| consumer | `src.aggregate.build_markdown_from_items` | `src\aggregate.py` |
|
||||
| consumer | `src.project_manager.save_project` | `src\project_manager.py` |
|
||||
| consumer | `src.models.from_dict` | `src\models.py` |
|
||||
| consumer | `src.ai_client._strip_cache_controls` | `src\ai_client.py` |
|
||||
| consumer | `src.ai_client._pre_dispatch` | `src\ai_client.py` |
|
||||
| consumer | `src.aggregate.build_tier3_context` | `src\aggregate.py` |
|
||||
| consumer | `src.app_controller._start_track_logic_result` | `src\app_controller.py` |
|
||||
| consumer | `src.app_controller._offload_entry_payload` | `src\app_controller.py` |
|
||||
| consumer | `src.ai_client._strip_private_keys` | `src\ai_client.py` |
|
||||
| consumer | `src.ai_client._trim_minimax_history` | `src\ai_client.py` |
|
||||
| consumer | `src.ai_client._repair_anthropic_history` | `src\ai_client.py` |
|
||||
| consumer | `src.ai_client._dashscope_call` | `src\ai_client.py` |
|
||||
| consumer | `src.ai_client._estimate_prompt_tokens` | `src\ai_client.py` |
|
||||
| consumer | `src.aggregate._build_files_section_from_items` | `src\aggregate.py` |
|
||||
|
||||
## FileItem (0 producers + 0 consumers)
|
||||
|
||||
@@ -128,8 +128,8 @@ _(no producers or consumers)_
|
||||
| role | fqname | file |
|
||||
|---|---|---|
|
||||
| consumer | `src.ai_client._build_file_context_text` | `src\ai_client.py` |
|
||||
| consumer | `src.ai_client._build_file_diff_text` | `src\ai_client.py` |
|
||||
| consumer | `src.ai_client._reread_file_items_result` | `src\ai_client.py` |
|
||||
| consumer | `src.ai_client._build_file_diff_text` | `src\ai_client.py` |
|
||||
|
||||
## CommsLogEntry (0 producers + 0 consumers)
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@ Cross-aggregate analysis of which fields are accessed how often across the codeb
|
||||
| `Metadata` | `get` | 39 |
|
||||
| `Metadata` | `pop` | 10 |
|
||||
| `Metadata` | `session_usage` | 7 |
|
||||
| `Metadata` | `ai_status` | 5 |
|
||||
| `Metadata` | `files` | 5 |
|
||||
| `Metadata` | `ai_status` | 5 |
|
||||
| `Metadata` | `_pending_history_adds_lock` | 4 |
|
||||
| `Metadata` | `_pending_history_adds` | 4 |
|
||||
| `Metadata` | `ui_auto_add_history` | 3 |
|
||||
| `Metadata` | `append` | 3 |
|
||||
| `Metadata` | `discussion` | 2 |
|
||||
| `Metadata` | `error` | 2 |
|
||||
| `ToolCall` | `to_dict` | 1 |
|
||||
|
||||
@@ -19,8 +19,8 @@ Functions on the per-LLM-turn path (high-frequency consumers).
|
||||
| function | pattern | total field accesses |
|
||||
|---|---|---|
|
||||
| `src.ai_client._build_file_context_text` | `whole_struct` | 0 |
|
||||
| `src.ai_client._build_file_diff_text` | `whole_struct` | 0 |
|
||||
| `src.ai_client._reread_file_items_result` | `whole_struct` | 0 |
|
||||
| `src.ai_client._build_file_diff_text` | `whole_struct` | 0 |
|
||||
|
||||
### `HistoryMessage`
|
||||
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
# Organization Deductions
|
||||
|
||||
Cross-aggregate view of codebase organization. Verdicts derived from SSDL analysis:
|
||||
- **well-organized**: <=50 effective codepaths AND >=50% field efficiency
|
||||
- **moderate**: between the two thresholds
|
||||
- **needs restructuring**: >200 effective codepaths OR <20% field efficiency
|
||||
|
||||
## Module organization observations
|
||||
|
||||
### Files with most cross-aggregate involvement
|
||||
|
||||
| file | aggregates produced | aggregates consumed |
|
||||
|---|---|---|
|
||||
| `src\ai_client.py` | 1 | 2 |
|
||||
| `src\app_controller.py` | 1 | 1 |
|
||||
| `src\models.py` | 1 | 1 |
|
||||
| `src\openai_compatible.py` | 1 | 1 |
|
||||
| `src\project_manager.py` | 1 | 1 |
|
||||
| `src\api_hook_client.py` | 1 | 0 |
|
||||
|
||||
### Files with high coupling (producers + consumers >= 8)
|
||||
|
||||
These files are the central nervous system of the codebase. Changes ripple across the most aggregates.
|
||||
|
||||
| file | coupling score (producers + consumers) |
|
||||
|---|---|
|
||||
|
||||
## Per-aggregate organization verdict
|
||||
|
||||
| Aggregate | Verdict | Notes |
|
||||
|---|---|---|
|
||||
| `Metadata` | needs restructuring | 6 nil checks; 0% field efficiency; 1125904201862042 effective codepaths |
|
||||
| `FileItem` | needs restructuring | 0% field efficiency |
|
||||
| `FileItems` | needs restructuring | 1 nil checks; 0% field efficiency; 104 effective codepaths |
|
||||
| `CommsLogEntry` | needs restructuring | 0% field efficiency |
|
||||
| `CommsLog` | needs restructuring | 0% field efficiency |
|
||||
| `HistoryMessage` | needs restructuring | 0% field efficiency |
|
||||
| `History` | needs restructuring | 0% field efficiency |
|
||||
| `ToolDefinition` | needs restructuring | 0% field efficiency |
|
||||
| `ToolCall` | needs restructuring | 0% field efficiency |
|
||||
| `Result` | needs restructuring | 0% field efficiency |
|
||||
|
||||
**Tally:** 0 well-organized, 0 moderate, 10 needs restructuring
|
||||
|
||||
## Restructuring routes (prioritized)
|
||||
|
||||
Top restructuring routes (by effective codepath count):
|
||||
|
||||
1. **`Metadata`**: 1125904201862042 effective codepaths (0% field efficiency)
|
||||
- Apply nil sentinel to 6 nil-check functions
|
||||
- Migrate to immediate-mode cache for 130 field-access sites
|
||||
2. **`FileItems`**: 104 effective codepaths (0% field efficiency)
|
||||
- Apply nil sentinel to 1 nil-check functions
|
||||
- Migrate to immediate-mode cache for 0 field-access sites
|
||||
3. **`HistoryMessage`**: 4 effective codepaths (0% field efficiency)
|
||||
- Apply nil sentinel to 0 nil-check functions
|
||||
- Migrate to immediate-mode cache for 4 field-access sites
|
||||
4. **`ToolCall`**: 1 effective codepaths (0% field efficiency)
|
||||
- Apply nil sentinel to 0 nil-check functions
|
||||
- Migrate to immediate-mode cache for 1 field-access sites
|
||||
5. **`FileItem`**: 0 effective codepaths (0% field efficiency)
|
||||
- Apply nil sentinel to 0 nil-check functions
|
||||
- Migrate to immediate-mode cache for 0 field-access sites
|
||||
@@ -0,0 +1,90 @@
|
||||
# SSDL Analysis Rollup
|
||||
|
||||
Per-aggregate analysis: effective codepaths, branch points, defusing opportunities.
|
||||
|
||||
## Effective codepaths ranking
|
||||
|
||||
| Aggregate | Consumers | Total branches | Effective codepaths | Field efficiency |
|
||||
|---|---|---|---|---|
|
||||
| `Metadata` | 35 | 251 | 1125904201862042 | 0% |
|
||||
| `FileItems` | 3 | 14 | 104 | 0% |
|
||||
| `HistoryMessage` | 2 | 2 | 4 | 0% |
|
||||
| `ToolCall` | 1 | 0 | 1 | 0% |
|
||||
| `FileItem` | 0 | 0 | 0 | 0% |
|
||||
| `CommsLogEntry` | 0 | 0 | 0 | 0% |
|
||||
| `CommsLog` | 0 | 0 | 0 | 0% |
|
||||
| `History` | 0 | 0 | 0 | 0% |
|
||||
| `ToolDefinition` | 0 | 0 | 0 | 0% |
|
||||
| `Result` | 0 | 0 | 0 | 0% |
|
||||
|
||||
## Defusing recommendations (top 10)
|
||||
|
||||
### `Metadata` - Generational Handles `[I:ResolveHandle] -> [B:Gen matches?] -> [N|safe]`
|
||||
|
||||
- **Location:** Metadata consumers have 251 explicit branch points total
|
||||
- **Current state:** Branch explosion: 251 branches = 1125904201862042 effective codepaths
|
||||
- **Recommended change:** Wrap the aggregate in a generational handle (index + generation). Validation is one comparison; mismatch returns the nil sentinel. Reduces N lifetime branches to 1 handle validation + sentinel return.
|
||||
- **Effective codepaths:** 1125904201862042 -> 35
|
||||
|
||||
### `Metadata` - Immediate-Mode Cache `[Q:key] -> [I:FetchCached] -> [T]`
|
||||
|
||||
- **Location:** Metadata consumers access 130 sites, only 0 typed (0%)
|
||||
- **Current state:** Many consumers use wildcard or defensive access patterns
|
||||
- **Recommended change:** Introduce a `metadata_cache` keyed lookup. Consumers request by key, get cached value, no field-existence checks. Reduces 130 field-check branches to 1 cache lookup.
|
||||
- **Effective codepaths:** 1125904201862042 -> 130
|
||||
|
||||
### `FileItems` - Immediate-Mode Cache `[Q:key] -> [I:FetchCached] -> [T]`
|
||||
|
||||
- **Location:** FileItems consumers access 0 sites, only 0 typed (0%)
|
||||
- **Current state:** Many consumers use wildcard or defensive access patterns
|
||||
- **Recommended change:** Introduce a `fileitems_cache` keyed lookup. Consumers request by key, get cached value, no field-existence checks. Reduces 0 field-check branches to 1 cache lookup.
|
||||
- **Effective codepaths:** 104 -> 1
|
||||
|
||||
### `Metadata` - Nil Sentinel `[N]`
|
||||
|
||||
- **Location:** 6 consumer functions have `is None` / `== None` checks
|
||||
- **Current state:** 6 nil-check branches contribute to branch explosion
|
||||
- **Recommended change:** Introduce a module-level `NIL_<AGGREGATE>` sentinel whose field accesses return safe defaults. Replace None checks with the sentinel. Collapses 2^branch_count into ~1.
|
||||
- **Effective codepaths:** 1125904201862042 -> 1125904201862030
|
||||
|
||||
### `FileItems` - Nil Sentinel `[N]`
|
||||
|
||||
- **Location:** 1 consumer function have `is None` / `== None` checks
|
||||
- **Current state:** 1 nil-check branches contribute to branch explosion
|
||||
- **Recommended change:** Introduce a module-level `NIL_<AGGREGATE>` sentinel whose field accesses return safe defaults. Replace None checks with the sentinel. Collapses 2^branch_count into ~1.
|
||||
- **Effective codepaths:** 104 -> 102
|
||||
|
||||
### `HistoryMessage` - Immediate-Mode Cache `[Q:key] -> [I:FetchCached] -> [T]`
|
||||
|
||||
- **Location:** HistoryMessage consumers access 4 sites, only 0 typed (0%)
|
||||
- **Current state:** Many consumers use wildcard or defensive access patterns
|
||||
- **Recommended change:** Introduce a `historymessage_cache` keyed lookup. Consumers request by key, get cached value, no field-existence checks. Reduces 4 field-check branches to 1 cache lookup.
|
||||
- **Effective codepaths:** 4 -> 4
|
||||
|
||||
### `ToolCall` - Immediate-Mode Cache `[Q:key] -> [I:FetchCached] -> [T]`
|
||||
|
||||
- **Location:** ToolCall consumers access 1 sites, only 0 typed (0%)
|
||||
- **Current state:** Many consumers use wildcard or defensive access patterns
|
||||
- **Recommended change:** Introduce a `toolcall_cache` keyed lookup. Consumers request by key, get cached value, no field-existence checks. Reduces 1 field-check branches to 1 cache lookup.
|
||||
- **Effective codepaths:** 1 -> 1
|
||||
|
||||
### `FileItem` - Immediate-Mode Cache `[Q:key] -> [I:FetchCached] -> [T]`
|
||||
|
||||
- **Location:** FileItem consumers access 0 sites, only 0 typed (0%)
|
||||
- **Current state:** Many consumers use wildcard or defensive access patterns
|
||||
- **Recommended change:** Introduce a `fileitem_cache` keyed lookup. Consumers request by key, get cached value, no field-existence checks. Reduces 0 field-check branches to 1 cache lookup.
|
||||
- **Effective codepaths:** 0 -> 1
|
||||
|
||||
### `CommsLogEntry` - Immediate-Mode Cache `[Q:key] -> [I:FetchCached] -> [T]`
|
||||
|
||||
- **Location:** CommsLogEntry consumers access 0 sites, only 0 typed (0%)
|
||||
- **Current state:** Many consumers use wildcard or defensive access patterns
|
||||
- **Recommended change:** Introduce a `commslogentry_cache` keyed lookup. Consumers request by key, get cached value, no field-existence checks. Reduces 0 field-check branches to 1 cache lookup.
|
||||
- **Effective codepaths:** 0 -> 1
|
||||
|
||||
### `CommsLog` - Immediate-Mode Cache `[Q:key] -> [I:FetchCached] -> [T]`
|
||||
|
||||
- **Location:** CommsLog consumers access 0 sites, only 0 typed (0%)
|
||||
- **Current state:** Many consumers use wildcard or defensive access patterns
|
||||
- **Recommended change:** Introduce a `commslog_cache` keyed lookup. Consumers request by key, get cached value, no field-existence checks. Reduces 0 field-check branches to 1 cache lookup.
|
||||
- **Effective codepaths:** 0 -> 1
|
||||
@@ -1242,6 +1242,10 @@ def render_rollups(summary: AuditSummary, output_dir: Path) -> dict[str, str]:
|
||||
render_hot_path_rollup,
|
||||
render_dead_field_rollup,
|
||||
)
|
||||
from src.code_path_audit_ssdl import (
|
||||
render_ssdl_rollup,
|
||||
render_organization_deductions,
|
||||
)
|
||||
field_usage_path = output_dir / "field_usage.md"
|
||||
field_usage_path.write_text(render_field_usage_rollup(profiles), encoding="utf-8")
|
||||
call_graph_path = output_dir / "call_graph.md"
|
||||
@@ -1253,6 +1257,10 @@ def render_rollups(summary: AuditSummary, output_dir: Path) -> dict[str, str]:
|
||||
summary_path.write_text(render_summary_rich(profiles), encoding="utf-8")
|
||||
decomposition_matrix_path.write_text(render_decomposition_matrix_rich(profiles), encoding="utf-8")
|
||||
candidates_path.write_text(render_candidates_rich(profiles), encoding="utf-8")
|
||||
ssdl_path = output_dir / "ssdl_analysis.md"
|
||||
ssdl_path.write_text(render_ssdl_rollup(profiles, "src"), encoding="utf-8")
|
||||
org_path = output_dir / "organization_deductions.md"
|
||||
org_path.write_text(render_organization_deductions(profiles, "src"), encoding="utf-8")
|
||||
return {
|
||||
"summary.md": str(summary_path),
|
||||
"cross_audit_summary.md": str(cross_audit_path),
|
||||
@@ -1262,6 +1270,8 @@ def render_rollups(summary: AuditSummary, output_dir: Path) -> dict[str, str]:
|
||||
"call_graph.md": str(call_graph_path),
|
||||
"hot_paths.md": str(hot_path_path),
|
||||
"dead_fields.md": str(dead_field_path),
|
||||
"ssdl_analysis.md": str(ssdl_path),
|
||||
"organization_deductions.md": str(org_path),
|
||||
}
|
||||
|
||||
def code_path_audit_v2(
|
||||
|
||||
@@ -10,6 +10,7 @@ from src.code_path_audit import (
|
||||
AggregateProfile,
|
||||
FunctionRef,
|
||||
)
|
||||
from src.code_path_audit_ssdl import render_ssdl_sketch
|
||||
|
||||
|
||||
def render_full_markdown(profile: AggregateProfile) -> str:
|
||||
@@ -130,6 +131,9 @@ def render_full_markdown(profile: AggregateProfile) -> str:
|
||||
pct = count / len(profile.access_pattern_evidence) * 100
|
||||
lines.append(f"- `{pat}`: {count} functions ({pct:.0f}%)")
|
||||
lines.append("")
|
||||
# SSDL Sketch (between Access pattern and Frequency)
|
||||
lines.append(render_ssdl_sketch(profile, "src"))
|
||||
lines.append("")
|
||||
# Frequency
|
||||
lines.append("## Frequency")
|
||||
lines.append("")
|
||||
|
||||
+306
-267
@@ -10,306 +10,345 @@ explosion can be defused by introducing a nil sentinel here".
|
||||
"""
|
||||
from __future__ import annotations
|
||||
import ast
|
||||
from collections import Counter
|
||||
from pathlib import Path
|
||||
from src.code_path_audit import (
|
||||
AggregateProfile,
|
||||
FunctionRef,
|
||||
AccessPatternEvidence,
|
||||
AggregateProfile,
|
||||
FunctionRef,
|
||||
)
|
||||
|
||||
|
||||
SSDL_PRIMITIVES: dict[str, str] = {
|
||||
"I": "Instruction (single unit of computation)",
|
||||
"T": "Terminator (returns/exits)",
|
||||
"B": "Branch (conditional fork)",
|
||||
"M": "Merge (control flow reconverges)",
|
||||
"Q": "State Query (reads persistent state)",
|
||||
"S": "State Mutation (writes persistent state)",
|
||||
"N": "Nil Sentinel (defuses branches)",
|
||||
"I": "Instruction (single unit of computation)",
|
||||
"T": "Terminator (returns/exits)",
|
||||
"B": "Branch (conditional fork)",
|
||||
"M": "Merge (control flow reconverges)",
|
||||
"Q": "State Query (reads persistent state)",
|
||||
"S": "State Mutation (writes persistent state)",
|
||||
"N": "Nil Sentinel (defuses branches)",
|
||||
}
|
||||
|
||||
|
||||
def _resolve_filepath(fref: FunctionRef, src_dir: str) -> Path | None:
|
||||
_p = Path(fref.file)
|
||||
filepath = _p if _p.exists() else Path(src_dir) / fref.file
|
||||
if not filepath.exists():
|
||||
return None
|
||||
return filepath
|
||||
|
||||
|
||||
def compute_effective_codepaths(profile: AggregateProfile, src_dir: str = "src") -> int:
|
||||
"""Compute the effective codepath count for one aggregate.
|
||||
"""Compute the effective codepath count for one aggregate.
|
||||
|
||||
Effective codepaths = sum over all consumer functions of
|
||||
2^(branch_count_in_function).
|
||||
Effective codepaths = sum over all consumer functions of
|
||||
2^(branch_count_in_function).
|
||||
|
||||
This is the combinatoric explosion metric (Fleury).
|
||||
High numbers indicate branch-explosion risk; defusing with
|
||||
nil sentinels or immediate-mode caches reduces it to ~1.
|
||||
"""
|
||||
if profile.is_candidate:
|
||||
return 0
|
||||
total = 0
|
||||
for fref in profile.consumers:
|
||||
branches = count_branches_in_function(fref, src_dir)
|
||||
effective = 2 ** branches
|
||||
total += effective
|
||||
return total
|
||||
This is the combinatoric explosion metric (Fleury).
|
||||
High numbers indicate branch-explosion risk; defusing with
|
||||
nil sentinels or immediate-mode caches reduces it to ~1.
|
||||
"""
|
||||
if profile.is_candidate:
|
||||
return 0
|
||||
total = 0
|
||||
for fref in profile.consumers:
|
||||
branches = count_branches_in_function(fref, src_dir)
|
||||
total += 2 ** branches
|
||||
return total
|
||||
|
||||
|
||||
def count_branches_in_function(fref: FunctionRef, src_dir: str = "src") -> int:
|
||||
"""Count the explicit branch points (if/elif/while/try/for/with) in a function."""
|
||||
_p = Path(fref.file)
|
||||
filepath = _p if _p.exists() else Path(src_dir) / fref.file
|
||||
if not filepath.exists():
|
||||
return 0
|
||||
try:
|
||||
source = filepath.read_text(encoding="utf-8")
|
||||
tree = ast.parse(source)
|
||||
except (OSError, SyntaxError):
|
||||
return 0
|
||||
for node in ast.walk(tree):
|
||||
if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)) and node.name == fref.fqname.rsplit(".", 1)[-1]:
|
||||
count = 0
|
||||
for sub in ast.walk(node):
|
||||
if isinstance(sub, (ast.If, ast.For, ast.While, ast.With, ast.Try, ast.ExceptHandler)):
|
||||
count += 1
|
||||
elif isinstance(sub, ast.BoolOp):
|
||||
count += len(sub.values) - 1
|
||||
return count
|
||||
return 0
|
||||
"""Count the explicit branch points (if/elif/while/try/for/with) in a function."""
|
||||
filepath = _resolve_filepath(fref, src_dir)
|
||||
if filepath is None:
|
||||
return 0
|
||||
try:
|
||||
source = filepath.read_text(encoding="utf-8")
|
||||
tree = ast.parse(source)
|
||||
except (OSError, SyntaxError):
|
||||
return 0
|
||||
func_name = fref.fqname.rsplit(".", 1)[-1]
|
||||
for node in ast.walk(tree):
|
||||
if not isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)):
|
||||
continue
|
||||
if node.name != func_name:
|
||||
continue
|
||||
count = 0
|
||||
for sub in ast.walk(node):
|
||||
if isinstance(sub, (ast.If, ast.For, ast.While, ast.With, ast.Try, ast.ExceptHandler)):
|
||||
count += 1
|
||||
elif isinstance(sub, ast.BoolOp):
|
||||
count += len(sub.values) - 1
|
||||
return count
|
||||
return 0
|
||||
|
||||
|
||||
def detect_nil_check_pattern(fref: FunctionRef, src_dir: str = "src") -> bool:
|
||||
"""Detect if the function uses `is None` / `== None` / `!= None` checks (a branch that nil-sentinel could defuse)."""
|
||||
_p = Path(fref.file)
|
||||
filepath = _p if _p.exists() else Path(src_dir) / fref.file
|
||||
if not filepath.exists():
|
||||
return False
|
||||
try:
|
||||
source = filepath.read_text(encoding="utf-8")
|
||||
tree = ast.parse(source)
|
||||
except (OSError, SyntaxError):
|
||||
return False
|
||||
for node in ast.walk(tree):
|
||||
if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)) and node.name == fref.fqname.rsplit(".", 1)[-1]:
|
||||
for sub in ast.walk(node):
|
||||
if isinstance(sub, ast.Compare):
|
||||
for comparator in sub.comparators:
|
||||
if isinstance(comparator, ast.Constant) and comparator.value is None:
|
||||
return True
|
||||
return False
|
||||
return False
|
||||
"""Detect if the function uses `is None` / `== None` / `!= None` checks.
|
||||
|
||||
A nil check is a branch that a nil sentinel could defuse.
|
||||
"""
|
||||
filepath = _resolve_filepath(fref, src_dir)
|
||||
if filepath is None:
|
||||
return False
|
||||
try:
|
||||
source = filepath.read_text(encoding="utf-8")
|
||||
tree = ast.parse(source)
|
||||
except (OSError, SyntaxError):
|
||||
return False
|
||||
func_name = fref.fqname.rsplit(".", 1)[-1]
|
||||
for node in ast.walk(tree):
|
||||
if not isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)):
|
||||
continue
|
||||
if node.name != func_name:
|
||||
continue
|
||||
for sub in ast.walk(node):
|
||||
if not isinstance(sub, ast.Compare):
|
||||
continue
|
||||
for comparator in sub.comparators:
|
||||
if isinstance(comparator, ast.Constant) and comparator.value is None:
|
||||
return True
|
||||
return False
|
||||
return False
|
||||
|
||||
|
||||
def compute_field_access_efficiency(profile: AggregateProfile) -> float:
|
||||
"""Compute field-access efficiency: ratio of typed accesses to total accesses.
|
||||
"""Compute field-access efficiency: ratio of typed accesses to total accesses.
|
||||
|
||||
High efficiency (>0.7) means consumers are using the typed fields directly.
|
||||
Low efficiency (<0.3) means consumers are using wildcards or the aggregate
|
||||
is being passed through without field use (candidate for immediate-mode).
|
||||
"""
|
||||
if profile.is_candidate:
|
||||
return 1.0
|
||||
tac = profile.type_alias_coverage
|
||||
if tac.total_sites == 0:
|
||||
return 0.0
|
||||
return tac.typed_sites / tac.total_sites
|
||||
High efficiency (>0.7) means consumers are using the typed fields directly.
|
||||
Low efficiency (<0.3) means consumers are using wildcards or the aggregate
|
||||
is being passed through without field use (candidate for immediate-mode).
|
||||
"""
|
||||
if profile.is_candidate:
|
||||
return 1.0
|
||||
tac = profile.type_alias_coverage
|
||||
if tac.total_sites == 0:
|
||||
return 0.0
|
||||
return tac.typed_sites / tac.total_sites
|
||||
|
||||
|
||||
def suggest_defusing_technique(profile: AggregateProfile, src_dir: str = "src") -> list[dict]:
|
||||
"""Suggest specific SSDL defusing techniques for this aggregate.
|
||||
"""Suggest specific SSDL defusing techniques for this aggregate.
|
||||
|
||||
Returns a list of {technique, location, current_state, recommended_change}.
|
||||
"""
|
||||
suggestions: list[dict] = []
|
||||
if profile.is_candidate:
|
||||
return suggestions
|
||||
nil_check_count = sum(1 for f in profile.consumers if detect_nil_check_pattern(f, src_dir))
|
||||
effective = compute_effective_codepaths(profile, src_dir)
|
||||
if nil_check_count > 0:
|
||||
suggestions.append({
|
||||
"technique": "Nil Sentinel `[N]`",
|
||||
"location": f"{nil_check_count} consumer function{'s' if nil_check_count != 1 else ''} have `is None` / `== None` checks",
|
||||
"current_state": f"Branch-defusing opportunity: {nil_check_count} functions with explicit None checks",
|
||||
"recommended_change": "Introduce a module-level `NIL_<AGGREGATE>` sentinel whose field accesses return safe defaults. Replace None checks with the sentinel. Reduces effective codepaths from 2^branch_count to 1.",
|
||||
"effective_codepaths_before": effective,
|
||||
"effective_codepaths_after": max(1, effective - nil_check_count),
|
||||
})
|
||||
efficiency = compute_field_access_efficiency(profile)
|
||||
if efficiency < 0.3:
|
||||
suggestions.append({
|
||||
"technique": "Immediate-Mode Cache `[Q:key] -> [I:FetchCached] -> [T]`",
|
||||
"location": f"{profile.name} consumers access {profile.type_alias_coverage.total_sites} sites, only {profile.type_alias_coverage.typed_sites} typed ({efficiency*100:.0f}%)",
|
||||
"current_state": "Many consumers use wildcard access (high effective codepaths via defensive checks)",
|
||||
"recommended_change": f"Introduce a `{profile.name.lower()}_cache` keyed lookup. Consumers request by key, get cached value, no field-existence checks. Reduces {profile.type_alias_coverage.total_sites} field-check branches to 1 cache lookup.",
|
||||
"effective_codepaths_before": effective,
|
||||
"effective_codepaths_after": max(1, profile.type_alias_coverage.total_sites),
|
||||
})
|
||||
branch_count = sum(count_branches_in_function(f, src_dir) for f in profile.consumers)
|
||||
if branch_count > 20:
|
||||
suggestions.append({
|
||||
"technique": "Generational Handles `[I:ResolveHandle] -> [B:Gen matches?] -> [N|safe]`",
|
||||
"location": f"{profile.name} consumers have {branch_count} explicit branch points total",
|
||||
"current_state": f"Branch explosion: {branch_count} branches = {effective} effective codepaths",
|
||||
"recommended_change": "Wrap the aggregate in a generational handle (index + generation). Validation is one comparison; mismatch returns the nil sentinel. Reduces N lifetime branches to 1 handle validation + sentinel return.",
|
||||
"effective_codepaths_before": effective,
|
||||
"effective_codepaths_after": len(profile.consumers),
|
||||
})
|
||||
return suggestions
|
||||
Returns a list of {technique, location, current_state, recommended_change,
|
||||
effective_codepaths_before, effective_codepaths_after}.
|
||||
"""
|
||||
suggestions: list[dict] = []
|
||||
if profile.is_candidate:
|
||||
return suggestions
|
||||
nil_check_count = sum(1 for f in profile.consumers if detect_nil_check_pattern(f, src_dir))
|
||||
effective = compute_effective_codepaths(profile, src_dir)
|
||||
efficiency = compute_field_access_efficiency(profile)
|
||||
branch_count = sum(count_branches_in_function(f, src_dir) for f in profile.consumers)
|
||||
|
||||
if nil_check_count > 0:
|
||||
suggestions.append({
|
||||
"technique": "Nil Sentinel `[N]`",
|
||||
"location": f"{nil_check_count} consumer function{'s' if nil_check_count != 1 else ''} have `is None` / `== None` checks",
|
||||
"current_state": f"{nil_check_count} nil-check branches contribute to branch explosion",
|
||||
"recommended_change": "Introduce a module-level `NIL_<AGGREGATE>` sentinel whose field accesses return safe defaults. Replace None checks with the sentinel. Collapses 2^branch_count into ~1.",
|
||||
"effective_codepaths_before": effective,
|
||||
"effective_codepaths_after": max(1, effective - nil_check_count * 2),
|
||||
})
|
||||
|
||||
if efficiency < 0.3:
|
||||
suggestions.append({
|
||||
"technique": "Immediate-Mode Cache `[Q:key] -> [I:FetchCached] -> [T]`",
|
||||
"location": f"{profile.name} consumers access {profile.type_alias_coverage.total_sites} sites, only {profile.type_alias_coverage.typed_sites} typed ({efficiency*100:.0f}%)",
|
||||
"current_state": "Many consumers use wildcard or defensive access patterns",
|
||||
"recommended_change": f"Introduce a `{profile.name.lower()}_cache` keyed lookup. Consumers request by key, get cached value, no field-existence checks. Reduces {profile.type_alias_coverage.total_sites} field-check branches to 1 cache lookup.",
|
||||
"effective_codepaths_before": effective,
|
||||
"effective_codepaths_after": max(1, profile.type_alias_coverage.total_sites),
|
||||
})
|
||||
|
||||
if branch_count > 20:
|
||||
suggestions.append({
|
||||
"technique": "Generational Handles `[I:ResolveHandle] -> [B:Gen matches?] -> [N|safe]`",
|
||||
"location": f"{profile.name} consumers have {branch_count} explicit branch points total",
|
||||
"current_state": f"Branch explosion: {branch_count} branches = {effective} effective codepaths",
|
||||
"recommended_change": "Wrap the aggregate in a generational handle (index + generation). Validation is one comparison; mismatch returns the nil sentinel. Reduces N lifetime branches to 1 handle validation + sentinel return.",
|
||||
"effective_codepaths_before": effective,
|
||||
"effective_codepaths_after": len(profile.consumers),
|
||||
})
|
||||
|
||||
return suggestions
|
||||
|
||||
|
||||
def render_ssdl_sketch(profile: AggregateProfile, src_dir: str = "src") -> str:
|
||||
"""Render an SSDL sketch of one aggregate's access pattern.
|
||||
"""Render an SSDL sketch of one aggregate's access pattern.
|
||||
|
||||
The sketch shows:
|
||||
- Producers (queries that fetch the aggregate)
|
||||
- Consumers (instruction sequences that read the aggregate)
|
||||
- Branch points (B)
|
||||
- Defusing opportunities (N)
|
||||
- Effective codepaths metric
|
||||
"""
|
||||
if profile.is_candidate:
|
||||
return f"## SSDL Sketch for {profile.name}\n\n_(placeholder; candidate aggregate, would be detected after any_type_componentization_20260621)_\n"
|
||||
lines: list[str] = [f"## SSDL Sketch for `{profile.name}`", ""]
|
||||
lines.append("```")
|
||||
lines.append(f"[Q:{profile.name} entry-point] -> [Q:PCG lookup]")
|
||||
nil_check_funcs = [f for f in profile.consumers if detect_nil_check_pattern(f, src_dir)]
|
||||
branches_total = 0
|
||||
for i, fref in enumerate(profile.consumers):
|
||||
b = count_branches_in_function(fref, src_dir)
|
||||
branches_total += b
|
||||
is_nil = fref in nil_check_funcs
|
||||
nil_marker = "[B:is None?]" if is_nil else "[B:check]"
|
||||
nil_defuse = "[N:safe]" if is_nil else ""
|
||||
lines.append(f" -> [{i+1}: {fref.fqname.rsplit('.', 1)[-1]}] {nil_marker} (branches={b}) {nil_defuse}")
|
||||
lines.append(" -> [T:done]")
|
||||
lines.append("```")
|
||||
lines.append("")
|
||||
effective = compute_effective_codepaths(profile, src_dir)
|
||||
lines.append(f"**Effective codepaths:** {effective} (sum of 2^branches across {len(profile.consumers)} consumers)")
|
||||
lines.append(f"**Total branch points:** {branches_total}")
|
||||
lines.append(f"**Nil-check functions:** {len(nil_check_funcs)}")
|
||||
lines.append("")
|
||||
suggestions = suggest_defusing_technique(profile, src_dir)
|
||||
if suggestions:
|
||||
lines.append("**Defusing opportunities:**")
|
||||
lines.append("")
|
||||
for s in suggestions:
|
||||
lines.append(f"- **{s['technique']}**: {s['recommended_change']}")
|
||||
lines.append(f" - Effective codepaths: {s['effective_codepaths_before']} -> {s['effective_codepaths_after']}")
|
||||
else:
|
||||
lines.append("**No SSDL defusing opportunities detected** (the aggregate is already well-structured for data-oriented access).")
|
||||
lines.append("")
|
||||
return "\n".join(lines)
|
||||
The sketch shows:
|
||||
- Producers (queries that fetch the aggregate)
|
||||
- Consumers (instruction sequences that read the aggregate)
|
||||
- Branch points (B)
|
||||
- Defusing opportunities (N)
|
||||
- Effective codepaths metric
|
||||
"""
|
||||
if profile.is_candidate:
|
||||
return f"## SSDL Sketch for {profile.name}\n\n_(placeholder; candidate aggregate)_\n"
|
||||
lines: list[str] = [f"## SSDL Sketch for `{profile.name}`", ""]
|
||||
lines.append("```")
|
||||
lines.append(f"[Q:{profile.name} entry-point] -> [Q:PCG lookup]")
|
||||
nil_check_funcs = [f for f in profile.consumers if detect_nil_check_pattern(f, src_dir)]
|
||||
branches_total = 0
|
||||
for i, fref in enumerate(profile.consumers):
|
||||
b = count_branches_in_function(fref, src_dir)
|
||||
branches_total += b
|
||||
is_nil = fref in nil_check_funcs
|
||||
nil_marker = "[B:is None?]" if is_nil else "[B:check]"
|
||||
nil_defuse = "[N:safe]" if is_nil else ""
|
||||
short_name = fref.fqname.rsplit(".", 1)[-1]
|
||||
lines.append(f" -> [{i+1}: {short_name}] {nil_marker} (branches={b}) {nil_defuse}")
|
||||
lines.append(" -> [T:done]")
|
||||
lines.append("```")
|
||||
lines.append("")
|
||||
effective = compute_effective_codepaths(profile, src_dir)
|
||||
lines.append(f"**Effective codepaths:** {effective} (sum of 2^branches across {len(profile.consumers)} consumers)")
|
||||
lines.append(f"**Total branch points:** {branches_total}")
|
||||
lines.append(f"**Nil-check functions:** {len(nil_check_funcs)}")
|
||||
lines.append("")
|
||||
suggestions = suggest_defusing_technique(profile, src_dir)
|
||||
if suggestions:
|
||||
lines.append("**Defusing opportunities:**")
|
||||
lines.append("")
|
||||
for s in suggestions:
|
||||
lines.append(f"- **{s['technique']}**: {s['recommended_change']}")
|
||||
lines.append(f" - Effective codepaths: {s['effective_codepaths_before']} -> {s['effective_codepaths_after']}")
|
||||
else:
|
||||
lines.append("**No SSDL defusing opportunities detected** (the aggregate is already well-structured for data-oriented access).")
|
||||
lines.append("")
|
||||
return "\n".join(lines)
|
||||
|
||||
|
||||
def render_ssdl_rollup(profiles: tuple[AggregateProfile, ...], src_dir: str = "src") -> str:
|
||||
"""Render the SSDL rollup (all aggregates + their defusing opportunities)."""
|
||||
lines: list[str] = ["# SSDL Analysis Rollup", ""]
|
||||
lines.append("Per-aggregate analysis: effective codepaths, branch points, defusing opportunities.")
|
||||
lines.append("")
|
||||
real_profiles = [p for p in profiles if not p.is_candidate]
|
||||
lines.append("## Effective codepaths ranking")
|
||||
lines.append("")
|
||||
lines.append("| Aggregate | Consumers | Total branches | Effective codepaths | Field efficiency |")
|
||||
lines.append("|---|---|---|---|---|")
|
||||
ranked = sorted(real_profiles, key=lambda p: -compute_effective_codepaths(p, src_dir))
|
||||
for p in ranked:
|
||||
ec = compute_effective_codepaths(p, src_dir)
|
||||
tc = sum(count_branches_in_function(f, src_dir) for f in p.consumers)
|
||||
eff = compute_field_access_efficiency(p) * 100
|
||||
lines.append(f"| `{p.name}` | {len(p.consumers)} | {tc} | {ec} | {eff:.0f}% |")
|
||||
lines.append("")
|
||||
lines.append("## Defusing recommendations (top 10)")
|
||||
lines.append("")
|
||||
all_suggestions: list[tuple[AggregateProfile, dict]] = []
|
||||
for p in real_profiles:
|
||||
for s in suggest_defusing_technique(p, src_dir):
|
||||
all_suggestions.append((p, s))
|
||||
all_suggestions.sort(key=lambda ps: -(ps[1]['effective_codepaths_before'] - ps[1]['effective_codepaths_after']))
|
||||
for p, s in all_suggestions[:10]:
|
||||
lines.append(f"### `{p.name}` - {s['technique']}")
|
||||
lines.append("")
|
||||
lines.append(f"- **Location:** {s['location']}")
|
||||
lines.append(f"- **Current state:** {s['current_state']}")
|
||||
lines.append(f"- **Recommended change:** {s['recommended_change']}")
|
||||
lines.append(f"- **Effective codepaths:** {s['effective_codepaths_before']} -> {s['effective_codepaths_after']}")
|
||||
lines.append("")
|
||||
return "\n".join(lines)
|
||||
"""Render the SSDL rollup (all aggregates + their defusing opportunities)."""
|
||||
lines: list[str] = ["# SSDL Analysis Rollup", ""]
|
||||
lines.append("Per-aggregate analysis: effective codepaths, branch points, defusing opportunities.")
|
||||
lines.append("")
|
||||
real_profiles = [p for p in profiles if not p.is_candidate]
|
||||
lines.append("## Effective codepaths ranking")
|
||||
lines.append("")
|
||||
lines.append("| Aggregate | Consumers | Total branches | Effective codepaths | Field efficiency |")
|
||||
lines.append("|---|---|---|---|---|")
|
||||
ranked = sorted(real_profiles, key=lambda p: -compute_effective_codepaths(p, src_dir))
|
||||
for p in ranked:
|
||||
ec = compute_effective_codepaths(p, src_dir)
|
||||
tc = sum(count_branches_in_function(f, src_dir) for f in p.consumers)
|
||||
eff = compute_field_access_efficiency(p) * 100
|
||||
lines.append(f"| `{p.name}` | {len(p.consumers)} | {tc} | {ec} | {eff:.0f}% |")
|
||||
lines.append("")
|
||||
lines.append("## Defusing recommendations (top 10)")
|
||||
lines.append("")
|
||||
all_suggestions: list[tuple[AggregateProfile, dict]] = []
|
||||
for p in real_profiles:
|
||||
for s in suggest_defusing_technique(p, src_dir):
|
||||
all_suggestions.append((p, s))
|
||||
all_suggestions.sort(key=lambda ps: -(ps[1]['effective_codepaths_before'] - ps[1]['effective_codepaths_after']))
|
||||
if not all_suggestions:
|
||||
lines.append("_(no defusing recommendations detected)_\n")
|
||||
return "\n".join(lines)
|
||||
for p, s in all_suggestions[:10]:
|
||||
lines.append(f"### `{p.name}` - {s['technique']}")
|
||||
lines.append("")
|
||||
lines.append(f"- **Location:** {s['location']}")
|
||||
lines.append(f"- **Current state:** {s['current_state']}")
|
||||
lines.append(f"- **Recommended change:** {s['recommended_change']}")
|
||||
lines.append(f"- **Effective codepaths:** {s['effective_codepaths_before']} -> {s['effective_codepaths_after']}")
|
||||
lines.append("")
|
||||
return "\n".join(lines)
|
||||
|
||||
|
||||
def render_organization_deductions(profiles: tuple[AggregateProfile, ...], src_dir: str = "src") -> str:
|
||||
"""Render the organization deductions rollup (where the codebase is well-organized vs needs restructuring)."""
|
||||
lines: list[str] = ["# Organization Deductions", ""]
|
||||
lines.append("Cross-aggregate view of codebase organization. Based on SSDL principles:")
|
||||
lines.append("- Well-organized: few branches, high field efficiency, few effective codepaths")
|
||||
lines.append("- Needs restructuring: many branches, low efficiency, branch-explosion risk")
|
||||
lines.append("")
|
||||
real_profiles = [p for p in profiles if not p.is_candidate]
|
||||
lines.append("## Module organization observations")
|
||||
lines.append("")
|
||||
lines.append("### Files with most cross-aggregate involvement")
|
||||
lines.append("")
|
||||
file_agg: dict[str, set[str]] = {}
|
||||
file_consumers: dict[str, set[str]] = {}
|
||||
for p in real_profiles:
|
||||
for f in p.producers:
|
||||
file_agg.setdefault(f.file, set()).add(p.name)
|
||||
for f in p.consumers:
|
||||
file_consumers.setdefault(f.file, set()).add(p.name)
|
||||
rows = []
|
||||
for f in sorted(file_agg.keys()):
|
||||
rows.append((f, len(file_agg[f]), len(file_consumers.get(f, set()))))
|
||||
rows.sort(key=lambda r: -(r[1] + r[2]))
|
||||
lines.append("| file | aggregates produced | aggregates consumed |")
|
||||
lines.append("|---|---|---|")
|
||||
for f, pc, cc in rows[:15]:
|
||||
lines.append(f"| `{f}` | {pc} | {cc} |")
|
||||
lines.append("")
|
||||
lines.append("### Files with high coupling (both many producers AND many consumers)")
|
||||
lines.append("")
|
||||
lines.append("These files are the central nervous system of the codebase. Changes here ripple across the most aggregates.")
|
||||
lines.append("")
|
||||
lines.append("| file | coupling score (producers + consumers) |")
|
||||
lines.append("|---|---|")
|
||||
for f, pc, cc in rows[:10]:
|
||||
score = pc + cc
|
||||
if score >= 8:
|
||||
lines.append(f"| `{f}` | {score} (high) |")
|
||||
lines.append("")
|
||||
lines.append("## Per-aggregate organization verdict")
|
||||
lines.append("")
|
||||
lines.append("| Aggregate | Verdict |")
|
||||
lines.append("|---|---|")
|
||||
for p in real_profiles:
|
||||
ec = compute_effective_codepaths(p, src_dir)
|
||||
eff = compute_field_access_efficiency(p) * 100
|
||||
nil_count = sum(1 for f in p.consumers if detect_nil_check_pattern(f, src_dir))
|
||||
if ec <= 50 and eff >= 50:
|
||||
verdict = "well-organized"
|
||||
elif ec > 200 or eff < 20:
|
||||
verdict = "needs restructuring"
|
||||
else:
|
||||
verdict = "moderate"
|
||||
notes = []
|
||||
if nil_count > 0:
|
||||
notes.append(f"{nil_count} nil checks")
|
||||
if eff < 50:
|
||||
notes.append(f"{eff:.0f}% field efficiency")
|
||||
note_str = "; ".join(notes) if notes else "no major issues"
|
||||
lines.append(f"| `{p.name}` | {verdict} ({note_str}) |")
|
||||
lines.append("")
|
||||
lines.append("## Restructuring routes (prioritized)")
|
||||
lines.append("")
|
||||
priority_routes = []
|
||||
for p in real_profiles:
|
||||
ec = compute_effective_codepaths(p, src_dir)
|
||||
eff = compute_field_access_efficiency(p)
|
||||
if ec > 100 or eff < 0.3:
|
||||
priority_routes.append((p, ec, eff))
|
||||
priority_routes.sort(key=lambda r: -r[1])
|
||||
if priority_routes:
|
||||
lines.append("Top restructuring routes (by effective codepath count):")
|
||||
lines.append("")
|
||||
for p, ec, eff in priority_routes[:5]:
|
||||
lines.append(f"1. **`{p.name}`**: {ec} effective codepaths ({eff*100:.0f}% field efficiency)")
|
||||
lines.append(f" - Apply nil sentinel to {sum(1 for f in p.consumers if detect_nil_check_pattern(f, src_dir))} nil-check functions")
|
||||
lines.append(f" - Migrate to immediate-mode cache for the {p.type_alias_coverage.total_sites} field-access sites")
|
||||
else:
|
||||
lines.append("_(no high-priority restructuring routes; all aggregates have moderate effective codepath counts)_")
|
||||
lines.append("")
|
||||
return "\n".join(lines)
|
||||
"""Render the organization deductions rollup.
|
||||
|
||||
Cross-aggregate view of codebase organization. Based on SSDL principles:
|
||||
- Well-organized: few branches, high field efficiency, few effective codepaths
|
||||
- Needs restructuring: many branches, low efficiency, branch-explosion risk
|
||||
"""
|
||||
lines: list[str] = ["# Organization Deductions", ""]
|
||||
lines.append("Cross-aggregate view of codebase organization. Verdicts derived from SSDL analysis:")
|
||||
lines.append("- **well-organized**: <=50 effective codepaths AND >=50% field efficiency")
|
||||
lines.append("- **moderate**: between the two thresholds")
|
||||
lines.append("- **needs restructuring**: >200 effective codepaths OR <20% field efficiency")
|
||||
lines.append("")
|
||||
real_profiles = [p for p in profiles if not p.is_candidate]
|
||||
|
||||
lines.append("## Module organization observations")
|
||||
lines.append("")
|
||||
lines.append("### Files with most cross-aggregate involvement")
|
||||
lines.append("")
|
||||
file_agg: dict[str, set[str]] = {}
|
||||
file_consumers: dict[str, set[str]] = {}
|
||||
for p in real_profiles:
|
||||
for f in p.producers:
|
||||
file_agg.setdefault(f.file, set()).add(p.name)
|
||||
for f in p.consumers:
|
||||
file_consumers.setdefault(f.file, set()).add(p.name)
|
||||
rows: list[tuple[str, int, int]] = []
|
||||
for f in sorted(file_agg.keys()):
|
||||
rows.append((f, len(file_agg[f]), len(file_consumers.get(f, set()))))
|
||||
rows.sort(key=lambda r: -(r[1] + r[2]))
|
||||
lines.append("| file | aggregates produced | aggregates consumed |")
|
||||
lines.append("|---|---|---|")
|
||||
for f, pc, cc in rows[:15]:
|
||||
lines.append(f"| `{f}` | {pc} | {cc} |")
|
||||
lines.append("")
|
||||
lines.append("### Files with high coupling (producers + consumers >= 8)")
|
||||
lines.append("")
|
||||
lines.append("These files are the central nervous system of the codebase. Changes ripple across the most aggregates.")
|
||||
lines.append("")
|
||||
lines.append("| file | coupling score (producers + consumers) |")
|
||||
lines.append("|---|---|")
|
||||
high_coupling = [(f, pc, cc) for f, pc, cc in rows if (pc + cc) >= 8]
|
||||
for f, pc, cc in high_coupling:
|
||||
lines.append(f"| `{f}` | {pc + cc} (high) |")
|
||||
lines.append("")
|
||||
|
||||
lines.append("## Per-aggregate organization verdict")
|
||||
lines.append("")
|
||||
lines.append("| Aggregate | Verdict | Notes |")
|
||||
lines.append("|---|---|---|")
|
||||
verdict_counts = {"well-organized": 0, "moderate": 0, "needs restructuring": 0}
|
||||
for p in real_profiles:
|
||||
ec = compute_effective_codepaths(p, src_dir)
|
||||
eff = compute_field_access_efficiency(p) * 100
|
||||
nil_count = sum(1 for f in p.consumers if detect_nil_check_pattern(f, src_dir))
|
||||
if ec <= 50 and eff >= 50:
|
||||
verdict = "well-organized"
|
||||
elif ec > 200 or eff < 20:
|
||||
verdict = "needs restructuring"
|
||||
else:
|
||||
verdict = "moderate"
|
||||
verdict_counts[verdict] += 1
|
||||
notes: list[str] = []
|
||||
if nil_count > 0:
|
||||
notes.append(f"{nil_count} nil checks")
|
||||
if eff < 50:
|
||||
notes.append(f"{eff:.0f}% field efficiency")
|
||||
if ec > 100:
|
||||
notes.append(f"{ec} effective codepaths")
|
||||
note_str = "; ".join(notes) if notes else "no major issues"
|
||||
lines.append(f"| `{p.name}` | {verdict} | {note_str} |")
|
||||
lines.append("")
|
||||
lines.append(f"**Tally:** {verdict_counts['well-organized']} well-organized, {verdict_counts['moderate']} moderate, {verdict_counts['needs restructuring']} needs restructuring")
|
||||
lines.append("")
|
||||
|
||||
lines.append("## Restructuring routes (prioritized)")
|
||||
lines.append("")
|
||||
priority_routes = []
|
||||
for p in real_profiles:
|
||||
ec = compute_effective_codepaths(p, src_dir)
|
||||
eff = compute_field_access_efficiency(p)
|
||||
if ec > 100 or eff < 0.3:
|
||||
priority_routes.append((p, ec, eff))
|
||||
priority_routes.sort(key=lambda r: -r[1])
|
||||
if priority_routes:
|
||||
lines.append("Top restructuring routes (by effective codepath count):")
|
||||
lines.append("")
|
||||
for i, (p, ec, eff) in enumerate(priority_routes[:5], 1):
|
||||
nil_count = sum(1 for f in p.consumers if detect_nil_check_pattern(f, src_dir))
|
||||
lines.append(f"{i}. **`{p.name}`**: {ec} effective codepaths ({eff*100:.0f}% field efficiency)")
|
||||
lines.append(f" - Apply nil sentinel to {nil_count} nil-check functions")
|
||||
lines.append(f" - Migrate to immediate-mode cache for {p.type_alias_coverage.total_sites} field-access sites")
|
||||
else:
|
||||
lines.append("_(no high-priority restructuring routes; all aggregates have moderate effective codepath counts)_")
|
||||
lines.append("")
|
||||
return "\n".join(lines)
|
||||
|
||||
Reference in New Issue
Block a user