Skip to content

feat: add validation layers for generated datasets#16

Merged
bella-247 merged 1 commit into
devfrom
feature/validator-layer
Jul 4, 2026
Merged

feat: add validation layers for generated datasets#16
bella-247 merged 1 commit into
devfrom
feature/validator-layer

Conversation

@bella-247

Copy link
Copy Markdown
Owner

This pull request introduces a comprehensive validation framework for generated datasets, ensuring that all schema constraints are enforced after data generation. The new validator package checks for NOT NULL, PRIMARY KEY, UNIQUE, and FOREIGN KEY violations, and aggregates all errors into a structured validation result. The main changes are grouped as follows:

Core validation logic and architecture:

  • Added the validator package, including the main Validate function, which checks all schema constraints for a generated dataset and returns a ValidationResult listing every violation. This includes helper types and functions for error reporting and primary key indexing.

Constraint-specific validation checks:

  • Implemented checkNotNull to ensure all NOT NULL columns have non-nil values in every row.
  • Implemented checkPrimaryKey to verify that primary key columns are non-nil and that primary key values are unique across all rows.
  • Implemented checkUnique to enforce uniqueness constraints on specified column sets, reporting any duplicate value combinations.
  • Implemented checkForeignKeys to ensure that all foreign key values reference existing primary key values in the referenced table, handling both single-column and composite keys.## What does this PR do?

Why is it needed?

Closes #

How was it tested?

Does it change any existing behavior?

Checklist

  • Tests added or updated
  • make test passes (go test ./... -race)
  • make lint passes (golangci-lint run ./...)
  • No cross-stage imports (parser doesn't import generator, etc.)
  • No time.Now() or unseeded randomness in the generation pipeline
  • Error messages follow the format in SRS §12.2
  • Exported functions have doc comments
  • Golden files updated if output format changed (make test-golden UPDATE=true)

@coderabbitai

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Free

Run ID: 233d98de-2700-40e6-98f1-65da7eb60ef3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands.

@bella-247 bella-247 merged commit bbd697b into dev Jul 4, 2026
1 check passed
@bella-247 bella-247 deleted the feature/validator-layer branch July 4, 2026 02:29
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