refactor: rebuild birth time rectification agent

This commit is contained in:
Jesse_Chen
2026-07-28 13:04:17 +08:00
parent ac5aef5f89
commit 8ade6ed5c8
59 changed files with 4423 additions and 1142 deletions
@@ -0,0 +1,23 @@
from __future__ import annotations
from typing import Any, Sequence
from scripts.active_rectification_event_engine import compute_candidate_static_contexts
from scripts.rectification.contracts import RectificationRequest
from scripts.rectification.scoring_service import ALGORITHM_VERSION, sha256
def build_candidate_feature_snapshot(
request: RectificationRequest,
calculation_spec_hash: str,
static_contexts: Sequence[dict[str, Any]] | None = None,
) -> dict[str, Any]:
contexts = list(static_contexts) if static_contexts is not None else compute_candidate_static_contexts(request)
features = [context["feature"] for context in contexts]
return {
"calculation_spec_hash": calculation_spec_hash,
"algorithm_version": ALGORITHM_VERSION,
"candidate_count": len(features),
"feature_hash": sha256(features),
"features": features,
}