Skip to content

fix: coerceInputTypes handles flat InputsSchema without properties wrapper#519

Merged
stack72 merged 1 commit intomainfrom
fix/coerce-input-types-flat-schema
Feb 27, 2026
Merged

fix: coerceInputTypes handles flat InputsSchema without properties wrapper#519
stack72 merged 1 commit intomainfrom
fix/coerce-input-types-flat-schema

Conversation

@keeb
Copy link
Copy Markdown
Contributor

@keeb keeb commented Feb 27, 2026

Summary

  • coerceInputTypes() only checked schema.properties, skipping type coercion entirely for flat schemas (properties directly on the schema object without a properties wrapper). This caused --input key=value with numeric/boolean types to fail validation since strings were never coerced.
  • Applied the same schema.properties ?? schema fallback pattern already used by InputValidationService and other InputsSchema consumers.
  • Added test covering flat schema coercion for number and boolean types.

Test Plan

  • Added coerceInputTypes: flat schema without properties wrapper test
  • All 2294 existing tests pass
  • deno check, deno lint, deno fmt all clean

🤖 Generated with Claude Code

…apper

The coerceInputTypes function only checked schema.properties, skipping
type coercion entirely for flat schemas (where property definitions sit
directly on the schema object). This caused --input key=value to fail
validation when the workflow used the common flat input format, since
string values were never coerced to their declared types.

Use the same schema.properties ?? schema fallback pattern used by
InputValidationService and other consumers of InputsSchema.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@stack72 stack72 enabled auto-merge (squash) February 27, 2026 17:26
Copy link
Copy Markdown

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

✅ Approved

This is a clean, well-tested bug fix.

What's Good

  • Pattern consistency: Uses the established schema?.properties ?? schema fallback pattern already present in InputValidationService and workflow_search.ts
  • Type safety: Proper import of JsonSchemaProperty type and defensive if (!propSchema?.type) check protects against edge cases
  • CLAUDE.md compliance: Named exports, no any types, proper copyright header
  • Test coverage: New test case comprehensively validates flat schema coercion for number, boolean, and string types
  • DDD appropriate: CLI-layer utility function is the correct location for input parsing/coercion

No Blocking Issues

The implementation is straightforward and follows existing codebase conventions.

🤖 Reviewed by Claude

@stack72 stack72 merged commit 547868b into main Feb 27, 2026
8 checks passed
@stack72 stack72 deleted the fix/coerce-input-types-flat-schema branch February 27, 2026 17:37
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