Skip to content

fix: convert the clock under the built-in policy and guard only read semi-structured columns - #133

Merged
kvlonge merged 3 commits into
mainfrom
fix/builtin-launch-refusals
Nov 7, 2026
Merged

kvlonge merged 3 commits into
mainfrom
fix/builtin-launch-refusals

Conversation

@kvlonge

@kvlonge kvlonge commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Why

Two refusals under the built-in policy blocked everyday queries:

  • CURRENT_DATE() and CURRENT_TIMESTAMP() refused, although both engines read the clock when the query runs; the value differing between runs is not a translation error.
  • Reading any column of a table that has a VARIANT, ARRAY or OBJECT column refused on json_fidelity, even when the query never read the semi-structured column (SELECT ticket_id FROM tickets).

Changes

  • The built-in default converts CURRENT_DATE() and CURRENT_TIMESTAMP() with a note stating the caveat: the value is taken when the query runs, in the session's time zone, which must be UTC in both engines. --strict, --loud-divergences-only and a non-UTC TIMEZONE still refuse them, with help naming the flag to drop.
  • A base table's semi-structured columns are guarded, relying on json_fidelity, only where the statement can read them: it names the column, or reads columns unnamed through a star other than COUNT(*), a positional $n, PIVOT, UNPIVOT, COLUMNS or a NATURAL join. Columns with names outside plain ASCII are always guarded.
  • The FROM rule's catalogue conditions state which semi-structured columns are guarded.
  • Docs, --builtin-policy help and SQ0008 help say the built-in policy refuses every known divergence but the clock.
  • CLI tests in test_builtin_policy.rs cover both changes, including reads that must stay guarded.

Verification

  • D94 gate on fc15d51 (merges main f2d93ee): make check-ci exit 0; make test-rust passed; make verify-recorded: 12,033 cases, 0 failed, 0 pending, 226/226 rules; translation results: 0 regressions, 0 other changes, main's baseline unchanged.
  • SELECT ticket_id FROM tickets refused on main and converts here; star, named, positional and subquery reads still rely on json_fidelity.

…structured columns a query reads

The built-in default now converts CURRENT_DATE() and CURRENT_TIMESTAMP() with a warning that
states the caveat: both engines take the value when the query runs, in the session's time zone.
Strict mode, --loud-divergences-only and a session outside UTC still refuse them.

A base table's VARIANT, ARRAY and OBJECT columns are guarded, relying on json_fidelity, only
where the statement can read them: it names the column, or reads columns without naming them
through a star other than COUNT(*), a positional column, PIVOT, UNPIVOT or a NATURAL join.
Reading another column of such a table no longer needs json_fidelity.

kvlonge commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

D94 gate on fc15d51 (this head, merging main f2d93ee), run locally with every crate rebuilt from this worktree:

  • make check-ci: exit 0
  • make test-rust: passed
  • make verify-recorded: 12,033 cases, 0 failed, 0 pending, 0 unproven; 226/226 equivalences and rules verified
  • translation results: 0 regressions, 0 other changes; results-baseline.json unchanged from main
  • public-repository hygiene scan: clean

Hosted CI on this repository is blocked by Actions billing, so the local gate is the landing check.

@kvlonge
kvlonge marked this pull request as ready for review November 7, 2026 00:56
@kvlonge
kvlonge merged commit fc15d51 into main Nov 7, 2026
1 check failed
@kvlonge
kvlonge deleted the fix/builtin-launch-refusals branch November 9, 2026 21:31
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.

1 participant