fix(STATE-WP-0064): parse consistency sweep stdout with skip prefixes
Extract the JSON payload from mixed script output and document Railiance01 kubectl sync steps. Mark T02 done after cluster bridge and resolver canaries.
This commit is contained in:
parent
acc5bea15b
commit
821b5d6c89
4 changed files with 62 additions and 14 deletions
|
|
@ -50,11 +50,27 @@ def _parse_stderr(stderr: str) -> dict[str, list[str]]:
|
|||
}
|
||||
|
||||
|
||||
def _extract_json_payload(text: str) -> Any:
|
||||
stripped = text.strip()
|
||||
if not stripped:
|
||||
return []
|
||||
decoder = json.JSONDecoder()
|
||||
for index, char in enumerate(stripped):
|
||||
if char not in "{[":
|
||||
continue
|
||||
try:
|
||||
payload, _end = decoder.raw_decode(stripped, index)
|
||||
return payload
|
||||
except json.JSONDecodeError:
|
||||
continue
|
||||
raise json.JSONDecodeError("No JSON payload found", stripped, 0)
|
||||
|
||||
|
||||
def _parse_stdout(stdout: str) -> list[ConsistencySweepRepoResult]:
|
||||
text = stdout.strip()
|
||||
if not text:
|
||||
return []
|
||||
payload = json.loads(text)
|
||||
payload = _extract_json_payload(text)
|
||||
items = payload if isinstance(payload, list) else [payload]
|
||||
results: list[ConsistencySweepRepoResult] = []
|
||||
for item in items:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue