fix(genbi): guard non-dict models/columns in inventory format#2548
fix(genbi): guard non-dict models/columns in inventory format#2548Bartok9 wants to merge 2 commits into
Conversation
|
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)
Walkthrough
ChangesModel inventory formatting
Estimated code review effort: 2 (Simple) | ~10 minutes 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/genbi/composer.py (1)
62-64: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueSimplify
raw_colsretrieval and type check.The
or []fallback on line 62 is redundant. Ifmodel.get("columns")returnsNone(or any other non-list value like a string or dictionary), the subsequentisinstance(raw_cols, list)check will evaluate toFalseand correctly resetraw_colsto[].You can simplify this to a direct
.get()call followed by the type check.♻️ Proposed refactor
- raw_cols = model.get("columns") or [] + raw_cols = model.get("columns") if not isinstance(raw_cols, list): raw_cols = []🤖 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/genbi/composer.py` around lines 62 - 64, In the raw_cols retrieval logic, remove the redundant `or []` fallback from `model.get("columns")` and keep the existing `isinstance(raw_cols, list)` check to reset all non-list values, including None, to an empty list.
🤖 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/genbi/composer.py`:
- Around line 62-64: In the raw_cols retrieval logic, remove the redundant `or
[]` fallback from `model.get("columns")` and keep the existing
`isinstance(raw_cols, list)` check to reset all non-list values, including None,
to an empty list.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 7894584d-ef3a-405e-a97b-7546e8ae4d7e
📒 Files selected for processing (2)
core/wren/src/wren/genbi/composer.pycore/wren/tests/unit/test_genbi_format_model_inventory.py
_format_model_inventory assumed dict rows; junk MDL entries raised AttributeError while composing build instructions.
1b6df91 to
081dc59
Compare
Summary
_format_model_inventoryiterated models/columns with unconditional.get.Verification
Apache-2.0 path:
core/wren/**.Summary by CodeRabbit