Add --continue-on-error flag for map-data CLI#163
Merged
amc-corey-cox merged 3 commits intomainfrom Mar 27, 2026
Merged
Conversation
Introduce TransformationError with structured context (class_derivation, slot_derivation, row_index) and on_error callback in transform_spec() so row-level errors can be collected instead of aborting. CLI reports error summary to stderr and exits 1 when errors occurred. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds structured, row-level error handling to the transformation engine and exposes it via a new --continue-on-error flag in the map-data CLI, enabling “collect and continue” behavior while preserving default fail-fast semantics.
Changes:
- Introduces
TransformationErrorcarrying structured context (class/slot/row/row_index) for transformation failures. - Adds an
on_errorcallback totransform_spec()to collect row errors and continue processing. - Extends
map-dataCLI with--continue-on-errorto report a summary of errors and exit with code 1 when any occur.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/linkml_map/transformer/errors.py |
Adds TransformationError dataclass with structured context + formatting. |
src/linkml_map/transformer/object_transformer.py |
Wraps slot-derivation exceptions as TransformationError with context. |
src/linkml_map/transformer/engine.py |
Adds on_error callback to collect/enrich row-level errors and continue. |
src/linkml_map/cli/cli.py |
Adds --continue-on-error flag; collects errors, prints summary, exits 1 if any. |
tests/test_transformer/test_object_transformer.py |
Updates exception expectation to TransformationError. |
tests/test_transformer/test_continue_on_error.py |
Adds engine/error-type unit tests for continue-on-error behavior. |
tests/test_compliance/test_compliance_suite.py |
Allows compliance tests to accept TransformationError wrapping. |
tests/test_cli/test_cli_tabular.py |
Adds CLI-level tests covering fail-fast vs continue-on-error behavior. |
- Restore match= assertion on test_derive_from_expr_restricted_raises - Fix errors.py docstring: row_index only added with on_error callback - Fix test_continue_on_error.py docstring to match actual field names Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
madanucd
approved these changes
Mar 26, 2026
Collaborator
madanucd
left a comment
There was a problem hiding this comment.
LGTM! All 25 tests pass including the 3 new CLI tests and 8 new error handling tests. Fail-fast default is preserved and --continue-on-error is a clean opt-in for batch jobs where one bad row shouldn't kill the entire run. All Copilot feedback addressed.
Resolve conflict in object_transformer.py: keep try/except error wrapping from continue-on-error around the refactored populated_from logic (joins, _resolve_fk_or_literal) from main. Co-Authored-By: Claude Opus 4.6 (1M context) <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.
Summary
TransformationErrordataclass exception with structured context (class_derivation_name,slot_derivation_name,source_row,row_index)map_object's slot derivation loop converts exceptions toTransformationErrorwith full contexttransform_spec()gains anon_errorcallback parameter:None= fail-fast (default), callback = collect and continue--continue-on-errorCLI flag collects all row-level errors, reports summary to stderr, exits 1Closes #162
Test plan
on_errorcallback, good rows yielded, fail-fast preserved when no callback--continue-on-errorreports to stderr with exit 1; no errors = exit 0; without flag = fail-fastjust testfull suite green🤖 Generated with Claude Code