Skip to content

Add YAML set operations to config-utils#5

Merged
dev-ankit merged 3 commits into
mainfrom
claude/build-config-tool-bldp3
Jan 11, 2026
Merged

Add YAML set operations to config-utils#5
dev-ankit merged 3 commits into
mainfrom
claude/build-config-tool-bldp3

Conversation

@dev-ankit
Copy link
Copy Markdown
Owner

Implement five set operation commands for comparing YAML files:

  • union: All keys/values present in either file
  • intersect: Only keys/values present in both files
  • diff: Keys/values in file1 but not in file2
  • rdiff: Keys/values in file2 but not in file1
  • symdiff: Keys/values in either file but not both

Features:

  • Two comparison modes: keys (ignore values) or kv (compare key-value pairs)
  • Depth control: 1 (root only), 2+ (nested levels), 0 (unlimited)
  • Comprehensive error handling for missing files, invalid YAML, non-dict roots
  • All operations output valid YAML to stdout
  • Exit code 0 on success, 1 on error

Updated version to 0.2.0 and added extensive documentation with examples.

Implement five set operation commands for comparing YAML files:
- union: All keys/values present in either file
- intersect: Only keys/values present in both files
- diff: Keys/values in file1 but not in file2
- rdiff: Keys/values in file2 but not in file1
- symdiff: Keys/values in either file but not both

Features:
- Two comparison modes: keys (ignore values) or kv (compare key-value pairs)
- Depth control: 1 (root only), 2+ (nested levels), 0 (unlimited)
- Comprehensive error handling for missing files, invalid YAML, non-dict roots
- All operations output valid YAML to stdout
- Exit code 0 on success, 1 on error

Updated version to 0.2.0 and added extensive documentation with examples.
Created a full test suite covering all YAML set operations functionality:

Test Coverage:
- 37 tests total, all passing with 75% code coverage
- All 5 set operations: union, intersect, diff, rdiff, symdiff
- Both comparison modes: keys and kv (key-value)
- All depth levels: 0 (unlimited), 1 (root only), 2+ (nested)
- Error handling: missing files, invalid YAML, non-dict roots
- Edge cases: empty files, identical files, no matches
- Helper functions: flatten_dict, unflatten_dict, make_hashable, etc.

Test Organization:
- tests/__init__.py: Test package initialization
- tests/test_set_operations.py: Comprehensive test suite with 10 test classes

Infrastructure:
- Added pytest and pytest-cov as dev dependencies
- Configured pytest in pyproject.toml with coverage settings
- Updated README.md with testing instructions and examples
- Uses temporary files for test fixtures to avoid pollution

All tests verified passing with `python -m pytest -v --cov=cli`
Changed the workflow from testing only locust-compare to testing all tools
in the repository using a matrix strategy.

Changes:
- Added matrix strategy with all tools: locust-compare, config-utils
- Set fail-fast: false to ensure all tools are tested even if one fails
- Updated step names to be dynamic based on matrix.tool
- Both tools now run tests in parallel as separate jobs

This ensures comprehensive testing across the entire repository.
@dev-ankit dev-ankit merged commit a6ea751 into main Jan 11, 2026
2 checks passed
@dev-ankit dev-ankit deleted the claude/build-config-tool-bldp3 branch January 11, 2026 09:53
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