feat: Introduce and enforce test contract annotations for critical modules and update coverage tracking.
This commit is contained in:
@@ -189,9 +189,36 @@ class SemanticEntity:
|
||||
with belief_scope("get_tier"):
|
||||
tier_str = self.tags.get("TIER", "STANDARD").upper()
|
||||
try:
|
||||
return Tier(tier_str)
|
||||
base_tier = Tier(tier_str)
|
||||
except ValueError:
|
||||
return Tier.STANDARD
|
||||
base_tier = Tier.STANDARD
|
||||
|
||||
# Dynamic Tier Adjustments based on User Feedback
|
||||
|
||||
# 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
|
||||
|
||||
# 2. Svelte components -> TRIVIAL/STANDARD (unless layout/page)
|
||||
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:
|
||||
return Tier.STANDARD
|
||||
|
||||
# 4. Promote critical security/data paths
|
||||
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
|
||||
|
||||
return base_tier
|
||||
# [/DEF:get_tier:Function]
|
||||
|
||||
# [DEF:to_dict:Function]
|
||||
|
||||
Reference in New Issue
Block a user