Repository navigation
Remove big_o_depth and is_recursive complexity metrics from the risk engine - #1032
Merged
Merged
Conversation
…engine - Deletes the indentation-based Big-O tracker and the name-occurrence-count recursion heuristic in detector.py, plus the FunctionNode fields they fed. Both generated systematic false positives: whitespace geometry doesn't measure algorithmic complexity, and counting a function's own name inside its body triggers on docstrings, comments, logging, and super().setUp() patterns. - Removes every downstream consumer beyond the issue's own checklist, found via grep: the magnitude/impact complexity_multiplier in detector.py, the "Algorithmic Network Bottleneck" feature in network_risk_sensor.py (a networkx graph attribute + telemetry field with no other consumer), signal_processor.py's max_algorithmic_complexity telemetry string, the big-O term in the documentation-risk "opaque execution" formula, the concurrency "resource exhaustion guard" starvation multiplier, and dev_agent_firewall.py's Context Window Exhaustion gate (now token_mass alone, consistent with #1013's choice not to invent a replacement AST-less heuristic). - Updates the two wiki pages and CLAUDE.md/ANTIGRAVITY.md self-scan-DB example queries that referenced these fields. This is sub-issue #1014 of epic #1025, next after #1015 since algorithmic_dos (#1015, merged via #1029) was mathematically built on big_o_depth. Closes #1014. Test plan: - python -m pytest tests/ -- 5444 passed, 0 failed, 2 skipped, 11 xfailed, 3 xpassed - python tests/tools/audit_check.py --regenerate -- clean (ruff/mypy baselines regenerated, all pure line-shifts) - ruff format --check -- clean - Golden master fixtures regenerated via update_golden_master.py in both full-precision and zero-dependency venvs -- diff is magnitude/impact and the concurrency/documentation risk scores shifting downward across the corpus now that the fake complexity multipliers are gone; crucible_check.py passes clean on both modes after blessing. 🤖 Generated with Claude Code Co-Authored-By: Claude Sonnet 5 <[email protected]>
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
big_o_depth(indentation-based Big-O tracker) andis_recursive(name-occurrence-count heuristic) metrics engine-wide: both generate systematic false positives, since whitespace geometry doesn't measure algorithmic complexity, and counting a function's own name inside its body triggers on docstrings, comments, logging statements, and standard patterns likesuper().setUp().FunctionNodeand the indentation/name-scanning logic indetector.py, plus thecomplexity_multiplierthey fed into the functionmagnitude/impactscore (now just(branch_hits + 1) * arg_multiplier + 0.05*effective_loc, no fake complexity term).db_complexitymetric from the Structural Extractor #1013's PR):network_risk_sensor.py: the whole "Algorithmic Network Bottleneck" feature (max_big_o/is_recursivegraph node attrs,is_algorithmic_bottlenecktelemetry field) in both the full-precision and Zero-Dependency Mode paths — no other consumer existed for it.signal_processor.py: themax_algorithmic_complexitytelemetry string, the Big-O term in the documentation-risk "opaque execution" formula (now gated onimpact > 50.0alone), and the concurrency "resource exhaustion guard" starvation multiplier (removed entirely, along with the now-unusedfunctionsparameter on_calc_concurrency).llm_recorder.py/record_keeper.py: the SQLite schema columns and report sections built on these fields (llm_recorder.py's "8.5 ALGORITHMIC & DATABASE BOTTLENECKS" section had already lost its DB half in Removedb_complexitymetric from the Structural Extractor #1013's PR — removing the algorithmic half removes the section entirely).dev_agent_firewall.py's Context Window Exhaustion gate — now triggers ontoken_massalone, consistent with Removedb_complexitymetric from the Structural Extractor #1013's precedent of not inventing a replacement AST-less heuristic.08-09-documentation-risk.md,08-15-concurrency-exposure.md) and theCLAUDE.md/ANTIGRAVITY.mdself-scan-DB example queries that referenced these fields.This is sub-issue #1014 of epic #1025, next after #1015 (merged via #1029) since
algorithmic_doswas mathematically built onbig_o_depth.Closes #1014.
Test plan
python -m pytest tests/— 5444 passed, 0 failed, 2 skipped, 11 xfailed, 3 xpassedpython tests/tools/audit_check.py --regenerate— clean (ruff/mypy baselines regenerated, all pure line-shifts from removed code)ruff format --check— cleanpython tests/tools/update_golden_master.pyin both full-precision and zero-dependency venvs (.crucible_venvs/) — diff is magnitude/impact and the concurrency/documentation risk scores shifting downward across the corpus now that the fake complexity multipliers are gone;crucible_check.pypasses clean on both modes after blessing.🤖 Generated with Claude Code