Repository navigation
refactor: retire unused mocks, helpers and obsolete scaffolding - #31011
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 8f01c14494fc2642fe7271ff1398360342f40a51
Assessment: approve
Reviewed the complete 66-file delta and affected owners. The cleanup preserves executable behavior, active tests and compatibility registrations. Removing unused private declarations and factoring identical HTTP tracking branches is proportionate and preserves existing ownership. No actionable defects or material runtime cost changes identified.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1586-7a01-9000-d45e20995cf8 · slot 1 · generation 1
Validation:
-
Independent Go audit passed: 63 files have identical executable tokens; the remaining three match exactly the reviewed declaration removals and branch factoring. All nine changed test files are token-identical. Parsing, directives, CGo preambles, gofmt and git diff --check passed.
-
Repository-wide reference audit confirmed the deleted wrapper and cluster field had no callers; mo-service proxy flag references remain unchanged. Reviewed GotConn metrics, locking and tracking order for both WasIdle values and nil/non-nil connections.
-
Passing receipts checks/1792803944340327811-5.json and checks/1792803961853544908-4.json match the frozen clean head and retained semantic-audit-v2.log/reference-audit.log. Full reconciliation is retained in /home/xupeng/.local/state/mo-bot/jobs/ffc1b3276b6f7370cbe02883/attempt-1/review-evidence.json.
Limitations:
-
No package, native, unit or integration tests executed. Acceptance rests on static equivalence and owner/caller review; no runtime performance improvement is claimed.
-
local_validation is empty. Author-reported native build, vet and lint results lack retained receipts and were not credited as independently verified.
-
The frozen CI snapshot reports failed CI preflight/CI Required and skipped kernel checks. Failure logs were not supplied, so the cause remains unclassified; these statuses were not counted as passing validation.
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 12a6479d48803a9011d2e7b30d4f2cad4dacb89a
Assessment: approve
Reviewed the complete 152-file delta and affected owners. The bounded retirement and canonical mock consolidation preserve live execution, cleanup, accounting, compatibility hooks and test oracles. No actionable defects or material runtime cost increases identified.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1586-7a01-9000-d45e20995cf8 · slot 1 · generation 1
Validation:
-
Audited all 149 changed Go files; 65 are token-identical. Reference analysis parsed 6,616 current Go files and found no surviving callers of removed top-level declarations.
-
Verified 530 retained mock implementations: 527 normalize identically; three preserve behavior through equivalent variadic handling or an existing type alias. All 24 implementations in the migrated auto-increment mock match.
-
Reviewed evaluator construction/reset/free, size accounting, HTTP tracking, test-oracle preservation and import initialization. Compiler directives, CGo preambles and init functions are unchanged.
-
Generator dry run selected the intended eight outputs. Formatting, git diff --check and exact-head cleanliness checks passed.
-
Eleven successful receipts were reconciled with retained logs and artifact hashes in /home/xupeng/.local/state/mo-bot/jobs/318b7ef40625809f3178348e/attempt-1/review-evidence.json.
Limitations:
-
Acceptance rests on static equivalence and ownership/reachability analysis. No repository package tests, native build, actual mock regeneration or performance benchmarks were executed.
-
local_validation is empty. Author-reported build/vet/lint/regeneration results lack retained receipts and were not independently verified; pending kernel CI was not counted as passing evidence.
-
Compatibility analysis covers repository consumers. Unknown out-of-tree imports of retired internal Go helpers are outside the documented scope.
12a6479 to
f482e13
Compare
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: f482e13fcb42ff071705d64be84736825d085d26
Assessment: approve
Reviewed the complete 152-file delta. The bounded retirement and mock consolidation simplify ownership while preserving live execution, cleanup, accounting, compatibility hooks and test oracles. No actionable defects identified.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1
Validation:
-
Audited all 149 changed Go files; 65 are token-identical. Parsed 6,620 repository Go files across tags and tests, finding no surviving references to removed top-level declarations.
-
Verified 527 equivalent retained mock implementations, three separately reviewed equivalent differences, and all 24 migrated auto-increment mock implementations.
-
Checked evaluator lifecycle, HTTP tracking, initialization dependencies and generator ownership. Formatting, diff checks, eight-output generator dry run and exact-head cleanliness passed.
-
Reconciled 12 current check receipts with logs and artifact hashes. Verified 11 earlier same-PR receipts and confirmed identical PR edit payloads. Evidence: /home/xupeng/.local/state/mo-bot/jobs/de00f565c2b5694eb28babf9/attempt-1/review-evidence.json.
Limitations:
-
Acceptance rests on static equivalence and ownership/reachability analysis. No repository package tests, native build, actual mock regeneration or performance benchmarks were executed.
-
local_validation is empty. Author-reported build/vet/lint/regeneration results were not independently credited; pending kernel CI was not counted as passing.
-
Compatibility analysis covers repository consumers. Unknown out-of-tree Go imports are outside the documented retirement scope.
iamlinjunhong
left a comment
There was a problem hiding this comment.
审查结论:批准。
我基于当前 head f482e13fcb42ff071705d64be84736825d085d26 对 152 个变更文件完成了完整 diff、相关调用闭包和保留测试审查。删除的 helper、接口、旧 mock 家族和禁用实现均未发现仓库内存活调用;8 组生成 mock 的保留方法面与对应接口一致,自动增量 mock 的消费者已迁移到 canonical frontend mock。对 evaluator 的 reset/free 生命周期、HTTP 连接追踪分支以及生成目标的依赖关系复核后,未发现运行时行为、并发/生命周期、兼容性或性能回归。
未发现可确认的问题;当前没有 P0、P1、P2 或 P3 finding。PR 当前检查状态已由上下文验证为全部结束且通过/跳过,未发现需要追加定向测试才能确认的风险。
gouhongshen
left a comment
There was a problem hiding this comment.
Codex automated review
Reviewed PR #31011 (152 files, +654/-10,682, net -10,028) as a dead-code / mock-retirement refactor at head f482e13. Conclusion: the change is behavior-preserving and safe to merge; one non-blocking maintenance nit found, no blocking defects.
Verification performed: (1) Extracted all 356 removed top-level declarations plus every removed method/struct-field from the full diff and searched the current tree for surviving references — all 33 names with live hits resolved as false positives (shadow types in other packages, comments, string literals). All ~90 removed moerr constructors, the removed exports (e.g. WithCollectorCnt, CreateCronTask, GetAllTables, TableNamesOfDB, SplitBatch, NewMetaSinker, WithCheckpointMinCount, txnif.DeleteChain/DeleteNode, frontend ColumnInfo/TableInfo, logservice ISnapshot*, embed cluster withProxy field) have zero in-tree references. (2) Removed methods on retained types: MysqlProtocolImpl.handleClientResponse41/320 had no callers even in base; Pattern.EvalPhrase and the list_operator/readutil/sql-plan hunks were commented-out code; apply_indices_cagra's getArgsFromDistFn was a duplicate of the surviving one in apply_indices_hnsw.go. (3) Verified all 13 regenerated mock families (8 frontend outputs + 2 util/export test mocks) textually cover their full interface method surfaces including embeddings; consumers of the reduced mock_* subpackages use only retained constructors (MockLockService/MockShardService/MockTaskRunner/MockServer), and the one migrated consumer now uses mock_frontend.NewMockAutoIncrementService which exists in the regenerated incrservice_mock.go. The handwritten MockTxnOperator capability extensions (TryEnterRunSqlWithTokenAndSQL, RequireAutoIncrEpochFenceCommit) predate this PR and match the additive interfaces in pkg/txn/client/types.go. (4) Semantics-adjacent edits: http_trace GotConn collapse merges two identical branches preserving the WasIdle metric; evaluator retainedBytesFn plumbing removal is dead (ExpressionExecutorRetainedBytes had zero callers in base; the function-package 4th return value contract is retained and its tests updated); only one active test (TestEngineColumnInfo, asserted only removed getters) was retired — matching the PR body and design doc, while TestWindowWithNulls and the batch-sql-handler test were already comment-disabled. (5) gofmt clean on all changed Go files, git diff --check clean; go vet + go test pass for pkg/common/moerr (the only fully checkable package here). Existing reviews (three mo-bot assessments, one human APPROVED) found no defects; no prior unresolved findings to duplicate.
Limitation: full local compile/vet/unit-test of most packages was impossible in this checkout — required native third-party headers (jemalloc.h, roaring.h, usearch.h) are not installed, and CGO_ENABLED=0 fails because several dependencies (usearch, onnxruntime, h3, gojieba, jemalloc allocator) are cgo-only. Static reference analysis, formatting checks, and the moerr test run were the substitutes; the PR's CI head checks (shared build, native build, sharded UT, e2e compose) are green, corroborating but not relied on for the code-level conclusions above.
P2 - Two regenerated util/export test mocks lost their recorded regeneration command and are not covered by the new Make target (pkg/util/export/mock_aggr_test.go:16)
Before this PR, mock_aggr_test.go and mock_batch_pipe_test.go each recorded the exact mockgen command in their generated header (e.g. mockgen -source pkg/util/export/table/aggr.go --destination pkg/util/export/mock_aggr_test.go -package=export). The PR replaced those headers with reflection-mode Source lines but only added a regeneration rule (root Makefile target generate-frontend-mocks) for the eight pkg/frontend/test outputs. No Makefile rule or go:generate directive now covers these two files (mock_trace_test.go in the same directory still carries its own command). A maintainer can still infer the reflection-mode invocation from the new header, but for consistency with the PR's own goal of owning regeneration in the root Make, consider adding two small targets or restoring the command comments.
What type of PR is this?
Which issue(s) this PR fixes:
issue #29249
Related engineering-quality work; this PR does not close the tracking issue.
What this PR does / why we need it:
Retire disconnected implementations and consolidate their existing owners.
Cumulative scope: 152 files, +654/-10,682, net -10,028 lines.
5,347 net deleted lines are generated mocks; the remaining delta covers
unused helper declarations/interfaces, obsolete commented implementations and
the design document. This is a source-maintenance change, with no runtime
performance claim.
Cleanup and ownership
auto-increment mock provider. Migrate its one test consumer to the existing
canonical frontend mock. Preserve every consumed interface's complete method
and recorder surface.
The root Make target owns native prerequisites/flags; the frontend Makefile
forwards to it. Reuse an installed matching tool version. Keep planner mocks
with handwritten defaults and generic trace mocks unchanged.
callback field. Keep evaluator/reset/free behavior and the function factory's
four-result contract. Admission continues to use actual
unsafe.Sizeof.adapters, option wrappers and named interfaces after incoming-reference checks.
Preserve error-code tables, codecs, actual configuration fields and live owners.
planner alternatives, storage/debug blocks and disabled test drafts.
Design and test boundaries
Reviewed retirement scope.
Honor the existing owner decision reserving catalog/checkpoint replay and
read-instance integration:
ReplayCheckpointEntries, metadata constructors,and checkpoint change-handler entrypoints remain. Source-compatibility trace
options, parser constructors, protocol revision predicates and diagnostic tools
also remain.
Remove only the isolated
TestEngineColumnInfogetter self-test with its deadowner; its assertions exercise no SQL or protocol path. Retained tests keep their
oracles. Two fixture edits discard an unread callback result and select the
canonical equivalent auto-increment mock. No replacement test framework is added.
Internal Go source compatibility is audited within this repository; out-of-tree
Go importers are outside this retirement proof.
Validation
Base:
2b94111625d746d048468ccc214c6b27fc23bd0d.Head:
12a6479d48803a9011d2e7b30d4f2cad4dacb89a.to the reviewed retirement; no added declarations. Retained mock methods match
after parameter/import/type-alias normalization, with equivalent variadic append
reviewed separately. The remaining mechanical edits are individually mapped.
make -j8 generate-frontend-mockscompleted; all 8 outputs arebyte-identical to the reviewed files. Native build completed successfully.
go vetover 114 owning/consumer packages: PASS.go build ./cmd/mo-servicewith matching native flags: PASS.PASS, configured golangci 0 issues in each batch. Molint's 67 diagnostics
exactly match the frozen-base source-overlay analysis; 0 new. Baseline analysis
explicitly enables the same three analyzers to refresh cached successful results.
git diff --check: PASS.these local compile/static results.