Finishing touches: per-language rules, MCP cache, tree-sitter types, edge overlay, new memory tables#2
Merged
singaraiona merged 5 commits intomainfrom May 1, 2026
Merged
Conversation
Adds RuleConfig.language_overrides — a per-language map of optional threshold overrides for the per-file rules: function complexity, cognitive complexity, file lines, function lines, fan-in/out for files and functions, and large-file threshold. Resolution order is: language override > plugin field > global. Languages whose idioms make a global threshold either too strict or too lax (Rust match arms vs flat Python conditionals, for example) can now declare their own caps without loosening the global ones.
…nce as memory tables Adds four splayed tables to RayMemory: temporal_hotspots, file_ages, change_coupling, and inheritance (one row per (type, base) pair derived from TypeFact.bases). Coupling strength is stored as integer milli to fit the i64 column type — divide by 1000 on read to recover the [0, 1] Jaccard. RayMemory.summary and save_splayed wire them through end-to-end.
Adds an MCP-level health cache keyed by (root, config-signature) and a HEALTH_INVALIDATING_TOOLS list. Read tools (health, hotspots, architecture, evolution, dsm) now consult the cache first; mutating tools (session_start/end, rescan, what_if, baseline_save, config_write, plugin mutations) clear it before they run. Repeated reads in the same MCP session no longer re-scan.
Adds an AST-driven type extractor that walks class_definition (Python) and class_declaration (TypeScript) nodes, picking up bases from the language-specific child fields (Python superclasses, TypeScript class_heritage / extends_clause / implements_clause). When tree-sitter parses cleanly the AST result wins; line-based extraction stays as a fallback for languages without grammar support and merges any plugin-driven abstract-base flags. Multiline class declarations and generic type arguments now produce accurate bases without confusing the line parser.
Adds an absolutely-positioned SVG overlay above the file grid that draws lines between cell centers for each adjacency edge under the active edge filter. Edges are off by default (toggle in the controls) to avoid clutter on large repos. Lines are color-coded by edge type (imports / calls / inherits) and dim when a file is selected unless they participate in its upstream or downstream route. Resize, focus changes, and edge-filter changes all re-render the overlay.
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
Closes the remaining 5 polish/accuracy items identified in the post-PR-1 audit. Each commit is independently verifiable and tested.
What changed
Behavioral
2334220) —RuleConfig.language_overrides: BTreeMap<String, LanguageRuleOverride>lets one language declare stricter or looser thresholds than the global ones for: function complexity, cognitive complexity, file lines, function lines, fan-in/out (file & function), large-file size. Resolution order: language override > plugin field > global.0d18a51) — for Python and TypeScript, the AST now producesTypeFact.basesfromclass_definition.superclasses/class_heritageinstead of the line-based parser. Handles multi-line declarations and generic type arguments correctly. Line parser stays as fallback.Internal quality
af0a5de) —McpState.cached_healthkeyed by(root, config-signature). Mutating tools (session_*,rescan,what_if,baseline_save,config_write,plugin_*) clear it via theHEALTH_INVALIDATING_TOOLSlist. Read tools (health,hotspots,architecture,evolution,dsm) consult the cache first.f03bf17) — splayed tables fortemporal_hotspots,file_ages,change_coupling, andinheritance(one row per(type, base)pair fromTypeFact.bases). Coupling strength stored as integer milli (×1000) to fit the i64 column type.UX
e9c90e0) — SVG overlay over the file grid renders lines between cell centers for each adjacency edge, color-coded by type (imports/calls/inherits). Off by default, toggleable. Lines dim when a file is selected unless they're on its route. Adjusts to resize, focus, and edge-filter changes.Numbers
Test plan
cargo fmt --check— clean.cargo test --workspace— all unit tests pass.cargo run -q -p raysense-cli -- health .— confirm output unchanged on this repo (no per-language overrides configured here).cargo run -q -p raysense-cli -- visualize . --output /tmp/r.html— open in browser, toggle "show edges", switch edge filter, click a file → confirm dimming.cargo run -q -p raysense-cli -- mcpover stdio — callraysense_healthtwice in a row and confirm the second is fast (cache hit). Then callraysense_rescanand confirm the nextraysense_healthre-scans.