Release v0.4#92
Merged
Merged
Conversation
Added instructions for spawning a server with uvx and adding the GIQL MCP server to a project.
…cates INTERSECTS, CONTAINS, and WITHIN ignored the table-storage convention declared via Table(coordinate_system=..., interval_type=...) and emitted SQL hard-coded for 0-based half-open columns. Tables backed by other conventions (e.g. VCF-style 1-based closed) silently received off-by-one results in both range-literal and column-join forms; SpatialSetPredicate inherited the same bug because it routes through the same helper. Introduce two staticmethod helpers, _canonical_start and _canonical_end, that wrap a raw start/end column expression to yield its canonical 0-based half-open value, plus _resolve_table to look up the Table backing a column reference. Wire the helpers into _generate_range_predicate and _generate_column_join so the table side is canonicalized before the existing comparison operators run. The literal side already arrives in canonical form via RangeParser.to_zero_based_half_open, so no per-operator branching is needed. DISTANCE and NEAREST still ignore coordinate_system and conflate interval_type with bedtools-compatibility math; that is tracked as a separate follow-up and out of scope here.
…val combinations Add eleven tests asserting the new canonicalization behavior for INTERSECTS, CONTAINS, WITHIN, and SpatialSetPredicate: - All three predicates against a 1-based-closed table in literal form - Column-join form for INTERSECTS, CONTAINS, and WITHIN with one default-convention table joined against a 1-based-closed table - INTERSECTS literal against the rare 0-based-closed and 1-based-half-open conventions to cover the remaining two cells of the (coordinate_system, interval_type) matrix - INTERSECTS literal against an explicitly-default Table to guard against accidental wrapping when defaults are passed in - CONTAINS point-query branch against a 1-based-closed table - INTERSECTS ANY against a 1-based-closed table to verify the fix flows through SpatialSetPredicate transitively Tests follow the BDD naming pattern test_<method>_should_<outcome>_when_<condition> and the AAA structure with Given/When/Then docstrings.
…ISTANCE/NEAREST DISTANCE and NEAREST previously ignored Table.coordinate_system and conflated Table.interval_type with bedtools-style "+1" gap counting. A 1-based-closed table fed raw start/end into the gap formula with no canonical (start - 1) shift, producing distances that were off-by-one for any non-default coordinate system. The "+1" gap quirk was implicitly enabled whenever interval_type was "closed", coupling a counting convention to a storage convention. Reuse the _canonical_start and _canonical_end helpers introduced in #88 to canonicalize all four endpoint expressions to 0-based half-open before they reach _generate_distance_case, so the CASE expression operates entirely in canonical space. Drop the implicit "+1" gap counting outright — interval_type no longer drives any gap arithmetic. BREAKING CHANGE: bedtools-style "+1" gap counting is removed from DISTANCE and NEAREST. Tables previously declared with interval_type="closed" will produce different numeric distances — specifically, gaps will be one less than before. If the legacy "+1" semantics are required, add the adjustment explicitly in the consuming query (e.g. wrap the result in `... + 1`).
…oval Rename the two pre-existing closed-interval tests to the BDD pattern and rewrite them to assert that closed-interval tables emit no "+1" gap adjustment — the legacy interval_type-driven implicit "+1" is gone and there is no replacement opt-in. Add parametrized tests covering each of the four (coordinate_system, interval_type) combinations for DISTANCE, plus a mixed-conventions DISTANCE test, a parametrized target-side NEAREST test across all four combinations, and a column-ref reference NEAREST test. Together they assert that logically equivalent intervals stored under different conventions yield the same canonical gap arithmetic.
Closes two coverage gaps left by the previous test commit on this branch and tightens one brittle assertion: - Add a NEAREST counterpart to the existing DISTANCE default-mode test, verifying that on a closed-interval target table the legacy interval_type-driven implicit "+1" is gone — NEAREST canonicalizes the target end as (end + 1) but no longer adds "+1" to the gap branches unless bedtools_compat is set. - Add coverage for _resolve_nearest_reference's correlated-implicit branch with a 1-based closed outer table, exercising the new canonicalization with a non-trivial convention. Existing implicit-reference tests use 0-based half-open tables, so the canonicalization was a no-op and the new code path was not meaningfully observed. - Replace the or-chained substring assertion in the existing bedtools-compat-set NEAREST test with three positive assertions that both gap branches carry the bedtools "+1" tail. The previous or chain would silently pass even if only one branch were correct.
…NEAREST Add a new tests/integration/coordinate_space/ package that exercises DISTANCE and NEAREST end-to-end via DuckDB across all four (coordinate_system, interval_type) combinations, including mixed pairs. Each test parametrizes the same canonical 0-based half-open interval(s) across the four conventions, re-encoding the stored start/end values via the inverse of _canonical_start / _canonical_end and feeding them through transpile() into a real DuckDB connection. This proves the canonicalization fix for #89 holds at the execution layer, not just at SQL emission. Coverage: same-convention DISTANCE (gap, overlap, adjacent, cross-chrom, signed +/-), 16 mixed-convention DISTANCE pairs, same-convention NEAREST (k=1, k=3 membership, max_distance, standalone literal reference, adjacent boundary), and 16 mixed-convention NEAREST pairs. 76 invocations total. The new package does not require pybedtools or the bedtools binary, so it runs on machines without bedtools installed.
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.
Auto-generated by the cut release workflow.