fix: recover DxDataBook control redraw races
Core regression / Python core, intervention UI and release configuration (push) Failing after 4m30s
Core regression / JavaScript syntax (push) Successful in 7s
Core regression / Python core, intervention UI and release configuration (pull_request) Successful in 4m36s
Core regression / JavaScript syntax (pull_request) Successful in 8s

This commit is contained in:
阿白叔 committed 2026-11-25 10:08:25 +08:00
1 parent 3187b304c6
commit ad3ee4151c
7 files changed
+268 -7

No files matched your search

+34
View File
@@ -59,6 +59,40 @@ def test_cold_list_recreation_reapplies_filter_and_uses_the_new_handle(attempt,
assert read_attempt(record)['state'] == 'prepared'
@pytest.mark.parametrize('during', ['filter', 'rows'])
def test_control_destroyed_between_discovery_and_access_is_reacquired(attempt, clock, during):
snapshot, record = attempt
state = {'controls': (10, 11)}
visited = []
def destroyed():
state['controls'] = (20, 21)
error = OSError('stale DxDataBook control')
if during == 'filter':
error.winerror = 1400
else:
error.hresult = -2147220991
raise error
def filter_part(handle):
visited.append(handle)
if during == 'filter' and handle == 11:
destroyed()
def rows(handle):
if during == 'rows' and handle == 10:
destroyed()
return [(handle, ['GATE', 'NEW', 'lib:SYM'])]
report = {}
handle, _ = native.load_databook_target(snapshot, report, 'NEW',
controls=lambda: state['controls'], browse=lambda: None, filter_part=filter_part,
list_rows=rows, dialogs=lambda: (), close_dialog=lambda _: pytest.fail('unexpected close'))
assert handle == 20 and visited == [11, 21]
assert len(report['databook']['loads']) == 1
assert read_attempt(record)['state'] == 'prepared'
@pytest.mark.parametrize('already_written', [False, True])
def test_timeout_reissues_filter_once_only_with_bound_prepared_attempt(attempt, clock, already_written):
snapshot, record = attempt