-
Notifications
You must be signed in to change notification settings - Fork 1
fix(storage): persist typed raw failure authority (#3897) #3897
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
bae76c4
3e176b6
51e9029
4e005cd
60e5b5f
44d99e4
d9adce7
34a5213
755d79c
08248bc
7809f92
a5ae2f8
f0eb5d7
7dca149
6ca5804
5871c41
f51226d
61f4a34
727e703
4271c4d
0819249
1fee118
7bdfd36
6497866
bca470a
54cd4e6
8749ff4
c92c4c4
c9b9d42
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -7,6 +7,7 @@ | |||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| from __future__ import annotations | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| import json | ||||||||||||||||||||||||||||||||||||
| from enum import StrEnum | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| from polylogue.core.enums import ArtifactSupportStatus | ||||||||||||||||||||||||||||||||||||
|
|
@@ -16,35 +17,197 @@ class RawFailureEvidenceKind(StrEnum): | |||||||||||||||||||||||||||||||||||
| """Durable lifecycle evidence attached to a retained raw artifact.""" | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| DEFERRED_HOT_JSONL_CAPTURE = "deferred_hot_jsonl_capture" | ||||||||||||||||||||||||||||||||||||
| DEFERRED_CLAUDE_CODE_PARTIAL_JSONL = "deferred_claude_code_partial_jsonl" | ||||||||||||||||||||||||||||||||||||
| DEFERRED_CAS_FRONTIER = "deferred_cas_frontier" | ||||||||||||||||||||||||||||||||||||
| # Historical rows written before CAS evidence was made provider-neutral. | ||||||||||||||||||||||||||||||||||||
| # Keep this token readable until a backup-gated migration or re-observation | ||||||||||||||||||||||||||||||||||||
| # receipt has converted every retained row. | ||||||||||||||||||||||||||||||||||||
| DEFERRED_CODEX_CAS_FRONTIER = "deferred_codex_cas_frontier" | ||||||||||||||||||||||||||||||||||||
| TERMINAL_CORRUPT_INPUT = "terminal_corrupt_input" | ||||||||||||||||||||||||||||||||||||
| TERMINAL_SUPERSEDED_DEFERRED_CAS_FRONTIER = "terminal_superseded_deferred_cas_frontier" | ||||||||||||||||||||||||||||||||||||
| TERMINAL_UNKNOWN_JSON_DECODE = "terminal_unknown_json_decode" | ||||||||||||||||||||||||||||||||||||
| TERMINAL_UNKNOWN_EXPORT_NO_SESSION = "terminal_unknown_export_no_session" | ||||||||||||||||||||||||||||||||||||
| TERMINAL_UNSUPPORTED_SHAPE = "terminal_unsupported_shape" | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| @property | ||||||||||||||||||||||||||||||||||||
| def support_status(self) -> ArtifactSupportStatus: | ||||||||||||||||||||||||||||||||||||
| if self is RawFailureEvidenceKind.DEFERRED_HOT_JSONL_CAPTURE: | ||||||||||||||||||||||||||||||||||||
| if self is RawFailureEvidenceKind.TERMINAL_SUPERSEDED_DEFERRED_CAS_FRONTIER: | ||||||||||||||||||||||||||||||||||||
| return ArtifactSupportStatus.UNKNOWN | ||||||||||||||||||||||||||||||||||||
| if self in { | ||||||||||||||||||||||||||||||||||||
| RawFailureEvidenceKind.DEFERRED_HOT_JSONL_CAPTURE, | ||||||||||||||||||||||||||||||||||||
| RawFailureEvidenceKind.DEFERRED_CLAUDE_CODE_PARTIAL_JSONL, | ||||||||||||||||||||||||||||||||||||
| RawFailureEvidenceKind.DEFERRED_CAS_FRONTIER, | ||||||||||||||||||||||||||||||||||||
| RawFailureEvidenceKind.DEFERRED_CODEX_CAS_FRONTIER, | ||||||||||||||||||||||||||||||||||||
| }: | ||||||||||||||||||||||||||||||||||||
| return ArtifactSupportStatus.PARTIAL_DECODE | ||||||||||||||||||||||||||||||||||||
| if self is RawFailureEvidenceKind.TERMINAL_CORRUPT_INPUT: | ||||||||||||||||||||||||||||||||||||
| if self in { | ||||||||||||||||||||||||||||||||||||
| RawFailureEvidenceKind.TERMINAL_CORRUPT_INPUT, | ||||||||||||||||||||||||||||||||||||
| RawFailureEvidenceKind.TERMINAL_UNKNOWN_JSON_DECODE, | ||||||||||||||||||||||||||||||||||||
| }: | ||||||||||||||||||||||||||||||||||||
| return ArtifactSupportStatus.DECODE_FAILED | ||||||||||||||||||||||||||||||||||||
| return ArtifactSupportStatus.UNSUPPORTED_PARSEABLE | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| @property | ||||||||||||||||||||||||||||||||||||
| def lifecycle(self) -> str: | ||||||||||||||||||||||||||||||||||||
| return "deferred" if self is RawFailureEvidenceKind.DEFERRED_HOT_JSONL_CAPTURE else "terminal" | ||||||||||||||||||||||||||||||||||||
| if self is RawFailureEvidenceKind.TERMINAL_SUPERSEDED_DEFERRED_CAS_FRONTIER: | ||||||||||||||||||||||||||||||||||||
| return "resolution" | ||||||||||||||||||||||||||||||||||||
| return "deferred" if self.value in RAW_FAILURE_DEFERRED_EVIDENCE_KINDS else "terminal" | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| RAW_FAILURE_TRUSTED_PROVENANCE = "worker-disposition-v1" | ||||||||||||||||||||||||||||||||||||
| RAW_FAILURE_VALIDATION_FAILURE_KINDS = frozenset( | ||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||
| RawFailureEvidenceKind.TERMINAL_CORRUPT_INPUT.value, | ||||||||||||||||||||||||||||||||||||
| RawFailureEvidenceKind.TERMINAL_UNKNOWN_JSON_DECODE.value, | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| def raw_failure_classification_reason( | ||||||||||||||||||||||||||||||||||||
| *, | ||||||||||||||||||||||||||||||||||||
| diagnostic: str | None, | ||||||||||||||||||||||||||||||||||||
| evidence_ref: str | None, | ||||||||||||||||||||||||||||||||||||
| outcome_code: str, | ||||||||||||||||||||||||||||||||||||
| remediation: str | None, | ||||||||||||||||||||||||||||||||||||
| retryable: bool | None, | ||||||||||||||||||||||||||||||||||||
| trusted_validation_failure: bool, | ||||||||||||||||||||||||||||||||||||
| ) -> str: | ||||||||||||||||||||||||||||||||||||
| """Encode the typed carrier, including proof for a validation failure.""" | ||||||||||||||||||||||||||||||||||||
| payload: dict[str, object] = { | ||||||||||||||||||||||||||||||||||||
| "diagnostic": diagnostic, | ||||||||||||||||||||||||||||||||||||
| "evidence_ref": evidence_ref, | ||||||||||||||||||||||||||||||||||||
| "outcome_code": outcome_code, | ||||||||||||||||||||||||||||||||||||
| "remediation": remediation, | ||||||||||||||||||||||||||||||||||||
| "retryable": retryable, | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
| if trusted_validation_failure: | ||||||||||||||||||||||||||||||||||||
| payload["provenance"] = RAW_FAILURE_TRUSTED_PROVENANCE | ||||||||||||||||||||||||||||||||||||
| return json.dumps(payload, sort_keys=True, separators=(",", ":")) | ||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Check the repository JSON helper contract and existing usage conventions.
fd -t f 'json.py' polylogue/core --exec sed -n '380,440p'
rg -nP --type=py '\bjson\.dumps\s*\(' polylogue | head -50
rg -nP --type=py 'from polylogue\.core\.json import' polylogue | head -30Repository: Sinity/polylogue Length of output: 11237 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== file outline =="
ast-grep outline polylogue/core/raw_failure_evidence.py || true
echo "== relevant file contents =="
cat -n polylogue/core/raw_failure_evidence.py | sed -n '1,140p'
echo "== json.py relevant exports/import helpers =="
cat -n polylogue/core/json.py | sed -n '320,455p'
grep -n '^def ' polylogue/core/json.py | sed -n '1,80p'
echo "== calls to raw_failure helpers around json =="
rg -n 'raw_failure_outcome_code|has_trusted_raw_failure_provenance|load_json_json|dump_json_json|json.dumps|json.loads|from polylogue\.core\.import json|import .*json' polylogue/core raw_failure_evidence.py polylogue/core/raw_failure_evidence.py 2>/dev/null || trueRepository: Sinity/polylogue Length of output: 18231 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== backend defaults and config =="
grep -nE '_BACKEND|BACKEND|core\.json|dumps_bytes|load_json_json|dump_json_json|canonical_json|to_payload|from_dict|read.*json|write.*json' polylogue/core/raw_failure_evidence.py polylogue/core/raw_failure_evidence.py 2>/dev/null || true
rg -nE 'class RawFailure|raw_failure_classification_reason|validated_raw_failure_evidence_kind|load_json_json|dump_json_json|to_payload|read.*json|write.*json' polylogue --python -g '*.py' | head -120
echo "== deterministic json contract probe =="
python3 - <<'PY'
import ast
from pathlib import Path
json_path = Path("polylogue/core/json.py")
tree = ast.parse(json_path.read_text())
for func_name in ("_BACKEND", "dumps", "dumps_bytes", "loads"):
nodes = [n for n in tree.body if isinstance(n, (ast.Assign, ast.AnnAssign)) and any(getattr(t, "id", None) == func_name for t in ast.walk(n.target)) if isinstance(n, ast.Assign)] or [n for n in tree.body if isinstance(n, ast.Assign)]
print("__BACKEND assignment candidates")
for node in [n for n in ast.walk(tree) if isinstance(n, ast.Assign)]:
for target in node.targets:
if isinstance(target, ast.Name) and target.id == "_BACKGET":
print(ast.get_source_segment(json_path.read_text(), node))
for node in tree.body:
if isinstance(node, ast.Assign):
for target in node.targets:
if isinstance(target, ast.Name) and target.id == "_BACKEND":
print(f"_BACKEND line={node.lineno} value={ast.unparse(node.value)}")
print("dumps signature:", ast.get_source_segment(json_path.read_text(), next(n for n in tree.body if isinstance(n, ast.FunctionDef) and n.name == "dumps")))
PYRepository: Sinity/polylogue Length of output: 403 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== relevant searches without -E flag =="
rg -n -g '*.py' 'class RawFailure|raw_failure_classification_reason|validated_raw_failure_evidence_kind|load_json_json|dump_json_json|to_payload|read.*json|write.*json|_BACKEND|_BACKGET' polylogue | head -200
echo "== json.py top imports and backend assignments =="
sed -n '1,120p' polylogue/core/json.py | cat -n
echo "== deterministic json contract probe =="
python3 - <<'PY'
import ast
from pathlib import Path
json_path = Path("polylogue/core/json.py")
src = json_path.read_text()
tree = ast.parse(src)
for node in tree.body:
if isinstance(node, ast.Assign):
for target in node.targets:
if isinstance(target, ast.Name) and target.id == "_BACKEND":
print(f"line={node.lineno} value={ast.unparse(node.value)}")
if isinstance(node, ast.FunctionDef):
if node.name == "dumps":
print("dumps_function=")
print(ast.get_source_segment(src, node))
elif node.name == "dumps_bytes":
print("dumps_bytes_function_signature=")
print(src.splitlines()[node.lineno-1])
with open("temp_json_check.py", "w", encoding="utf-8") as f:
f.write('''
def stdlib_compact_sort(payload):
import json
return json.dumps(payload, sort_keys=True, separators=(",", ":"))
def core_json_string_via_dumps_bytes(payload):
import json as _stdlib_json
separators = (",", ":")
return _stdlib_json.dumps(
payload, default=None, sort_keys=True, indent=None, separators=separators, ensure_ascii=False,
).encode("utf-8").decode("utf-8")
payload = {"a": 1, "b": 2}
print(stdlib_compact_sort(payload) == core_json_string_via_dumps_bytes(payload))
''')
PY
python3 temp_json_check.py
rm temp_json_check.pyRepository: Sinity/polylogue Length of output: 28364 Use
🤖 Prompt for AI AgentsSource: Linters/SAST tools |
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| def has_trusted_raw_failure_provenance( | ||||||||||||||||||||||||||||||||||||
| classification_reason: object, | ||||||||||||||||||||||||||||||||||||
| *, | ||||||||||||||||||||||||||||||||||||
| artifact_kind: RawFailureEvidenceKind, | ||||||||||||||||||||||||||||||||||||
| outcome_code: object, | ||||||||||||||||||||||||||||||||||||
| ) -> bool: | ||||||||||||||||||||||||||||||||||||
| """Check the structural worker receipt required for corrupt evidence.""" | ||||||||||||||||||||||||||||||||||||
| if artifact_kind.value not in RAW_FAILURE_VALIDATION_FAILURE_KINDS: | ||||||||||||||||||||||||||||||||||||
| return False | ||||||||||||||||||||||||||||||||||||
| if str(outcome_code) != "corrupt_input": | ||||||||||||||||||||||||||||||||||||
| return False | ||||||||||||||||||||||||||||||||||||
| if not isinstance(classification_reason, str): | ||||||||||||||||||||||||||||||||||||
| return False | ||||||||||||||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||||||||||||||
| payload = json.loads(classification_reason) | ||||||||||||||||||||||||||||||||||||
| except (TypeError, ValueError): | ||||||||||||||||||||||||||||||||||||
| return False | ||||||||||||||||||||||||||||||||||||
| return isinstance(payload, dict) and payload.get("provenance") == RAW_FAILURE_TRUSTED_PROVENANCE | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| def raw_failure_outcome_code(classification_reason: object) -> object: | ||||||||||||||||||||||||||||||||||||
| """Read the typed outcome code from a structured failure carrier.""" | ||||||||||||||||||||||||||||||||||||
| if not isinstance(classification_reason, str): | ||||||||||||||||||||||||||||||||||||
| return None | ||||||||||||||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||||||||||||||
| payload = json.loads(classification_reason) | ||||||||||||||||||||||||||||||||||||
| except (TypeError, ValueError): | ||||||||||||||||||||||||||||||||||||
| return None | ||||||||||||||||||||||||||||||||||||
| return payload.get("outcome_code") if isinstance(payload, dict) else None | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| def validated_raw_failure_evidence_kind( | ||||||||||||||||||||||||||||||||||||
| artifact_kind: object, | ||||||||||||||||||||||||||||||||||||
| support_status: object, | ||||||||||||||||||||||||||||||||||||
| *, | ||||||||||||||||||||||||||||||||||||
| validation_failed: bool, | ||||||||||||||||||||||||||||||||||||
| classification_reason: object = None, | ||||||||||||||||||||||||||||||||||||
| outcome_code: object = None, | ||||||||||||||||||||||||||||||||||||
| ) -> RawFailureEvidenceKind | None: | ||||||||||||||||||||||||||||||||||||
| """Return a typed kind only for a complete, self-consistent carrier. | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| Decode failures are reported by the worker as validation failures because | ||||||||||||||||||||||||||||||||||||
| the payload cannot satisfy the input contract. A matching terminal | ||||||||||||||||||||||||||||||||||||
| corrupt-input/decode carrier explains that state; deferred evidence still | ||||||||||||||||||||||||||||||||||||
| requires validation to have passed or been skipped. | ||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||
| if artifact_kind is None or support_status is None: | ||||||||||||||||||||||||||||||||||||
| return None | ||||||||||||||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||||||||||||||
| evidence_kind = RawFailureEvidenceKind(str(artifact_kind)) | ||||||||||||||||||||||||||||||||||||
| except ValueError: | ||||||||||||||||||||||||||||||||||||
| return None | ||||||||||||||||||||||||||||||||||||
| if evidence_kind.support_status.value != str(support_status): | ||||||||||||||||||||||||||||||||||||
| return None | ||||||||||||||||||||||||||||||||||||
| if validation_failed and not has_trusted_raw_failure_provenance( | ||||||||||||||||||||||||||||||||||||
| classification_reason, | ||||||||||||||||||||||||||||||||||||
| artifact_kind=evidence_kind, | ||||||||||||||||||||||||||||||||||||
| outcome_code=outcome_code, | ||||||||||||||||||||||||||||||||||||
| ): | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+142
to
+146
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When an operator applies AGENTS.md reference: AGENTS.md:L189-L192 Useful? React with 👍 / 👎. |
||||||||||||||||||||||||||||||||||||
| return None | ||||||||||||||||||||||||||||||||||||
| return evidence_kind | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| RAW_FAILURE_EVIDENCE_KINDS = frozenset(kind.value for kind in RawFailureEvidenceKind) | ||||||||||||||||||||||||||||||||||||
| RAW_FAILURE_DEFERRED_EVIDENCE_KINDS = frozenset({RawFailureEvidenceKind.DEFERRED_HOT_JSONL_CAPTURE.value}) | ||||||||||||||||||||||||||||||||||||
| RAW_FAILURE_DEFERRED_EVIDENCE_KINDS = frozenset( | ||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||
| RawFailureEvidenceKind.DEFERRED_HOT_JSONL_CAPTURE.value, | ||||||||||||||||||||||||||||||||||||
| RawFailureEvidenceKind.DEFERRED_CLAUDE_CODE_PARTIAL_JSONL.value, | ||||||||||||||||||||||||||||||||||||
| RawFailureEvidenceKind.DEFERRED_CAS_FRONTIER.value, | ||||||||||||||||||||||||||||||||||||
| RawFailureEvidenceKind.DEFERRED_CODEX_CAS_FRONTIER.value, | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||
| # Only frontier conflicts authorize retained-raw replay. Hot captures remain | ||||||||||||||||||||||||||||||||||||
| # deferred until a complete source observation arrives; replaying their | ||||||||||||||||||||||||||||||||||||
| # truncated blob would advance the cursor past the record that later bytes | ||||||||||||||||||||||||||||||||||||
| # complete. | ||||||||||||||||||||||||||||||||||||
| RAW_FAILURE_REPLAY_AUTHORITY_EVIDENCE_KINDS = frozenset( | ||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||
| RawFailureEvidenceKind.DEFERRED_CAS_FRONTIER.value, | ||||||||||||||||||||||||||||||||||||
| RawFailureEvidenceKind.DEFERRED_CODEX_CAS_FRONTIER.value, | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||
| # Every deferred raw-failure carrier represents a partial decode. Consumers | ||||||||||||||||||||||||||||||||||||
| # selecting retry authority must validate this companion field as well as the | ||||||||||||||||||||||||||||||||||||
| # closed kind, or contradictory rows can authorize replay. | ||||||||||||||||||||||||||||||||||||
| RAW_FAILURE_DEFERRED_SUPPORT_STATUS = ArtifactSupportStatus.PARTIAL_DECODE.value | ||||||||||||||||||||||||||||||||||||
| RAW_FAILURE_EVIDENCE_SUPPORT_STATUS_PAIRS = tuple( | ||||||||||||||||||||||||||||||||||||
| sorted((kind.value, kind.support_status.value) for kind in RawFailureEvidenceKind) | ||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||
| RAW_FAILURE_LIFECYCLE_EVIDENCE_SUPPORT_STATUS_PAIRS = tuple( | ||||||||||||||||||||||||||||||||||||
| sorted( | ||||||||||||||||||||||||||||||||||||
| (kind.value, kind.support_status.value) | ||||||||||||||||||||||||||||||||||||
| for kind in RawFailureEvidenceKind | ||||||||||||||||||||||||||||||||||||
| if kind.lifecycle in {"deferred", "terminal"} | ||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||
| RAW_FAILURE_TERMINAL_EVIDENCE_KINDS = frozenset( | ||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||
| RawFailureEvidenceKind.TERMINAL_CORRUPT_INPUT.value, | ||||||||||||||||||||||||||||||||||||
| RawFailureEvidenceKind.TERMINAL_UNKNOWN_JSON_DECODE.value, | ||||||||||||||||||||||||||||||||||||
| RawFailureEvidenceKind.TERMINAL_UNKNOWN_EXPORT_NO_SESSION.value, | ||||||||||||||||||||||||||||||||||||
| RawFailureEvidenceKind.TERMINAL_UNSUPPORTED_SHAPE.value, | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||
| RAW_FAILURE_TERMINAL_EVIDENCE_SUPPORT_STATUS_PAIRS = tuple( | ||||||||||||||||||||||||||||||||||||
| sorted((kind.value, kind.support_status.value) for kind in RawFailureEvidenceKind if kind.lifecycle == "terminal") | ||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
184
to
+194
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win Derive Lines 184-191 hand-list the terminal kinds. Lines 192-194 derive the terminal pairs from ♻️ Proposed refactor-RAW_FAILURE_TERMINAL_EVIDENCE_KINDS = frozenset(
- {
- RawFailureEvidenceKind.TERMINAL_CORRUPT_INPUT.value,
- RawFailureEvidenceKind.TERMINAL_UNKNOWN_JSON_DECODE.value,
- RawFailureEvidenceKind.TERMINAL_UNKNOWN_EXPORT_NO_SESSION.value,
- RawFailureEvidenceKind.TERMINAL_UNSUPPORTED_SHAPE.value,
- }
-)
+RAW_FAILURE_TERMINAL_EVIDENCE_KINDS = frozenset(
+ kind.value for kind in RawFailureEvidenceKind if kind.lifecycle == "terminal"
+)📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| __all__ = [ | ||||||||||||||||||||||||||||||||||||
| "RAW_FAILURE_DEFERRED_EVIDENCE_KINDS", | ||||||||||||||||||||||||||||||||||||
| "RAW_FAILURE_DEFERRED_SUPPORT_STATUS", | ||||||||||||||||||||||||||||||||||||
| "RAW_FAILURE_EVIDENCE_KINDS", | ||||||||||||||||||||||||||||||||||||
| "RAW_FAILURE_EVIDENCE_SUPPORT_STATUS_PAIRS", | ||||||||||||||||||||||||||||||||||||
| "RAW_FAILURE_LIFECYCLE_EVIDENCE_SUPPORT_STATUS_PAIRS", | ||||||||||||||||||||||||||||||||||||
| "RAW_FAILURE_REPLAY_AUTHORITY_EVIDENCE_KINDS", | ||||||||||||||||||||||||||||||||||||
| "RAW_FAILURE_TERMINAL_EVIDENCE_KINDS", | ||||||||||||||||||||||||||||||||||||
| "RAW_FAILURE_TERMINAL_EVIDENCE_SUPPORT_STATUS_PAIRS", | ||||||||||||||||||||||||||||||||||||
| "RAW_FAILURE_TRUSTED_PROVENANCE", | ||||||||||||||||||||||||||||||||||||
| "RAW_FAILURE_VALIDATION_FAILURE_KINDS", | ||||||||||||||||||||||||||||||||||||
| "RawFailureEvidenceKind", | ||||||||||||||||||||||||||||||||||||
| "has_trusted_raw_failure_provenance", | ||||||||||||||||||||||||||||||||||||
| "raw_failure_classification_reason", | ||||||||||||||||||||||||||||||||||||
| "raw_failure_outcome_code", | ||||||||||||||||||||||||||||||||||||
| "validated_raw_failure_evidence_kind", | ||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When more than the 10 sampled raw failures exist, the lifecycle reader's
ORDER BY CASEstill recognizes only the three pre-existing kind/status pairs. The newly added Claude partial, CAS-frontier, unknown-decode, and unknown-no-session kinds therefore fall into the same lowest-priority bucket as unexplained failures and can be omitted from daemon status even when they are newer, while older recognized failures occupy the sample; update the sample predicate from the closed evidence vocabulary so these typed failures remain inspectable.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preserved. Lifecycle sampling is driven by the complete closed evidence vocabulary and support pairs, so every typed kind remains inspectable.