Skip to content

fix(dingtalk): restore card auto layout - #2423

Open
Iams4kura wants to merge 1 commit into
langbot-app:masterfrom
Iams4kura:bugfix/restore-dingtalk-card-auto-layout-20260813t080129z
Open

fix(dingtalk): restore card auto layout#2423
Iams4kura wants to merge 1 commit into
langbot-app:masterfrom
Iams4kura:bugfix/restore-dingtalk-card-auto-layout-20260813t080129z

Conversation

@Iams4kura

Copy link
Copy Markdown

概述 / Overview

Fixes #2361.

DingTalk streaming cards ignored card_auto_layout because create_and_deliver_card placed the serialized config beside cardParamMap. DingTalk template variables are read from cardData.cardParamMap, so the setting never reached the card template.

This change merges card_data_config into a copy of the parameter map before the existing stringification step. Existing template parameters remain intact, caller-owned data is not mutated, and the request now carries config at the level expected by DingTalk.

更改前后对比截图 / Screenshots

This is a request-payload fix with no local UI to screenshot. The regression test captures the before/after payload shape:

  • Before: cardData.config = "{\"autoLayout\": true}"
  • After: cardData.cardParamMap.config = "{\"autoLayout\": true}"

Regression evidence

  • Before: uv run --python 3.12 --no-sync pytest tests/unit_tests/platform/test_dingtalk_api.py::test_create_and_deliver_card_places_config_in_card_param_map -q exited 1 with KeyError: 'config'.
  • After: the same command exited 0.

Verification

  • uv run --python 3.12 --no-sync pytest tests/unit_tests/platform/test_dingtalk_api.py tests/unit_tests/platform/test_dingtalk_adapter.py -q — 19 passed.
  • bash scripts/test-quick.sh — Ruff passed; 2,764 unit tests and 15 smoke tests passed.
  • uv run --python 3.12 --no-sync pre-commit run --files src/langbot/libs/dingtalk_api/api.py tests/unit_tests/platform/test_dingtalk_api.py --show-diff-on-failure — passed.
  • git diff --cached --check — passed.

Scope

  • 2 files changed, +41 / -3 lines.
  • No dependency, generated-file, schema, or API changes.

检查清单 / Checklist

PR 作者完成 / For PR author

  • 阅读仓库贡献指引了吗? / Have you read the contribution guide?
  • 我已签署或将在机器人提示后签署 CLA。 / I have signed, or will sign when prompted by the bot, the CLA.
  • 与项目所有者沟通过了吗? / Have you communicated with the project maintainer? (The existing issue includes maintainer confirmation of the regression.)
  • 我确定已自行测试所作的更改,确保功能符合预期。 / I have tested the changes and ensured they work as expected.

项目维护者完成 / For project maintainer

  • 相关 issues 链接了吗? / Have you linked the related issues?
  • 配置项写好了吗?迁移写好了吗?生效了吗? / Have you written the configuration items? Have you written the migration? Has it taken effect?
  • 依赖加到 pyproject.toml 和 core/bootutils/deps.py 了吗 / Have you added the dependencies to pyproject.toml and core/bootutils/deps.py?
  • 文档编写了吗? / Have you written the documentation?

Additional context

An all-files pre-commit run was also attempted. The repository's current hooks proposed mass-formatting 79 unrelated baseline files, so those unrelated changes were discarded. Both files in this focused patch pass the same configured Ruff hooks.

@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Aug 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution! ❤️ Before we can merge this pull request, we need you to sign the LangBot Contributor License Agreement (CLA). You keep full copyright of your code — the CLA grants us a license to use and distribute your contribution. Signing takes 10 seconds and covers all repositories in this organization, permanently.

感谢您的贡献!合并前请阅读并签署贡献者许可协议(CLA)。您保留代码的全部版权,签署仅需回复下方指定内容,一次签署对本组织全部仓库永久有效。


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@dosubot dosubot Bot added the bug? Bug或Bug修复相关 / maybe a bug label Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug? Bug或Bug修复相关 / maybe a bug size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: 钉钉卡片宽屏配置 card_auto_layout 失效——config 被放在 cardData 而非 cardParamMap(#1952 在 #2226 中回归)

1 participant