Fix Transformation Strategy 'null' - #170
Open
GALHP wants to merge 20 commits into
Open
Conversation
6 tasks
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
Fixes a bug where the
nullcolumn strategy (set a column to SQL NULL) iswritten unquoted into a generated
.cloning.yaml, so the nextcloning:runfails validation.
The bug
The PII baseline defines a
nullstrategy(
gender: { transformation: { strategy: 'null' } }).cloning:dumpserializedit with a bare
sprintf, emitting the string"null"unquoted —strategy: null. YAML reads that as the null literal, not"null", so the nextcloning:runaborts in Phase-1 validation:(Even bypassing validation, the loader coerced the null literal to
keep, sothe column wouldn't be nulled.)
The fix
CloningYamlWriternow serializes the column strategy through its existingencodeYamlScalar()helper, which already quotes values colliding with YAMLliterals (
null,true, …). It emitsstrategy: "null", which round-trips asthe string
"null"— validation passes andAnonymizationEnginemaps'null'to SQL NULL. Other strategies are unchanged. One-line change scoped to the buggy
line, general for any future literal-colliding value.
Testing
CloningYamlWriterTestadds anull-strategy case: asserts the quoted output,and a round-trip regression — the written YAML loads back with
strategy === 'null'(not'keep') andCloningYamlValidatorreturns noerrors. Verified end-to-end:
genderdumps asstrategy: "null",cloning:runvalidates and completes, target column is
NULL.