fix: address independent verification review findings
Core regression / Python core, intervention UI and release configuration (push) Successful in 12m44s
Core regression / JavaScript syntax (push) Successful in 10s
Core regression / Python core, intervention UI and release configuration (pull_request) Failing after 24m33s
Core regression / JavaScript syntax (pull_request) Successful in 10s

This commit is contained in:
阿白叔 committed 2026-11-19 14:44:52 +08:00
1 parent 7597e98eef
commit b2a84404d8
18 files changed
+514 -97

No files matched your search

+20 -8
View File
@@ -192,10 +192,11 @@ def test_legacy_rule_retry_cannot_create_a_replacement_before_baseline(rule_run)
assert receipt['execution_status'] == 'completed' and receipt['acceptance']['status'] == 'unavailable'
def test_retry_receipt_refresh_preserves_other_task_without_dispatch(tmp_path, monkeypatch):
def test_retry_receipt_refresh_preserves_other_task_without_dispatch(tmp_path, monkeypatch, request):
from types import SimpleNamespace as NS
from dx_productivity.dsh.execution_runs import execute_incident_retry
from dx_productivity.dsh.execution_runs import _finish_execution_run, execute_incident_retry
from dx_productivity.trial_task_center import netlist_verification, task_queue
from dx_productivity.trial_task_center.verification.service import VerificationService
selected, other, run_id = 'a' * 32, 'b' * 32, 'c' * 32
hashes = {selected: 'd' * 64, other: 'e' * 64}
monkeypatch.setattr(task_queue, '_plan_hash', lambda child, key: hashes[key])
@@ -206,22 +207,32 @@ def test_retry_receipt_refresh_preserves_other_task_without_dispatch(tmp_path, m
def execute(key, **options):
dispatch.append(key)
return NS(paused=False)
service = NS(for_project_task=lambda key: service, task_context=context, execute_quick_run_queue=execute)
store = TaskStore(tmp_path / 'tasks.db')
request.addfinalizer(store.close)
verification_service = VerificationService(store, tmp_path)
service = NS(for_project_task=lambda key: service, task_context=context, execute_quick_run_queue=execute,
verification=verification_service)
class Checks:
def __init__(self, *args): self.tasks = {}
def __enter__(self): return self
def __exit__(self, *args): pass
def before_task(self, child, key, *, existing_only): assert existing_only
def after_task(self, key, **options): assert key == selected
def finish(self): return {selected: {'status': 'verified', 'verified': True, 'report_path': 'new.json'}}
def finish(self):
return {selected: {'status': 'verified', 'verified': True, 'report_path': 'new.json',
'execution': {'state': 'completed', 'saved_items': 1}}}
monkeypatch.setattr(netlist_verification, 'NetlistVerification', Checks)
journal = RunJournal(tmp_path)
journal.begin(run_id, [selected, other], hashes)
old_other = {'task_id': other, 'state': 'completed', 'message': 'original saved result'}
old_report = {'status': 'verified', 'verified': True, 'report_path': 'original.json'}
journal.finish(run_id, {'status': 'failed', 'entries': [
{'task_id': selected, 'state': 'failed', 'message': 'safe failure'}, old_other],
'netlist_verification': {other: old_report}})
old_report = {'status': 'verified', 'verified': True, 'report_path': 'original.json',
'execution': {'state': 'completed', 'saved_items': 1}}
initial = task_queue.TaskQueueResult(run_id, (
task_queue.TaskQueueEntry(selected, 'failed', 'safe failure'),
task_queue.TaskQueueEntry(**old_other)), False, netlist_verification={other: old_report})
_finish_execution_run(service, tmp_path, [selected, other], Event(), run_id, initial, baseline={})
verification_task = verification_service.list_tasks()['tasks'][0]['task_id']
assert verification_service.read_task(verification_task)['summary']['total'] == 1
checkpoint = tmp_path / 'task-queues' / (run_id + '.json')
checkpoint.parent.mkdir()
checkpoint.write_text(json.dumps({'version': 1, 'phase': 'finished', 'task_ids': [selected, other],
@@ -234,6 +245,7 @@ def test_retry_receipt_refresh_preserves_other_task_without_dispatch(tmp_path, m
assert next(row for row in receipt['entries'] if row['task_id'] == other) == old_other
assert receipt['netlist_verification'][other] == old_report
assert json.loads(checkpoint.read_text())['entries'][other] == {'state': 'completed', 'message': 'original saved result'}
assert {row['item_key'] for row in verification_service.read_task(verification_task)['items']} == {selected, other}
@pytest.mark.parametrize('scheduled', [False, True])