Skip to content

refactor(linkage): simplify runtime task handling - #95

Merged
Fernandez81 merged 1 commit into
mainfrom
refactor/linkage-runtime-simplification
Aug 6, 2026
Merged

refactor(linkage): simplify runtime task handling#95
Fernandez81 merged 1 commit into
mainfrom
refactor/linkage-runtime-simplification

Conversation

@Fernandez81

Copy link
Copy Markdown
Contributor

Summary

  • 将联动运行时节点状态精简为四个字符串快照,同时保持构造函数、getter、服务接口和 JSON 持久化格式不变。
  • 统一 canonical/legacy 动作 ID 与参数键的分类逻辑,使运行时解析和 CRUD 校验共享同一契约。
  • 合并动作工厂、任务树挂接与查询遍历逻辑,并补充快照、兼容键、深层查询、执行门控及持久化测试。

Related issue

Closes #94

Root cause

联动运行时此前保存了完整 workflow 动作对象,但实际只需要四个不可变标识字段;动作类型和兼容参数键又分别在运行时与校验器中重复判断。任务构建、子节点挂接和占用查询也存在单调用方辅助函数及重复遍历框架,增加了状态、分支和兼容规则漂移的风险。

Scope

In scope

  • 精简 LinkAgeBase 常驻状态并保持构造时快照语义。
  • 统一动作类型与 canonical/legacy 参数键分类。
  • 简化任务工厂、后代挂接、DFS 查询及 JSON 可选字段读取。
  • 扩展 linkage runtime/service 聚焦测试。
  • Sophon/aarch64 构建、产包、设备测试和启动烟测。

Out of scope

  • 告警绑定排序或二分查找优化。
  • 邻接索引、并行子节点或任务执行顺序变更。
  • 公共 API、持久化 schema、日志、线程及对象生命周期变更。
  • 未经授权的真实音柱播放。

Risk tags

  • Runtime / lifecycle
  • Thread / memory safety
  • API / authentication / network
  • Media / streaming
  • Model / inference / flow
  • Frontend console
  • Build / package / deployment
  • Compatibility / migration
  • None of the above

Type of change

  • Bug fix
  • Feature
  • Documentation
  • Build / deployment
  • Refactor
  • Test

Area

  • Backend service
  • Frontend web console
  • Pipeline / scenario configuration
  • Model import / model runtime
  • API / MQTT / WebSocket
  • Media / streaming
  • Build / deployment
  • Documentation

Candidate identity

  • Base commit: 1a1cab831ddd4dca2faecc8be6bec76f7ba36365
  • Candidate commit: e54ae4f79c46fd0b6c48ecb096f92ee8ae24e8b9
  • Candidate tree: be641e8bf1c88021f928b837dae2f7a1fcd00e84
  • Package SHA-256: 6be7648ad4ea1eebb1ac07391c6675b88d2d68d605928f3e0073d9f294b28f13
  • Test binary SHA-256: 52ce4c1272f833bd2e29404e0a075d29b2868a1e8149d36e3bacd49074b5a8a0

The candidate was not amended, rebased, or merged after evidence collection. origin/main advanced afterward to 213f9202 with documentation-only changes; this branch intentionally remains bound to the validated base and CI should revalidate integration with current main.

Verification

Parent baseline

BLOCKED
Command: N/A
Environment: parent commit 1a1cab831ddd4dca2faecc8be6bec76f7ba36365.
No retained pre-change aarch64 executable/device result was available before production source edits, and no x86/ONNX result was substituted.

Candidate checks

PASS  docker-compose -f docker-compose.sophon.yml run --rm cosmo-sophon-package bash -lc './scripts/build_test.sh'
PASS  ./scripts/format_check.sh --staged --check
      11/11 changed C++ files passed
PASS  ./scripts/static_analysis.sh --staged --cppcheck
      exit 0; only non-failing std::string_view pass-by-value notices
