letitloop 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- letitloop-0.2.0.dist-info/METADATA +232 -0
- letitloop-0.2.0.dist-info/RECORD +175 -0
- letitloop-0.2.0.dist-info/WHEEL +5 -0
- letitloop-0.2.0.dist-info/entry_points.txt +4 -0
- letitloop-0.2.0.dist-info/licenses/LICENSE +21 -0
- letitloop-0.2.0.dist-info/top_level.txt +1 -0
- orchestrator/SKILL.md +292 -0
- orchestrator/__init__.py +151 -0
- orchestrator/anti_ouroboros.py +78 -0
- orchestrator/approval.py +139 -0
- orchestrator/ast_node_splicer.py +130 -0
- orchestrator/ast_splicer.py +94 -0
- orchestrator/audit.py +88 -0
- orchestrator/budget.py +195 -0
- orchestrator/checkpoint.py +248 -0
- orchestrator/cli.py +1971 -0
- orchestrator/codebase_introspector.py +66 -0
- orchestrator/component_slicer.py +185 -0
- orchestrator/config.py +152 -0
- orchestrator/contract.py +404 -0
- orchestrator/dag_validator.py +172 -0
- orchestrator/elasticity_governor.py +80 -0
- orchestrator/env_doctor.py +166 -0
- orchestrator/errors.py +211 -0
- orchestrator/events.py +120 -0
- orchestrator/evidence.py +203 -0
- orchestrator/exceptions.py +37 -0
- orchestrator/experimental/arena_arbiter.py +260 -0
- orchestrator/experimental/fuzz_engine.py +206 -0
- orchestrator/experimental/mutation_tester.py +382 -0
- orchestrator/failure.py +226 -0
- orchestrator/fast_sandbox.py +126 -0
- orchestrator/feasibility_gate.py +115 -0
- orchestrator/feedback.py +302 -0
- orchestrator/fixtures/__init__.py +0 -0
- orchestrator/fixtures/example_contract.json +50 -0
- orchestrator/fixtures/generated/evidence-cli-run-test-step-1.json +47 -0
- orchestrator/fixtures/generated/evidence-cli-run-test-step-2.json +47 -0
- orchestrator/fixtures/generated/evidence-inject-test-a.json +47 -0
- orchestrator/fixtures/generated/evidence-inject-test-b.json +47 -0
- orchestrator/fixtures/generated/evidence-inject-test-c.json +47 -0
- orchestrator/fixtures/generated/evidence-json-test-a.json +47 -0
- orchestrator/fixtures/generated/evidence-json-test-b.json +47 -0
- orchestrator/fixtures/generated/fail-report-fail-task-1.json +47 -0
- orchestrator/fixtures/generated/fail-report-json-task-1.json +47 -0
- orchestrator/fixtures/generated/fail-report-success-task-1.json +47 -0
- orchestrator/fixtures/generated/fuzz-engine-design.json +63 -0
- orchestrator/fixtures/generated/fuzz-engine-impl.json +62 -0
- orchestrator/fixtures/generated/fuzz-engine-tests.json +62 -0
- orchestrator/fixtures/generated/fuzz-engine-verify.json +62 -0
- orchestrator/fixtures/generated/goal-orch-step-1.json +63 -0
- orchestrator/fixtures/generated/goal-orch-step-2.json +62 -0
- orchestrator/fixtures/generated/goal-orch-step-3.json +62 -0
- orchestrator/fixtures/generated/goal-orch-step-4.json +62 -0
- orchestrator/fixtures/generated/goal-orch-step-5.json +62 -0
- orchestrator/fixtures/generated/goal-orch-step-6.json +63 -0
- orchestrator/fixtures/generated/implement-a-thread-safe-token-bucket-rat-task-1.json +53 -0
- orchestrator/fixtures/generated/orchestrator-checkpoint-rollback-3.json +63 -0
- orchestrator/fixtures/generated/orchestrator-checkpoint-rollback.json +62 -0
- orchestrator/fixtures/generated/orchestrator-live-telemetry-2.json +62 -0
- orchestrator/fixtures/generated/orchestrator-live-telemetry.json +62 -0
- orchestrator/fixtures/generated/orchestrator-spec-synthesis-1.json +62 -0
- orchestrator/fixtures/generated/orchestrator-spec-synthesis.json +62 -0
- orchestrator/fixtures/generated/orchestrator-test-verification-4.json +62 -0
- orchestrator/fixtures/generated/orchestrator-test-verification.json +62 -0
- orchestrator/fixtures/generated/perf-step-1.json +61 -0
- orchestrator/fixtures/generated/perf-step-2.json +62 -0
- orchestrator/fixtures/generated/perf-step-3.json +62 -0
- orchestrator/fixtures/generated/perf-step-4.json +62 -0
- orchestrator/fixtures/generated/perf-step-5.json +63 -0
- orchestrator/fixtures/generated/phase2-proof-two-step-step-1.json +47 -0
- orchestrator/fixtures/generated/phase2-proof-two-step-step-2.json +47 -0
- orchestrator/fixtures/generated/planner-spec-synthesis-impl.json +59 -0
- orchestrator/fixtures/generated/self-evolution-ast-formatter.json +69 -0
- orchestrator/fixtures/generated/self-evolution-checkpoint-rollback.json +70 -0
- orchestrator/fixtures/generated/self-evolution-spec-synthesis.json +70 -0
- orchestrator/fixtures/generated/self-evolution-step-1.json +70 -0
- orchestrator/fixtures/generated/self-evolution-step-2.json +70 -0
- orchestrator/fixtures/generated/self-evolution-step-3.json +70 -0
- orchestrator/fixtures/generated/self-evolution-step-4.json +70 -0
- orchestrator/fixtures/generated/self-evolution-step-5.json +65 -0
- orchestrator/fixtures/generated/self-evolution-telemetry.json +70 -0
- orchestrator/fixtures/generated/self-evolution-tests.json +71 -0
- orchestrator/fixtures/generated/spec-telemetry-research-design.json +64 -0
- orchestrator/fixtures/generated/spec-telemetry-step-1.json +62 -0
- orchestrator/fixtures/generated/spec-telemetry-step-2.json +62 -0
- orchestrator/fixtures/generated/spec-telemetry-step-3.json +62 -0
- orchestrator/fixtures/generated/spec-telemetry-step-4.json +62 -0
- orchestrator/fixtures/generated/spec-telemetry-step-5.json +62 -0
- orchestrator/fixtures/generated/spec-telemetry-verification.json +58 -0
- orchestrator/fixtures/generated/token-bucket-impl.json +69 -0
- orchestrator/fixtures/generated/token-bucket-step-1.json +70 -0
- orchestrator/fixtures/generated/token-bucket-step-2.json +70 -0
- orchestrator/fixtures/generated/token-bucket-step-3.json +60 -0
- orchestrator/fixtures/generated/token-bucket-tests.json +70 -0
- orchestrator/fixtures/generated/token-bucket-verify.json +61 -0
- orchestrator/fixtures/generated/trace-ux-tests-step-1.json +64 -0
- orchestrator/fixtures/generated/trace-ux-tests-step-2.json +64 -0
- orchestrator/fixtures/generated/trace-ux-tests-step-3.json +62 -0
- orchestrator/fixtures/generated/tui-live-telemetry-impl.json +59 -0
- orchestrator/fixtures/phase1_proof_escalation_contract.json +41 -0
- orchestrator/fixtures/phase1_proof_happy_path_contract.json +83 -0
- orchestrator/fixtures/phase1_proof_qc_contract.json +41 -0
- orchestrator/fixtures/phase1_proof_repair_contract.json +41 -0
- orchestrator/fixtures/phase2_proof_two_step_goal.json +15 -0
- orchestrator/fixtures/run_proofs.py +299 -0
- orchestrator/fixtures/test_normalizer.py +16 -0
- orchestrator/generator.py +239 -0
- orchestrator/goal.py +245 -0
- orchestrator/handoff.py +86 -0
- orchestrator/hybrid_worker.py +840 -0
- orchestrator/impossibility.py +162 -0
- orchestrator/limits.py +60 -0
- orchestrator/live_evolution_engine.py +247 -0
- orchestrator/llm.py +291 -0
- orchestrator/local_tool_calling.py +285 -0
- orchestrator/lock.py +404 -0
- orchestrator/mcp_client.py +571 -0
- orchestrator/mcp_server.py +344 -0
- orchestrator/memory_bridge.py +182 -0
- orchestrator/metrics.py +159 -0
- orchestrator/micro_epoch.py +42 -0
- orchestrator/models.py +350 -0
- orchestrator/parsing.py +237 -0
- orchestrator/patch_applier.py +154 -0
- orchestrator/plan_preview.py +138 -0
- orchestrator/plan_quality.py +357 -0
- orchestrator/planner.py +532 -0
- orchestrator/preferences.py +115 -0
- orchestrator/preflight.py +141 -0
- orchestrator/process_guard.py +357 -0
- orchestrator/prometheus_exporter.py +207 -0
- orchestrator/prompts.py +275 -0
- orchestrator/proposal_ledger.py +194 -0
- orchestrator/provenance.py +263 -0
- orchestrator/provider_scheduler.py +394 -0
- orchestrator/qc/__init__.py +153 -0
- orchestrator/qc/aggregator.py +330 -0
- orchestrator/qc/parsing.py +287 -0
- orchestrator/qc/personas.py +242 -0
- orchestrator/qc/runner.py +569 -0
- orchestrator/qc_overrule.py +87 -0
- orchestrator/qc_review.py +282 -0
- orchestrator/quality_lenses.py +314 -0
- orchestrator/quality_plan.py +449 -0
- orchestrator/quality_plane.py +103 -0
- orchestrator/reconcile.py +191 -0
- orchestrator/replanner.py +433 -0
- orchestrator/research.py +176 -0
- orchestrator/review_artifact.py +672 -0
- orchestrator/safety.py +271 -0
- orchestrator/schemas.py +230 -0
- orchestrator/scope.py +466 -0
- orchestrator/sensory_radar.py +79 -0
- orchestrator/skill_installer.py +140 -0
- orchestrator/sse_server.py +160 -0
- orchestrator/state.py +871 -0
- orchestrator/subprocess_helper.py +131 -0
- orchestrator/supervisor/__init__.py +184 -0
- orchestrator/supervisor/_shared.py +164 -0
- orchestrator/supervisor/cleanup.py +185 -0
- orchestrator/supervisor/core.py +1680 -0
- orchestrator/supervisor/recovery.py +367 -0
- orchestrator/supervisor/reporting.py +251 -0
- orchestrator/surgical_extractor.py +119 -0
- orchestrator/telemetry.py +61 -0
- orchestrator/templates.py +268 -0
- orchestrator/token_gate.py +245 -0
- orchestrator/tui.py +649 -0
- orchestrator/verifier.py +1103 -0
- orchestrator/webhooks.py +168 -0
- orchestrator/worker.py +469 -0
- orchestrator/worker_adapters.py +815 -0
- orchestrator/worker_pool.py +121 -0
- orchestrator/worktree.py +364 -0
|
@@ -0,0 +1,672 @@
|
|
|
1
|
+
"""Structured review artifact schema for the quality plane.
|
|
2
|
+
|
|
3
|
+
Every reviewer (human or LLM) returns a ReviewArtifact. This schema enforces
|
|
4
|
+
evidence-first review: unsupported claims are tracked separately, and
|
|
5
|
+
INSUFFICIENT_EVIDENCE is the default for zero evidence_read paths.
|
|
6
|
+
|
|
7
|
+
Zero model calls. Zero side effects.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
import math
|
|
13
|
+
from typing import Any, Dict, List, Optional
|
|
14
|
+
|
|
15
|
+
VERDICT_PASS = "PASS"
|
|
16
|
+
VERDICT_REJECT = "REJECT"
|
|
17
|
+
VERDICT_CONDITIONAL_PASS = "CONDITIONAL_PASS"
|
|
18
|
+
VERDICT_INSUFFICIENT_EVIDENCE = "INSUFFICIENT_EVIDENCE"
|
|
19
|
+
VERDICT_ERROR = "ERROR"
|
|
20
|
+
VALID_VERDICTS = {
|
|
21
|
+
VERDICT_PASS,
|
|
22
|
+
VERDICT_REJECT,
|
|
23
|
+
VERDICT_CONDITIONAL_PASS,
|
|
24
|
+
VERDICT_INSUFFICIENT_EVIDENCE,
|
|
25
|
+
VERDICT_ERROR,
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
ISSUE_SEVERITY_P0 = "P0"
|
|
29
|
+
ISSUE_SEVERITY_P1 = "P1"
|
|
30
|
+
ISSUE_SEVERITY_P2 = "P2"
|
|
31
|
+
ISSUE_SEVERITY_P3 = "P3"
|
|
32
|
+
VALID_SEVERITIES = {ISSUE_SEVERITY_P0, ISSUE_SEVERITY_P1, ISSUE_SEVERITY_P2, ISSUE_SEVERITY_P3}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class EvidenceRead:
|
|
36
|
+
"""Tracks what evidence a reviewer actually examined.
|
|
37
|
+
|
|
38
|
+
origin distinguishes files *provided* to the reviewer (auto-populated
|
|
39
|
+
from component_files) from evidence the reviewer *cited* in its issues.
|
|
40
|
+
The orchestrator supplies file names, so origin="provided" does not
|
|
41
|
+
claim the model actually read the file (F7 provenance fix).
|
|
42
|
+
"""
|
|
43
|
+
|
|
44
|
+
def __init__(self, path: str, sections_or_lines: str = "", origin: str = "provided"):
|
|
45
|
+
self.path = path
|
|
46
|
+
self.sections_or_lines = sections_or_lines
|
|
47
|
+
self.origin = origin if origin in ("provided", "cited") else "provided"
|
|
48
|
+
|
|
49
|
+
def to_dict(self) -> Dict[str, str]:
|
|
50
|
+
return {
|
|
51
|
+
"path": self.path,
|
|
52
|
+
"sections_or_lines": self.sections_or_lines,
|
|
53
|
+
"origin": self.origin,
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@classmethod
|
|
57
|
+
def from_dict(cls, d: Dict[str, str]) -> EvidenceRead:
|
|
58
|
+
if not isinstance(d, dict):
|
|
59
|
+
d = {}
|
|
60
|
+
path = d.get("path", "")
|
|
61
|
+
sections = d.get("sections_or_lines", "")
|
|
62
|
+
# NEW-9: persisted evidence fields must be strings — a scalar/none
|
|
63
|
+
# value must never survive into path normalization/serialization.
|
|
64
|
+
return cls(
|
|
65
|
+
path=path if isinstance(path, str) else "",
|
|
66
|
+
sections_or_lines=sections if isinstance(sections, str) else "",
|
|
67
|
+
origin=d.get("origin", "provided"),
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
class ReviewIssue:
|
|
72
|
+
"""A single issue found during review."""
|
|
73
|
+
|
|
74
|
+
def __init__(
|
|
75
|
+
self,
|
|
76
|
+
severity: str,
|
|
77
|
+
path: str = "",
|
|
78
|
+
line: int = 0,
|
|
79
|
+
claim: str = "",
|
|
80
|
+
evidence: str = "",
|
|
81
|
+
recommended_action: str = "",
|
|
82
|
+
):
|
|
83
|
+
self.severity = severity
|
|
84
|
+
self.path = path
|
|
85
|
+
self.line = line
|
|
86
|
+
self.claim = claim
|
|
87
|
+
self.evidence = evidence
|
|
88
|
+
self.recommended_action = recommended_action
|
|
89
|
+
|
|
90
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
91
|
+
return {
|
|
92
|
+
"severity": self.severity,
|
|
93
|
+
"path": self.path,
|
|
94
|
+
"line": self.line,
|
|
95
|
+
"claim": self.claim,
|
|
96
|
+
"evidence": self.evidence,
|
|
97
|
+
"recommended_action": self.recommended_action,
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@classmethod
|
|
101
|
+
def from_dict(cls, d: Dict[str, Any]) -> ReviewIssue:
|
|
102
|
+
severity = d.get("severity", ISSUE_SEVERITY_P3)
|
|
103
|
+
if severity not in VALID_SEVERITIES:
|
|
104
|
+
severity = ISSUE_SEVERITY_P3
|
|
105
|
+
try:
|
|
106
|
+
line = int(d.get("line", 0))
|
|
107
|
+
except (TypeError, ValueError, OverflowError):
|
|
108
|
+
line = 0
|
|
109
|
+
return cls(
|
|
110
|
+
severity=severity,
|
|
111
|
+
path=d.get("path", "") if isinstance(d.get("path", ""), str) else "",
|
|
112
|
+
line=line,
|
|
113
|
+
claim=d.get("claim", "") if isinstance(d.get("claim", ""), str) else str(d.get("claim", "")),
|
|
114
|
+
evidence=d.get("evidence", "") if isinstance(d.get("evidence", ""), str) else "",
|
|
115
|
+
recommended_action=(
|
|
116
|
+
d.get("recommended_action", "") if isinstance(d.get("recommended_action", ""), str) else ""
|
|
117
|
+
),
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
class ReviewArtifact:
|
|
122
|
+
"""Structured output from a single reviewer in the quality plane.
|
|
123
|
+
|
|
124
|
+
Every reviewer MUST populate evidence_read. If empty, the artifact
|
|
125
|
+
should be treated as INSUFFICIENT_EVIDENCE at the synthesis layer.
|
|
126
|
+
"""
|
|
127
|
+
|
|
128
|
+
def __init__(
|
|
129
|
+
self,
|
|
130
|
+
reviewer_id: str,
|
|
131
|
+
role: str,
|
|
132
|
+
model: str = "",
|
|
133
|
+
component_id: str = "",
|
|
134
|
+
verdict: str = VERDICT_INSUFFICIENT_EVIDENCE,
|
|
135
|
+
confidence: float = 0.0,
|
|
136
|
+
evidence_read: Optional[List[EvidenceRead]] = None,
|
|
137
|
+
issues: Optional[List[ReviewIssue]] = None,
|
|
138
|
+
strengths: Optional[List[str]] = None,
|
|
139
|
+
dissent: Optional[List[str]] = None,
|
|
140
|
+
unsupported_claims: Optional[List[str]] = None,
|
|
141
|
+
owner_level_challenges: Optional[List[str]] = None,
|
|
142
|
+
timed_out: bool = False,
|
|
143
|
+
elapsed_sec: float = 0.0,
|
|
144
|
+
reason: str = "",
|
|
145
|
+
):
|
|
146
|
+
self.reviewer_id = reviewer_id
|
|
147
|
+
self.role = role
|
|
148
|
+
self.model = model
|
|
149
|
+
self.component_id = component_id
|
|
150
|
+
self.verdict = verdict
|
|
151
|
+
self.confidence = confidence
|
|
152
|
+
self.evidence_read = evidence_read or []
|
|
153
|
+
self.issues = issues or []
|
|
154
|
+
self.strengths = strengths or []
|
|
155
|
+
self.dissent = dissent or []
|
|
156
|
+
self.unsupported_claims = unsupported_claims or []
|
|
157
|
+
self.owner_level_challenges = owner_level_challenges or []
|
|
158
|
+
self.timed_out = timed_out
|
|
159
|
+
self.elapsed_sec = elapsed_sec
|
|
160
|
+
self.reason = reason
|
|
161
|
+
|
|
162
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
163
|
+
return {
|
|
164
|
+
"reviewer_id": self.reviewer_id,
|
|
165
|
+
"role": self.role,
|
|
166
|
+
"model": self.model,
|
|
167
|
+
"component_id": self.component_id,
|
|
168
|
+
"verdict": self.verdict,
|
|
169
|
+
"confidence": self.confidence,
|
|
170
|
+
"evidence_read": [e.to_dict() for e in self.evidence_read],
|
|
171
|
+
"issues": [i.to_dict() for i in self.issues],
|
|
172
|
+
"strengths": list(self.strengths),
|
|
173
|
+
"dissent": list(self.dissent),
|
|
174
|
+
"unsupported_claims": list(self.unsupported_claims),
|
|
175
|
+
"owner_level_challenges": list(self.owner_level_challenges),
|
|
176
|
+
"timed_out": self.timed_out,
|
|
177
|
+
"elapsed_sec": self.elapsed_sec,
|
|
178
|
+
"reason": self.reason,
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
@classmethod
|
|
182
|
+
def from_dict(cls, d: Dict[str, Any]) -> ReviewArtifact:
|
|
183
|
+
verdict = d.get("verdict", VERDICT_INSUFFICIENT_EVIDENCE)
|
|
184
|
+
if verdict not in VALID_VERDICTS:
|
|
185
|
+
verdict = VERDICT_INSUFFICIENT_EVIDENCE
|
|
186
|
+
try:
|
|
187
|
+
confidence = float(d.get("confidence", 0.0))
|
|
188
|
+
except (TypeError, ValueError, OverflowError):
|
|
189
|
+
confidence = 0.0
|
|
190
|
+
if not math.isfinite(confidence):
|
|
191
|
+
confidence = 0.0
|
|
192
|
+
confidence = max(0.0, min(1.0, confidence))
|
|
193
|
+
evidence_list = d.get("evidence_read", [])
|
|
194
|
+
if not isinstance(evidence_list, list):
|
|
195
|
+
evidence_list = []
|
|
196
|
+
issues_list = d.get("issues", [])
|
|
197
|
+
if not isinstance(issues_list, list):
|
|
198
|
+
issues_list = []
|
|
199
|
+
|
|
200
|
+
def _str_list(key):
|
|
201
|
+
values = d.get(key, [])
|
|
202
|
+
if not isinstance(values, list):
|
|
203
|
+
return []
|
|
204
|
+
return [v for v in values if isinstance(v, str)]
|
|
205
|
+
|
|
206
|
+
try:
|
|
207
|
+
elapsed = float(d.get("elapsed_sec", 0.0))
|
|
208
|
+
except (TypeError, ValueError, OverflowError):
|
|
209
|
+
elapsed = 0.0
|
|
210
|
+
if not math.isfinite(elapsed) or elapsed < 0.0:
|
|
211
|
+
elapsed = 0.0
|
|
212
|
+
|
|
213
|
+
return cls(
|
|
214
|
+
reviewer_id=d.get("reviewer_id", "") if isinstance(d.get("reviewer_id", ""), str) else "",
|
|
215
|
+
role=d.get("role", "") if isinstance(d.get("role", ""), str) else "",
|
|
216
|
+
model=d.get("model", "") if isinstance(d.get("model", ""), str) else "",
|
|
217
|
+
component_id=d.get("component_id", "") if isinstance(d.get("component_id", ""), str) else "",
|
|
218
|
+
verdict=verdict,
|
|
219
|
+
confidence=confidence,
|
|
220
|
+
evidence_read=[EvidenceRead.from_dict(e) for e in evidence_list if isinstance(e, dict)],
|
|
221
|
+
issues=[ReviewIssue.from_dict(i) for i in issues_list if isinstance(i, dict)],
|
|
222
|
+
# F-NEW-2: every list field must normalize to a list of strings —
|
|
223
|
+
# a scalar persisted value must never crash serialization.
|
|
224
|
+
strengths=_str_list("strengths"),
|
|
225
|
+
dissent=_str_list("dissent"),
|
|
226
|
+
unsupported_claims=_str_list("unsupported_claims"),
|
|
227
|
+
owner_level_challenges=_str_list("owner_level_challenges"),
|
|
228
|
+
timed_out=bool(d.get("timed_out", False)),
|
|
229
|
+
elapsed_sec=elapsed,
|
|
230
|
+
reason=d.get("reason", "") if isinstance(d.get("reason", ""), str) else "",
|
|
231
|
+
)
|
|
232
|
+
|
|
233
|
+
def has_evidence(self) -> bool:
|
|
234
|
+
"""Return True if the reviewer read at least one source file."""
|
|
235
|
+
return len(self.evidence_read) > 0
|
|
236
|
+
|
|
237
|
+
def has_cited_evidence(self) -> bool:
|
|
238
|
+
"""Return True if the reviewer explicitly cited evidence (F5).
|
|
239
|
+
|
|
240
|
+
Provided evidence (auto-populated from component_files) records what
|
|
241
|
+
the orchestrator supplied; only origin="cited" demonstrates the
|
|
242
|
+
reviewer actually engaged with a file.
|
|
243
|
+
"""
|
|
244
|
+
return any(e.origin == "cited" for e in self.evidence_read)
|
|
245
|
+
|
|
246
|
+
def has_p0_issues(self) -> bool:
|
|
247
|
+
"""Return True if any issue is severity P0."""
|
|
248
|
+
return any(i.severity == ISSUE_SEVERITY_P0 for i in self.issues)
|
|
249
|
+
|
|
250
|
+
def has_p1_issues(self) -> bool:
|
|
251
|
+
"""Return True if any issue is severity P1."""
|
|
252
|
+
return any(i.severity == ISSUE_SEVERITY_P1 for i in self.issues)
|
|
253
|
+
|
|
254
|
+
def max_severity(self) -> str:
|
|
255
|
+
"""Return the highest severity found, or None if no issues."""
|
|
256
|
+
if self.has_p0_issues():
|
|
257
|
+
return ISSUE_SEVERITY_P0
|
|
258
|
+
if self.has_p1_issues():
|
|
259
|
+
return ISSUE_SEVERITY_P1
|
|
260
|
+
for i in self.issues:
|
|
261
|
+
if i.severity in VALID_SEVERITIES:
|
|
262
|
+
return i.severity
|
|
263
|
+
return ""
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
class SynthesisVerdict:
|
|
267
|
+
"""Aggregated output after merging multiple ReviewArtifacts.
|
|
268
|
+
|
|
269
|
+
NOT a summary. Preserves dissent, detects unsupported claims,
|
|
270
|
+
enforces reject-on-P0.
|
|
271
|
+
"""
|
|
272
|
+
|
|
273
|
+
def __init__(
|
|
274
|
+
self,
|
|
275
|
+
status: str = VERDICT_PASS,
|
|
276
|
+
score: float = 0.0,
|
|
277
|
+
merged_issues: Optional[List[ReviewIssue]] = None,
|
|
278
|
+
unresolved_disagreements: Optional[List[str]] = None,
|
|
279
|
+
p0_blockers: Optional[List[ReviewIssue]] = None,
|
|
280
|
+
p1_required_fixes: Optional[List[ReviewIssue]] = None,
|
|
281
|
+
recommended_next_actions: Optional[List[str]] = None,
|
|
282
|
+
dissent_preserved: bool = True,
|
|
283
|
+
):
|
|
284
|
+
self.status = status
|
|
285
|
+
self.score = score
|
|
286
|
+
self.merged_issues = merged_issues or []
|
|
287
|
+
self.unresolved_disagreements = unresolved_disagreements or []
|
|
288
|
+
self.p0_blockers = p0_blockers or []
|
|
289
|
+
self.p1_required_fixes = p1_required_fixes or []
|
|
290
|
+
self.recommended_next_actions = recommended_next_actions or []
|
|
291
|
+
self.dissent_preserved = dissent_preserved
|
|
292
|
+
|
|
293
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
294
|
+
return {
|
|
295
|
+
"status": self.status,
|
|
296
|
+
"score": self.score,
|
|
297
|
+
"merged_issues": [i.to_dict() for i in self.merged_issues],
|
|
298
|
+
"unresolved_disagreements": list(self.unresolved_disagreements),
|
|
299
|
+
"p0_blockers": [i.to_dict() for i in self.p0_blockers],
|
|
300
|
+
"p1_required_fixes": [i.to_dict() for i in self.p1_required_fixes],
|
|
301
|
+
"recommended_next_actions": list(self.recommended_next_actions),
|
|
302
|
+
"dissent_preserved": self.dissent_preserved,
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
@classmethod
|
|
306
|
+
def from_dict(cls, d: Dict[str, Any]) -> SynthesisVerdict:
|
|
307
|
+
# N2: persisted records must pass through the same fail-closed
|
|
308
|
+
# normalization as live responses.
|
|
309
|
+
if not isinstance(d, dict):
|
|
310
|
+
d = {}
|
|
311
|
+
status = d.get("status", VERDICT_PASS)
|
|
312
|
+
valid = {VERDICT_PASS, VERDICT_REJECT, VERDICT_CONDITIONAL_PASS, VERDICT_INSUFFICIENT_EVIDENCE}
|
|
313
|
+
if status not in valid:
|
|
314
|
+
status = VERDICT_INSUFFICIENT_EVIDENCE
|
|
315
|
+
try:
|
|
316
|
+
score = float(d.get("score", 0.0))
|
|
317
|
+
except (TypeError, ValueError, OverflowError):
|
|
318
|
+
score = 0.0
|
|
319
|
+
if not math.isfinite(score) or score < 0.0 or score > 1.0:
|
|
320
|
+
score = 0.0
|
|
321
|
+
|
|
322
|
+
def _issue_list(key):
|
|
323
|
+
values = d.get(key, [])
|
|
324
|
+
if not isinstance(values, list):
|
|
325
|
+
return []
|
|
326
|
+
return [ReviewIssue.from_dict(i) for i in values if isinstance(i, dict)]
|
|
327
|
+
|
|
328
|
+
def _str_list(key):
|
|
329
|
+
values = d.get(key, [])
|
|
330
|
+
if not isinstance(values, list):
|
|
331
|
+
return []
|
|
332
|
+
return [v for v in values if isinstance(v, str)]
|
|
333
|
+
|
|
334
|
+
return cls(
|
|
335
|
+
status=status,
|
|
336
|
+
score=score,
|
|
337
|
+
merged_issues=_issue_list("merged_issues"),
|
|
338
|
+
unresolved_disagreements=_str_list("unresolved_disagreements"),
|
|
339
|
+
p0_blockers=_issue_list("p0_blockers"),
|
|
340
|
+
p1_required_fixes=_issue_list("p1_required_fixes"),
|
|
341
|
+
recommended_next_actions=_str_list("recommended_next_actions"),
|
|
342
|
+
dissent_preserved=bool(d.get("dissent_preserved", True)),
|
|
343
|
+
)
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
class ArbitrationVerdict:
|
|
347
|
+
"""Terminal resolver for reviewer disagreements.
|
|
348
|
+
|
|
349
|
+
Max depth = 1. No arbitration of arbitration.
|
|
350
|
+
"""
|
|
351
|
+
|
|
352
|
+
def __init__(
|
|
353
|
+
self,
|
|
354
|
+
status: str = VERDICT_REJECT,
|
|
355
|
+
winning_claims: Optional[List[str]] = None,
|
|
356
|
+
discarded_claims: Optional[List[str]] = None,
|
|
357
|
+
reason: str = "",
|
|
358
|
+
confidence: float = 0.0,
|
|
359
|
+
):
|
|
360
|
+
self.status = status
|
|
361
|
+
self.winning_claims = winning_claims or []
|
|
362
|
+
self.discarded_claims = discarded_claims or []
|
|
363
|
+
self.reason = reason
|
|
364
|
+
self.confidence = confidence
|
|
365
|
+
|
|
366
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
367
|
+
return {
|
|
368
|
+
"status": self.status,
|
|
369
|
+
"winning_claims": list(self.winning_claims),
|
|
370
|
+
"discarded_claims": list(self.discarded_claims),
|
|
371
|
+
"reason": self.reason,
|
|
372
|
+
"confidence": self.confidence,
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
@classmethod
|
|
376
|
+
def from_dict(cls, d: Dict[str, Any]) -> ArbitrationVerdict:
|
|
377
|
+
if not isinstance(d, dict):
|
|
378
|
+
d = {}
|
|
379
|
+
status = d.get("status", VERDICT_REJECT)
|
|
380
|
+
if status not in (
|
|
381
|
+
VERDICT_PASS,
|
|
382
|
+
VERDICT_REJECT,
|
|
383
|
+
VERDICT_CONDITIONAL_PASS,
|
|
384
|
+
VERDICT_INSUFFICIENT_EVIDENCE,
|
|
385
|
+
):
|
|
386
|
+
status = VERDICT_REJECT
|
|
387
|
+
try:
|
|
388
|
+
confidence = float(d.get("confidence", 0.0))
|
|
389
|
+
except (TypeError, ValueError, OverflowError):
|
|
390
|
+
confidence = 0.0
|
|
391
|
+
if not math.isfinite(confidence):
|
|
392
|
+
confidence = 0.0
|
|
393
|
+
confidence = max(0.0, min(1.0, confidence))
|
|
394
|
+
return cls(
|
|
395
|
+
status=status,
|
|
396
|
+
winning_claims=[c for c in d.get("winning_claims", []) if isinstance(c, str)],
|
|
397
|
+
discarded_claims=[c for c in d.get("discarded_claims", []) if isinstance(c, str)],
|
|
398
|
+
reason=d.get("reason", "") if isinstance(d.get("reason", ""), str) else "",
|
|
399
|
+
confidence=confidence,
|
|
400
|
+
)
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
class QualityPlaneVerdict:
|
|
404
|
+
"""Final aggregate verdict from the quality plane.
|
|
405
|
+
|
|
406
|
+
Returned by run_quality_plane() and consumed by supervisor.
|
|
407
|
+
Maps to supervisor states: PASS→COMPLETE, REJECT→QC_REJECTED,
|
|
408
|
+
INSUFFICIENT_EVIDENCE→QC_INSUFFICIENT_EVIDENCE, ERROR→QC_REJECTED,
|
|
409
|
+
CONDITIONAL_PASS→QC_CONDITIONAL_PASS, HUMAN_REQUIRED→ESCALATED.
|
|
410
|
+
"""
|
|
411
|
+
|
|
412
|
+
def __init__(
|
|
413
|
+
self,
|
|
414
|
+
passed: bool = False,
|
|
415
|
+
status: str = VERDICT_INSUFFICIENT_EVIDENCE,
|
|
416
|
+
score: float = 0.0,
|
|
417
|
+
reason: str = "",
|
|
418
|
+
issues: Optional[List[Dict[str, Any]]] = None,
|
|
419
|
+
component_verdicts: Optional[List[Dict[str, Any]]] = None,
|
|
420
|
+
review_artifacts: Optional[List[Dict[str, Any]]] = None,
|
|
421
|
+
synthesis_result: Optional[Dict[str, Any]] = None,
|
|
422
|
+
arbitration_result: Optional[Dict[str, Any]] = None,
|
|
423
|
+
budget_used: Optional[Dict[str, Any]] = None,
|
|
424
|
+
degraded: bool = False,
|
|
425
|
+
degrade_reason: str = "",
|
|
426
|
+
):
|
|
427
|
+
self.passed = passed
|
|
428
|
+
self.status = status
|
|
429
|
+
self.score = score
|
|
430
|
+
self.reason = reason
|
|
431
|
+
self.issues = issues or []
|
|
432
|
+
self.component_verdicts = component_verdicts or []
|
|
433
|
+
self.review_artifacts = review_artifacts or []
|
|
434
|
+
self.synthesis_result = synthesis_result
|
|
435
|
+
self.arbitration_result = arbitration_result
|
|
436
|
+
self.budget_used = budget_used or {"llm_calls": 0, "elapsed_sec": 0.0}
|
|
437
|
+
self.degraded = degraded
|
|
438
|
+
self.degrade_reason = degrade_reason
|
|
439
|
+
|
|
440
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
441
|
+
d = {
|
|
442
|
+
"passed": self.passed,
|
|
443
|
+
"status": self.status,
|
|
444
|
+
"score": self.score,
|
|
445
|
+
"reason": self.reason,
|
|
446
|
+
"issues": list(self.issues),
|
|
447
|
+
"component_verdicts": list(self.component_verdicts),
|
|
448
|
+
"review_artifacts": list(self.review_artifacts),
|
|
449
|
+
"synthesis_result": self.synthesis_result.to_dict()
|
|
450
|
+
if isinstance(self.synthesis_result, SynthesisVerdict)
|
|
451
|
+
else self.synthesis_result,
|
|
452
|
+
"arbitration_result": self.arbitration_result.to_dict()
|
|
453
|
+
if isinstance(self.arbitration_result, ArbitrationVerdict)
|
|
454
|
+
else self.arbitration_result,
|
|
455
|
+
"budget_used": dict(self.budget_used),
|
|
456
|
+
"degraded": self.degraded,
|
|
457
|
+
"degrade_reason": self.degrade_reason,
|
|
458
|
+
}
|
|
459
|
+
if hasattr(self, "_qc_model") and self._qc_model:
|
|
460
|
+
d["qc_model"] = self._qc_model
|
|
461
|
+
if hasattr(self, "_worker_model") and self._worker_model:
|
|
462
|
+
d["worker_model"] = self._worker_model
|
|
463
|
+
return d
|
|
464
|
+
|
|
465
|
+
@classmethod
|
|
466
|
+
def from_dict(cls, d: Dict[str, Any]) -> QualityPlaneVerdict:
|
|
467
|
+
# N2: persisted verdict records must be fail-closed on
|
|
468
|
+
# deserialization — contradictory or unknown fields are normalized
|
|
469
|
+
# instead of re-entering the system as trusted audit data.
|
|
470
|
+
if not isinstance(d, dict):
|
|
471
|
+
d = {}
|
|
472
|
+
status = d.get("status", VERDICT_INSUFFICIENT_EVIDENCE)
|
|
473
|
+
valid = {VERDICT_PASS, VERDICT_REJECT, VERDICT_CONDITIONAL_PASS, VERDICT_INSUFFICIENT_EVIDENCE, VERDICT_ERROR}
|
|
474
|
+
if status not in valid:
|
|
475
|
+
status = VERDICT_INSUFFICIENT_EVIDENCE
|
|
476
|
+
try:
|
|
477
|
+
score = float(d.get("score", 0.0))
|
|
478
|
+
except (TypeError, ValueError, OverflowError):
|
|
479
|
+
score = 0.0
|
|
480
|
+
if not math.isfinite(score) or score < 0.0 or score > 1.0:
|
|
481
|
+
score = 0.0
|
|
482
|
+
passed = bool(d.get("passed", False))
|
|
483
|
+
if passed and status != VERDICT_PASS:
|
|
484
|
+
# Contradictory terminal semantics: fail closed.
|
|
485
|
+
passed = False
|
|
486
|
+
budget = d.get("budget_used", {})
|
|
487
|
+
if not isinstance(budget, dict):
|
|
488
|
+
budget = {}
|
|
489
|
+
|
|
490
|
+
def _verdict_list(key):
|
|
491
|
+
values = d.get(key, [])
|
|
492
|
+
if not isinstance(values, list):
|
|
493
|
+
return []
|
|
494
|
+
return [v for v in values if isinstance(v, dict)]
|
|
495
|
+
|
|
496
|
+
synthesis_raw = d.get("synthesis_result")
|
|
497
|
+
synthesis_result = SynthesisVerdict.from_dict(synthesis_raw) if isinstance(synthesis_raw, dict) else None
|
|
498
|
+
arb_raw = d.get("arbitration_result")
|
|
499
|
+
arbitration_result = ArbitrationVerdict.from_dict(arb_raw) if isinstance(arb_raw, dict) else None
|
|
500
|
+
|
|
501
|
+
return cls(
|
|
502
|
+
passed=passed,
|
|
503
|
+
status=status,
|
|
504
|
+
score=score,
|
|
505
|
+
reason=d.get("reason", "") if isinstance(d.get("reason", ""), str) else "",
|
|
506
|
+
issues=_verdict_list("issues"),
|
|
507
|
+
component_verdicts=_verdict_list("component_verdicts"),
|
|
508
|
+
review_artifacts=_verdict_list("review_artifacts"),
|
|
509
|
+
synthesis_result=synthesis_result,
|
|
510
|
+
arbitration_result=arbitration_result,
|
|
511
|
+
budget_used=budget,
|
|
512
|
+
degraded=bool(d.get("degraded", False)),
|
|
513
|
+
degrade_reason=(d.get("degrade_reason", "") if isinstance(d.get("degrade_reason", ""), str) else ""),
|
|
514
|
+
)
|
|
515
|
+
|
|
516
|
+
@classmethod
|
|
517
|
+
def from_qc_verdict(cls, qc_verdict, qc_model: str = "", worker_model: str = "") -> QualityPlaneVerdict:
|
|
518
|
+
"""Convert a legacy QCVerdict to a QualityPlaneVerdict for backward compat."""
|
|
519
|
+
return cls(
|
|
520
|
+
passed=qc_verdict.passed,
|
|
521
|
+
status=qc_verdict.status,
|
|
522
|
+
score=qc_verdict.score,
|
|
523
|
+
reason=qc_verdict.reason,
|
|
524
|
+
issues=qc_verdict.issues,
|
|
525
|
+
budget_used={"llm_calls": 1, "elapsed_sec": 0.0},
|
|
526
|
+
)
|
|
527
|
+
|
|
528
|
+
def add_model_metadata(self, qc_model: str, worker_model: str) -> None:
|
|
529
|
+
"""Attach model metadata after construction (for qc_verdict.json compat)."""
|
|
530
|
+
self._qc_model = qc_model
|
|
531
|
+
self._worker_model = worker_model
|
|
532
|
+
|
|
533
|
+
|
|
534
|
+
def synthesize_artifacts(artifacts: List[ReviewArtifact], quality_spec: Optional[dict] = None) -> SynthesisVerdict:
|
|
535
|
+
"""Merge reviewer artifacts using deterministic fail-closed precedence.
|
|
536
|
+
|
|
537
|
+
Precedence (checked in order):
|
|
538
|
+
1. any artifact verdict ERROR → ERROR (before the evidence gate: a failed
|
|
539
|
+
reviewer call must never synthesize to PASS or IE)
|
|
540
|
+
2. any artifact verdict REJECT → REJECT (fail-closed: a REJECT verdict is
|
|
541
|
+
honored even when its issue list is empty or unparseable)
|
|
542
|
+
3. no evidence → INSUFFICIENT_EVIDENCE
|
|
543
|
+
4. P0 with a claim → REJECT (severity is the gate, not evidence field)
|
|
544
|
+
5. P1 → CONDITIONAL_PASS
|
|
545
|
+
6. else PASS
|
|
546
|
+
Issues without a claim are recorded but never block. All dissent preserved.
|
|
547
|
+
"""
|
|
548
|
+
all_issues: List[ReviewIssue] = []
|
|
549
|
+
p0_blockers: List[ReviewIssue] = []
|
|
550
|
+
p1_required: List[ReviewIssue] = []
|
|
551
|
+
disagreements: List[str] = []
|
|
552
|
+
all_dissent: List[str] = []
|
|
553
|
+
scores: List[float] = []
|
|
554
|
+
|
|
555
|
+
for a in artifacts:
|
|
556
|
+
scores.append(a.confidence)
|
|
557
|
+
all_dissent.extend(a.dissent)
|
|
558
|
+
for i in a.issues:
|
|
559
|
+
all_issues.append(i)
|
|
560
|
+
if i.severity == ISSUE_SEVERITY_P0 and i.claim:
|
|
561
|
+
p0_blockers.append(i)
|
|
562
|
+
elif i.severity == ISSUE_SEVERITY_P1:
|
|
563
|
+
p1_required.append(i)
|
|
564
|
+
|
|
565
|
+
if any(a.verdict == VERDICT_ERROR for a in artifacts):
|
|
566
|
+
return SynthesisVerdict(
|
|
567
|
+
status=VERDICT_ERROR,
|
|
568
|
+
score=min(scores) if scores else 0.0,
|
|
569
|
+
merged_issues=all_issues,
|
|
570
|
+
unresolved_disagreements=disagreements,
|
|
571
|
+
p0_blockers=p0_blockers,
|
|
572
|
+
p1_required_fixes=p1_required,
|
|
573
|
+
dissent_preserved=True,
|
|
574
|
+
)
|
|
575
|
+
|
|
576
|
+
if any(a.verdict == VERDICT_REJECT for a in artifacts):
|
|
577
|
+
return SynthesisVerdict(
|
|
578
|
+
status=VERDICT_REJECT,
|
|
579
|
+
score=min(scores) if scores else 0.0,
|
|
580
|
+
merged_issues=all_issues,
|
|
581
|
+
unresolved_disagreements=disagreements,
|
|
582
|
+
p0_blockers=p0_blockers,
|
|
583
|
+
p1_required_fixes=p1_required,
|
|
584
|
+
dissent_preserved=True,
|
|
585
|
+
)
|
|
586
|
+
|
|
587
|
+
has_evidence = any(a.has_cited_evidence() and a.verdict != VERDICT_INSUFFICIENT_EVIDENCE for a in artifacts)
|
|
588
|
+
if not has_evidence:
|
|
589
|
+
return SynthesisVerdict(
|
|
590
|
+
status=VERDICT_INSUFFICIENT_EVIDENCE,
|
|
591
|
+
score=0.0,
|
|
592
|
+
merged_issues=all_issues,
|
|
593
|
+
unresolved_disagreements=disagreements,
|
|
594
|
+
p0_blockers=p0_blockers,
|
|
595
|
+
p1_required_fixes=p1_required,
|
|
596
|
+
dissent_preserved=True,
|
|
597
|
+
)
|
|
598
|
+
|
|
599
|
+
if p0_blockers:
|
|
600
|
+
status = VERDICT_REJECT
|
|
601
|
+
score = min(scores) if scores else 0.0
|
|
602
|
+
elif p1_required:
|
|
603
|
+
status = VERDICT_CONDITIONAL_PASS
|
|
604
|
+
score = sum(scores) / len(scores) if scores else 0.5
|
|
605
|
+
else:
|
|
606
|
+
status = VERDICT_PASS
|
|
607
|
+
score = sum(scores) / len(scores) if scores else 1.0
|
|
608
|
+
|
|
609
|
+
if quality_spec and status == VERDICT_PASS:
|
|
610
|
+
# N6: quality_spec thresholds are deterministic gates, not just
|
|
611
|
+
# prompt instructions.
|
|
612
|
+
hard = quality_spec.get("hard_failures") or []
|
|
613
|
+
if isinstance(hard, list):
|
|
614
|
+
for hf in hard:
|
|
615
|
+
if (
|
|
616
|
+
isinstance(hf, str)
|
|
617
|
+
and hf
|
|
618
|
+
and any(
|
|
619
|
+
hf.lower() in (i.claim or "").lower() or hf.lower() in (i.path or "").lower()
|
|
620
|
+
for i in all_issues
|
|
621
|
+
)
|
|
622
|
+
):
|
|
623
|
+
return SynthesisVerdict(
|
|
624
|
+
status=VERDICT_REJECT,
|
|
625
|
+
score=min(scores) if scores else 0.0,
|
|
626
|
+
merged_issues=all_issues,
|
|
627
|
+
unresolved_disagreements=disagreements,
|
|
628
|
+
p0_blockers=p0_blockers,
|
|
629
|
+
p1_required_fixes=p1_required,
|
|
630
|
+
dissent_preserved=True,
|
|
631
|
+
)
|
|
632
|
+
try:
|
|
633
|
+
min_score = float(quality_spec.get("minimum_score", 0.0) or 0.0)
|
|
634
|
+
except (TypeError, ValueError, OverflowError):
|
|
635
|
+
min_score = 0.0
|
|
636
|
+
min_counts = quality_spec.get("minimum_counts") or {}
|
|
637
|
+
if not isinstance(min_counts, dict):
|
|
638
|
+
min_counts = {}
|
|
639
|
+
try:
|
|
640
|
+
required_issues = int(min_counts.get("issues", 0) or 0)
|
|
641
|
+
required_evidence = int(min_counts.get("cited_evidence", 0) or 0)
|
|
642
|
+
except (TypeError, ValueError):
|
|
643
|
+
required_issues = required_evidence = 0
|
|
644
|
+
cited_count = sum(1 for a in artifacts if a.has_cited_evidence())
|
|
645
|
+
unmet = []
|
|
646
|
+
if min_score > 0 and score < min_score:
|
|
647
|
+
unmet.append(f"score {score:.2f} below minimum_score {min_score}")
|
|
648
|
+
if required_issues > 0 and len(all_issues) < required_issues:
|
|
649
|
+
unmet.append(f"issues {len(all_issues)} below minimum_counts.issues {required_issues}")
|
|
650
|
+
if required_evidence > 0 and cited_count < required_evidence:
|
|
651
|
+
unmet.append(f"cited evidence {cited_count} below minimum_counts.cited_evidence {required_evidence}")
|
|
652
|
+
if unmet:
|
|
653
|
+
# PASS is only granted when every threshold is met; otherwise
|
|
654
|
+
# the outcome degrades to CONDITIONAL_PASS with the unmet
|
|
655
|
+
# thresholds recorded as required fixes.
|
|
656
|
+
status = VERDICT_CONDITIONAL_PASS
|
|
657
|
+
p1_required = list(p1_required) + [
|
|
658
|
+
ReviewIssue(
|
|
659
|
+
severity=ISSUE_SEVERITY_P1,
|
|
660
|
+
claim="quality_spec unmet: " + "; ".join(unmet),
|
|
661
|
+
)
|
|
662
|
+
]
|
|
663
|
+
|
|
664
|
+
return SynthesisVerdict(
|
|
665
|
+
status=status,
|
|
666
|
+
score=score,
|
|
667
|
+
merged_issues=all_issues,
|
|
668
|
+
unresolved_disagreements=disagreements,
|
|
669
|
+
p0_blockers=p0_blockers,
|
|
670
|
+
p1_required_fixes=p1_required,
|
|
671
|
+
dissent_preserved=True,
|
|
672
|
+
)
|