Skip to content

feat(mysql): MySQL and MariaDB query dialect, fuzzed on both (#53) - #135

Merged
Makisuo merged 7 commits into
mainfrom
feat/mysql-dialect
Nov 6, 2026
Merged

Makisuo merged 7 commits into
mainfrom
feat/mysql-dialect

fix: refuse impossible calendar dates in text timestamps; CodeRabbit …

4dc5d44
Select commit
Loading
Failed to load commit list.
Maple Review Bot / Maple / review succeeded Nov 6, 2026 in 1m 18s

Confidence 10/10 · No issues found

🟢 Confidence 10/10 · safe to merge. The head is a small, tested fix to the shared timestamp check plus a CI job; only the year-0000 leap day escapes both.
1 note · tests covered · risk medium

The last commits make the shared text-timestamp check refuse impossible calendar dates before Date.parse moves them on, pin that with a MySQL test, and add the MySQL/MariaDB CI job. Mergeable; one leap-day edge in the new check.

  • realCalendarDate runs before Date.parse in isText and in the Date comparison literal
  • mysql.test.ts pins the refused 2023-02-30 and the accepted 2023-02-28
  • CI gains a Builder / MySQL 8.4, MariaDB 11.4 job with both services
  • The ILIKE refusal now names contains(…, { insensitive: true }) instead of SQLite's rules

Findings

🔵 Note · F2 · realCalendarDate reads year 0000 as 1900 and refuses 0000-02-29

correctness · src/sql/text-timestamp.ts:32-33

Date.UTC(year, month, 0) maps years 00-99 to 19xx, so year 0000 gets 1900's day count and the leap day is refused. timestampText writes 0000-02-29 00:00:00.000 on SQLite (minYear: 0) and Date.parse reads it, but isText now rejects the text the codec itself produced.

	const [year, month, day] = [Number(date[1]), Number(date[2]), Number(date[3])]
	// `Date.UTC` maps years 00-99 to 19xx, whose leap years are not the year's own.
	const last = new Date(0)
	last.setUTCFullYear(year, month, 0)
	return month >= 1 && month <= 12 && day >= 1 && day <= last.getUTCDate()
What was checked
  • Ran the new realCalendarDate in node over impossible dates, leap days and month bounds
  • pgTimestampToIso→chDateTimeToIso reads the YYYY-MM-DD hh:mm:ss text as UTC (src/pg/types.ts:36)
  • The CI job's ports 3306/3307, health checks and URLs agree with what the live tests read

4dc5d44 · Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.

Annotations

Check notice on line 33 in src/sql/text-timestamp.ts

See this annotation in the file changed.

@maple-review-bot maple-review-bot / Maple / review

correctness: `realCalendarDate` reads year `0000` as 1900 and refuses `0000-02-29`

`Date.UTC(year, month, 0)` maps years 00-99 to 19xx, so year `0000` gets 1900's day count and the leap day is refused. `timestampText` writes `0000-02-29 00:00:00.000` on SQLite (`minYear: 0`) and `Date.parse` reads it, but `isText` now rejects the text the codec itself produced.