PASS  git diff --cached --check
PASS  ./.codex/validate_candidate.sh --issue 94 --base origin/main
PASS  docker-compose -f docker-compose.sophon.yml run --rm cosmo-sophon-package
PASS  LD_LIBRARY_PATH=/appfs/cosmo_wander/cwai_data/lib /tmp/cosmo-tests "[linkage-runtime],[linkage-service],[LinkageHandler]" --reporter console
      16 test cases, 143 assertions
PASS  ./.codex/validate_candidate.sh --issue 94 --base origin/main --package build/packages/cosmo-V1.0.0-9625cbc0c351d92c29d45343788bb2ad.tar.gz --tests build/cosmo-tests
PASS  git show --check --stat HEAD

Risk-based evidence

  • API/network: external HTTP/API contracts, service interfaces and persisted JSON schema are unchanged.
  • Media/streaming: no media pipeline change; real speaker playback remains BLOCKED because no clearly authorized non-production speaker and repeatable alarm source were available.
  • Sophon/device: focused aarch64 tests passed on an authorized Sophon device; candidate engine started successfully with the matching packaged model-guard runtime.
  • Frontend/UI: N/A.
  • Package/deployment: canonical Sophon package completed; package and test-binary hashes are recorded above. Engine and matching package guard library must be deployed together.

Documentation impact

  • Documentation was updated.
  • Documentation is not needed for this behavior-preserving refactor.
  • Documentation will be handled in a follow-up.

Compatibility and deployment impact

  • This change is backward compatible.
  • This change may affect public APIs, configuration files, pipelines, deployment scripts, or model artifacts.
  • Not applicable.

Third-party code and assets

  • This PR does not add third-party code, models, datasets, media, or generated assets.
  • This PR adds third-party materials, and their source and license are documented.
  • This PR does not include GPL, AGPL, or other strong copyleft code.

Security and release checklist

  • No secrets, tokens, private keys, or certificates are included.
  • No real device SN values, customer names, or private IPs are included.
  • No private model weights or proprietary download links are included.
  • New dependencies have an acceptable license and are documented.
  • Documentation was updated if behavior changed.
  • My commits are signed off with Signed-off-by: according to the DCO-style requirement in CONTRIBUTING.md.
  • I have read CONTRIBUTING.md and CODE_OF_CONDUCT.md.

Acceptance and cleanup

  • Candidate-bound acceptance: automated checks and focused device validation passed for e54ae4f79c46fd0b6c48ecb096f92ee8ae24e8b9 / package 6be7648ad4ea1eebb1ac07391c6675b88d2d68d605928f3e0073d9f294b28f13; real audio playback is BLOCKED as noted above.
  • Device test filter: [linkage-runtime],[linkage-service],[LinkageHandler]
  • Device backup state: restored
  • Temporary-data cleanup: complete
  • Final Git status: clean
  • Evidence was collected from the candidate commit listed above.
  • Any source change after validation invalidated and restarted the required checks.
  • No temporary credentials, media, models, device exports, or generated packages are included.

Notes for reviewers

  • During the engine-start smoke, deploying only the candidate engine exposed an existing model-guard ABI mismatch on the device. The candidate started with the matching guard library from the same final package; deployment should update the engine and guard runtime as one package.
  • The original engine, guard symlink and configuration were restored, services were returned to systemd management, and temporary device files were removed.
  • A real alarm-to-speaker playback smoke was not attempted without an explicitly authorized experimental speaker and repeatable alarm source.
  • Alarm-binding sorting/binary-search optimization remains intentionally out of scope pending production-scale measurements.

- 精简联动节点常驻状态并统一动作与参数分类
- 复用 JSON 可选字段解析并合并任务树遍历逻辑
- 补充兼容动作、分支遍历和序列化测试

Signed-off-by: Fernandez <yuanhaon81@gmail.com>
@Fernandez81
Fernandez81 merged commit b84a455 into main Aug 6, 2026
8 checks passed
@Fernandez81
Fernandez81 deleted the refactor/linkage-runtime-simplification branch August 6, 2026 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(linkage): simplify runtime task handling

1 participant