Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
WalkthroughToken resolution now trims values and treats blank environment or dotenv entries as missing, while seed query generation skips malformed model and relationship manifest entries. ChangesToken resolution
Seed query validation
Estimated code review effort: 2 (Simple) | ~15 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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
core/wren/tests/unit/test_resolve_token_blank.py (1)
6-20: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd coverage for the dotenv lookup tiers.
These tests only exercise
os.environ; stubbing_ensure_env_loadedand omitting.envfiles means regressions in standard dotenv loading and explicit project.envnormalization will go undetected. Add cases for a blank process value with a valid standard.env, plus a blank/whitespace value in the explicit project.env.🤖 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/tests/unit/test_resolve_token_blank.py` around lines 6 - 20, Extend the resolve_token tests around test_resolve_token_treats_blank_env_as_missing and test_resolve_token_strips to cover dotenv lookup tiers: create a valid standard .env and verify a blank process value falls back to it, then create an explicit project .env containing a blank or whitespace token and verify that value is normalized as missing. Exercise the real _ensure_env_loaded path for these cases instead of stubbing it, while preserving the existing environment-value assertions.
🤖 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/genbi/tokens.py`:
- Around line 35-43: Update the token lookup flow around `_as_token` and
`_ensure_env_loaded` so a whitespace-only process environment value cannot block
a valid token from the standard dotenv sources; clear or otherwise bypass the
blank value before resolving tier 2, while preserving precedence for nonblank
process values. Add a regression test covering a blank shell value and a valid
standard `.env` token.
---
Nitpick comments:
In `@core/wren/tests/unit/test_resolve_token_blank.py`:
- Around line 6-20: Extend the resolve_token tests around
test_resolve_token_treats_blank_env_as_missing and test_resolve_token_strips to
cover dotenv lookup tiers: create a valid standard .env and verify a blank
process value falls back to it, then create an explicit project .env containing
a blank or whitespace token and verify that value is normalized as missing.
Exercise the real _ensure_env_loaded path for these cases instead of stubbing
it, while preserving the existing environment-value assertions.
🪄 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 Plus
Run ID: 9ece4469-e063-44fc-b489-a1f91e7dd7a1
📒 Files selected for processing (2)
core/wren/src/wren/genbi/tokens.pycore/wren/tests/unit/test_resolve_token_blank.py
A whitespace-only shell value (VERCEL_TOKEN=) stayed in os.environ and blocked load_dotenv(override=False) from resolving a valid token in the standard .env tier. Delete the blank key before dotenv discovery; add regression tests for dotenv fallback and blank project-.env values.
|
Good catch on the dotenv-tier gap. Fixed in 3bfc92f: a blank/whitespace-only shell value could stay in |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
core/wren/tests/unit/test_seed_queries_nonduct_models.py (1)
26-38: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winStrengthen the assertions to prove malformed entries are skipped.
The current checks only require one
ordersresult and a"sql"key. Add a validcustomersmodel, assert the valid relationship seed is retained, and assert malformed model/relationship entries do not produce output (preferably with exact expected pairs or counts).🤖 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/tests/unit/test_seed_queries_nonduct_models.py` around lines 26 - 38, Strengthen the assertions around generate_seed_queries by adding a valid customers model to the manifest, then verify the valid orders/customers relationship seed is retained. Assert that the malformed "bad-rel" model and relationship entries produce no seed output, using exact expected pairs or counts rather than only checking for an orders result and a sql key.
🤖 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/tests/unit/test_seed_queries_nonduct_models.py`:
- Line 34: Add production validation in generate_seed_queries before the
model-layer comprehension and subsequent model loop access model entries as
dictionaries, and before the relationship loop calls _relationship_seed. Reject
or skip invalid "bad"/None model entries and the "bad-rel" relationship entry so
dictionary subscripting and _relationship_seed’s .get() are never invoked on
unsupported values, while preserving valid seed-query generation.
---
Nitpick comments:
In `@core/wren/tests/unit/test_seed_queries_nonduct_models.py`:
- Around line 26-38: Strengthen the assertions around generate_seed_queries by
adding a valid customers model to the manifest, then verify the valid
orders/customers relationship seed is retained. Assert that the malformed
"bad-rel" model and relationship entries produce no seed output, using exact
expected pairs or counts rather than only checking for an orders result and a
sql key.
🪄 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 Plus
Run ID: 30d65780-dfd1-4f2e-a83a-eba4cb88a0ba
📒 Files selected for processing (3)
core/wren/src/wren/genbi/tokens.pycore/wren/tests/unit/test_resolve_token_blank.pycore/wren/tests/unit/test_seed_queries_nonduct_models.py
🚧 Files skipped from review as they are similar to previous changes (1)
- core/wren/src/wren/genbi/tokens.py
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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/seed_queries.py`:
- Around line 34-38: The model filtering in the seed-query construction must
reject whitespace-only and non-string names before they reach _norm_ident().
Update the models comprehension to require a string name whose stripped value is
non-empty, and add regression coverage for whitespace-only and integer name
values.
- Around line 54-56: Normalize and filter each relationship in the
relationship-processing flow so only dictionaries with valid string model names
in models and a string condition reach _relationship_seed; apply the same
validation before sqlglot.parse_one in core/wren/src/wren/memory/seed_queries.py
at lines 54-56 and 176-178, respectively. Reuse the normalized fields for both
consumers and skip malformed relationships.
🪄 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 Plus
Run ID: dc1d0645-99d1-4baf-8ded-1a498665c88e
📒 Files selected for processing (1)
core/wren/src/wren/memory/seed_queries.py
| for rel in manifest.get("relationships", []): | ||
| if not isinstance(rel, dict): | ||
| continue |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Validate relationship fields once before both consumers.
Checking isinstance(rel, dict) is insufficient: malformed dictionaries can crash _relationship_seed() or SQL parsing. Normalize/filter relationships so models contains valid string names and condition is a string before using them in either path.
core/wren/src/wren/memory/seed_queries.py#L54-L56: validate before calling_relationship_seed.core/wren/src/wren/memory/seed_queries.py#L176-L178: apply the same validation beforesqlglot.parse_one.
📍 Affects 1 file
core/wren/src/wren/memory/seed_queries.py#L54-L56(this comment)core/wren/src/wren/memory/seed_queries.py#L176-L178
🤖 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 54 - 56, Normalize
and filter each relationship in the relationship-processing flow so only
dictionaries with valid string model names in models and a string condition
reach _relationship_seed; apply the same validation before sqlglot.parse_one in
core/wren/src/wren/memory/seed_queries.py at lines 54-56 and 176-178,
respectively. Reuse the normalized fields for both consumers and skip malformed
relationships.
Reject whitespace-only and non-string model names in seed-query generation, and reformat the model_layers comprehension to satisfy ruff format --check.
|
Pushed 46e8b59:
|
|
Closing this as-is, but the core idea is worth resubmitting — please split it. What's good: Why I can't take this diff:
A PR touching only |
|
All fair — especially the process-environment mutation. |
Summary
resolve_tokenreturned whitespace-only env values as tokens, so deploy usedAuthorization: Bearerand failed opaquely.Changes
Summary by CodeRabbit
.envsources, so blank env entries won’t prevent valid.envvalues.modelsandrelationships..envfallback behavior.