fix(memory): skip non-dict columns in seed query generation - #2514
Conversation
Closes nothing specific — defensive MDL resilience.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughSeed query generation filters malformed or unnamed manifest columns, uses safe name extraction for aggregation and accepted-values queries, and includes a unit test covering mixed invalid and valid metadata. ChangesSeed query robustness
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
core/wren/src/wren/memory/seed_queries.py (1)
77-88: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider pre-filtering valid columns to avoid duplicated checks.
The exact same defensive validation logic is duplicated in the second loop below (lines 124-128). You can DRY this up by pre-filtering the
columnslist once before the loops.♻️ Proposed refactor
valid_columns = [ c for c in columns if isinstance(c, dict) and c.get("name") ]Then, you can simply iterate over
valid_columnsin both loops and safely remove theisinstanceandcol_namechecks from the loop bodies.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@core/wren/src/wren/memory/seed_queries.py` around lines 77 - 88, Pre-filter the columns once into a valid_columns collection containing only dictionary entries with a non-empty name, then iterate over it in both loops. Update the current loop and the second loop to use valid_columns and remove their duplicated isinstance and col_name checks, preserving the existing normalization and column-processing behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@core/wren/src/wren/memory/seed_queries.py`:
- Around line 77-88: Pre-filter the columns once into a valid_columns collection
containing only dictionary entries with a non-empty name, then iterate over it
in both loops. Update the current loop and the second loop to use valid_columns
and remove their duplicated isinstance and col_name checks, preserving the
existing normalization and column-processing behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 63556fb2-76ca-412b-9a69-1c1e948cd6e0
📒 Files selected for processing (2)
core/wren/src/wren/memory/seed_queries.pycore/wren/tests/unit/test_seed_queries.py
CI lint failed on ruff format --check for seed_queries.py.
Address CodeRabbit nitpick: DRY up the duplicated isinstance/name validation by pre-filtering columns into a single valid-columns list used by both the aggregation and accepted-values loops.
|
Thanks @coderabbitai — pre-filtered columns into a single |
|
Tip For best results, initiate chat on the files or code changes.
ヽ(•‿•)ノ |
Summary
_model_seedsskips non-dict or nameless column entries instead of TypeErroring oncol["name"].core/wren/**.Motivation
Partial/hand-edited MDL column arrays can include nulls or unshaped rows. Seed generation is pure and runs during indexing; a single bad column listed should not kill the model.
Verification
cd core/wren && .venv/bin/python -m pytest tests/unit/test_seed_queries.py -v— 39 passedReal behavior proof
test_skips_non_dict_columnsPASSED (null/string/missing-name columns ignored; SUM(amount) still generated).Summary by CodeRabbit