Skip to content

Harden batch input validation and gem runtime surface#8

Merged
dpaluy merged 3 commits into
masterfrom
feat/issue-5
Jul 11, 2026
Merged

Harden batch input validation and gem runtime surface#8
dpaluy merged 3 commits into
masterfrom
feat/issue-5

Conversation

@dpaluy

@dpaluy dpaluy commented Jul 11, 2026

Copy link
Copy Markdown
Owner

Closes #5

What

  • csv runtime dependency (rubric_llm.gemspec): csv moved from a default gem to a bundled gem in Ruby 3.4, so every Bundler-managed consumer hit a LoadError on Report#export_csv. The gem now declares it; the redundant gem "csv" Gemfile entry and the "optional dependency" comment in report.rb are removed.
  • Upfront dataset validation (lib/rubric_llm.rb): evaluate_batch now calls validate_dataset! before any evaluation. Non-hash samples, samples missing :question/:answer, and samples with nil values (string or symbol keys) raise ArgumentError with the offending sample index, before any LLM call, so sequential and concurrent modes fail identically and without API spend.
  • ruby_llm bumped to ~> 1.16 (separate commit).

Descoped per issue

No Thread#value refactor, no Evaluator rescue broadening, no Ruby floor change.

Tests

New test/test_batch_validation.rb: non-hash rejection, missing-key rejection (both key styles), nil-value rejection, acceptance of complete symbol- and string-keyed samples, and malformed-sample-under-concurrency, each asserting zero judge calls where applicable.

bundle exec rake: 141 runs, 328 assertions, 0 failures, 0 errors. RuboCop: 45 files, no offenses.

dpaluy added 3 commits July 11, 2026 17:16
csv moved from a default gem to a bundled gem in Ruby 3.4, so Bundler-managed
consumers hit a LoadError on Report#export_csv without an explicit dependency.

CodeFactory builder
Add validate_dataset! to evaluate_batch so malformed samples (non-hash,
missing or nil :question/:answer, string or symbol keys) raise ArgumentError
with the offending index before any API spend, making sequential and
concurrent modes fail identically. Remove the redundant csv Gemfile entry
now that it is a gemspec runtime dependency.

Closes #5

CodeFactory builder
CodeFactory builder
@dpaluy
dpaluy merged commit 2bca6d2 into master Jul 11, 2026
2 checks passed
@dpaluy
dpaluy deleted the feat/issue-5 branch July 11, 2026 22:40
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.

Harden batch input validation and gem runtime surface

1 participant