Skip to content

test(agent-loader): add tests for parseToolsConfig YAML array and CSV handling#2921

Closed
robinmordasiewicz wants to merge 4 commits intocode-yeongyu:devfrom
f5xc-salesdemos:fix/parseToolsConfig-tests
Closed

test(agent-loader): add tests for parseToolsConfig YAML array and CSV handling#2921
robinmordasiewicz wants to merge 4 commits intocode-yeongyu:devfrom
f5xc-salesdemos:fix/parseToolsConfig-tests

Conversation

@robinmordasiewicz
Copy link
Copy Markdown
Contributor

@robinmordasiewicz robinmordasiewicz commented Mar 28, 2026

Summary

  • Export parseToolsConfig in both agent-loader and plugin-agent-loader for testability
  • Add comprehensive test coverage for the YAML array support added in 3e5c69d

Test Cases

  • undefined and empty string input → returns undefined
  • CSV comma-separated string parsing → boolean map
  • YAML array (string[]) parsing → same boolean map
  • Whitespace trimming and empty entry filtering
  • Case-insensitive key normalization
  • Empty array → returns undefined

Changes

  • src/features/claude-code-agent-loader/loader.ts — export parseToolsConfig
  • src/features/claude-code-plugin-loader/agent-loader.ts — export parseToolsConfig
  • src/features/claude-code-agent-loader/parse-tools-config.test.ts — new (10 test cases)
  • src/features/claude-code-plugin-loader/parse-tools-config.test.ts — new (10 test cases)

Summary by cubic

Adds YAML array and CSV support for the tools field in both agent loaders and adds tests to cover parsing and edge cases. Also introduces an upstream sync workflow and new ops issue templates.

  • Bug Fixes

    • parseToolsConfig now accepts string | string[] in both loaders and normalizes keys.
    • Trims whitespace, ignores empty entries, and returns undefined for empty input.
    • Exports parseToolsConfig for testability.
    • Updates types to tools?: string | string[].
  • New Features

    • Adds .github/workflows/sync-upstream.yml to auto-merge upstream every 6 hours and rebase ops; creates issues on conflicts.
    • Adds .github/ISSUE_TEMPLATE/ops-task.yml and upstream-contribution.yml for structured ops and upstream work.

Written for commit 10acb47. Summary will update on new commits.

robinmordasiewicz and others added 4 commits March 27, 2026 18:42
The agent loader's parseToolsConfig() only handled CSV strings
(tools: Read, Bash) but not YAML lists (tools:\n  - Read\n  - Bash).
When js-yaml parsed a YAML list into string[], calling .split() on
it threw TypeError which was silently caught, skipping the agent.

Mirror the fix from 48f6c5e (skill allowed-tools-parser) into both
agent loaders: accept string | string[] and use Array.isArray() to
branch between array and CSV parsing.

Files changed:
- claude-code-agent-loader/types.ts: tools?: string | string[]
- claude-code-agent-loader/loader.ts: parseToolsConfig handles both
- claude-code-plugin-loader/agent-loader.ts: same fix for plugins
Add 6-hour scheduled sync from upstream using merge-upstream API.
Auto-rebases ops branch after sync. Creates issues on conflicts.
Add issue templates for ops tasks and upstream contributions.

Closes #3, closes #5

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… handling

Export parseToolsConfig in both agent-loader and plugin-agent-loader
for testability. Add comprehensive test coverage for:
- undefined and empty string input
- CSV comma-separated string parsing
- YAML array (string[]) parsing
- whitespace trimming and empty entry filtering
- case-insensitive key normalization

Closes #6

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 8 files

Confidence score: 3/5

  • There is a concrete medium-risk issue in .github/workflows/sync-upstream.yml: gh api failures are being suppressed, and unknown/error responses can be treated as up-to-date, which may mask real sync breakages.
  • The severity/confidence signal (6/10, 8/10) suggests this is more than a cosmetic concern; it can cause silent CI workflow regressions even if application code is unchanged.
  • Pay close attention to .github/workflows/sync-upstream.yml - error handling and response classification should fail clearly instead of reporting false up-to-date status.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name=".github/workflows/sync-upstream.yml">

<violation number="1" location=".github/workflows/sync-upstream.yml:26">
P2: The workflow suppresses `gh api` failures and misclassifies unknown/error responses as `up-to-date`, which can hide real upstream sync failures.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

--method POST \
"repos/${{ github.repository }}/merge-upstream" \
-f branch=dev \
2>&1) || true
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The workflow suppresses gh api failures and misclassifies unknown/error responses as up-to-date, which can hide real upstream sync failures.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/sync-upstream.yml, line 26:

<comment>The workflow suppresses `gh api` failures and misclassifies unknown/error responses as `up-to-date`, which can hide real upstream sync failures.</comment>

<file context>
@@ -0,0 +1,106 @@
+            --method POST \
+            "repos/${{ github.repository }}/merge-upstream" \
+            -f branch=dev \
+            2>&1) || true
+
+          if echo "$RESPONSE" | grep -q '"merge_type"'; then
</file context>
Fix with Cubic

@code-yeongyu
Copy link
Copy Markdown
Owner

Thanks for the test improvements! However, this PR mixes fork-specific infrastructure (.github/ISSUE_TEMPLATE/ops-task.yml, upstream-contribution.yml, sync-upstream.yml) with actual code changes (parseToolsConfig tests).

Could you split this into two PRs?

  1. Test-only PR: The parseToolsConfig test improvements (we can merge this)
  2. Fork infra PR: The GitHub templates and sync workflow (these are fork-specific and shouldn't go into the main repo)

Happy to merge the test improvements once separated!

@robinmordasiewicz robinmordasiewicz deleted the fix/parseToolsConfig-tests branch April 2, 2026 19:42
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.

2 participants