feat: prefill isolated issue-only reporter for clients without Git

This commit is contained in:
阿白叔 committed 2026-10-30 14:05:16 +08:00
1 parent 6c708224d2
commit e9b77186dc
15 files changed
+435 -20

No files matched your search

+15 -3
View File
@@ -22,6 +22,7 @@ def main():
parser.add_argument('--live-model', action='store_true')
parser.add_argument('--incident', action='store_true', help='Inject a read-only controlled failure and verify automatic diagnosis and Git escalation')
parser.add_argument('--outbox-only', action='store_true', help='Verify failed publication stays in local outbox without creating another real issue')
parser.add_argument('--without-git', action='store_true', help='Simulate a client with no Git credentials or executable')
args = parser.parse_args()
output = args.output.resolve()
output.mkdir(parents=True, exist_ok=True)
@@ -32,8 +33,14 @@ def main():
shutil.copy2(args.provider_config / name, data / 'dsh' / name)
if args.incident:
(data / 'dsh').mkdir(parents=True, exist_ok=True)
(data / 'dsh/issue-config.json').write_text(json.dumps({'enabled': not args.outbox_only, 'acceptance': True,
'server': 'https://git.simgreek.com', 'repository': 'Skyworth_Digital_Hardware/dxdesigner-part-replacement'}), encoding='utf8')
(data / 'dsh/issue-config.json').write_text(json.dumps({'enabled': not args.outbox_only, 'acceptance': True}), encoding='utf8')
if args.without_git:
original_run = subprocess.run
def no_git_run(command, *positional, **keywords):
if isinstance(command, (list, tuple)) and Path(str(command[0])).stem.casefold() == 'git':
raise FileNotFoundError('Git is not installed in this acceptance client')
return original_run(command, *positional, **keywords)
subprocess.run = no_git_run
os.environ['QTWEBENGINE_REMOTE_DEBUGGING'] = f'127.0.0.1:{args.port}'
os.environ.pop('QT_QPA_PLATFORM', None)
from PySide6.QtCore import QTimer, Qt
@@ -122,9 +129,13 @@ def main():
report['checks'].append('native composer draft survived direct navigation')
if args.incident:
row = window._dsh_automation.latest
assert row['issue_code'] == 'dsh_acceptance_failure', 'Unexpected UI error replaced controlled incident'
assert row['status'] == ('pending_issue' if args.outbox_only else 'escalated') and row['attempts'] == 0
if not args.outbox_only:
assert row['ticket']['attachment_status'] == 'uploaded'
if args.without_git:
assert row['ticket']['credential_source'] == 'prefilled_issue_token'
report['checks'].append('client without Git used only the prefilled issue reporter token')
report['incident'] = row
report['checks'].append('real native automatic diagnosis and reflection, evidence and ' +
('retryable local issue outbox' if args.outbox_only else 'Git issue attachment') + ' completed without CAD mutations')
@@ -151,6 +162,7 @@ def main():
log = (data / 'logs/application.log').read_text(encoding='utf8')
report['cleanShutdown'] = 'application_clean_shutdown exit_code=0' in log
report['uncaughtErrors'] = 'uncaught_main_thread' in log
report['unexpectedUiErrors'] = 'operation=ui message=' in log
if args.live_model or args.incident:
audit_file = data / 'dsh/harness-home/task-tool-audit.jsonl'
audit = [json.loads(line) for line in audit_file.read_text(encoding='utf8').splitlines()] if audit_file.is_file() else []
@@ -158,7 +170,7 @@ def main():
report['modelToolSucceeded'] = any(row['name'] == 'dx_task_snapshot' and row['is_error'] is False for row in audit)
(output / 'desktop-report.json').write_text(json.dumps(report, ensure_ascii=False, indent=2), encoding='utf8')
print(json.dumps(report, ensure_ascii=True))
return 0 if report['cleanShutdown'] and not report['uncaughtErrors'] and (not (args.live_model or args.incident) or report['modelToolSucceeded']) else 1
return 0 if report['cleanShutdown'] and not report['uncaughtErrors'] and not report['unexpectedUiErrors'] and (not (args.live_model or args.incident) or report['modelToolSucceeded']) else 1
if __name__ == '__main__':