Loading...
Loading...
Compare original and translation side by side
.agents/stack-context.md.agents/stack-context.md-- Code looks similar but represents different concepts — DO NOT unify
def calculate_shipping_cost(weight, distance):
return weight * 0.5 + distance * 0.1
def calculate_insurance_premium(value, risk_factor):
return value * 0.5 + risk_factor * 0.1
-- These are different business rules that happen to share a formula today.
-- They will diverge. Keep them separate.-- Code looks similar but represents different concepts — DO NOT unify
def calculate_shipping_cost(weight, distance):
return weight * 0.5 + distance * 0.1
def calculate_insurance_premium(value, risk_factor):
return value * 0.5 + risk_factor * 0.1
-- These are different business rules that happen to share a formula today.
-- They will diverge. Keep them separate.-- Same validation rule duplicated — UNIFY
// in signup handler
if len(password) < 8 or not has_uppercase(password):
return error("Password too weak")
// in password-reset handler
if len(new_password) < 8 or not has_uppercase(new_password):
return error("Password too weak")
-- Fix: single source of truth
def validate_password(password):
if len(password) < 8:
return error("Password must be at least 8 characters")
if not has_uppercase(password):
return error("Password must contain an uppercase letter")
return ok()-- Same validation rule duplicated — UNIFY
// in signup handler
if len(password) < 8 or not has_uppercase(password):
return error("Password too weak")
// in password-reset handler
if len(new_password) < 8 or not has_uppercase(new_password):
return error("Password too weak")
-- Fix: single source of truth
def validate_password(password):
if len(password) < 8:
return error("Password must be at least 8 characters")
if not has_uppercase(password):
return error("Password must contain an uppercase letter")
return ok()