Skip to content

fix(dataset): remove Arrow null padding before Weka union validation - #62

Open
rawsh wants to merge 2 commits into
SemiAnalysisAI:masterfrom
rawsh:fix/weka-null-padding
Open

rawsh wants to merge 2 commits into
SemiAnalysisAI:masterfrom
rawsh:fix/weka-null-padding

Conversation

@rawsh

@rawsh rawsh commented Oct 23, 2026 •

Copy link
Copy Markdown

Loading semianalysisai/cc-traces-weka-062126 through HF datasets fills absent union fields with null, which then fails WekaTrace validation. This drops those null keys for fields the target model doesn't define; non-null extra fields still fail. Adds tests.


Note

Low Risk
Scoped to the HF Weka loader validation path with tests; file loading and rejection of malformed rows stay strict.

Overview
Fixes HuggingFace loading of SemiAnalysis Weka corpora (e.g. semianalysisai/cc-traces-weka-062126) where Arrow union encoding injects null keys for fields that belong to other request variants, causing strict WekaTrace Pydantic validation to fail.

The HF loader now runs each row through _strip_hf_null_padding before WekaTrace.model_validate, recursively trimming absent union fields per discriminated request type (n, s, subagent) while keeping strict behavior for non-null unknown keys and null required fields. The file-based --input-file path is unchanged.

Unit tests simulate an Arrow Dataset roundtrip and assert padding is stripped without mutating the source row; docs note the HF-only relaxation.

Reviewed by Cursor Bugbot for commit 44c296f. Bugbot is set up for automated code reviews on this repo. Configure here.

Signed-off-by: Robert Washbourne <rawashbourne@gmail.com>
@rawsh
rawsh requested a review from FrankD412 as a code owner October 23, 2026 08:33
@cursor

cursor Bot commented Oct 23, 2026

Copy link
Copy Markdown

Bugbot is paused — your team has an unpaid invoice

Bugbot is paused because your team has an unpaid invoice.

Pay it from the billing page in the Cursor dashboard and Bugbot resumes automatically.

(requestId: 3b92f487-9d40-4f4d-b249-bf80f09c5b4a)

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Try out this PR

Quick install:

pip install --upgrade --force-reinstall git+https://github.com/ai-dynamo/aiperf.git@44c296f712d87e1e5eba3d58257b337cbd9e3385

Recommended with virtual environment (using uv):

uv venv --python 3.12 && source .venv/bin/activate
uv pip install --upgrade --force-reinstall git+https://github.com/ai-dynamo/aiperf.git@44c296f712d87e1e5eba3d58257b337cbd9e3385

Last updated for commit: 44c296f • Browse code

@github-actions github-actions Bot added the fix label Oct 23, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T08:37:57.634192Z 09760f1 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 09760f19aa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

return row

def test_arrow_roundtrip_preserves_valid_trace(self) -> None:
from datasets import Dataset

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Move the gated datasets import to module scope

On Windows ARM, datasets is intentionally absent (pyproject.toml:30-34), and the unit-suite gate only ignores modules whose top-level imports are detected (tests/harness/optional_deps.py:89-120). Because this import is inside the test, test_semianalysis_cc_traces_weka.py is still collected and then fails here with ModuleNotFoundError; move it (and the local ValidationError import below) to module scope so the existing scanner can skip the module and the test follows the repository's top-level-import convention.

AGENTS.md reference: AGENTS.md:L105-L105

Useful? React with 👍 / 👎.

@FrankD412

Copy link
Copy Markdown
Collaborator

@rawsh -- thanks for contributing a fix. I'll review this soon. In the mean time, I'm also exploring what it will take to bring the InferenceX runs up to using upstream AIPerf, so a PR there porting this fix would be appreciated to we can keep these in sync while I work through some things.

tests/harness/optional_deps.py skips test modules by their top-level imports, so a function-level datasets import fails instead of skipping where datasets is unavailable (Windows ARM).

Signed-off-by: Robert Washbourne <rawashbourne@gmail.com>
@rawsh

rawsh commented Oct 30, 2026

Copy link
Copy Markdown
Author

Ported upstream: ai-dynamo#1647. Also moved the datasets imports to module scope.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants