Skip to content

refactor: replace hand-rolled columnar helpers with mloda's public ones - #88

Merged
TomKaltofen merged 1 commit into
mloda-ai:mainfrom
TomKaltofen:refactor/mloda-columnar-helpers
Jul 13, 2026
Merged

refactor: replace hand-rolled columnar helpers with mloda's public ones#88
TomKaltofen merged 1 commit into
mloda-ai:mainfrom
TomKaltofen:refactor/mloda-columnar-helpers

Conversation

@TKaltofen

Copy link
Copy Markdown
Collaborator

Closes #82.

mloda 0.10.0 ships columnar_to_rows and homogenize_rows in python_dict_utils, so the local rag_integration/feature_groups/columnar.py (added in #81 when 0.9.0 had no public inverse of rows_to_columnar) is retired. All 27 importing files, plus demo.ipynb, now use the mloda helpers.

Strictness change

mloda's columnar_to_rows raises ValueError on any non-columnar-dict input, where the local helper passed lists through and mapped None/str to []. Per call site:

  • Feature groups, connector contract tests, CLI demos: always receive a genuine columnar dict from the PythonDict framework, so the strict helper is a drop-in. A malformed partition now raises instead of silently yielding [], which is the better failure mode.
  • tests/integration/helpers.py::flatten_result: keeps its tolerant shape dispatch locally (row-wise passthrough, empty fallback) and only hands genuine columnar dicts to the strict helper. Behavior is preserved branch by branch; the new tests/integration/test_helpers.py pins that dispatch.
  • tests/feature_groups/test_columnar.py: retired with the module; the pivot semantics are pinned upstream in mloda.

Test and annotation cleanup

Unit tests that handed calculate_feature row-wise lists (dedup base, both retrieval evaluators, graph source chaining) now build the columnar shape the framework actually delivers, via rows_to_columnar + homogenize_rows where rows are heterogeneous. calculate_feature overrides annotated data: List[Dict[str, Any]] are widened to data: Any, matching the runtime contract and the other overrides in the repo.

Verification

  • tox green (707 tests, ruff format, ruff check, mypy --strict, bandit).
  • Dual review pass (independent Claude Opus agent + codex): one finding each, both addressed (stale demo.ipynb import; dedup test name clarified). No correctness findings.

mloda 0.10.0 ships columnar_to_rows and homogenize_rows in
python_dict_utils, so the local rag_integration/feature_groups/columnar.py
(added for the 0.9.0 bump when no public inverse of rows_to_columnar
existed) is retired. All imports, including demo.ipynb, now point at the
mloda helpers.

mloda's columnar_to_rows is strict: it raises ValueError on any
non-columnar-dict input instead of passing lists through or mapping
None/str to []. Call sites fed by the PythonDict framework are unaffected
(they always receive a columnar dict). flatten_result keeps the tolerant
shape dispatch locally and only hands genuine columnar dicts to the strict
helper; a new tests/integration/test_helpers.py pins that dispatch.

Unit tests that handed calculate_feature row-wise lists now build the
columnar shape the framework actually delivers (via rows_to_columnar +
homogenize_rows for heterogeneous rows). calculate_feature overrides that
claimed data: List[Dict[str, Any]] are widened to data: Any, matching the
runtime contract and the remaining overrides in the repo.

Closes mloda-ai#82
@TomKaltofen
TomKaltofen merged commit 9924bc3 into mloda-ai:main Jul 13, 2026
3 checks passed
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.

Replace hand-rolled columnar helpers with mloda's public ones

2 participants