cowork: schema command error-path hardening + honest sample footer - #49
Draft
Coding-Dev-Tools wants to merge 8 commits into
Draft
cowork: schema command error-path hardening + honest sample footer#49Coding-Dev-Tools wants to merge 8 commits into
Coding-Dev-Tools wants to merge 8 commits into
Conversation
Three correctness fixes in converters.py: 1. CsvWriter extrasaction='raise' → 'ignore': JSON/YAML→CSV conversions with heterogeneous rows (later rows having extra keys not seen in the first row) raised ValueError and aborted the conversion. extrasaction= 'ignore' silently drops extra fields, which is correct CSV behaviour — the output schema is fixed at the first row. 2. Remove redundant CSV pre-peek in convert(): the code opened a fresh read_stream() to peek the first row and call set_field_order(), then opened a second read_stream() for the actual conversion — reading the input file twice. CsvWriter.write_stream() already falls back to list(row.keys()) when _field_order is unset, so the pre-peek was entirely redundant. Removed; one read pass now suffices. 3. Populate ConversionResult.rows_read: the field was declared but never set (always 0). Set to rows_written after a successful conversion so callers can trust the result object. 5 new regression tests; 119/119 green.
…morph # Conflicts: # .github/workflows/pages.yml # .github/workflows/publish.yml # .gitignore # LICENSE # README.md # package.json # pyproject.toml # src/datamorph/__init__.py # src/datamorph/cli.py # src/datamorph/converters.py # tests/test_converters.py # tests/test_validate.py
- Add parquet, avro, protobuf, and all optional dependency groups to pyproject.toml - Wrap optional dependency imports in try/except with user-friendly error messages pointing to the correct pip install command - All 141 tests pass, ruff clean
… bad merge An earlier merge on cowork/improve-datamorph inadvertently dropped 14 files that exist on master (ci.yml, auto-code-review.yml, conftest.py, CHANGELOG, CONTRIBUTING, SECURITY, issue/PR templates, dependabot, FUNDING, cli.js, .gitattributes). Restored them verbatim from origin/master so this branch's PR diff contains only the intended improvements (converters.py graceful optional-import errors + pyproject optional-dependency groups + auto-pr wf).
…adge, git+ install)
…morph # Conflicts: # pyproject.toml
…ted format and malformed input, no tracebacks); fix misleading 'Inferred from N+ rows' footer to honest sample cap; +3 CLI error-path tests
🤖 Automated Code Review✅ Ruff Lint — No issues
|
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.
Harden the
schemasubcommand (silent-failure class): unsupported --format and malformed input now exit cleanly with a red ERROR message instead of an unhandled traceback. Fix misleading 'Inferred from N+ rows' footer to 'up to N rows' (honest claim). Adds 3 CLI error-path tests (144 total pass, ruff clean). Branch also carries a merge of origin/master resolving the pyproject self-referential extra conflict in favor of the corrected datamorph-cli name.