Expand test coverage and fix critical bugs in semantic layer#29
Merged
Expand test coverage and fix critical bugs in semantic layer#29
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eced342f2c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
eced342 to
76f18bd
Compare
This branch adds comprehensive test coverage for untested modules and fixes critical bugs found during testing: **Test Additions (+1,377 tests):** - Database adapters: 34+ tests covering URL parsing, SQL injection prevention, dialect-specific SQL - Format adapters: 77 new tests for Hex, Omni, Rill, Superset adapters - Time intelligence: 91 tests including 21 new SQL execution tests with DuckDB - Symmetric aggregates: 43 tests proving double-counting prevention with real data - Table calculations: 79 tests covering running totals, percentiles, formula security - End-to-end integration: 36 tests with full stack execution and numeric verification **Critical Bug Fixes:** - Fix ratio metrics ignoring metric-level filters - numerator/denominator now apply filters independently - Fix filter inheritance bug where unfiltered metrics incorrectly inherited filters from other metrics - Fix SQL injection vulnerabilities in all database adapters (Postgres, Snowflake, BigQuery, etc.) - Fix zero offset silently becoming 1 in time intelligence - now raises validation error - Fix invalid table calculation expressions returning None silently - now validates at creation time - Implement missing percentile calculation type with linear interpolation - Fix Rill adapter returning empty graph for missing paths - now raises FileNotFoundError - Fix derived metrics not extracting column dependencies for CTEs - now handles inline SQL filters **Test Quality:** All 1419 tests are high-value: they execute real SQL against DuckDB with exact numeric assertions, test edge cases (NULLs, empty results, large values), and use real fixture files from external formats. These would catch real regressions.
76f18bd to
dc9b291
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR expands test coverage from ~1200 to 1419 tests (+219 tests) and fixes 8 critical bugs discovered during testing.
Test Additions
Database adapters (34 new tests): URL parsing edge cases, SQL injection prevention, dialect-specific SQL generation
Format adapters (77 new tests): Comprehensive coverage for Hex, Omni, Rill, and Superset adapters with fixture-based parsing and round-trip verification
Time intelligence (91 tests): Model validation tests plus 21 new SQL execution tests against DuckDB (YoY, MoM, WoW, trailing periods, edge cases)
Symmetric aggregates (43 tests): Proves the symmetric aggregate pattern prevents double-counting in fan-out joins with real SQL execution
Table calculations (79 tests): Running totals, percentiles, formula validation, security tests for code injection prevention
End-to-end integration (36 tests): Full stack execution from YAML/BSL through SQL generation to DuckDB with exact numeric assertions
Critical Bugs Fixed
Test Quality
All new tests are high-value: they execute real SQL, verify exact numeric results, test edge cases (NULLs, empty results, large values, division by zero), and use real fixture files. These tests would catch real regressions.