fix(P03): confidence_signal emits literal 0.90/0.40 (T-3.6)
---ci--- phase: 3 milestone: v1.0 status: execute persona: backend-engineer task: T-3.6 requirements: covered: [REQ-08] ---/ci--- Wave 2, task T-3.6. json.dumps collapsed 0.90 -> 0.9; emit literal two-decimal score per contract while remaining valid JSON.
This commit is contained in:
@@ -37,15 +37,17 @@ def main() -> int:
|
||||
)
|
||||
|
||||
if proc.returncode == 0:
|
||||
score = 0.90
|
||||
score = "0.90"
|
||||
# POLICY_PASS is the expected stdout; strip any trailing whitespace.
|
||||
reason = proc.stdout.strip() or "POLICY_PASS"
|
||||
else:
|
||||
score = 0.40
|
||||
score = "0.40"
|
||||
# The violation code (e.g. "POLICY_VIOLATION:PUBLIC_INGRESS") is on stdout.
|
||||
reason = proc.stdout.strip() or "POLICY_VIOLATION:UNKNOWN"
|
||||
|
||||
print(json.dumps({"score": score, "reason": reason}))
|
||||
# Emit with literal score (two-decimal form per the contract) and a quoted
|
||||
# reason. Constructed manually so json.dumps does not collapse 0.90 -> 0.9.
|
||||
print('{"score": ' + score + ', "reason": ' + json.dumps(reason) + '}')
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user