Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions loopx/capabilities/decision_context/assembler.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@
canonical_context_matches,
opaque_provider_ref,
)
from .freshness import build_source_freshness_report, source_freshness_row
from .freshness import (
_SUCCESS_STATUSES,
build_source_freshness_report,
source_freshness_row,
)
from .packets import build_decision_evidence_packet
from .sources import (
DecisionSourceExactRead,
Expand Down Expand Up @@ -177,7 +181,7 @@ def _source_coverage(
complete_count = sum(
1
for collected in sources
if collected.scan.status in {"completed", "no_change"}
if collected.scan.status in _SUCCESS_STATUSES
and not collected.exact_read_failed
)
priority_rows.append(
Expand All @@ -193,7 +197,7 @@ def _source_coverage(
incomplete_required_source_ids.extend(
collected.source.source_id
for collected in sources
if collected.scan.status not in {"completed", "no_change"}
if collected.scan.status not in _SUCCESS_STATUSES
or collected.exact_read_failed
)

Expand Down Expand Up @@ -485,7 +489,7 @@ def _assembly_source_freshness(
observed_at=assembly_time,
last_read_at=(
assembly_time.isoformat()
if attempt in {"completed", "no_change"}
if attempt in _SUCCESS_STATUSES
else None
),
last_attempt_status=attempt,
Expand Down Expand Up @@ -720,7 +724,7 @@ def assemble_decision_evidence(
"provider": source.provider_id,
"status": (
"healthy"
if scan.status in {"completed", "no_change"}
if scan.status in _SUCCESS_STATUSES

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] 让回归测试覆盖 provider 健康状态。 把成功状态的生产定义临时加入可区分状态 unavailable,再只把 assemble_decision_evidence 的健康状态判断改回两值字面集合。 同一真实 prepare-evidence 在未改写判断时输出 healthy,改回字面集合后输出 unavailable。来源覆盖仍为 complete 且最近读取时间相同,新增架构检查与两套已跑调用方测试仍为 78 项通过。 为现有 widened-owner 探针加一项真实 prepare-evidence 的 provider_health 对照。只复写该判断应使测试失败;保留已有展示列的合法变体用例。 现有行为探针

and not exact_read_failed
else "degraded"
if scan.status == "completed"
Expand Down
8 changes: 4 additions & 4 deletions loopx/capabilities/decision_context/capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
assemble_decision_evidence,
)
from .freshness import (
_SUCCESS_STATUSES,
build_source_freshness_report,
source_freshness_row,
write_capture_host_health,
Expand All @@ -33,7 +34,6 @@
from .runtime import _build_source_providers
from .sources import DecisionSourceProvider, DecisionSourceSpec

_READ_SUCCESS_STATUSES = frozenset({"completed", "no_change"})
_READ_FAILURE_STATUSES = frozenset({"provider_failed", "failed", "unavailable"})


Expand Down Expand Up @@ -150,7 +150,7 @@ def _status(
else:
last_read_at = (
source["checked_at"]
if source["status"] in _READ_SUCCESS_STATUSES
if source["status"] in _SUCCESS_STATUSES
else None
)
failure_streak = (
Expand Down Expand Up @@ -478,7 +478,7 @@ def _execute_capture_tick(
else:
status = scan.status
if (
status in {"completed", "no_change"}
status in _SUCCESS_STATUSES
and scan.cursor_after
and scan.cursor_after != cursor
):
Expand All @@ -497,7 +497,7 @@ def _execute_capture_tick(
# advance last_success_at, so repeated failures cannot look fresh.
last_success_at = row["last_success_at"] if row else None
failure_streak = int(row["failure_streak"] or 0) if row else 0
if status in _READ_SUCCESS_STATUSES:
if status in _SUCCESS_STATUSES:
last_success_at, failure_streak = observed_at, 0
elif status in _READ_FAILURE_STATUSES:
failure_streak += 1
Expand Down
Loading
Loading