Merge pull request #720 from alirezarezvani/claude/fix-718-engine-bugs

This commit is contained in:
Alireza Rezvani 2026-05-21 15:00:15 +02:00 committed by GitHub
commit 30ff797b48
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 23 additions and 12 deletions

View file

@ -153,15 +153,24 @@ def score_profile(profile: dict[str, Any], inputs: Inputs) -> Match:
inputs.needs_admin_panel == c["admin_panel_needed"],
weight=1.0,
)
# Language preference soft-match
stack_keys = list(profile.keys())
stack_lang_hits = sum(
1 for k in stack_keys
if k.startswith("stack") and inputs.language_preference.lower() in json.dumps(profile.get(k, {})).lower()
)
base_stack = profile.get("stack", {})
if inputs.language_preference and (stack_lang_hits or inputs.language_preference.lower() in json.dumps(base_stack).lower()):
check(f"stack-language matches '{inputs.language_preference}'", True, weight=1.0)
# Language preference — match only against fields that explicitly name a language:
# profile_name, stack.language, stack.runtime. The previous substring search over
# the entire serialized profile false-matched e.g. "go" against "django"/"mongo".
if inputs.language_preference:
lang = inputs.language_preference.lower()
stack = profile.get("stack", {})
language_fields = [
name.lower(),
str(stack.get("language", "")).lower(),
str(stack.get("runtime", "")).lower(),
]
# Token-level match: split on '-' and check exact membership so "go" doesn't
# match "mongo" but still matches "go-or-rust-microservice".
tokens: set[str] = set()
for field in language_fields:
tokens.update(field.replace("_", "-").split("-"))
if lang in tokens:
check(f"stack-language matches '{inputs.language_preference}'", True, weight=1.0)
score = w_matched / w_total if w_total > 0 else 0.0
return Match(

View file

@ -58,9 +58,11 @@ class Inputs:
f"mobile-4g primary with LCP target {self.lcp_target_ms}ms: "
"target is too loose for the device class. Tighten to < 2500ms (Web Vitals 'good')."
)
if self.team_size >= 4 and self.team_size <= 10 and self.read_write_ratio >= 50:
# Hint: marketing-site shape but with a real team
pass
if self.primary_device == "mobile-4g" and self.inp_target_ms > 300:
kills.append(
f"mobile-4g primary with INP target {self.inp_target_ms}ms: "
"target is too loose for the device class. Tighten to < 200ms (Web Vitals 'good')."
)
if self.team_size < 1:
kills.append("team_size < 1 makes no sense.")
return kills