Skip to content

fix(websets): validate import/scope conflicts and improve CLI help#7

Merged
benjaminjackson merged 1 commit intomainfrom
fix/webset-import-search-scope
Dec 4, 2025
Merged

fix(websets): validate import/scope conflicts and improve CLI help#7
benjaminjackson merged 1 commit intomainfrom
fix/webset-import-search-scope

Conversation

@benjaminjackson
Copy link
Copy Markdown
Owner

Summary

Fixes an issue where users could specify the same import/webset ID in both top-level :import and search[:scope] parameters, causing a 400 error from the API. Adds client-side validation to catch this early with a clear error message.

Also significantly improves CLI help text by adding JSON format examples and clarifying the distinction between :import (data loading) and scope (search filtering).

Changes

Validation

  • Added validate_no_duplicate_ids_in_import_and_scope! to CreateValidator
  • Detects when same source ID appears in both :import and search[:scope]
  • Raises clear ArgumentError with the conflicting IDs listed

Tests

  • Added test for duplicate import IDs (should raise error)
  • Added test for duplicate webset IDs (should raise error)
  • Added test for different IDs (should pass)
  • Added test for import without scope (should pass)
  • Added test for scope without import (should pass)

CLI Help Text Improvements

webset-create:

  • Clarified :import loads data (for enrichment) but doesn't filter searches
  • Clarified search.scope filters searches to specific sources
  • Added JSON format examples for all parameters
  • Added JSON Format Details section with scope/relationship examples
  • Added warning about duplicate ID constraint
  • Added example showing scoped search within import
  • Added example showing import + unscoped search (different datasets)

webset-search-create:

  • Added JSON format examples for --criteria, --exclude, --scope, --metadata
  • Documented relationship object structure for hop searches
  • Clarified --behavior defaults (override with scope, append otherwise)
  • Added scoped search example
  • Added hop search example with relationship

Test Results

171 runs, 355 assertions, 0 failures, 0 errors, 0 skips

Files Changed

  • lib/exa/services/websets/create_validator.rb - validation logic
  • test/services/websets/create_validator_test.rb - comprehensive test coverage
  • exe/exa-ai-webset-create - improved help text with formats and warnings
  • exe/exa-ai-webset-search-create - improved help text with formats and examples

🤖 Generated with Claude Code

Add validation to prevent using the same import/webset ID in both
top-level :import and search[:scope] parameters, which causes a 400
error from the API.

Improve CLI help text with:
- JSON format examples for all parameters
- Clear distinction between :import (data loading) and scope (search filtering)
- Warning about the duplicate ID constraint
- Additional examples showing scoped searches and hop searches

Changes:
- Add validate_no_duplicate_ids_in_import_and_scope! to CreateValidator
- Add comprehensive tests for duplicate ID detection
- Update webset-create help with JSON formats and important warnings
- Update webset-search-create help with JSON formats and examples

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@benjaminjackson benjaminjackson merged commit 0565dc5 into main Dec 4, 2025
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.

1 participant