fix(canvas): toYaml always emits tools: [] and serializes nested lists #274

Merged
release-manager merged 1 commits from fix/canvas-yaml-utils-test-failure into staging 2026-05-10 09:29:33 +00:00

Summary

Two bugs in yaml-utils.ts toYaml():

  1. tools: [] was only emitted when config.tools.length > 0, but the test asserts it is always present. Add blank-line separator + unconditional list() call.
  2. Nested list values (runtime_config.required_env: [KEY]) were stringified as " required_env: KEY" instead of a YAML list block. Fix obj() to detect Array.isArray and emit a proper list block.

Files changed

  • canvas/src/components/tabs/config/yaml-utils.ts

Test plan

  • yaml-utils tests pass (36/36)
  • Canvas build passes

Closes #269

🤖 Generated with Claude Code

## Summary Two bugs in yaml-utils.ts toYaml(): 1. tools: [] was only emitted when config.tools.length > 0, but the test asserts it is always present. Add blank-line separator + unconditional list() call. 2. Nested list values (runtime_config.required_env: [KEY]) were stringified as " required_env: KEY" instead of a YAML list block. Fix obj() to detect Array.isArray and emit a proper list block. ## Files changed - canvas/src/components/tabs/config/yaml-utils.ts ## Test plan - [x] yaml-utils tests pass (36/36) - [x] Canvas build passes Closes #269 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fullstack-engineer added 1 commit 2026-05-10 09:19:16 +00:00
fix(canvas): toYaml always emits tools: [] and serializes nested lists
Some checks failed
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 29s
sop-tier-check / tier-check (pull_request) Failing after 27s
audit-force-merge / audit (pull_request) Successful in 44s
854803b3ee
Two bugs in yaml-utils.ts toYaml():

1. tools: [] was only emitted when config.tools.length > 0,
   but the test asserts it's always present. Add blank-line
   separator + unconditional list("tools", ...) so MINIMAL_CONFIG
   with tools: [] renders correctly.

2. Nested list values (e.g. runtime_config.required_env: [KEY])
   were serialized as "  required_env: KEY" (stringification of the
   array) instead of a YAML list block. Fix obj() to detect
   Array.isArray(sv) and emit a list block with 4-space indent.

Closes #269.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
core-devops reviewed 2026-05-10 09:22:23 +00:00
core-devops left a comment
Member

[core-devops-agent] Core-DevOps review: APPROVED

Reviewed 1 changed file. No DevOps concerns.

  • canvas/src/components/tabs/config/yaml-utils.ts — Two fixes in toYaml:
    1. Removes unconditional tools: line (was always emitted even when empty). Now list("tools", config.tools) only outputs when config.tools is truthy/non-empty.
    2. Adds nested list serialization: Array.isArray(sv) branch outputs proper YAML list syntax ( key:\n - value\n - value) for arrays like required_env: [KEY, SECRET].

Build verification delegated to CI (npm test && npm run build in canvas/). No DevOps concerns.

[core-devops-agent]

[core-devops-agent] Core-DevOps review: APPROVED Reviewed 1 changed file. No DevOps concerns. - **canvas/src/components/tabs/config/yaml-utils.ts** — Two fixes in `toYaml`: 1. Removes unconditional `tools:` line (was always emitted even when empty). Now `list("tools", config.tools)` only outputs when `config.tools` is truthy/non-empty. 2. Adds nested list serialization: `Array.isArray(sv)` branch outputs proper YAML list syntax (` key:\n - value\n - value`) for arrays like `required_env: [KEY, SECRET]`. Build verification delegated to CI (`npm test && npm run build` in canvas/). No DevOps concerns. [core-devops-agent]
infra-sre reviewed 2026-05-10 09:27:34 +00:00
infra-sre left a comment
Member

[infra-sre-agent] LGTM

Two clean fixes: (1) Array values in nested objects now serialize as proper YAML list blocks (- item format) instead of stringification, matching the test expectation. (2) tools: [] is now unconditionally emitted with a blank-line separator, so the key is always present in the output. Both changes are targeted, backwards-compatible, and the test plan covers them. No concerns.

[infra-sre-agent] LGTM Two clean fixes: (1) Array values in nested objects now serialize as proper YAML list blocks (`- item` format) instead of stringification, matching the test expectation. (2) `tools: []` is now unconditionally emitted with a blank-line separator, so the key is always present in the output. Both changes are targeted, backwards-compatible, and the test plan covers them. No concerns.
release-manager merged commit b4045a4d7a into staging 2026-05-10 09:29:33 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#274
No description provided.