Skip to content

fix(memory): skip non-dict models/rels/views in extract_schema_items#2541

Open
Bartok9 wants to merge 3 commits into
Canner:mainfrom
Bartok9:fix/schema-extract-skip-nonduct-models
Open

fix(memory): skip non-dict models/rels/views in extract_schema_items#2541
Bartok9 wants to merge 3 commits into
Canner:mainfrom
Bartok9:fix/schema-extract-skip-nonduct-models

Conversation

@Bartok9

@Bartok9 Bartok9 commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • extract_schema_items ignores non-dict models/relationships/views and nameless/non-dict columns.
  • _model_record column summary only joins dict columns with names.

License

Apache-2.0 path under core/wren.

Verification

cd core/wren && .venv/bin/python -m pytest tests/unit/test_schema_extract_nonduct_models.py -q

Test plan

  • unit test malformed manifest
  • CI green

Summary by CodeRabbit

  • Bug Fixes
    • Improved schema extraction resilience when manifests include malformed or incomplete models, columns, relationships, and views.
    • Safely skips invalid non-conforming entries to prevent extraction and summary failures.
    • Prevents malformed column data from impacting generated model summaries.
  • Tests
    • Added unit test coverage using mixed valid and invalid schema inputs to confirm invalid entries are ignored while valid items are extracted correctly.

@github-actions github-actions Bot added python Pull requests that update Python code core labels Jul 19, 2026
@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: f963c8ff-d607-4ac9-86fd-f574b27882ac

📥 Commits

Reviewing files that changed from the base of the PR and between cf42247 and acd584f.

📒 Files selected for processing (1)
  • core/wren/src/wren/memory/schema_indexer.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • core/wren/src/wren/memory/schema_indexer.py

Walkthrough

Schema extraction now validates manifest item and column shapes, skips entries without valid names, and safely builds model column summaries. A new unit test covers mixed valid and malformed models, columns, relationships, and views.

Changes

Schema extraction hardening

Layer / File(s) Summary
Validated schema extraction and coverage
core/wren/src/wren/memory/schema_indexer.py, core/wren/tests/unit/test_schema_extract_nonduct_models.py
Manifest traversal and model summaries now tolerate malformed entries, while tests verify valid records are retained and invalid entries are skipped.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Poem

I’m a rabbit guarding schemas tight,
Skipping broken leaves from sight.
Valid columns hop along,
Safe summaries grow strong.
No “nope” entries in my burrow tonight!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main hardening in schema extraction and matches the changed behavior.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@core/wren/src/wren/memory/schema_indexer.py`:
- Around line 244-254: Update extract_schema_items to require rel.get("name") is
not None before passing relationship dictionaries to _relationship_record, and
apply the same guard to view dictionaries before calling _view_record. Preserve
processing of named entries while skipping unnamed relationships and views to
avoid KeyError.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 65724ab9-98a5-437d-bac9-4f23cb51c05c

📥 Commits

Reviewing files that changed from the base of the PR and between 3dac00a and cf42247.

📒 Files selected for processing (2)
  • core/wren/src/wren/memory/schema_indexer.py
  • core/wren/tests/unit/test_schema_extract_nonduct_models.py

Comment thread core/wren/src/wren/memory/schema_indexer.py
Skip relationship/view entries lacking a name so _relationship_record /
_view_record no longer KeyError on malformed manifests, matching the
existing models guard.

Addresses CodeRabbit review feedback on Canner#2541.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core python Pull requests that update Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant