独立副本采用RX=-2范围最低加200、最高加100,RX=-1.1最低减100、最高减300。 四站逐层工具Z正反90度,切换姿态Y退50毫米,X端余量100毫米。 13个已发布方案及任务、新扫描组件默认点间距统一0.7,激光亮度保持原值。 保留旧路径、显式任务参数和冻结版本,补充迁移保护、既有回归及中文发布记录。
45 lines
2.1 KiB
Python
45 lines
2.1 KiB
Python
"""Authenticated scanner parameter boundaries; never submits a device command."""
|
|
import json
|
|
from pathlib import Path
|
|
from verify_cmvr_native import Client, TargetReadOnlyDb, require
|
|
|
|
def run():
|
|
client = Client().login()
|
|
db = TargetReadOnlyDb(client)
|
|
cases = [
|
|
('defaults', {'pointDistance': .7, 'brightness': 17}, 200),
|
|
('lower bounds', {'pointDistance': .05, 'brightness': 0}, 200),
|
|
('upper bounds', {'pointDistance': 10, 'brightness': 17}, 200),
|
|
('brightness only', {'brightness': 8}, 200),
|
|
('distance only', {'pointDistance': .2}, 200),
|
|
('distance too small', {'pointDistance': .049}, 400),
|
|
('distance too large', {'pointDistance': 10.001}, 400),
|
|
('distance string', {'pointDistance': '0.2'}, 400),
|
|
('brightness zero', {'brightness': 0}, 200),
|
|
('brightness negative', {'brightness': -1}, 400),
|
|
('brightness too large', {'brightness': 18}, 400),
|
|
('fractional brightness', {'brightness': 8.5}, 400),
|
|
('brightness string', {'brightness': '8'}, 400),
|
|
('empty object', {}, 400)
|
|
]
|
|
before = db.select('SELECT COUNT(*) n FROM lab_scanner_command')[0]['n']
|
|
results = []
|
|
try:
|
|
for name, body, expected in cases:
|
|
response = client.native('POST', '/scanner/validate', {
|
|
'operation': 'PARAMETERS', 'requestJson': json.dumps(body)
|
|
}, expected=None)
|
|
require(response.get('code') == expected, name + ': unexpected validation code ' + str(response.get('code')))
|
|
results.append({'name': name, 'code': expected, 'passed': True})
|
|
require(db.select('SELECT COUNT(*) n FROM lab_scanner_command')[0]['n'] == before,
|
|
'Validation created a scanner command')
|
|
finally:
|
|
db.close()
|
|
return {'passed': True, 'checks': results, 'deviceCommands': 0}
|
|
|
|
if __name__ == '__main__':
|
|
result = run()
|
|
path = Path(__file__).resolve().parents[1] / '.local/optimization-audit-parameters.json'
|
|
path.write_text(json.dumps(result, indent=2), encoding='utf-8')
|
|
print(json.dumps({'passed': True, 'checks': len(result['checks']), 'deviceCommands': 0}))
|