fix: repair chained imports and track blocked evidence dependencies
Assistant: codex Assistant-Model: gpt-6.1-sol Assistant-Session: 01a1046e-465c-7d43-8c4c-d10f0a1feadd
This commit is contained in:
parent
28b567e588
commit
146f4e1dd3
21 changed files with 869 additions and 95 deletions
|
|
@ -64,6 +64,29 @@ class ChainReport:
|
|||
}
|
||||
|
||||
|
||||
def order_chain_rows(rows: Iterable[ChainRow]) -> list[ChainRow]:
|
||||
"""Follow stored links, independently of historical acceptance timestamps.
|
||||
|
||||
Keep unreachable/forked rows in the result so verify_rows reports a break
|
||||
rather than silently dropping evidence outside the genesis chain.
|
||||
"""
|
||||
remaining = list(rows)
|
||||
successors: dict[str, list[ChainRow]] = {}
|
||||
for row in remaining:
|
||||
successors.setdefault(row.chain_prev, []).append(row)
|
||||
ordered: list[ChainRow] = []
|
||||
used: set[str] = set()
|
||||
previous = GENESIS
|
||||
while len(successors.get(previous, [])) == 1:
|
||||
row = successors[previous][0]
|
||||
if row.event_id in used:
|
||||
break
|
||||
ordered.append(row)
|
||||
used.add(row.event_id)
|
||||
previous = row.chain_hash
|
||||
return ordered + [row for row in remaining if row.event_id not in used]
|
||||
|
||||
|
||||
def verify_rows(
|
||||
rows: Iterable[ChainRow],
|
||||
*,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue