fix: require dataset_query.database in create_card to prevent NULL co…#14
Open
eric-summersault wants to merge 1 commit intoCognitionAI:mainfrom
Open
Conversation
…nstraint errors
Root cause: When calling create_card, the database_id was null causing:
"ERROR: null value in column "database_id" of relation "report_card" violates not-null constraint"
Changes:
- Make dataset_query required with database, type fields validated by Zod
- Make display required (Metabase API requirement)
- Filter payload to only include valid Metabase card fields (prevents LLMs from passing extra fields that could break the API)
- Default visualization_settings to {} if not provided
- Improve error handling to include Metabase API response details
Added test infrastructure (Vitest) with tests covering:
- Proper payload structure for create_card
- Required database ID validation
- Extra field filtering
- Error message extraction
Fixes CognitionAI#9
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…nstraint errors
Root cause: When calling create_card, the database_id was null causing:
"ERROR: null value in column "database_id" of relation "report_card" violates not-null constraint"
Changes:
Added test infrastructure (Vitest) with tests covering:
Fixes #9
🤖 Generated with Claude Code