Skip to content

feat: add Choice field validator for categorical columns - #542

Merged
im-anishraj merged 8 commits into
im-anishraj:arnio-old-versionfrom
suhavani23:feat/choice-field-validator
Jul 21, 2026
Merged

feat: add Choice field validator for categorical columns#542
im-anishraj merged 8 commits into
im-anishraj:arnio-old-versionfrom
suhavani23:feat/choice-field-validator

Conversation

@suhavani23

Copy link
Copy Markdown
Contributor

Summary

Adds a Choice() field helper to arnio.schema that validates categorical columns against an explicit set of allowed values. Builds on the existing allowed validation logic in _validate_column. Raises ValueError if the allowed set is empty.

Linked issue

Fixes #194

Type of change

  • Feature

Area

  • Schema validation

Testing

  • make test
  • Added 8 tests in tests/test_schema.py covering valid choices, invalid choices, empty allowed set, nullable behavior, and different input types (list, tuple, set).

Contributor checklist

  • I read the contributing guide.
  • I kept the PR focused on one issue or one logical change.
  • I added or updated tests for behavior changes.
  • I added or updated docs/examples for public API changes.
  • I checked that generated files, logs, and local build artifacts are not committed.
  • My PR title uses Conventional Commits (feat:, fix:, docs:, test:, refactor:, chore:).

@suhavani23
suhavani23 requested a review from im-anishraj as a code owner May 18, 2026 02:39
@suhavani23

Copy link
Copy Markdown
Contributor Author

All CI checks passing. Ready for review! Fixes #194"

@im-anishraj im-anishraj left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks @suhavani23 for the clean first pass on Choice. I rechecked the branch against current main; this needs another update before it can be merged.

Blockers:

  • The branch now conflicts with current main in tests/test_schema.py after the latest schema work was merged.
  • upstream_tests.txt appears to be an accidental binary/workspace artifact and should be removed from the PR.
  • Please keep the tests focused and remove unused fixtures/imports where possible; for example, test_choice_valid_values takes sample_csv but then creates its own DataFrame.

Please rebase on latest main, remove the stray file, resolve the schema test conflict by preserving all existing tests, and keep the Choice additions additive.

@im-anishraj im-anishraj left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for rebasing, but this head still cannot be approved.

Blockers:

  • CI is failing across lint, smoke tests, notebook smoke, and the Python matrix.
  • upstream_tests.txt is still included as a stray workspace artifact and should be removed from the PR.
  • The Choice helper appears inserted in the middle of the CountryCode section in arnio/schema.py, leaving the surrounding docstring/body malformed. Please place Choice as a standalone helper between complete function definitions.
  • tests/test_schema.py has an unrelated assert result.bad_rows == [1, 3] added inside test_schema_json_roundtrip_preserves_fields_and_options, where result is not part of that test. Please remove that unrelated assertion and keep the new tests additive/focused.
  • test_choice_valid_values still takes sample_csv and reads it before replacing frame with a pandas-created frame; please remove the unused fixture/read.

Please remove the artifact, fix the malformed schema/test edits, run Black/Ruff, and make sure CI is green before requesting another review.

@im-anishraj im-anishraj moved this to Needs review in Arnio Maintainer Board May 23, 2026
@im-anishraj im-anishraj added area:cpp-core C++ Frame, Column, pybind11, memory, and core engine internals area:schema Schema, Field, validate, semantic validators, data contracts level:intermediate GSSoC-compatible intermediate-level contribution label type:feature GSSoC-compatible feature label labels May 24, 2026
@im-anishraj

Copy link
Copy Markdown
Owner

Hi @suhavani23, maintainer deadline update: please push the requested fixes/rebase or reply with your ETA by May 31, 2026 at 11:59 PM IST.

We are not closing this PR right now. This deadline is only to keep the active review queue organized and confirm which PRs are still being worked on. If this PR overlaps with already merged work or another open PR, please also clarify what unique change remains. Thanks.

