-
Notifications
You must be signed in to change notification settings - Fork 1
feat: implement remaining M3 administrative commands #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Add 15 remaining M3 commands via RunCommand and Go driver APIs: - Database info: db.stats(), db.serverStatus(), db.serverBuildInfo(), db.version(), db.hostInfo(), db.listCommands() - Collection info: collection.stats(), collection.dataSize(), collection.storageSize(), collection.totalIndexSize(), collection.totalSize(), collection.isCapped() - Collection admin: collection.validate(), collection.latencyStats() - Index management: collection.createIndexes() This completes the full M3 milestone, emptying the method registry so all commands execute natively without mongosh fallback. Co-Authored-By: Claude Opus 4.6 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Implements the remaining M3 administrative/metadata commands end-to-end (parser translation → operation types → executor implementations) and adds integration coverage for them.
Changes:
- Added new operation types and wired translator visitor cases for remaining DB/collection admin commands (including
createIndexes, stats/info commands,validate,latencyStats). - Implemented executor support via
RunCommand,collStats, aggregation$collStats, and Go driver index APIs. - Added integration tests in
admin_test.gofor the new commands and removed all “planned/fallback” entries from the method registry.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| types/operation_type.go | Adds new OperationType constants for M3 admin/info commands. |
| internal/translator/visitor.go | Routes new parsed commands/method calls to the new operation types. |
| internal/translator/types.go | Extends Operation with IndexSpecs for createIndexes(). |
| internal/translator/method_registry.go | Clears planned-method registry (no more mongosh fallback for M1–M3). |
| internal/translator/collection.go | Adds argument extraction for createIndexes() specs. |
| internal/executor/executor.go | Dispatches new operation types to executor implementations. |
| internal/executor/admin.go | Implements createIndexes plus DB/collection info/admin commands. |
| client.go | Documents result shapes for the new operations. |
| admin_test.go | Adds integration tests for all newly implemented commands. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
All M3 methods are now implemented natively, so the method registry that tracked planned-but-unimplemented methods is no longer needed. - Delete internal/translator/method_registry.go and method_registry.go - Remove public IsPlannedMethod/MethodRegistryStats APIs from errors.go - Simplify handleUnsupportedMethod to always return UnsupportedOperationError - Remove obsolete TestPlannedOperation and TestMethodRegistryStats tests Co-Authored-By: Claude Opus 4.6 <[email protected]>
Address PR review feedback: - Validate 'key' field is a non-empty bson.D in extractCreateIndexesArgs - Return errors on type mismatches for createIndexes spec fields (key, name, unique, sparse, expireAfterSeconds) instead of silently ignoring - Return error when version field is missing from buildInfo result in executeDbVersion Co-Authored-By: Claude Opus 4.6 <[email protected]>
- Fix ineffectual assignment lint error in extractCreateIndexesArgs - Remove redundant nil check before len() (staticcheck S1009) - Skip TestServerStatus on DocumentDB (serverStatus unsupported) Co-Authored-By: Claude Opus 4.6 <[email protected]>
Summary
db.stats(),db.serverStatus(),db.serverBuildInfo(),db.version(),db.hostInfo(),db.listCommands()collection.stats(),collection.dataSize(),collection.storageSize(),collection.totalIndexSize(),collection.totalSize(),collection.isCapped()collection.validate(),collection.latencyStats()collection.createIndexes()Test plan
admin_test.gogo test ./internal/...go vet ./...passesgo test -c -o /dev/null .🤖 Generated with Claude Code