Repository navigation
Compile calendar duration SQL with month-end and leap-year handling - #346
Draft
seyoung4503 wants to merge 2 commits into
Draft
seyoung4503 wants to merge 2 commits into
seyoung4503 wants to merge 2 commits into
Conversation
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.
Calendar spans generated by the model subtracted year/month/day fields independently, losing calendar borrowing. Add a deterministic SQLite calendar interval compiler exposed through the existing internal and MCP tool registries. It emits portable CTEs with explicit month-end clamping, leap-year, reversed-date and invalid-date behavior. Queries still execute through the existing guarded run_sql; no UDF, model prompt change, business-definition bypass or grader change.
The compiler requires calendar_input(row_id, start_date, end_date), reserves calendar_* CTE names, and implements absolute ordered calendar spans rather than signed AGE or boundary counts. SQLite is the only supported dialect. It chooses no fractional-year formula or aggregation.
Validation: 317 passed, 1 skipped, including actual MCP stdio compilation/execution and missing-receipt rejection. A separately executed 1,000-pair seeded synthetic comparison matched dateutil.relativedelta. Ruff and diff checks pass. A fresh original-input Astra/high retry of local007 is frozen in the protocol; official result 0 → 1 (one selected failure repaired). The model called the compiler and then wrote its own month-end-borrowing SQL, returning 4.82; this was not a verbatim CTE copy. Exact prompts/events/SQL/CSV, the unchanged official score, paired HTML/JSON comparison, synthetic check script and SHA-256 index are archived under
bench/accuracy/mcp-review-results/calendar-interval. Single-failure repair is not full Spider accuracy. Stacked on #345; no merge requested.Implementation principles verification: