am-freescan/am-backend/yudao-module-cmvr
2026-11-24 13:41:49 +08:00
..
src fix(arm): preserve coordinate application proof during task pause 2026-11-24 13:41:49 +08:00
pom.xml first commit 2026-10-22 16:18:37 +08:00
README.md first commit 2026-10-22 16:18:37 +08:00

CMVR domain port

This module ports the original CMVR-AIMA business implementation into the host's Java 17 / Spring Boot 3 application. Source checkouts are read only. The original com.cmvr and generated cmvr package names remain intact because workflow action identifiers, stored JSON and node dispatch depend on them.

The imported domains include AIMA cases/tasks/instances/logs, the complete test workflow engine, resource robots/devices/maps/terminals, the original gRPC edge clients and protobuf definitions, vision calibration, media analysis, voice/touch/evaluation/TTS operators, and the original QUIC gateway and event broker. The original WebSocket channel subscription and message envelopes remain available.

Host integration

  • cn.iocoder.yudao.module.cmvr.config.CmvrPortConfiguration scans the imported domain and its mapper interfaces. No source security configuration or source data source is imported.
  • Original REST controller paths are prefixed literally with /admin-api/cmvr. For example /aima/testcase, /aima/taskinstance, /test/detect, /flow, /resource/robots, /resource/devices, /system/group, /system/file, and /common/upload retain their original suffixes.
  • Success and pagination envelopes retain original code: 200, data, rows, and total semantics. Business errors use the original AjaxResult envelope.
  • WebSocket endpoint: /admin-api/cmvr/ws?token=<host-access-token>. Authentication and the tenant boundary belong to the host. No anonymous HTTP or WebSocket security chain is introduced.
  • @cmvrSs delegates original permission expressions to the host's PermissionApi. The original static SecurityUtils adapts the host principal and user record for audit fields.
  • Domain entities use @TenantIgnore to preserve the original schema. The host restricts this domain to its explicitly designated tenant; it must not expose these shared original tables across tenants.
  • Original user and dictionary joins point to system_users and system_dict_data. Group and file metadata use cmvr_group and cmvr_file_info, avoiding host system table collisions.
  • PageHelper is registered alongside the host's MyBatis infrastructure. The host remains the owner of transaction management, the MySQL connection and Redis configuration.

Scanner bridge and immutable execution

cn.iocoder.yudao.module.cmvr.api.CmvrWorkflowFacade exposes execute, executeFrozen, executeTrial, loadRequest, rerun, pause, resume, and stop.

For a frozen scanner execution, persist the original native task configuration and its ordered orchestration, set TeTaskExecuteNormalVO.moduleCode to the host's module code, and call executeFrozen(request, versionIds). Version IDs are ordered per orchestration binding, including repeated instances of the same item. The engine validates every version against the bound detection item and loads its immutable graph/config. It creates the original NORMAL TeTaskInst and ordered TeTaskInstFlowVersion manifest, then runs the complete original engine. Reruns preserve frozen IDs in the execution-request snapshot.

Map the returned native instance ID to the host execution in the same transaction. Async dispatch is deferred until transaction commit, so workflow events cannot precede committed host mappings. Implement the original FlowExecutionListener with the matching module code to receive node and task lifecycle events. AIMA instance IDs, native workflow instance IDs and scanner execution IDs remain distinct.

External services

No source credentials or source service addresses are inherited. The exact environment variable names for former literal endpoints and keys are listed in src/main/resources/cmvr-external-settings.json. Those variables can also be supplied as JVM system properties with the same name.

The original configuration groups remain supported: api.*, api.agents.*, media-analysis.*, flowise.*, minio.*, grpc.client.grpc-server.address, and cmvr.quic.*. Configure real robot/device records and endpoints before hardware actions. MinIO is instantiated lazily and explicitly reports missing credentials when storage is used; startup does not provision or alter an external bucket.

QUIC retains its original opt-in cmvr.quic.enabled flag and requires the original TLS settings and native runtime. All Netty Java artifacts and the native QUIC artifact must use the host's unified 4.2.16.Final version. No TLS certificate or source environment key is copied.

The source contained an unconditional 15-second sleep followed by success in the touch operator. This bypass is removed in the target: touch now performs the original coordinate validation and actual HLC / edge-script request underneath it. Disconnected hardware cannot be reported successful by that bypass.

Native node-log updates are limited to unfinished rows. The source updated every historical row matching the same instance/item/node/iteration, so a repeated case could overwrite an earlier case's actual output or status. Success, failure, pause/resume, and resume cleanup now preserve completed occurrences.

Schema and verification

src/main/resources/sql/cmvr-schema.sql contains the original-domain schema, with missing base tables reconstructed from source entities and mapper SQL. Only the designated new am-freescan database may receive it. It contains no historical business rows or host system schema replacement.

The original regression tests are retained under src/test/java. Added tests verify frozen published graph execution and the instance-version manifest, dispatch after transaction commit, and repeated-item log preservation using real generated SQL against a test-only H2 database. Hardware adapter tests use explicit test doubles; these doubles are not application services.

Run from the backend root:

mvn -pl yudao-module-cmvr -am test -Dtest=com.cmvr.**.*Test -Dsurefire.failIfNoSpecifiedTests=false

The source-to-target class manifest is recorded at src/main/resources/cmvr-port-manifest.json. The cross-domain scope audit is in the repository's docs/cmvr-port-matrix.md.