Repository navigation
fix(qualify): refuse record.surface on non-surfaces verifier for every key shape - #2162
Open
yunusarda-sudo wants to merge 1 commit into
Open
yunusarda-sudo wants to merge 1 commit into
yunusarda-sudo wants to merge 1 commit into
Conversation
…y key shape (OpenAdaptAI#2132) Signed-off-by: Yunus Ardaguney <yunusarda-sudo@users.noreply.github.com>
This branch has not been deployed
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.
Resolves #2132.
Context & Problem
In #1576,
record.surfacesupport was introduced so a record contract can read other tables for its frame. However,record_readervalidation (which verifies whether the verifier iskind: surfacesand whether the named surface exists) was only invoked viacomposite_key_read_problems, which only executed ifisinstance(record.duplicate_key, list).As noted in #2132, when
record.duplicate_keywas a scalar string (e.g."id","email") or unset (None), specifyingrecord.surfaceon a non-surfaces verifier (e.g.kind: sqlorkind: rest) was accepted silently by bothqualifyandverify_runparsers instead of raising a clear configuration error.Solution
openadapt_flow/qualify/config.py(VerifyConfig._record): Ifrecord.surfaceis specified, validate it viarecord_reader(self.verifier.verifier, record.surface)and raiseValueErroron problems before checking duplicate key structures.openadapt_flow/verify_run.py(parse_verify_config): Ifrecord.surfaceis present, validate it viarecord_reader(cfg.verifier, surface)and raiseVerifyRunErroron problems for every key shape.packages/flow/tests/test_record_surface.py):None, scalar"group_key", composite["group_key"]) verifying that bothqualifyandverify_runparsers refuserecord.surfaceon a non-surfaces verifier (record.surface needs verifier.kind: surfaces; verifier.kind is 'sql').record.surface names 'nowhere').Verification
PYTHONPATH=packages/flow pytest packages/flow/tests/test_record_surface.py -v: 16/16 tests passed.PYTHONPATH=packages/flow pytest packages/flow/tests/test_verify_run*.py packages/flow/tests/test_qualify*.py -v: 123/123 tests passed.ruff checkandruff format --check: clean.