Repository navigation
Description
Why do you want to refactor this code?
Establish a long-running MatrixOne engineering-quality task for small, focused cleanup PRs submitted daily or nearly daily. The goal is to reduce system complexity, maintenance burden, and test cost rather than continually adding patches, frameworks, and overlapping tests.
The absence of a runtime bug does not justify retaining unused state, duplicate implementations, low-value test combinations, or obsolete paths left behind after fixes. These should be removed based on evidence. Conversely, code quality must not be judged by line count or test count, and necessary safeguards must not be weakened merely to achieve net deletions.
This is an ongoing tracking issue, not a task completed by merging a single PR. The repository has no dedicated Task template, so this issue follows the Refactoring request template.
Describe the solution you'd like
Scope
- Code removal: Remove dead code, unused fields/parameters/enums, redundant computations, abstractions without consumers, and historical compatibility paths whose retirement conditions have been met.
- Consolidated ownership: Reuse canonical implementations, fix shared root causes, and merge duplicate branches instead of maintaining separate rules at each caller. When a new implementation replaces an old path, explicitly identify when the old path can be removed.
- Simpler design: Review overengineering, speculative extension points, frameworks without demonstrated needs, and duplicate state. Prefer local, readable, verifiable implementations.
- Test quality: Cover unit, planner, protocol, operator, integration, and BVT tests. Assign distinct contracts and failure mechanisms to each layer; remove or replace low-value duplication and unnecessary Cartesian products. Avoid repeatedly testing the same entrypoint, data, and assertion across layers.
- Root-cause coverage and completeness: Check whether fixes address related callers, lifecycle boundaries, and sibling paths rather than merely special-casing a SQL shape or symptom. Tests should distinguish exercising the intended fix from obtaining the same result through another path.
- Cost and stability: Prioritize expensive duplicate cluster startup/execution, unnecessary waits, validation that continues after a campaign is already invalid, and fragile assertions coupled to internal call counts.
Acceptance criteria for each linked PR
- Identify the reviewed baseline, scope, specific problem, and source/call-graph evidence; “optimize code” alone is insufficient.
- Explain what is removed, consolidated, or replaced; which independent contracts remain covered; and why behavior is preserved or must change.
- For test deduplication, provide a concise coverage mapping: which cases genuinely overlap and which retained cases detect each relevant failure mechanism.
- When simplifying critical regression tests, use fix-reversion or mutation testing where appropriate to demonstrate continued sensitivity to the original bug. Do not mechanically add tests for deleting a purely unused field.
- Run existing checks proportional to the risk. Do not claim speed, memory, or CI-time improvements without measurements; distinguish cluster startup cost from test execution cost.
- Net line reduction is not a mandatory metric, but any new state, abstraction, hook, or test layer must explain why existing paths cannot serve the need.
- Do not introduce production frameworks merely to simplify testing. Preserve necessary protocol-input, authorization, memory-ownership, version-compatibility, cancellation, and cleanup safeguards.
- Keep PRs small, focused, independently reviewable, verifiable, and revertible. Do not bundle unrelated refactors into a daily PR.
Initial candidates
These candidates come from review of main at 66da3877e9e77f01083c4aac0cb9f94ab6e11fe6. Recheck current code before implementation; inclusion here is not blanket approval to delete code.
- Unused state from perf(plan): eliminate bounded groups on not-null unique keys #29225:
scanUniqueKeyProof.source, its enum, and assignments have no consumers. Remove the unused information while preserving the semantic restrictions required for unique-key proofs. - Test responsibility split for fix: preserve prepared INSERT SELECT assignment types #29169: The Go integration test and BVT overlap at the SQL PREPARE entrypoint. Consider replacing the Go prepared branches with actual binary prepare, retaining controls with and without secondary indexes rather than adding another near-duplicate test.
- Low-value matrix reduction for feat(sql): support EXCEPT ALL multiset subtraction #29228: Review alias coverage multiplied across every dimension and repeated text execution without a distinct additional oracle. Preserve independent evidence for different set operators, LIMIT/pushdown boundaries, actual remote execution, and genuine prepared-statement reuse.
- Retirement of superseded paths: For subsequent daily PRs, trace new implementations back to old implementations, callers, and compatibility branches. Remove old paths only after proving replacement relationships and retirement conditions.
Do not assume the following require changes:
- The terminal test in test(compile): cover attached remote terminal cleanup #29224 already has mutation-test evidence. Its global Done-call count is fragile, but retain it until an equally deterministic, simpler alternative is demonstrated. Do not add a production hook merely to replace the assertion.
- Metadata call sites in fix(frontend): preserve direct integer function wire metadata #29233 serve different lifecycle responsibilities; call-site count alone does not establish duplication. Validate compatibility contracts before changing AST special cases, and avoid introducing a heavier provenance framework without demonstrated need.
Describe alternatives you've considered
- Continually adding tests and defensive branches: Easy to deliver locally, but may increase maintenance cost without replacing root-cause fixes or obsolete-path removal.
- Bulk deletion based on line count or similar SQL: Risks removing independent protocol, topology, and lifecycle guarantees. Inspect actual entrypoints, execution paths, and assertions first.
- Building a universal framework before migrating existing code: Risks introducing more state and parallel paths. Prefer direct deletion, local consolidation, and replacement of existing tests; introduce abstractions only when actual consumers justify them.
- Opening a separate issue for every small cleanup: Use this task for routine items. Track independent product bugs, high-risk design changes, and cross-team work in separate issues with cross-references.
Additional information
- Owner: @XuPeng-SH.
- Link routine PRs with Refs [Task]: Continuous engineering quality: code reduction, design simplification, and test deduplication #29249, not Fixes/Closes/Resolves, to avoid automatically closing this long-running task. A bug-fix PR may close its specific bug issue while only referencing this task.
- Aim for small PRs daily or nearly daily, but do not manufacture low-value changes to meet a cadence.
- Keep this issue open until the owner explicitly ends it or replaces it with another ongoing task. Completing the initial checklist does not automatically complete this issue.
- Related concrete defect: [Bug]: Sirius parity harness validates only after all runs and loses failure artifacts #29244, covering delayed Sirius parity validation and failure diagnostics. Its acceptance criteria remain in that separate issue.
- Track progress through linked PRs and concise evidence notes. Record confirmed, rejected, and deferred findings to avoid repeating investigations or reintroducing complexity already removed.
Activity
[-][Task]: 持续工程质量治理:代码减法、设计收敛与测试去重[/-][+][Task]: Continuous engineering quality: code reduction, design simplification, and test deduplication[/+]fix: consolidate engineering quality fixes and regression coverage (#…
test(sql): harden fixture cleanup and map retained coverage
test(colexec): verify zonemap scratch heap ownership and reset
test(sql): compress date format fixtures and release case resources
test(function): release simulated lock blockers before fixture reset
refactor(sql): consolidate active owners and retire obsolete paths (#…
refactor(txn): retire transaction data trace runtime (#29577)
test(function): release snapshot locks before fatal assertions
test(function): observe backlog admission without simulated timeout
perf(function): discard evaluation-owned regexp runners without extra…
test(function): centralize fixture ownership and reduce contract test…
69 remaining items
refactor: consolidate unused code and bookkeeping cleanup (#31348)
refactor(sql): share DELETE target name resolution (#31786)
refactor(sql): consolidate UPDATE target ownership (#31798)
fix(frontend): restore read-only classifier build (#31826)
refactor(colexec): scope expression diagnostics to their subtrees (#3…
fix(ci): cancel obsolete PR runs and avoid post-merge main checks (#3…
fix(ci): repair shared UT lifecycle and trim redundant fixtures (#31933)
XuPeng-SH commentedon Oct 30, 2026
合并增量核对:#31933、#31934 已合入 main,但本 issue 是持续工程质量总项,不因单批 CI/生命周期/诊断改动整体转 QA。#31933 明确仍需分别处理 #31744、#31781、#31790、#31696、#31545、#31491、#30985;本轮保持研发负责人,不宣称这些独立缺陷已修复。本轮仅远端源码/评论静态核对,未运行新测试。
test(ci): isolate shared fixtures and align observation barriers (#31938
refactor: consolidate unused code and duplicate responsibilities (#31488
XuPeng-SH commentedon Oct 31, 2026
合并增量核对:#31488 已于 2026-10-31 04:02:23 UTC 合入 main,merge SHA
3f484ec428b2fdaeda333c82b8d562fdb5dbe71a。本批清理重复职责和未使用实现,并把未发布的 catalog 迁移收敛到 4.0.7/41;PR 明确保留本持续工程质量总项开放,因此保持 XuPeng-SH 负责,不整体转 QA。验证边界:PR 作者报告了 bootstrap/version 普通及 race 测试、升级/回滚/CDC 场景、发布版持久数据升级和 SIGKILL 恢复,以及最后 STATISTICS 测试修正的定向验证。这些是作者报告,本轮仅核对远端合并记录和完整 issue 评论,未运行本地测试;不能据此宣称全套回归、分布式或混合版本升级验收通过。
Fix daemon claim races and reduce redundant race-test work (#31942)
XuPeng-SH commentedon Oct 31, 2026
合并增量核对:#31942 已于 2026-10-31 12:10:42 UTC 合入 main,merge SHA
ae40f12a647880a63466de32a9f507c2c72dca0b。本批修复 daemon claim/heartbeat fencing、CDC commit/SQL row 错误传播与暂停状态处理,并缩减部分重复测试。本 issue 明确为持续工程质量总项,因此继续由 XuPeng-SH 负责,不整体转 QA。尚未完成的开发范围:PR 与最终评审明确未宣称原 queued-pause/HAKeeper 超时已修复;旧 routine、替代 claim、legacy Publication 生命周期及共享 watermark 边界仍需安全修复,现存 CDC/generic status 并发和混合版本 stale writer 也不在保证范围。早先 scope review 异议已由 owner 的组合范围例外解决,不作为永久阻塞。
验证证据仅来自远端作者/评审报告:taskservice、compiler、CN normal/race,planner/SQL integration normal,真实 driver claim、双 CN CDC 与 snapshot/publication race 及定向重复测试。最终评审未把完整 frontend normal/race 算作通过(只读 checkout 下既有测试写文件失败),外部 MySQL BVT、全量 CI 与性能提升亦未独立复现。本轮未运行本地测试,不作整体验收或生产/混合版本正确性结论。
test: stabilize CI fixtures and reduce test I/O (#32643)
ci: add make static-check-changed for fast local SCA (#33012)