fix: isolate component failures and recover owned CAD resources

This commit is contained in:
阿白叔 committed 2026-11-06 14:56:53 +08:00
1 parent a8da30aad2
commit 4db5f05531
87 files changed
+6688 -301

No files matched your search

+25
View File
@@ -7,6 +7,31 @@ import pytest
from dx_productivity.trial_task_center import diagnostics_bundle as bundle
def test_nonblocking_queue_and_owner_loss_evidence_are_exported_without_scope_inputs(tmp_path):
root = tmp_path / 'data'
queue = root / 'workspace-queues'
queue.mkdir(parents=True)
(queue / ('a' * 32 + '.json')).write_text(json.dumps({'phase': 'problems'}))
owner = root / 'batch-resources' / ('b' * 32)
owner.mkdir(parents=True)
(owner / 'owner-loss.json').write_text(json.dumps({'reason': 'parent_exited', 'token': 'private'}))
(owner / 'force-request.json').write_text(json.dumps({'confirmed': True}))
evidence = root / 'tasks' / 't' / 'quick-run'
evidence.mkdir(parents=True)
(evidence / 'project-read-release.json').write_text(json.dumps({'released': True}))
(evidence / ('retained-worker-' + 'c' * 32 + '.json')).write_text(json.dumps({'state': 'blocked'}))
(evidence / 'component-scope.json').write_text('private component inventory')
output = bundle.export_diagnostic_bundle(root, tmp_path / 'support.zip')
with zipfile.ZipFile(output) as archive:
assert 'workspace-queues/' + 'a' * 32 + '.json' in archive.namelist()
assert 'batch-resources/' + 'b' * 32 + '/owner-loss.json' in archive.namelist()
assert 'batch-resources/' + 'b' * 32 + '/force-request.json' in archive.namelist()
assert 'tasks/t/quick-run/retained-worker-' + 'c' * 32 + '.json' in archive.namelist()
assert 'tasks/t/quick-run/project-read-release.json' in archive.namelist()
assert 'tasks/t/quick-run/component-scope.json' not in archive.namelist()
assert b'private' not in archive.read('batch-resources/' + 'b' * 32 + '/owner-loss.json')
def test_bundle_allowlist_redacts_secrets_and_home_and_omits_inputs(tmp_path):
root = tmp_path / 'data'
session = root / 'batch-resources' / 'batch1'