fix dashboard validation fallback and semantic relation parsing
This commit is contained in:
@@ -200,30 +200,41 @@ class SemanticEntity:
|
||||
except ValueError:
|
||||
base_tier = Tier.STANDARD
|
||||
|
||||
# Dynamic Tier Adjustments based on User Feedback
|
||||
file_path_lower = self.file_path.lower()
|
||||
is_test_entity = (
|
||||
"test" in file_path_lower
|
||||
or "/__tests__/" in self.file_path
|
||||
or self.name.startswith("test_")
|
||||
)
|
||||
|
||||
# 1. Tests should never be higher than STANDARD
|
||||
if "test" in self.file_path.lower() or "/__tests__/" in self.file_path or self.name.startswith("test_"):
|
||||
if base_tier == Tier.CRITICAL:
|
||||
return Tier.STANDARD
|
||||
if is_test_entity and base_tier == Tier.CRITICAL:
|
||||
return Tier.STANDARD
|
||||
|
||||
# 2. Svelte components -> TRIVIAL/STANDARD (unless layout/page)
|
||||
# 2. Non-route Svelte entities should not be escalated beyond STANDARD by path heuristics.
|
||||
if self.file_path.endswith(".svelte"):
|
||||
if "+page" not in self.name and "+layout" not in self.name and "Page" not in self.name and "Layout" not in self.name:
|
||||
if base_tier == Tier.CRITICAL:
|
||||
return Tier.STANDARD
|
||||
|
||||
# 3. Tooling scripts
|
||||
if "scripts/" in self.file_path or "_tui.py" in self.file_path:
|
||||
if base_tier == Tier.CRITICAL:
|
||||
is_route_level_svelte = any(
|
||||
marker in self.name for marker in ["+page", "+layout", "Page", "Layout"]
|
||||
)
|
||||
if not is_route_level_svelte and base_tier == Tier.CRITICAL:
|
||||
return Tier.STANDARD
|
||||
|
||||
# 4. Promote critical security/data paths
|
||||
|
||||
# 3. Tooling scripts should not be escalated beyond STANDARD.
|
||||
if ("scripts/" in self.file_path or "_tui.py" in self.file_path) and base_tier == Tier.CRITICAL:
|
||||
return Tier.STANDARD
|
||||
|
||||
# 4. Promote only module-like entities in critical domains by path heuristic.
|
||||
# This prevents path segments like "migration" from forcing every nested
|
||||
# Block/Function/Component in a route file into CRITICAL validation.
|
||||
critical_keywords = ["auth", "security", "jwt", "database", "migration", "config", "session"]
|
||||
if any(keyword in self.file_path.lower() for keyword in critical_keywords) and "test" not in self.file_path.lower():
|
||||
# Allow explicit overrides to lower tiers if explicitly tagged TRIVIAL, otherwise promote logic mapping
|
||||
if base_tier != Tier.TRIVIAL:
|
||||
return Tier.CRITICAL
|
||||
module_like_types = {"Module", "Class", "Store"}
|
||||
if (
|
||||
self.type in module_like_types
|
||||
and any(keyword in file_path_lower for keyword in critical_keywords)
|
||||
and not is_test_entity
|
||||
and base_tier != Tier.TRIVIAL
|
||||
):
|
||||
return Tier.CRITICAL
|
||||
|
||||
return base_tier
|
||||
# [/DEF:get_tier:Function]
|
||||
@@ -440,7 +451,7 @@ def get_patterns(lang: str) -> Dict[str, Pattern]:
|
||||
"js_anchor_end": re.compile(r"//\s*\[/DEF:(?P<name>[-\w\.]+):(?P<type>\w+)\]"),
|
||||
"html_tag": re.compile(r"@(?P<tag>[A-Z_]+):\s*(?P<value>.*)"),
|
||||
"jsdoc_tag": re.compile(r"\*\s*@(?P<tag>[A-Za-z_]+)\s*:?\s*(?P<value>.*)"),
|
||||
"relation": re.compile(r"//\s*@RELATION:\s*\[?(?P<type>\w+)\]?\s*->\s*\[?(?P<target>[^\]]+)\]?"),
|
||||
"relation": re.compile(r"(?:<!--\s*|//\s*|\*\s*|\s*)@RELATION:\s*\[?(?P<type>\w+)\]?\s*->\s*\[?(?P<target>[^\]\n]+)\]?"),
|
||||
"func_def": re.compile(r"^\s*(export\s+)?(async\s+)?function\s+(?P<name>\w+)"),
|
||||
"console_log": re.compile(r"console\.(info|warn|debug)\s*\(\s*['\"`]\[[\w\.-]+\]\[(EXPLORE|REASON|REFLECT|[A-Za-z0-9_:]+)\]"),
|
||||
# Svelte-specific patterns
|
||||
|
||||
Reference in New Issue
Block a user