fix: relocate cwos-portal decompiled output to correct path; remove nested directory

Former-commit-id: dc30d42a8c55ed8b2382a41dc2434233fbed9930
This commit is contained in:
反编译工作区
2026-04-29 12:09:48 +08:00
parent ea8e492076
commit e8672a3c7b
1759 changed files with 547735 additions and 280 deletions
@@ -0,0 +1,64 @@
"""
在基线请求体上叠加 boundary_patches,用于双端对拍的入参边界/范围扩展。
catalog 中可选字段(仅当开启 ELEVATOR_PARITY_BOUNDARY=1 时展开)::
"boundary_patches": [
{ "id": "rows_zero", "description": "可选说明", "patch": { "rowsOfPage": 0 } }
]
patch 与基线 JSON **深度合并**(字典递归;非 dict 叶子由 patch 覆盖)。
"""
from __future__ import annotations
import copy
import os
from typing import Any, Dict, Iterator, List, Tuple
from parity.catalog_loader import endpoint_body
def deep_merge(base: Any, patch: Any) -> Any:
"""深度合并:patch 覆盖 base;两 dict 则递归。"""
if not isinstance(base, dict) or not isinstance(patch, dict):
return copy.deepcopy(patch)
out = copy.deepcopy(base)
for k, v in patch.items():
if k in out and isinstance(out[k], dict) and isinstance(v, dict):
out[k] = deep_merge(out[k], v)
else:
out[k] = copy.deepcopy(v)
return out
def boundary_enabled() -> bool:
return os.environ.get("ELEVATOR_PARITY_BOUNDARY", "0").strip() == "1"
def iter_parity_request_cases(ep: Dict[str, Any]) -> Iterator[Tuple[str, Dict[str, Any]]]:
"""
生成 (case_id, body)。首条恒为 (\"default\", 基线体)。
boundary 开启且条目含 boundary_patches 时,追加合并后的变体。
"""
base = endpoint_body(ep)
yield "default", base
if not boundary_enabled():
return
patches: List[Dict[str, Any]] = ep.get("boundary_patches") or []
if not patches:
return
for bp in patches:
cid = str(bp.get("id") or bp.get("label") or "variant").strip()
if not cid:
cid = "variant"
patch = bp.get("patch")
if patch is None or not isinstance(patch, dict):
continue
merged = deep_merge(base, patch)
if not isinstance(merged, dict):
merged = {}
yield cid, merged