feat: implement remaining M3 administrative commands#24
Merged
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 <noreply@anthropic.com>
There was a problem hiding this comment.
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
- 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 <noreply@anthropic.com>
rebelice
approved these changes
Feb 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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