Skip to content

fix: harden schema properties and add CODE_MAP.md#25

Merged
dtsong merged 3 commits intomasterfrom
fix/schema-property-hardening
Mar 4, 2026
Merged

fix: harden schema properties and add CODE_MAP.md#25
dtsong merged 3 commits intomasterfrom
fix/schema-property-hardening

Conversation

@dtsong
Copy link
Owner

@dtsong dtsong commented Mar 4, 2026

Summary

Test plan

  • uv run pytest tests/test_query.py -x -q — 32/32 pass (covers CTE schema tests from PR fix: register CTE schema correctly when params rename columns #21)
  • Broader test suite passes (failures are pre-existing DB connection issues)
  • safezip import verified, error messages preserved
  • s.new(...) produces identical results to type(s)(...) for both dict types

🤖 Generated with Claude Code

dtsong and others added 3 commits March 3, 2026 20:21
Resolves #22 and #23: harden schema property error handling in
Cte, Join, and Select classes. Replace type(s)(...) with s.new(...),
use safezip for length validation, add CTE params type validator,
and wrap inner schema resolution with error context.

Add CODE_MAP.md for AI agent and contributor codebase navigation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add null guard to Join.schema to prevent AttributeError on None schema
- Change Join's ValueError to QueryBuilderError for consistent error hierarchy
- Use QB_TypeError in CTE params validator instead of plain TypeError
- Widen Cte.schema catch to include ValueError from inner schema resolution
- Include CTE name in wrapped error message for better diagnostics
- Narrow try block around safezip to avoid masking errors from s.new()
- Fix CODE_MAP.md inaccuracies: frozen claim, Schema type alias, errors.py

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add the original exception text to the wrapped QueryBuilderError
message so callers inspecting str(e) see the root cause without
needing to walk __cause__. Also document why ValueError is in the
catch tuple.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dtsong dtsong merged commit 91426f5 into master Mar 4, 2026
6 checks passed
@dtsong dtsong deleted the fix/schema-property-hardening branch March 4, 2026 04:52
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.

fix: harden schema property error handling across AST classes fix: Cte.schema return type and use safezip

1 participant