已合并
!2744 Serialize union arrays for TS #57
pavelmironchik创建于 2025年10月27日
!2744 Serialize union arrays for TS #57
已合并
pavelmironchik创建于 2025年10月27日
pavelmironchik
pavelmironchik成员
2025年10月27日

一、内容说明(相关的Issue)

二、建议测试周期和提测地址

建议测试完成时间:xxxx.xx.xx
投产上线时间:xxxx.xx.xx
提测地址:CI环境/压测环境
测试账号:

三、变更内容

  • 3.1 关联PR列表

  • 3.2 数据库和部署说明

    1. 常规更新
    2. 重启unicorn
    3. 重启sidekiq
    4. 迁移任务:是否有迁移任务,没有写 "无"
    5. rake脚本:bundle exec xxx RAILS_ENV = production;没有写 "无"
  • 3.4 其他技术优化内容(做了什么,变更了什么)

    • 重构了 xxxx 代码
    • xxxx 算法优化
  • 3.5 废弃通知(什么字段、方法弃用?)

  • 3.6 后向不兼容变更(是否有无法向后兼容的变更?)

四、研发自测点(自测哪些?冒烟用例全部自测?)

自测测试结论:

五、测试关注点(需要提醒QA重点关注的、可能会忽略的地方)

检查点:

需求名称 是否影响xx公共模块 是否需要xx功能 需求升级是否依赖其他子产品
xxx 需要 不需要

接口测试:

性能测试:

并发测试:

其他:

likedislike
Pull Request已成功合入, 合并人@openharmony_ci
(感谢 pavelmironchik 的贡献)
openharmony_ci
openharmony_ci成员
2025年10月27日 评论:

感谢提交 Pull Requests!
Thanks for submitting a pull request.

likedislike
openharmony_ciopenharmony_ci成员
2025年10月27日 添加了label:dco检查成功
pavelmironchik
pavelmironchik成员2025年10月27日进行代码检视1
core/src/LanguageWriters/writers/TsLanguageWriter.ts
@@ -406,1 +406,4 @@
406406 }
407+ override instanceOf(value: string, type: idl.IDLType): LanguageExpression {
408+ return idl.IDLContainerUtils.isSequence(type)
409+ ? this.makeString(`Array.isArray(${value})`)
pavelmironchik
pavelmironchik2025年10月27日评论:

Very useful and required for TS/ArkTS, because Arrays actually not very common object and it's better to handle them with builtin way

likedislike
pavelmironchikpavelmironchik成员
2025年10月27日 解决了最后一个问题
kolegovilya
kolegovilya2025年10月27日进行代码检视1
core/src/LanguageWriters/writers/ETSLanguageWriter.ts
@@ -324,2 +324,4 @@
324324 return new TSCastExpression(value, `${this.getNodeName(node)}`, options?.unsafe ?? false)
325325 }
326+ override instanceOf(value: string, type: idl.IDLType): LanguageExpression {
327+ return this.makeString(`${value} instanceof ${withInsideInstanceof(true, () => this.getNodeName(type))}`)
kolegovilya
kolegovilya2025年10月27日评论:

withInsideInstanceof is global function. It is use another global variable "under the hood". This is bad. We should consider make it local somehow.

likedislike
kolegovilya
kolegovilya2025年10月27日进行代码检视2
core/src/LanguageWriters/ArgConvertors.ts
@@ -1044,1 +1042,3 @@
1044- return true
1042+ // Indexed discriminator is only used in CPP
1043+ // All other languages check the first array element type for arrays discrimination
1044+ if (writer.language == Language.CPP) return true
kolegovilya
kolegovilya2025年10月27日评论:
改动建议
1044
- if (writer.language == Language.CPP) return true
1044
+ if (writer.language === Language.CPP) return true
应用建议

Using == is bad practice in JS/TS.

likedislike
peterz_5686
peterz_5686
2025年10月27日 评论:
likedislike
kolegovilya
kolegovilya2025年10月27日进行代码检视1
ohosgen/tests/unit/idl/test_union.idl
@@ -14,1 +22,3 @@
14-UnionSampleInterface checkUnionSample(UnionSampleInterface value);
22+[Entity=Interface]
23+interface UnionSampleNumberArrayInterface {
24+ 
kolegovilya
kolegovilya2025年10月27日评论:

This empty line does not divide or highligt something in this interface. So, I think it can be removed.

likedislike
kolegovilya
kolegovilya2025年10月27日进行代码检视1
ohosgen/tests/unit/idl/test_union.idl
@@ -12,3 +20,3 @@
1220};
1321 
14-UnionSampleInterface checkUnionSample(UnionSampleInterface value);
22+[Entity=Interface]
kolegovilya
kolegovilya2025年10月27日评论:

By default any interface entry in IDL is interface. We should discuss rules of using this extended attribute and maybe it can be ommitted in cases, where Entity=Interface

likedislike
guozejunguozejun成员
2025年10月30日 通过审查
openharmony_ciopenharmony_ci成员
2025年10月30日 审查状态已重置,审查人: guozejun
pavelmironchikpavelmironchik成员
2025年10月30日 取消了草稿状态
pavelmironchikpavelmironchik成员
2025年10月30日 修改标题为 “!2744 Serialize union arrays for TS”,原标题为“[WIP] !2744 Serialize union arrays for TS”
pavelmironchik
pavelmironchik成员
2025年10月30日 评论:

FORCE_VERIFY

likedislike
openharmony_ciopenharmony_ci成员
2025年10月30日 通过测试
openharmony_ci
openharmony_ci成员
2025年10月30日 评论:

添加 测试通过 成功!

likedislike
openharmony_ci
openharmony_ci成员
2025年10月30日 评论:
guozejunguozejun成员
2025年10月30日 通过审查
pavelmironchik
pavelmironchik成员
2025年10月30日 评论:

FORCE_VERIFY

likedislike
openharmony_ciopenharmony_ci成员
2025年10月30日 通过测试
openharmony_ci
openharmony_ci成员
2025年10月30日 评论:

添加 测试通过 成功!

likedislike
openharmony_ciopenharmony_ci成员
2025年10月30日 合入了pull request,合并节点 SHA:f136e25c5f5fa433b3e0e252328550b1f627ac54