am-freescan/docs/verify-cmvr-native.md
2026-10-22 16:18:37 +08:00

36 lines
3.8 KiB
Markdown

# Original CMVR API verification
`scripts/verify_cmvr_native.py` exercises the imported CMVR controllers and complete original workflow runtime through the running local server on port 48090. It must run after the new module has been packaged and the server restarted.
```powershell
& 'C:/Users/Administrator/.cache/codex-runtimes/codex-primary-runtime/dependencies/python/python.exe' scripts/verify_cmvr_native.py
```
The script reads `.local/runtime.json` without printing credentials. Its HTTP client accepts only the new local port, and its database helper accepts only the designated `192.168.28.10/am-freescan` target. Database operations are SELECT-only, with a read-only session. All business mutations use authenticated original APIs.
Each run creates a unique `CMVR_VERIFY_...` prefix. Cases, copies, tasks, instances, published versions, original node logs, and AIMA result logs remain for review and carry a verification remark. Robot/map records are created solely for metadata CRUD; the robot is archived and the map deleted through the APIs after binding and unbinding checks. No robot endpoint is supplied and no physical command, remote map operation, stream, or external AI service is invoked.
Checks include original case creation/editing, linked detection items, immutable publishing/version reads, full case copying, duplicate ordered bindings, NORMAL JavaScript execution, occurrence-specific parameters, AIMA listener logs, persisted version manifests, execution of a frozen older version after a newer publication, rerunning with parameter snapshots, SLEEP-based pause/resume/stop, resource metadata operations, authenticated WebSocket subscriptions, and gzip-compressed AIMA notifications.
The original device controller supports list/detail and business-configuration updates. Device creation/removal belongs to actual QUIC discovery and has no corresponding POST/DELETE API. The script reads the inventory and updates only a device matching its own unique prefix, if one has been discovered. Otherwise that write is explicitly reported as skipped. Existing hardware resources are never edited to make a test pass.
Reports are saved under `.local/cmvr_verify_....json`; `--report` selects another output path. Reports contain test record IDs, checks, failures, skipped capabilities and request status/timing. Login response bodies and authentication secrets are not recorded. The process returns a nonzero exit code on any failed scenario. `--no-websocket` can isolate HTTP/database diagnostics; it deliberately leaves WebSocket verification outside that run.
`--wait-ready 90` retries login while the new server starts. Frozen-version execution and rerunning form a separate scenario, so an earlier AIMA assertion cannot prevent this coverage. The generated start input types use the original editor's lowercase `number` and `string` values.
The module is reusable by the host integration verification without running its `main`:
```python
import importlib.util
spec = importlib.util.spec_from_file_location("cmvr_native", "scripts/verify_cmvr_native.py")
cmvr_native = importlib.util.module_from_spec(spec)
spec.loader.exec_module(cmvr_native)
client = cmvr_native.Client().login()
verifier = cmvr_native.NativeVerifier(client)
case = verifier.create_published_case("host", 42)
# case: caseId, detectItemId, versionId, versionNo, caseCode, caseName, flowData
```
`create_published_case` also accepts `sleep_ms` and a complete optional `code` string. Its default JavaScript returns `value`, a `VALUE` measurement, the resolved input `params`, and a marker. The start node declares numeric `factor`/`seed` inputs and the code node references them, along with AIMA context identifiers. This allows the host test to verify parameter propagation and the final result confirmation chain using the same native definition.