Skip to content

fix(parser): gate executable comments by MySQL version - #31168

Merged
XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
iamlinjunhong:codex/loom/develop/b774c10a86b2fefa5fb06d05529c01320554e43f6f404ec2f84ab71da77f2fb1
Nov 1, 2026
Merged

XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
iamlinjunhong:codex/loom/develop/b774c10a86b2fefa5fb06d05529c01320554e43f6f404ec2f84ab71da77f2fb1

Conversation

@iamlinjunhong

@iamlinjunhong iamlinjunhong commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

What this PR does / why we need it:

Future-version executable comments currently enter the SQL token stream unconditionally. For example, /*!99999 SELECT 42 */ executes, and SELECT 2 /*!999999999 */ fails because leftover version digits become SQL.

Compare the complete immediate ASCII digit run with the fixed MySQL compatibility baseline (80030), saturating the value to prevent overflow. Ignore future bodies through the first block-comment terminator, retaining complete comment spans and existing parser/split/continuation semantics. Share compatibility constants with the default handshake prefix. Matching, lower-version and unversioned comments continue to execute; 1–4 digit guards remain invalid.

Complete-run comparison is an intentional extension for nonstandard long guards, including leading zeros. Custom display prefixes do not change the SQL compatibility baseline; nested-comment support is unchanged. Scanning remains linear with constant extra numeric space and no new allocations or mutable global state.

Rebased onto official main 2465dae7a4ada1b277113cca5afff6fe10149b96 to refresh CI after #31146 was closed with upstream CI/test corrections. Both original commits remain identical under git range-diff; this refresh adds no product or test changes.

Validation on rebased e10d395884b38901d660751d915b96a27d2d1526, Darwin/arm64, Go 1.27.1, normal CGo with freshly built usearch 2.26.5/libmo:

  • New: go test -mod=readonly -v -count=1 -timeout=300s -run '^TestRunSQLWithFrontend$' ./pkg/embed passes, including its two rounds of COM_QUERY results, mode effects and error recovery.
  • New: the existing comment/executable_comment.sql passes normal mo-tester comparison twice on one owned ready instance (./run.sh -n -g -o -p <case>), 20/20 each, zero ignored/failed. Mode restoration and database teardown pass; SQL/result fixtures are unchanged. Standard -n disables metadata comparison.
  • New: service build, scoped go vet, configured incremental lint for the five changed Go packages (zero issues), formatting and diff checks pass.
  • Reused: public/MySQL parser, scanner state/span/bind, split/staged parse, work-budget/cancellation, version coherence and default/custom-prefix tests from the original validated source. Their relevant gate logic and test oracles are unchanged. The historical config-suite evidence excludes two unrelated legacy tests with hardcoded /tmp paths; no unrestricted full-config-suite result is claimed.

New-head CI is pending. The failed old run is not rerun. Issue verification remains with the reporter after merge.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@fengttt fengttt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR definitely needs BVT tests.

@iamlinjunhong

Copy link
Copy Markdown
Contributor Author

This PR definitely needs BVT tests.

done

@iamlinjunhong
iamlinjunhong force-pushed the codex/loom/develop/b774c10a86b2fefa5fb06d05529c01320554e43f6f404ec2f84ab71da77f2fb1 branch from 63ebc06 to e10d395 Compare October 27, 2026 02:49
@XuPeng-SH

XuPeng-SH commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · done

Commit: e10d395884b38901d660751d915b96a27d2d1526

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mo-bot review · mo-bot-local · review

Commit: e10d395884b38901d660751d915b96a27d2d1526

Assessment: approve

Reviewed the complete 14-file delta and affected callers. Version gating belongs in the shared scanner; bounded numeric comparison avoids overflow without duplicating parsing or adding retained state. Error handling, cancellation, source spans and session-mode behavior remain coherent. No actionable defect remains. The earlier BVT request is resolved by the maintained SQL/result cases and supporting execution evidence.

Model: gpt-6-astra / xhigh

Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1

Validation:

  • Evidence retained under /home/xupeng/.local/state/mo-bot/jobs/41979fa9d962d18c19ae58f8/attempt-1. review-record.json maps commands, source fingerprints, exit receipts and logs; discussion-assessment.json accounts for all four nonempty discussion items.

  • Isolation preflight and fresh repository-owned native build passed. Verified 200 native inputs against the frozen source and seven output hashes.

  • Eleven focused tests passed, including scanner/parser boundaries, cancellation, work budgets and an independent 415-guard numeric oracle. Configuration and real frontend tests passed, covering both COM_QUERY rounds and connection recovery after errors.

  • Frozen current-head CI reports successful unit tests, static analysis and PROXY/PESSIMISTIC BVT. Reviewed the author’s reported exact-head frontend and two 20/20 BVT runs as supporting evidence.

  • Base-scanner overlay comparison: future-body scanning improved from 8.750 to 2.528 microseconds; eligible-comment scanning increased from 136.3 to 191.7 nanoseconds. Allocation counts and bytes were unchanged across measured paths.

  • Formatting, diff and final evidence audits passed; source remains unchanged. Final audit: audit-review.log and checks/1793076901717000806-4.json.

Limitations:

  • Linked issue text and raw author/CI logs were not supplied; local_validation was empty. The PR contains concrete reproductions, and local checks independently exercised the changed behavior.

  • Full BVT and race suites were not rerun locally.

  • Benchmarks measure scanner behavior on an unpinned host, not SQL throughput. Ordinary SELECT/INSERT/DDL medians were approximately 4%/12%/3% higher; short, noisy samples do not establish a causal regression or prove its absence.

@mergify

mergify Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Queued — the merge queue status continues in this comment ↓.

@mergify

mergify Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

queue

🛑 Pull request from fork cannot be queued

Details

This pull request comes from a fork, and Mergify needs the author's permission to update its branch.
The author needs to enable "Allow edits from maintainers" on this pull request.

@iamlinjunhong

Copy link
Copy Markdown
Contributor Author

@Mergifyio refresh

@mergify

mergify Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

refresh

✅ Pull request refreshed

@mergify mergify Bot added the queued label Nov 1, 2026
@mergify

mergify Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

🚫 Left the queue

38 min in the queue, with no time running CI.

So far

  • ✅ Entered the queue Sun 1 Nov, 04:31 · rule main · triggered by rule Automatic queue on approval for main
  • ⏹️ Testing stopped · in place
  • 🚫 Left the queue 05:09 · 25b0c10

Reason

Pull request #31168 has been dequeued

Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.

The author needs to enable "Allow edits from maintainers" on this pull request.

Hint

You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it.
If you do update this pull request, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Merge conditions not met when it left the queue

  • any of · required by GitHub branch protection:
    • check-neutral = CI Required
    • check-skipped = CI Required
    • check-success = CI Required

Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).

  • Requeue this pull request
2 merge conditions met
  • #review-threads-unresolved = 0 · required by GitHub branch protection
  • github-review-approved · required by GitHub branch protection

Times in UTC · dashboard · how the merge queue works

This branch was successfully deployed

No deployments
ci — 25b0c105 Deployed Nov 1, 2026 by mergify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dequeued kind/bug Something isn't working size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants