Skip to content

Reject extra keys schema validation#348

Closed
Scr4tch587 wants to merge 0 commit into
kai/extra-keys-schema-validationfrom
main
Closed

Reject extra keys schema validation#348
Scr4tch587 wants to merge 0 commit into
kai/extra-keys-schema-validationfrom
main

Conversation

@Scr4tch587

@Scr4tch587 Scr4tch587 commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

What changed

Added an extra-key check to validate() in core/runtime/validator.py. Before inserting builder output, the
validator now raises ValidationError if a row contains any key not declared in the dataset's schema.

Added schema={"val": SchemaType.INT} to 4 worker unit tests whose mock output was silently passing the old
empty-schema check.

Why

Extra keys were silently dropped, which made schema drift hard to catch: builders could diverge from their
declared schema without any visible error.

Testing

  1. Unit, updated test_validator.py: replaced the old test_extra_keys_allowed (which asserted the wrong behaviour) with test_extra_keys_raises, confirming a ValidationError is raised with the expected message.
  2. Integration, added test_schema_unexpected_key to test_errors.py: builder returns a valid schema key plus
    an extra key, confirms the build returns 500 and no rows are inserted.
  3. All 13 unit tests and 38 integration tests pass.

@Scr4tch587 Scr4tch587 requested a review from Blackgaurd June 4, 2026 01:09
@Scr4tch587 Scr4tch587 self-assigned this Jun 4, 2026
@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown

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.

1 participant