@im-anishraj im-anishraj added gssoc Part of the GSSoC 2026 contributor program gssoc:level-2 GSSoC intermediate-level task difficulty:intermediate Requires understanding one or two modules and tests labels May 28, 2026
@suhavani23

Copy link
Copy Markdown
Contributor Author

Hey @im-anishraj , acknowledged! I'll have the fixes pushed by June 5. Thanks for the patience!

@suhavani23
suhavani23 force-pushed the feat/choice-field-validator branch from 5f12497 to 50b06c4 Compare June 2, 2026 16:29
@vercel

vercel Bot commented Jun 2, 2026

Copy link
Copy Markdown

@suhavani23 is attempting to deploy a commit to the xtylishanish-gmailcom's projects Team on Vercel.

A member of the Team first needs to authorize it.

@suhavani23
suhavani23 force-pushed the feat/choice-field-validator branch from 50b06c4 to b439c71 Compare June 3, 2026 03:01
@im-anishraj

Copy link
Copy Markdown
Owner

Hi @suhavani23, thanks for pushing the update. I checked the latest head (�439c71) and this still needs fixes before it can be re-reviewed for merge.\n\nCurrent blockers from CI:\n\n- Black still fails and would reformat �rnio/frame.py, �rnio/schema.py, and ests/test_frame.py.\n- The Python test matrix fails on ests/test_website_api_docs.py::test_website_api_reference_mentions_public_exports because Choice is now exported publicly but is not documented in the website API reference.\n\nPlease run Black on the changed files and add the new Choice helper to the public API docs/website reference so the export coverage test passes. I also added status:blocked while these CI failures remain. Vercel is still an external authorization issue, but the lint/test failures above are contributor-side blockers.

@im-anishraj im-anishraj added the status:blocked Blocked by another decision, issue, dependency, or maintainer action label Jun 3, 2026
Adds test coverage for ar.Choice() covering valid/invalid values,
empty allowed set, bare string rejection, nullable/unique/severity
interactions, and row index reporting.

Adds README usage example and website API reference entry for
Choice(), fixing the website public-exports doc check that started
failing once Choice became a documented public export.

Fixes im-anishraj#194
@suhavani23

Copy link
Copy Markdown
Contributor Author

Hi @im-anishraj — thanks for the review! I've addressed both blockers:

Ran Black on frame.py, schema.py, and test_frame.py — all reformatted and CI lint now passes
Added the Choice() field builder to the website API reference (website/api.html), so the public-exports doc check now passes too

All 48 checks are green except Vercel, which looks like it needs deploy authorization on your end. Ready for another look whenever you get a chance!

@suhavani23
suhavani23 requested a review from im-anishraj July 14, 2026 04:58
@im-anishraj im-anishraj added gssoc:approved Merged and approved GSSoC contribution quality:clean GSSoC scoring label for clean, well-scoped merged PRs labels Jul 20, 2026
@im-anishraj
im-anishraj changed the base branch from main to arnio-old-version July 21, 2026 12:42
@im-anishraj
im-anishraj merged commit ab034ee into im-anishraj:arnio-old-version Jul 21, 2026
47 of 48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:cpp-core C++ Frame, Column, pybind11, memory, and core engine internals area:schema Schema, Field, validate, semantic validators, data contracts difficulty:intermediate Requires understanding one or two modules and tests gssoc:approved Merged and approved GSSoC contribution gssoc:level-2 GSSoC intermediate-level task gssoc Part of the GSSoC 2026 contributor program level:intermediate GSSoC-compatible intermediate-level contribution label quality:clean GSSoC scoring label for clean, well-scoped merged PRs status:blocked Blocked by another decision, issue, dependency, or maintainer action type:feature GSSoC-compatible feature label

Projects

Status: Needs review

Development

Successfully merging this pull request may close these issues.

Schema: Add Choice field validator

2 participants