feat(ts-sdk): family-adapter batch architecture + math standards-alignment family - #152
Open
adnanrhussain wants to merge 2 commits into
Open
feat(ts-sdk): family-adapter batch architecture + math standards-alignment family#152adnanrhussain wants to merge 2 commits into
adnanrhussain wants to merge 2 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
Refactors the TypeScript batch-evaluation SDK from a single hardcoded evaluator-group model into a family/adapter architecture, enabling heterogeneous evaluator contracts and adding a new math standards-alignment family.
Changes:
- Introduces
EvaluatorFamily/FamilyRunnerabstractions with a registry and shared column normalization (aliases/defaults + required-column validation). - Updates
BatchEvaluatororchestration to be family-driven (rows × selected members), addspayloadsupport for structured outputs, and makes CSV parsing schema-agnostic. - Adds the
math-standards-alignmentfamily (KG-backed + Anthropic by default) and expands/rewrites unit/integration tests accordingly.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| sdks/typescript/src/batch/evaluator.ts | Refactors batch execution to use families/runners; updates evaluate() signature and row normalization flow. |
| sdks/typescript/src/batch/families/family.ts | Adds the family interfaces plus column validation/normalization and member resolution helpers. |
| sdks/typescript/src/batch/families/registry.ts | Adds a registry for available evaluator families. |
| sdks/typescript/src/batch/families/qtc.ts | Implements the existing text-complexity family using the new runner abstraction. |
| sdks/typescript/src/batch/families/standards.ts | Adds the math standards-alignment family and runner integration. |
| sdks/typescript/src/batch/csv.ts | Makes CSV parsing schema-agnostic and returns column bags instead of fixed text/grade. |
| sdks/typescript/src/batch/types.ts | Updates batch types for family rows/tasks and adds payload + new config fields. |
| sdks/typescript/src/batch/index.ts | Re-exports new family APIs and types from the batch entrypoint. |
| sdks/typescript/src/batch/cli.ts | Adjusts CLI invocation to the new evaluate(..., { onProgress }) calling convention. |
| sdks/typescript/tests/unit/batch/csv-parsing.test.ts | Updates tests for schema-agnostic CSV parsing behavior. |
| sdks/typescript/tests/unit/batch/column-normalization.test.ts | Adds new tests for alias/default/required-column normalization and member resolution. |
| sdks/typescript/tests/unit/batch/limits.test.ts | Rewrites orchestration tests to use stub families instead of internal state poking. |
| sdks/typescript/tests/unit/batch/llm-provider.test.ts | Updates BYO-provider tests to assert behavior via public results. |
| sdks/typescript/tests/integration/batch.integration.test.ts | Updates integration usage to the new options object signature and new input shape. |
| sdks/typescript/tests/unit/knowledge-graph/client.test.ts | Adds a positive test to ensure successful KG lookups are cached. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
adnanrhussain
force-pushed
the
ahussain/batch-family-adapter
branch
2 times, most recently
from
August 8, 2026 04:57
bd1c3e5 to
2ef7183
Compare
adnanrhussain
force-pushed
the
ahussain/batch-family-adapter
branch
from
August 8, 2026 05:25
2ef7183 to
c9b767e
Compare
adnanrhussain
marked this pull request as ready for review
August 8, 2026 05:39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Refactors the batch-evaluation tool from a hardcoded single "evaluator group" into an evaluator-family adapter architecture, and lands math standards-alignment as the first non-text family. This is the base PR of a stack — output projections (JSON/HTML/CSV) and the CLI flow (family/member selection,
--yes/non-interactive, platform-key resolution) follow in stacked PRs.Why
The batch tool assumed every evaluator was homogeneous:
evaluate(text, grade) → {score, reasoning}, CSV requiringtext+grade, one fixed group, a QTC-specific report. Math standards alignment breaks all of those (3-argevaluate(question, statementCode, jurisdiction), structured per-learning-component output, a platform/KG key). Rather than special-case it, this introduces a family seam so the next family (feedback) slots in without core changes.What changed
src/batch/families/(new):EvaluatorFamilyinterface (members, columns, required keys,createRunner,maxInputRows) + registry.family.tsalso owns column normalization (normalizeRow,validateRequiredColumns) with alias + default support.BatchEvaluatoris now family-driven: it owns orchestration (concurrency, cancellation, per-task error isolation, timing) and delegates how to invoke an evaluator to the family runner.evaluate()accepts a family id or a family object.math-standards-alignment. Maps to a{alignedCount, totalCount, learningComponents[]}payload; jurisdiction defaults to Multi-State; platform key hard-required. Column aliases (ccss_standard→statementCode,text→question).parseCSVis now schema-agnostic (reads all columns); family owns validation/aliases/defaults. One malformed row → an error result, not a whole-run abort.statementCode:jurisdiction+UUID; the standards runner reuses one client across rows, so N items over M unique standards do M fetches. Locked with a positive cache-hit test.Input-shape change
BatchInputmoves from{ text, grade, rowIndex, originalRow }to{ rowIndex, columns, originalRow },and
parseCSVreturns the new shape. Both are public via the./batchsubpath export, so a consumerreading
row.textgetsundefined(plus TS2339) and a hand-built row hits the shape check below. Noin-repo consumer outside
src/batch/is affected; the demo server is pinned to the published^0.8.0.A malformed row is now rejected with a message naming the expected shape and the migration, rather than
the bare
TypeError: Cannot convert undefined or null to objectthatObject.keys(undefined)produced.Not in this PR (stacked follow-ups)
--modelshortcodes,--platform-api-key,--yes/non-interactive. (Standards family is not yet reachable from the CLI — programmatic API only.)Testing