Skip to content

Conversation

@h3n4l
Copy link
Member

@h3n4l h3n4l commented Jan 30, 2026

Summary

  • Update github.com/bytebase/parser to pick up bytebase/parser#57 which replaces the unified MethodCallContext with separate CollectionMethodCallContext and CursorMethodCallContext
  • Split visitMethodCall into visitCollectionMethodCall and visitCursorMethodCall to match the new grammar structure
  • Replace removed GenericMethod catch-all with extractMethodNameFromText helper for unsupported method error messages

Test plan

  • go build ./... passes
  • go test -v ./... — all tests pass across all 3 packages
  • golangci-lint run --allow-parallel-runners — 0 issues

🤖 Generated with Claude Code

The upstream parser (bytebase/parser#57) replaced the unified
MethodCallContext with CollectionMethodCallContext and
CursorMethodCallContext, and removed the GenericMethod catch-all.

- Split visitMethodCall into visitCollectionMethodCall and
  visitCursorMethodCall
- Update visitMethodChain to use CollectionMethodCall() and
  AllCursorMethodCall() instead of AllMethodCall()
- Replace GenericMethod fallback with extractMethodNameFromText

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings January 30, 2026 09:16
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the MongoDB parser dependency and refactors the internal AST visitor to match the new method-call grammar split between collection and cursor method calls, while preserving existing translation behavior and error reporting.

Changes:

  • Bump github.com/bytebase/parser to a newer commit that introduces CollectionMethodCallContext and CursorMethodCallContext.
  • Refactor visitMethodChain to handle a single CollectionMethodCall followed by zero or more CursorMethodCalls, instead of iterating a unified MethodCall list.
  • Replace the old visitMethodCall + extractMethodName logic with visitCollectionMethodCall, visitCursorMethodCall, and a shared extractMethodNameFromText helper for unsupported-method error handling.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
internal/translator/visitor.go Adapts the visitor to the new parser method-call contexts, cleanly separates collection vs cursor handling, and centralizes unsupported-method name extraction using raw parse text.
go.mod Updates the github.com/bytebase/parser dependency to a newer pseudo-version that exposes the new MongoDB grammar APIs.
go.sum Syncs module checksums with the updated parser version to keep dependency resolution consistent.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rebelice rebelice merged commit 0425183 into main Jan 30, 2026
8 checks passed
@rebelice rebelice deleted the vk/88a8-update-the-githu branch January 30, 2026 09:18
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.

3 participants