Skip to content

fix: align validation results with input index - #1078

Open
suryapilla wants to merge 1 commit into
NVIDIA-NeMo:mainfrom
suryapilla:fix/validation-index-alignment
Open

suryapilla wants to merge 1 commit into
NVIDIA-NeMo:mainfrom
suryapilla:fix/validation-index-alignment

Conversation

@suryapilla

@suryapilla suryapilla commented Oct 23, 2026 •

Copy link
Copy Markdown

📋 Summary

Fixes misaligned validation results when upstream rows were dropped or reordered. ValidationColumnGenerator now builds its results with the input frame's index, and raises a clear error if a validator returns a different number of results than records.

🔗 Related Issue

Fixes #1073

🔄 Changes

  • Build the validation results DataFrame with index=data.index, so results stay aligned to their rows. Previously a fresh 0..n-1 index plus pd.concat(..., axis=1) produced extra rows when the input index had gaps (returned 4 rows but 3 were expected), and could attach results to the wrong rows when the index was reordered (as @ting-hong-shieh found on the issue).
  • Raise DataDesignerRuntimeError when a validator returns a different number of results than records. Previously this was silently padded with empty rows.
  • Updated test_validation_column_generator_generate_with_different_strategies: its mock returned one result per batch instead of one per record, and only passed because of the silent padding. It now returns one result per record, like real validators.

🧪 Testing

  • make test passes
  • Unit tests added/updated
  • E2E tests added/updated (if applicable)

New tests:

  • test_validation_column_generator_preserves_non_contiguous_index: fails on main (4 rows for 3), passes with the fix
  • test_validation_column_generator_preserves_reordered_index: fails on main (results on the wrong rows), passes with the fix
  • test_validation_column_generator_raises_on_result_count_mismatch: covers the new error

make check-all-fix passes.

✅ Checklist

  • Follows commit message conventions
  • Commits are signed off (DCO)
  • If I am an external contributor, the linked issue is open and labeled triaged
  • Architecture docs updated (if applicable)

Prepared with AI assistance; I reviewed and tested the changes locally.

Signed-off-by: suryapilla <pslsubbarao@gmail.com>
@suryapilla
suryapilla requested a review from a team as a code owner October 23, 2026 00:24
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

All contributors have signed the DCO ✍️ ✅
Posted by the DCO Assistant Lite bot.

@greptile-apps

greptile-apps Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Keeps validation results aligned with the input rows when their index has gaps or a different order.

  • Validation results stay with their input rows.

Reviews (1) · Last reviewed commit: "fix: align validation results with input..." · Reviewed by Greptile

@suryapilla

Copy link
Copy Markdown
Author

I have read the DCO document and I hereby sign the DCO.

@nabinchha nabinchha left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix, @suryapilla!

Summary

Preserving the input index fixes validation-result alignment after upstream rows are dropped or reordered, matching the reported issue. The new total-count guard is useful, but count validation also needs to happen per batch to prevent incorrect assignments.

Findings

Warnings — Worth addressing

packages/data-designer-engine/src/data_designer/engine/column_generators/generators/validation.py:102 — Check each batch's result count before combining outputs

  • What: The new guard checks only the combined count. For four inputs split into batches of two, responses containing one and three results still total four and pass the check. This behavior predates the PR; the request is to complete the count validation being added here.
  • Why: Results can silently attach to the wrong records. In the reproduction, inputs with IDs [0, 1, 2, 3] receive results for IDs [0, 2, 3, 3] despite the correct total count.
  • Suggestion: Validate each batch's result count against its input count before flattening, covering both sequential and parallel execution. Add a regression where short and excess responses cancel in the aggregate, and ensure malformed batches cannot shift another batch's results.

packages/data-designer-engine/tests/engine/column_generators/generators/test_validation.py:283 — Cover empty and excess validator results

  • What: The mismatch test covers one returned result for three inputs, but does not cover empty or excess results.
  • Why: A guard that rejects only short responses would still pass this test, leaving excess-result handling unprotected. The current production guard correctly handles these total-count cases.
  • Suggestion: Parametrize the returned count over 0, 1, and 4 for three input records, and assert the corresponding error message.

What Looks Good

  • Preserving data.index fixes extra rows after upstream drops and incorrect assignments after reordering.
  • The regression tests verify per-row validation values; all three fail against the parent implementation and pass with this fix.
  • The batching mock now returns one result per input record, matching the validator contract.

Residual Risk

All 740 tests across column generators, validators, and dataset builders passed, along with lint and formatting checks. Live remote services, the full repository suite, and the supported Python/pandas version matrix were not exercised.

Verdict

Needs changes — enforce per-batch result counts and add coverage for empty, excess, and compensating batch responses before merging.


This review was generated by an AI assistant.

This branch has not been deployed

No deployments
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.

ValidationColumnConfig misaligns rows and discards the whole batch after an upstream row is dropped

2 participants